Retrieves an object based on the tag given to it.
The tag of the object to search for.
The Nth object with this tag may be requested. (Default: 0)
Returns the nNth object of the specified tag or OBJECT_INVALID if the object cannot be found.
sString cannot be "", this will return OBJECT_INVALID.
The nNth parameter has been determined to return the nNth object with the specified sTag starting at position 0. Outside of the current area, the scan will begin starting with the last (most recent) area added to the module following this hierarchy:
OBJECT_TYPE_AREA_OF_EFFECT (16) (spell effects, like web)
GetObjectByTag can also be used to get areas, but not the module (use GetModule() instead). It is unknown what will be returned if an area has the same tag as a non-object area.
The feature of "" returning player characters (IE: Those objects without a tag) has been fixed or changed in 1.64, and now properly returns OBJECT_INVALID.
This function is in most cases more efficient and faster than GetWaypointByTag or GetNearestObject* functions. This is because it uses a binary search tree to speed up search, rather than iterating over all objects until a match is found. Use unique tags and GetObjectByTag for best results. This might be a concern in a large modules with 10k+ objects.
author: Sarev0k, editors: Jasperre, Mistress, additional contributors: David Scott, Glenn Berden, Lilac Soul, Jeff Robertson, Kolyana