-
Ok, this is something I've been using for a while now in my scripting in some form or the other.
Scenario: You want to keep track of two locations, regardless of vnums, such that the scripting will work anywhere in the game. For instance, you want to mark the current room and a destination (predefined or chosen at random).
Well, what I would do is use what I call an Anchor. Anchors are usually wizimobs (protected with all detects and whatnot) with a UNIQUE name. Using the mm#mm format is always a good bet. Wizi is usually needed if players will ever see the mobile in any way shape or form. With a uniquely named mob, you can TARGET that mobile with a script remotely, and be guaranteed to zero in on that mobile, provided the script entity can SEE it (only considered on mobiles of course).
There are two ways to use an Anchor mobile: to mark the current location or forcing it to a remote location. Both ways will make the script work anywhere in the game.
An example of this is on the eerie green mist in Lestat. It propagates through the exits by loading an anchor mob and forcing a wizimob to roam about, which targets the anchor mobile in a goto, and proceeds with each lateral exit in the original room.
Another example is an attack used by Minobe (which is still being worked on) in which he grabs you and flings you out a random lateral exit. It uses a wizimob to move to the desired exit in which he then uses as an anchor to transfer you to and to target when he "pursues".
-
With the advent of tokens and the future addition of the $[ ] substitution code, there is a way to do anchors without the need for pesky anchor mobs.
Create a general token and have the mob give itself one. (of course! brilliant!)
Priming the token:
````
token adjust $i VNUM VALUE# = $[[room $i]]
````
Using stored location:
````
mob goto $[[tokenvalue $i VNUM VALUE#]]
````
-
Yup :> death to wizimobs!
When we have time I'll implement a global token list, as well as tokens for objects – and possibly rooms. The global will have to have some permissions associated with it, though, else wise all hell could break loose.