IsInSameCurrentLocAsRef

From the CreationKit Wiki
Revision as of 17:11, 2 December 2011 by imported>Scornett-Bot (Script running global find and replace: = for '''=)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

IsInSameCurrentLocAsRef returns 1 if the two refs' current locations are the same location, or their current locations have a parent location matching the (optional) keyword.

The keyword is used to essentially define which "level" of location to test. For example, if two actors' current locations are each a different interior (their houses), and each of the their houses are attached to locations that have the same parent location (a town), then passing a keyword associated with that parent location (example: LocTypeTown), it will return true.

Not passing the keyword tests against the immediate location of the cell each reference is currently in (in other words, doesn't care if they share any of same parent locations).

Usually you will be supplying a keyword that helps define the "range" of the location you are looking at, above the particular immediate location the reference is placed. For example, are these two references in the same dungeon, or town, or Hold, rather than are these two reference in the same house, or room.

Note: When used as a condition when filling Location Alias, it will be filled with a location having the keyword type and that is (or is the parent location of) the parameter reference's current location.

Syntax

[ObjectREF.]IsInSameCurrentLocAsRef OtherRef LocationKeyword

Examples

player.IsInSameCurrentLocAsRef AlvorRef     ; returns true if both the player and AlvorRef are currently each in a cell in the same location
player.IsInSameCurrentLocAsRef AlvorRef LocTypeCity     ; returns true if both the player and AlvorRef are each currently in a cell in locations that have the keyword LocTypeCioty, or if any of the parents of their locations have that keyword.

See Also

Papyrus Version

GetCurrentLocation - ObjectReference
HasCommonParent - Location