Manual:Zone Manual/The Reset Section/Special reset functions

From DikuMUD Wiki
< Manual:Zone Manual‎ | The Reset Section
Revision as of 14:33, 25 May 2020 by Nove (talk | contribs) (Created page with "=== Special reset functions === Now that we have gone over the basic load and equip commands we have some special commands that you can add to them to make them do more in...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Special reset functions

Now that we have gone over the basic load and equip commands we have some special commands that you can add to them to make them do more interesting things. Sometimes when doing resets you don't always want items or NPCs to load or sometimes you want them to load but only if a certain amount of other things correctly load. There are also times you want to clear the rooms or reload an entire object after removing the old one. All these things and more can be accomplished with the reset section.

The complete directive.

The 'load' and 'equip' commands have one more argument that can be placed at the end of them to make them act a bit different.the complete directive. In the case where this directive is placed at the end of a 'load or 'equip' command, the unit is only loaded in case all immediate commands inside its nesting are executed successfully. For example:

	load captain into jail_room complete
	{
	   equip magic_sword position WEAR_WIELD max 1
	   load bag
	   {
	      load ruby_ring max 1
	   }
	}

In this case the captain is only loaded if the objects magic_sword and bag are successfully loaded. if the ruby_ring is not loaded, it will have no effect on the complete directive. To make the ruby_ring affect to captains complete directive, the bag must also have specified a complete directive (because the bag would then not be complete, and thus the captain would not be complete).

The follow command

Once you load a NPC you may want that NPC to follow another NPC. That is what the 'follow' command is for. The following is the format of the 'follow' command

	   follow <symbol> <load amount #> <complete>
symbol
The first argument to the follow command is the symbolic name of the NPC to follow the NPC of the outer grouping.
load amount
the second argument is an optional argument that tells the reset how many of the NPC followers of this type 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.

complete
This only makes the NPC follow if all the other things in the grouping finishes completely. For a better description of how this directive works see (Link to resetcomplete).

The follow command is always used nested inside a loaded NPC to force the NPC <symbol> to follow the NPC of the outer grouping. The following would be a correct use of the follow command.

	load captain into jail
	  {
	  follow guard max 4
	    {
		equip guard_helmet WEAR_HEAD
		equip guard_plate WEAR_BODY
		equip guard_legs WEAR_LEGS
		equip guard_boots WEAR_FEET
		}
		  follow guard max 4
	    {
		equip guard_helmet WEAR_HEAD
		equip guard_plate WEAR_BODY
		equip guard_legs WEAR_LEGS
		equip guard_boots WEAR_FEET
		}
	  }

This example would load two guards that are fully dressed and they would start following the captain which is also loaded.

The purge command

There are times when you want to clean up a room. This can be done very easy by using the purge. The following is the format of the purge command.

	purge <symbol>

This command doesn't take much description. The symbol is the room you want to empty of all objects and NPCs. If you wanted to get rid of all objects and NPCs from a room with the symbolic name of jail it would look like this.

	purge jail

The random command

If you ever want to load something only some of the time. There is a built in random command that allows you to pick the percentage of the time that the item will load. The random command has the following format.

	random <num>
	  {group or single set of resets}

It is important to point out this is done by a random percentage chance where as 1% of the time would be almost not at all and 100% of the time would be all the time. If we wanted to load a group of things only 80% of the time it would look like this.

	random 80
	  {
	  load captain into jail_room complete
	    {
	    equip magic_sword position WEAR_WIELD max 1
	    load bag
	      {
	      load ruby_ring max 1
	      }
	    }
	}

The remove command

Many times players take items out of containers like chests or steal items from your NPCs and leave them naked. If the NPC is not dead the resets don't reload them therefore your NPCs will stand there empty and so will your chests. This is fine if that is what you want but sometimes you want them to get dressed or refilled again at reset time. that is what the remove command is for. The following is the format of the remove command.

	remove <symbol1> in <symbol2>

Again the remove command is a simple command and it only has two arguments, the item and where it is to remove it from. If you wanted to have a cabinet that at every reset it would have a knife and a bag of sugar in it would look like this.

	remove cabinet in kitchen
	load cabinet into kitchen
	 {
	 load sugarbag
	 load knife
	 }