NWNWiki
NWNWiki
3,719
pages

A location, in NWScript, defines a place within a module. It has three components — an object indicating the area, a vector indicating the position within the area, and a float indicating the facing (the front of whatever is at that location). These components are accessed with the commands GetAreaFromLocation(), GetPositionFromLocation(), and GetFacingFromLocation().

Constructor[]

A location can be constructed with the command Location(), which returns a location with the three provided components.

location Location (object oArea, vector vPosition,
float fOrientation)

Known issues[]

The object component of a location is module-specific and loses its meaning if the module changes. (This includes both starting a new module and restarting the current module, particularly if the current module was edited in the interim.) For locations that must be stored persistently, it is usually necessary to store the three components separately, using the area's tag instead of the area itself. If each area has a unique tag, then the location can be reconstructed from these components as needed.

Location(GetObjectByTag(<area tag>), <position>, <facing>)

In particular, SetCampaignLocation() is not a good way to store locations.