GetAreaFromLocation

From NWN Lexicon



Contents

[edit] GetAreaFromLocation(location)

Returns the area that a particular location is in.

object GetAreaFromLocation(
    location lLocation = None
);

[edit] Parameters

lLocation

The location (Default: None)


[edit] Description

Get the area's object ID from lLocation.

The function GetArea would generally be used more often, as it's parameter is an object, rather than a location, but GetAreaFromLocation is useful when a location is being manipulated. For example, when a new location is needed based on the facing, and/or the position of an existing location.



[edit] Remarks

If the location provided isn't valid, the function returns OBJECT_INVALID.

It is a good way to get if a stored GetLocalLocation() is invalid or valid - it is basically the only way to do it! If the area is valid for the local location, a creature can be sucessfully moved there without problems (where they appear is another matter).


[edit] Version

1.22

[edit] Example

    // Get the location of the calling object
    location lMyLocation = GetLocation (OBJECT_SELF);
 
    // Get the area, position and facing
    object   oArea       = GetAreaFromLocation (lMyLocation);
    vector   vPosition   = GetPositionFromLocation (lMyLocation);
    float    fFacing     = GetFacingFromLocation (lMyLocation);
 
    // Build a new location, which faces in the opposite direction
    location lNewLocation = Location (oArea, vPosition, fFacing + 180.0);

[edit] See Also

functions: 

LocationToString



 author: Steve Moseley, editor: Jasperre
 

Personal tools
Categories