GetLocation(object)

Gets the location of an object.

location GetLocation(
    object oObject
);

Parameters

oObject

The object to get the location of.


Description

Returns the location of the object passed. The object can be any valid object.

Note: A location is made up of a vector position (X, Y, Z) area (object) and facing (0-360 degrees). All can be got by GetXFromLocation().



Remarks

An invalid object will still return a location, of a sort. As you cannot compare a return value from this to, say, LOCATION_INVALID, you must use either an always valid object, or use GetAreaFromLocation() and compare it to OBJECT_INVALID.


Known Bugs

There are reports that GetLocation does not work OnClientLeave. I do not have access to a multiplayer environment, so I cannot test this. If this is infact true, and anybody knows a good workaround, please send it to the Lexicon using the Send comments link at the bottom of this page.


Version

1.61

Example

// this will cause the player to cast a fake fireball at the npc
void main()
{
    location l = GetLocation(GetObjectByTag("NPC"));
    AssignCommand(GetFirstPC(),
        ActionCastFakeSpellAtLocation(SPELL_FIREBALL, l));
}

See Also

functions: GetAreaFromLocation | GetStartingLocation | Location
categories: Get Data Functions | Targeting Functions


 author: GoLeM, editor: Jasperre, additional contributor(s): Lilac Soul
 Send comments on this topic.