Difference between revisions of "GetCurrentLocation - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Terra Nova2
m (Function returns none if the cell isn't part of any location.)
imported>Rasikko
(→‎Notes: removed note about the error. Not sure why that came about. Testing has shown that no error occurs if the location is none.)
 
Line 29: Line 29:
*If you want to compare two different actors' locations TO one another, you probably want to use [[IsSameLocation - Location|IsSameLocation]].
*If you want to compare two different actors' locations TO one another, you probably want to use [[IsSameLocation - Location|IsSameLocation]].
*This function will return NONE until the actor has interacted with a navmesh. Thus, it does not work on a dragon while in flight, or while perched on a building. They must land on the ground first.
*This function will return NONE until the actor has interacted with a navmesh. Thus, it does not work on a dragon while in flight, or while perched on a building. They must land on the ground first.
*This function will return none and post an error to the log if the cell isn't part of any location. This mostly applies to exterior cells, as the majority of interiors, with the exception of Dagon's shrine, and the vampire dreamworlds, are part of a location.
*Many wilderness cells don't have a location assigned to them, thus this function will return none.


== See Also ==
== See Also ==

Latest revision as of 13:20, 19 December 2017

Member of: ObjectReference Script

Obtains this reference's current Location.

Syntax[edit | edit source]

Location Function GetCurrentLocation() native

Parameters[edit | edit source]

None.

Return Value[edit | edit source]

This reference's current Location.

Examples[edit | edit source]

; Is this object in the tomb?
if (TombLocationProperty == SwordProperty.GetCurrentLocation())
  Debug.Trace("The sword is in the tomb (but not a child location)!")
endIf

Notes[edit | edit source]

  • If you want to know if the actor is in the location or any of its children, you need to use IsInLocation.
    • For example, if you want to know if the actor is in SolitudeLocation or any of the city interiors, use IsInLocation(SolitudeLocation).
  • If you want to compare two different actors' locations TO one another, you probably want to use IsSameLocation.
  • This function will return NONE until the actor has interacted with a navmesh. Thus, it does not work on a dragon while in flight, or while perched on a building. They must land on the ground first.
  • Many wilderness cells don't have a location assigned to them, thus this function will return none.

See Also[edit | edit source]