Difference between revisions of "OnLocationChange - Actor"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Arthmoor
(→‎Notes: Added note about dragons needing to land for this event to work on them.)
imported>Lisselli
(→‎Notes: Note on most exterior cells not having a location.)
 
Line 27: Line 27:
*Keep in mind that [[Location|Locations]] can be large groups of multiple cells, sometimes including numerous interior and exterior cells. As a result, this event may not be ideal for use as a general purpose cell movement tracker. Try [[OnCellLoad - ObjectReference|OnCellLoad]] or [[OnCellAttach - ObjectReference|OnCellAttach]] instead.
*Keep in mind that [[Location|Locations]] can be large groups of multiple cells, sometimes including numerous interior and exterior cells. As a result, this event may not be ideal for use as a general purpose cell movement tracker. Try [[OnCellLoad - ObjectReference|OnCellLoad]] or [[OnCellAttach - ObjectReference|OnCellAttach]] instead.
*This event will not be called on a dragon in flight. The dragon must first land and make contact with the navmesh before an OnLocationChange will be called.
*This event will not be called on a dragon in flight. The dragon must first land and make contact with the navmesh before an OnLocationChange will be called.
* The vast majority of Skyrim's exterior cells are wilderness and as such they do not have locations attached to their form. As result, this Event will return none for all wilderness cells that do not have location.


== See Also ==
== See Also ==
*[[Actor Script]]
*[[Actor Script]]

Latest revision as of 18:54, 7 December 2016

Member of: Actor Script

Event called when this actor moves from one location to another.

Syntax[edit | edit source]

Event OnLocationChange(Location akOldLoc, Location akNewLoc)

Parameters[edit | edit source]

  • akOldLoc: The Location that we left (may be None).
  • akNewLoc: The Location that we entered (may be None).

Examples[edit | edit source]

Event OnLocationChange(Location akOldLoc, Location akNewLoc)
  if (Game.GetPlayer().GetCurrentLocation() == akOldLoc)
    Debug.Trace("We have left the player's location!")
  endIf
endEvent

Notes[edit | edit source]

  • Keep in mind that Locations can be large groups of multiple cells, sometimes including numerous interior and exterior cells. As a result, this event may not be ideal for use as a general purpose cell movement tracker. Try OnCellLoad or OnCellAttach instead.
  • This event will not be called on a dragon in flight. The dragon must first land and make contact with the navmesh before an OnLocationChange will be called.
  • The vast majority of Skyrim's exterior cells are wilderness and as such they do not have locations attached to their form. As result, this Event will return none for all wilderness cells that do not have location.

See Also[edit | edit source]