Background for Skyrim SE
Member of the Actor script
eventOnLocationChange(LocationakOldLoc, LocationakNewLoc)

Description

Wiki Description

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

Documentation Comment

Event that is triggered when this actor changes from one location to another


Caveats

CK Wiki - Notes

  • 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 ObjectReference.OnCellLoad() or 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.
  • 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.

Parameters

  1. LocationakOldLoc

    CK Wiki Description

    The Location that we left (may be None).

  2. LocationakNewLoc

    CK Wiki Description

    The Location that we entered (may be None).


Examples

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

Auto-Generated Example

Scriptname MyCoolScript extends Actor

event OnLocationChange(Location akOldLoc, Location akNewLoc)
    Debug.trace("Event received - OnLocationChange: akOldLoc = " + akOldLoc + " akNewLoc = " + akNewLoc)
endEvent

Related Pages


Additional References

View this event’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.