Allows entities to function off-screen.
This is a global object that can always be accessed.
For instance, if an NPC needs to walk to his bed and sleep, he needs to be added to the watch manager so he can function offscreen.
When toggling the FPS display (Ctrl-F) the number after the W indicates how many entities are currently being “watched”.
//insure this entity will function for the next 5 seconds no matter where it is
GetWatchManager:Add(this, 1000*5); (5000 milliseconds)
nil Add(Entity ent, number timeToWatchMS)
If a function called “OnWatchTimeout” exists in the Entity’s namespace, it will be called when the watch times-out (finishes). The function must accept a parameter that will be a boolean set to TRUE if the Entity is currently on the screen. If an Entity is deleted who was on the watch list, it is automatically removed.
//we want to know when the watch is over
LogMsg("Watch complete, no longer letting this entity run on its own!");
if (bIsOnScreen) then
LogMsg("Entity is currently on the screen!");
LogMsg("Entity is off screen.");
If you would like an entity to become as its map is loaded, you can call this function in an entity’s OnMapInsert() script function.
|ent||The Entity that should remain active regardless of where it is.|
|timeToWatchMS||How long before this Entity returns to a normal state. (ie, unwatched) Use C_TIME_FOREVER to stay watched forever.|
How many entities are currently being watched. (Allowed to function off-screen)
Used with WatchManager::Add.