IsSameLocation - Location
From Creation Kit
Member of: Location Script
Returns true if the calling location is the same as the supplied location. Or, if an optional keyword is supplied it also returns true if the locations share a parent with that keyword, or one of the locations has the keyword and is a parent of the other.
Syntax
bool Function IsSameLocation(Location akOtherLocation, Keyword akKeyword = None)
Parameters
- akOtherLocation: The other location to look at.
- akKeyword: if supplied, it uses the keyword to test if the locations share a parent with that keyword, or one of the locations has the keyword and is a parent of the other.
- Default: None
Return Value
Returns if the locations are the same (or share a parent with the keyword, or is a child with the keyword)
Examples
; Is myLocationProperty the same as MarylandLocationProperty? if (MyLocationProperty.IsSameLocation(MarylandLocationProperty)) Debug.Trace("MyLocationProperty is MarylandLocationProperty.") endIf
; Is myLocationProperty the same as MyOtherLocationProperty OR are both locations in the same location with the ; keyword "LocTypeCountry" stored in LocTypeProperty? if (MyLocationProperty.IsSameLocation(MyOtherLocationProperty, LocTypeProperty)) Debug.Trace("MyLocationProperty is MyOtherLocationProperty or we are in the same Country " + \ "(or one us is the Country the other one is in).") endIf
; Is the player in a location that is WhiterunLocation or a location who has WhiterunLocation as a parent ; (when WhiterunProperty points to WhiterunLocation and KeywordHoldProperty points to LocTypeHold keyword) if Game.GetPlayer().GetCurrentLocation().IsSameLocation(WhiterunProperty, KeywordHoldProperty) Debug.Trace("Player is in WhiterunLocation, or a child of WhiterunLocation.") endif
; Is the player and the CourierRef (stored in pCourier) in the same settlement, town, or city (ie the "LocTypeHabitation" ; keyword stored in)pLocTypeHabitation if pCourier.getCurrentLocation().IsSameLocation(Game.GetPlayer().getCurrentLocation(), pLocTypeHabitation) debug.trace("WICourierScript: Courier and player are in same habitation.") else debug.trace("WICourierScript: Courier and player are not in same habitation.") endif