TagManager

When an Entity is “named”, it’s instantly locatable throughout the world at all times through the tag manager.

About

In most cases usage of the TagManager happens behind the scenes, for instance, when you use GetEntityByName.

If you need to be able to locate entities without actually loading them or their Map, using the TagManager directly is useful.

Usage

local tag = GetTagManager:GetFromString("Gary");
Summary
TagManagerWhen an Entity is “named”, it’s instantly locatable throughout the world at all times through the tag manager.
Member Functions
GetFromString
GetPosFromName
RegisterAsWarp

Member Functions

GetFromString

Tag GetFromString(string name)

Returns information about a named Entity.  Very fast.

Parameters

namethe name of an Entity.

Usage

local tag = GetTagManager:GetFromString("Gary");

if (tag == nil) then
LogMsg("Gary doesn't exist!");
else
LogMsg("Gary is located on the map called " .. tag:GetMapName());
LogMsg("Gary's xy location is " .. tostring(tag:GetPos());

if (tag:GetID() == C_ENTITY_NONE) then
LogMsg("Gary exists, but he hasn't actually been loaded yet.");
else
LogMsg("Gary exists and has been loaded, his entityID is " .. tag:GetID());
end
end

Returns

A Tag object containing inforamtion about the Entity or nil if the name doesn’t exist.

GetPosFromName

Vector2 GetPosFromName(string name)

Allows you to quickly get the position of a named Entity that may or may not be loaded.

Returns

A Vector2 object containing the position.  If not found, will return 0,0 and an error will pop up.

RegisterAsWarp

nil RegisterAsWarp(Entity ent, string targetName)

Connects two entities together in the nagivational graph.  This is so the path-finding engine can understand warps, even those that lead to other Maps.  For a two-way warp, the other side must also register as a warp.

Note

You probably shouldn’t play with this directly.  But if you do, you must put it in the function “OnMapInsert” in the script of an Entity.

Parameters

entThe source Entity connection.
targetNameThe destination Entity name.  (Doesn’t have to actually be loaded)
The Entity object.
When an Entity is “named”, it’s instantly locatable throughout the world at all times through the tag manager.
A map is a single area that can be any size and contain any amount of tiles, including Entities and TilePic’s.
Contains information about a named Entity.
The Vector2 object.