Difference between revisions of "IsInSameCurrentLocAsRef"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Scornett-Bot
m (Script running global find and replace: = for '''=)
 
Line 8: Line 8:
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.
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.''
===When used to fill a Location Alias===
 
When you use <code>IsInSameCurrentLocAsRef</code> to fill a Location Alias, the game will first find the parent location of <code>OtherRef</code> that has the specified keyword. It will then select a Location at random ''within that parent Location'', regardless of whether <code>OtherRef</code> is currently in the selected Location. To emphasize, '''<code>OtherRef</code> might not be in the selected Location or one of its children at all'''.
 
For example, if you fill an alias using <code>IsInSameCurrentLocAsRef PlayerRef LocTypeHold</code> while the player is standing in Candlehearth Hall in Eastmarch, this will select a location ''within Eastmarch hold'', but it will not necessarily select ''the hold itself''. It may even select a Location that has ''no other parent Location in common'' with the player other than Eastmarch hold. It could select a Location in Darkwater Crossing or in Kynesgrove, even though the player is standing in Windhelm. Using this example, if you want to force selection of the player's current hold, you must also use [[LocationHasKeyword]] as one of the conditions on the Location Alias.


==Syntax==
==Syntax==

Revision as of 22:31, 1 December 2021

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.

When used to fill a Location Alias

When you use IsInSameCurrentLocAsRef to fill a Location Alias, the game will first find the parent location of OtherRef that has the specified keyword. It will then select a Location at random within that parent Location, regardless of whether OtherRef is currently in the selected Location. To emphasize, OtherRef might not be in the selected Location or one of its children at all.

For example, if you fill an alias using IsInSameCurrentLocAsRef PlayerRef LocTypeHold while the player is standing in Candlehearth Hall in Eastmarch, this will select a location within Eastmarch hold, but it will not necessarily select the hold itself. It may even select a Location that has no other parent Location in common with the player other than Eastmarch hold. It could select a Location in Darkwater Crossing or in Kynesgrove, even though the player is standing in Windhelm. Using this example, if you want to force selection of the player's current hold, you must also use LocationHasKeyword as one of the conditions on the Location Alias.

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