Manual:Zone Manual/The Reset Section/Loading objects and NPCs
Loading objects and NPCs
Time to start loading your zone with its life and all the other strange things you have built. There is two commands that do all the loading and equipping of objects. Oddly enough the commands are called 'load' and 'equip'. The format of the commands are almost the same but equip must be used inside a NPC grouping. With that in mind lets start with simple loads and work our way up.
The command to load an object or an NPC into a room is as follows:
load <object or NPC> [into] [<room<] [<load amount>] [{Other loads and equip commands}]
- object or NPC
- The first argument to the load command is the object or NPC symbolic name that you want to load. The first argument is the only one that must be included in all load commands.
- into
- This is just a symbol that tells the reset that we are loading the object or NPC into some other unit.
- object, NPC, and room
- The third argument is the symbolic name of the place where you are loading the object and the NPC.
- load amount
- the fourth argument is an optional argument that tells the reset how many of the objects are allowed in the world, zone, or locally. The possible values for this field are as follows:
- max <num>
- This command is always part of another reset command (load,
equip, etc.). At reset time the entire world is scanned for occurences of the loaded unit - only if the currently existing number is less than <num> will the command be executed.
- local <num>
- This command is always part of another reset command (load,
equip, etc.). At reset time the location of which the unit is to be loaded into is scanned for occurences of the loaded unit only if the currently existing number is less than <num> will the command be executed.
- zonemax <num>
- This command is always part of another reset command (load,
equip, etc.). At reset time the entire zone being reset is scanned for occurences of the loaded unit - only if the currently existing number is less than <num> will the command be executed.
- Optional grouping
- Any reset command may be followed by a pair of curly brackets {}
containing more reset commands. The commands inside the brackets will only be executed in case the associated command was successful.
Don't be alarmed if this sounds a bit hard. It all gets much more clear as some examples are explained. Lets take a look at the following example and see if we can't make this much more clear.
load udgaard/fido into midgaard/temple max 1
This example is pretty simple it says load the fido into the temple only if there isn't already 1 in the world. Now lets get a bit more complicated.
load udgaard/fido into midgaard/temple max 1 { load bone load excrement into midgaard/temple }
Now we have said again load the fido into the temple if there is not already one in the world. Then if fido loads fill his inventory with a bone and load excrement into the temple as well.
We can get even more complicated but still just using the load commands by doing the following
load udgaard/fido into midgaard/temple max 1 { load bone load excrement into midgaard/temple load bag { load apple max 1 } }
now we still have the fido loading if there isn't one already in the world then the bone and the excrement and finally we load a bag. If there isn't an apple already in the world we load the bag with a apple in it other wise the bag will be empty.
Well that should be enough load examples for now but we will get right back to them in a bit. Now we should introduce another reset command called the 'equip' command that we have already mentioned. The 'equip' command works a lot like load but has much simpler arguments. The 'equip' command is as follows.
equip <symbol> position [load amount <num>]
- symbol
- The first argument is just the symbolic name of the item being worn by the NPC.
- position
- The position is any of the positions available in the
vme.h. The following are all the positions along side there defines as found in the vme.h.
Position | Define(s) |
---|---|
head | WEAR_HEAD |
hands | WEAR_HANDS |
arms | WEAR_ARMS |
body | WEAR_BODY |
legs | WEAR_LEGS |
feet | WEAR_FEET |
cloak | WEAR_ABOUT |
shield | WEAR_SHIELD |
hold | WEAR_HOLD |
wield | WEAR_WIELD |
ear | WEAR_EAR_R and WEAR_EAR_L |
neck | WEAR_NECK_1 and WEAR_NECK_2 |
wrist | WEAR_WRIST_R and WEAR_WRIST_L |
finger | WEAR_FINGER_R and WEAR_FINGER_L |
chest | MANIPULATE_WEAR_CHEST |
back | MANIPULATE_WEAR_BACK |
waist | MANIPULATE_WEAR_WAIST |
ankle | WEAR_ANKLE_R and WEAR_ANKLE_L |
- load amount
- the fourth argument is an optional argument that tells the reset how many of the objects are allowed in the world, zone, or locally. The possible values for this field are as follows:
- max <num>
- This command is always part of another reset command (load,
equip, etc.). At reset time the entire world is scanned for occurences of the loaded unit - only if the currently existing number is less than <num> will the command be executed.
- local <num>
- This command is always part of another reset command (load,
equip, etc.). At reset time the location of which the unit is to be loaded into is scanned for occurences of the loaded unit - only if the currently existing number is less than <num> will the command be executed.
- zonemax <num>
- This command is always part of another reset command (load,
equip, etc.). At reset time the entire zone being reset is scanned for occurences of the loaded unit - only if the currently existing number is less than <num> will the command be executed.
Now with the equipment command you can now get your NPCs dressed and ready for battle. The 'load' and 'equip' commands are not the easiest though so lets go through some simple examples.
load guard into jail { equip helmet WEAR_HEAD equip plate WEAR_BODY equip pants WEAR_LEGS equip specialsword max 1 load brass_key }
This is how you would equip a NPC with all items from the current zone. As you can see we didn't need full symbolics because the server knows to grab the items from the zone the resets are in.
load guard into safe_room max 2 { equip plate WEAR_BODY load powersword max1 { load silver_pile into safe_room } }
In this example we only load the silver pile if the guard loads and if the power sword loads which may or may not happen since there is only a max of one sword allowed while there is a max of 2 guards allowed. What will happen in this case is at the first reset there will be one guard and one pile of silver. The next reset there will still only be one pile of silver but now there will be two guards.
Hopefully you have got the basic resets down. If not don't worry there are plenty more examples to come and we still have to make the resets for our dragon station zone.