JediMUD Wiki
Register
Advertisement

Zone Files[]

Zone files are the files that control how areas are configured and how they reset. They integrate the mobiles, objects, and rooms to create an inhabited world.

A zone file contains certain initial information (specified below), followed by a series of reset commands. Each time a zone is reset, the server executes all the commands in order from beginning to end. All zones are reset when the server first boots, and periodically reset again while the game is running.

The Format of a Zone File[]

 #<virtual number>

<zone name>~

<top room number> <lifespan> <reset mode>

{zero or more zone commands}

S

Lines starting with * are considered comments and ignored. Zone commands themselves may also be followed by a comment delimited by a single *. The zone's commands must then be terminated by the literal letter S.


Virtual Number[]

An arbitrary number used to identify the zone. Zone numbers are traditionally the room numbers of the zone divided by 100; for example, Midgaard, which consists of rooms 3000 through 3099, is zone 30.


Zone Name[]

A label given to the zone so that it can be identified in system logs.


Top Room Number[]

The highest numbered room belonging to this zone. A room with virtual number V belongs to zone N if TopRoom(zone N-1) < V <= TopRoom(zone N) for all N > 0. Rooms belong to zone 0 if their number is between 0 and the top of zone 0.


Lifespan[]

The number of real-time minutes between zone resets for this zone. When the age of the zone (measured in minutes since the last time that zone has been reset) reaches the zone's lifespan, the zone is queued for reset. The zone is then reset when it reaches the front of the queue, and the conditions of the Reset Mode (see below) are satisfied.


Reset Mode[]

Can take one of three values (0, 1, or 2):

0[]

Never reset the zone. In this case, the age of the zone is never updated, and it will never be queued for reset. Thus, the value of the Lifespan is effectively ignored.

1[]

Reset the zone only after it reaches its Lifespan and after the zone becomes deserted, i.e. as soon as there are no players located within the zone (checked once every minute). This can make a zone more ``fair because it will keep the hard mobs from reappearing in the zone until everyone leaves, but on a busy MUD it can prevent a zone from ever being reset since the zone may never stay empty for more than one minute.

2[]

Reset the zone as soon as it reaches its Lifespan, regardless of who or what is in it. This is the most commonly used Reset Mode.

Zone Commands[]

Each command consists of a letter or "flag", identifying the command-type, followed by three or four numeric arguments.


     'M': Read a mobile
     'O': Read an object
     'G': Give obj to mob
     'P': Put obj in obj
     'G': Obj to char
     'E': Obj to char equip
     'D': Set state of door
     'F': Statistical Equip
     'H': Statistical Give
     'Q': Statistical load obj into another object.
     'W': Stochastic Load Mob
     'X': Stochastic Load Obj
     'Y': Stochastic Give Obj
     'Z': Stochastic Equip Obj

The first argument, common to all the commands, is called the ``if-flag". If the if-flag for a command is 1, that command is only executed if the command immediately before it was executed as well. If the if-flag is 0, the command is always executed. If-flags are useful for things like equipping mobiles--you don't want to try to equip a mobile that has not been loaded.

Commands that load mobiles and objects also include a ``max existing argument. This specifies the maximum number of copies of the mobile or object that are allowed to exist in the entire world at once. If the number currently existing is greater than or equal to the max existing limit, the command is not executed.
For example, from the Trog Caves and Outpost .zon file, the following snippet:
W 0 4452 1 4408 90 Protector

Z 1 4494 5 17 80      Sword of the Protector  (80% load rate)

Z 5 4436 1 17 25      Sword of the Protector (25% load rate) 
The first line  loads the Protector (mob 4452) into room 4408 with a 90% probability.  The next line attempts to load a mag flag version (green glow) of the Protector's Sword, but only if the previous load command (the Old Trail Protector mob load) was successful, there are less than five of these swords in the game, and a random number is of a value 80 or less.  The next line fires if the previous mob load was successful, there are less than one of these non-MAG swords in the game, and a random number is of a value 25 or less.

The valid zone-reset commands are M, O, G, E, P, D, and R.

The If-Flag[]

Here are the currently implemented if-flag values at JeduMUD:
if_flag:
     0 - execute regardless
     1 - execute if prev command successful
     2 - execute if prev command failed
     3 - execute if prev mob was loaded 
     4 - execute if prev mob NOT loaded because it failed the stochastic test
     5 - execute if prev mob was loaded 
     6 - execute if prev mob NOT loaded for any reason
     7 - execute if prev equip command failed due to probability


M: Load a Mobile[]

Format: M <if-flag> <mob vnum> <max existing> <room vnum>

Mob vnum is the vnum of the mob to be loaded. Room vnum is the vnum of the room in which the mob should be placed. The mob will be loaded into the room.

O: Load an Object[]

Format: O <if-flag> <obj vnum> <max existing> <room vnum>

Obj vnum is the vnum of the obj to be loaded. Room vnum is the vnum of the room in which the obj should be placed. The object will be loaded and left lying on the ground.


G: Give Object to Mobile[]

