RegisterForLOS - Form

From Creation Kit
Jump to: navigation, search

Member of: ActiveMagicEffect Script, Alias Script, and Form Script

Registers this active magic effect/alias/form to receive LOS (line-of-sight) events between the viewer and the target. Only the specific form, alias, or magic effect that registered will get the event - it will not be relayed to attached aliases or magic effects.

Syntax

Function RegisterForLOS(Actor akViewer, ObjectReference akTarget) native

Parameters

  • akViewer: The Actor that will be looking for the target.
  • akTarget: The target the actor will be looking for. If the viewer is not the player, this must be an actor.

Return Value

None

Examples

; Register for LOS events for the player seeing, and not seeing, the secret door
RegisterForLOS(Game.GetPlayer(), SecretDoor)

Notes

  • The form that this function is called on doesn't have to be the viewer or the target. In this way you could have a quest that gets LOS events from between the player and the quest objective.
  • If the viewer is the player the target may be an actor, or an object. If the viewer is an actor that isn't the player, then the target must be an actor. Actors will simply do a single check (using the detection system) and the player will do three picks (low, medium, and high) clipped to the camera to see if they see it.
  • Since LOS picks are expensive, they are heavily throttled in code. The more scripts that register for LOS events, the more the delay each script will have in receiving its events. As a general rule, one pick will be done per frame - not counting objects that can be trivially determined not to see eachother (example: player looking for something that is behind them). So for example, if 30 scripts register to know when the player can see something, and that something is in the camera view (but maybe hiding behind a log) then the script may not get a LOS event for a full second - or if the player looks away and then looks back within a second, no events will be sent.
  • Aliases and quests will automatically unregister for this event when the quest stops. Active magic effects will automatically unregister when they are removed.

See Also