When an Entity is “named”, it’s instantly locatable throughout the world at all times through the tag manager.
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.
local tag = GetTagManager:GetFromString("Gary");
TagManager | When an Entity is “named”, it’s instantly locatable throughout the world at all times through the tag manager. |
Member Functions | |
GetFromString | |
GetPosFromName | |
RegisterAsWarp |
Tag GetFromString(string name)
Returns information about a named Entity. Very fast.
name | the name of an Entity. |
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
A Tag object containing inforamtion about the Entity or nil if the name doesn’t exist.
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.
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.
ent | The source Entity connection. |
targetName | The destination Entity name. (Doesn’t have to actually be loaded) |