Difference between revisions of "IsInLocation - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Jlundin
 
imported>Darklocq
(clarify (this is "in" not "is"))
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
'''Member of:''' [[ObjectReference Script]]
'''Member of:''' [[ObjectReference Script]]


Checks to see if this object is in the specified location, or a child of the specified location.
Checks to see if this object is in the specified location, or in a child of the specified location.


== Syntax ==
== Syntax ==
<source lang="papyrus">
<source lang="papyrus">
bool Function IsInLocation(Location akLocation)
bool Function IsInLocation(Location akLocation)
Location currLoc = GetCurrentLocation()
if currLoc == None
return false
else
return akLocation.IsChild(currLoc) || currLoc == akLocation
endif
endFunction
</source>
</source>



Latest revision as of 18:35, 28 October 2018

Member of: ObjectReference Script

Checks to see if this object is in the specified location, or in a child of the specified location.

Syntax[edit | edit source]

bool Function IsInLocation(Location akLocation)
	Location currLoc = GetCurrentLocation()
	if currLoc == None
		return false
	else
		return akLocation.IsChild(currLoc) || currLoc == akLocation
	endif
endFunction

Parameters[edit | edit source]

Return Value[edit | edit source]

Whether this reference is in the specified location.

Examples[edit | edit source]

; Is the box in the house location?
if Box.IsInLocation(House)
  Debug.Trace("Box is in the house!")
endIf

See Also[edit | edit source]