Format: G <if-flag> <obj vnum> <max existing>
Obj vnum is the vnum of the obj to be given. The object will be loaded and placed in the inventory of the last mobile loaded with an `M command.
This command will usually be used with an if-flag of 1, since attempting to give an object to a non-existing mobile will result in an error.

E: Equip Mobile With Object[]

Format: E <if-flag> <obj vnum> <max existing> <equipment position>

Obj vnum is the vnum of the obj to be equipped. The object will be loaded and added to the equipment list of the last mobile loaded with an M command. Equipment Position should be one of the following:

          0    Used as light

          1    Worn on right finger

          2    Worn on left finger

          3    First object worn around neck

          4    Second object worn around neck

          5    Worn on body

          6    Worn on head

          7    Worn on legs

          8    Worn on feet

          9    Worn on hands

          10   Worn on arms

          11   Worn as shield

          12   Worn about body

          13   Worn around waist

          14   Worn around right wrist

          15   Worn around left wrist

          16   Wielded as a weapon

          17   Held

This command will usually be used with an if-flag of 1, since attempting to give an object to a non-existing mobile will result in an error.

W: Load Mobile[]

Format: W <if-flag> <obj vnum> <max existing> <equipment position> <chance in 100>


Y: Equip Mobile With Object (Percentage)[]

Format: Y <if-flag> <obj vnum> <max existing> <equipment position> <chance in 100>
A Y object is a DEMI+ object.
Obj vnum is the vnum of the obj to be equipped. If a random number is rolled the satisfies the load rate (n/100) specified in the zone load command, the object will be loaded and added to the equipment list of the last mobile loaded with an M command.
Equipment Position should be one of the following: (see table above).

Z: Add Object to Mobile Inventory (Percentage) []

Format: Z <if-flag> <obj vnum> <max existing> <chance in 100>
Obj vnum is the vnum of the obj to be placed in a mob's inventory if the load percentage is satisfied.
If a random number is rolled the satisfies the load rate (n/100) specified in the zone load command, the object will be added to the inventory of the last mobile loaded to the zone with an M command.
For example, in Rhyoden (Trog Caves and Outpost -- JediMUD zone 44), this is the .zon file script that loads General Quagar's items:
M 0 4447 1 4628          General Quagar
E 1 4449 10 17           Key of the Gods
Z 5 4484 3 6 70          Hat of the Stratigest
Z 5 4493 1 2 3           Black Onyx Ring
The first command, "M," loads Quagar (vnum 4628) into his room (4447).   If that load was successful, (E 1), put the Key of the Gods (the key to Siawyn's attic room) into his inventory.  If the Quagar mob load was successful, and there are not more than three Hats of the Strategist in the game, there is a 17% chance that you will equip him with a Hat of the Strategist on his head (equipment position 6).  If the Quagar load was successful, and there are not more than one Black Onyx Rings in the game, there is a 3% chance that you will load a Black Onyx Ring on his left finger (equipment position 2).  In this case, the presence or absence of a key or Hats of the Strategist will not affect the Black Onyx Ring load.
In our second example, we'll use Tiamat (Gobinville - JediMUD zone 92), and this is the .zon file script loading Tiamat and Tiamat's items:
M 0 9218 1 9224            Tiamat
Z 1 9235 3 3 50            Platinum Cloak
Z 1 9236 3 17 10           Platinum Orb
Z 1 9237 3 11 35           platinum scale shield
Y 2 9238 3 50              platinum potion
Y 5 9239 3 50              dragon claw
The first line loads the mob unconditionally. The second line shows a 50% chance of a platinum cloak load as long as there are less than four cloaks in the game and Tiamat loaded.  The next line shows a 10% chance of a platinum orb load if the platinum cloak loaded and there are less than four orbs in the game.   The next line shows a 35% chance of a platinum scale shield loading, but again, only if the previous three loads completed successfully. 
The following Y command loads a potion only if the previous line has failed and if the percentile chance (50%) is satisfied.   The dragon claw is added to inventory if Tiamat has loaded and its odds are satisfied (50%).
This is the difference between the "1" if-flag and the "5" if-flag.  The 5 flag loads items based on mob load and percentile chance, while the 1 flag checks to see that the previous line has successfullly loaded and its own assigned percentile chance.  This .zon loading method is known as tiered loading. 

P: Put Object in Object[]

Format: P <if-flag> <obj vnum 1> <max existing> <obj vnum 2>
An object with Obj Vnum 1 will be loaded, and placed inside of the copy of Obj Vnum 2 most recently loaded.
This command will usually be used with an if-flag of 1, since attempting to put an object inside of a non-existing object will result in an error.

Q: Put Object in Object []

Format: Q <if-flag> <obj vnum 1> <max existing> <obj vnum 2> <load rate>
An object with Obj Vnum 1 will be loaded, and placed inside of the copy of Obj Vnum 2 most recently loaded upon the additional satisfaction of the random percentage chance indicated.
This command will usually be used with an if-flag of 1, since attempting to put an object inside of a non-existing object will result in an error.

D: Set the State of a Door[]

Format: D <if-flag> <room vnum> <exit num> <state>
Room vnum is the virtual number of the room with the door to be set. Exit num being one of:
          0    North

          1    East

          2    South

          3    West

          4    Up

          5    Down
State being one of:
          0    Open

          1    Closed

          2    Closed and locked
Care should be taken to set both sides of a door correctly. Closing the north exit of one room does not automatically close the south exit of the room on the other side of the door.

R: Remove Object from Room[]

Format: R <if-flag> <room vnum> <obj vnum>
If an object with vnum Obj Vnum exists in the room with vnum Room Vnum, it will be removed from the room and purged.
Advertisement