Section 8:    #ENCOUNTERTABLES

This section defines the encounters that may occur when the mud calls an encounter table. Like the #RESETS, the #ENCOUNTERTABLES create objects, load mobiles, equip those mobiles, and so on. Unlike the #RESETS, an encounter table cannot close doors or randomize rooms. On the other hand, an encounter table can execute a mobprog without a mobile present.

The #ENCOUNTERTABLES area header can have more than one encounter table. Each encounter table is specified by a vnum and a series of single-line commands. These commands are:

  1.      M     load a mobile into a room
  2.      G     give an object to a mobile
  3.      E     equip an object to a mobile
  4.      R     create a random object
  5.      O     load an object into a room or sub-table
  6.      P     put an object in an object (pizza in an oven, for example)
  7.      D     execute a mobprog after the player enters the room
  8.      X     execute a mobprog before a player enters the room
  9.      T     choose from another encounter table
  10.      A     choose from another encounter table - all entries checked once

Here's an example of how the #ENCOUNTERTABLES area header is set up, taken from Shamrock's Cafe:

#ENCOUNTERTABLES
#1
D 10 mShamrockCafeEncounters01    * mobprog 
D 10 mShamrockCafeEncounters02    * mobprog 
O  5 1  3 1d1+0 0 201             * clump of purple flowers
O  5 1  3 1d1+0 0 202             * handful of white flowers
O  5 1  3 1d1+0 0 203             * a small mushroom
O  5 1  5 1d1+0 3   0             * choose a random object
M 20 1  4 1d1+0 4   0             * choose a mobile
#2
D 10 mShamrockCafeEncounters03    * mobprog 
D 10 mShamrockCafeEncounters04    * mobprog 
M 40 1  1 1d1+0 0 205             * a drunk
E  5 7 0                             * choose a torso clothing
E  7 8 0                             * choose a leg item
E  8 9 0                             * choose a foot item
#3
O 35 1  2 1d1+0 0 :108:12819      * a yellow flower
O 35 1  2 1d1+0 0 :68:300         * some herbs
O 30 1  2 1d1+0 0 :68:304         * some wildflowers
.
.
.
#0

Again, each encounter table under #ENCOUNTERTABLES begins with its own vnum (see our previous discussion of vnums in the introduction to the #AREAS area header.). The encounter table then ends at the next vnum or, if the #ENCOUNTERTABLES area header is ending, at #0. The body of each encounter table is a series of single-line commands and comments.

Here's the breakdown of the commands:

  1.      M     load a mobile into a room

    The format for inserting mobiles into your area is as follows:

    M [chance] [room limit] [area limit] [copies] [table vnum] [mob vnum]

    1.slot: M signifies that a mobile is being loaded.

    2.slot: the chance a mobile is loaded into the room.

    3.slot: total number of copies of that mobile that may exist in the room.

    4.slot: total number of copies of that mobile that may exist in the area.

    5.slot: the number of mobiles placed in the room, given in terms of ndn+n.

    6.slot: the table from which to draw the mobile (if [mob vnum] not used).

    7.slot: the vnum of the specific mobile (if [table vnum] not used).

    Examples:

    M 10 2  3 1d2+0 0 202
    M 20 2  4 1d2+0 4   0
    M  2 1  1 1d1+0 0 :31:2540
    

    The first example has a 10% chance of choosing one or two mobiles from a specific mob vnum in the area file, that is, mobile 202. If the room already has two such mobs in it (including any that may have wandered in from another room), the encounter will forfeit the choice (the mud will create no additional mobs there.) If the area has three of the same mob in it, no additional mobs of that same vnum will be made.

    The second example resembles the first, differing only in that the encounter draws on a table internal to the area file, that is, table 4. If the table is called, the maximums specified by the command (2 and 4, respectively) will be ignored, and the new maximums found in table 4 will be used.

    The third example resembles the first two, except it draws on a mob from a different area file. Yes, this can be done, and it will override any maximum world copies of that area file. (The area file specifies only 20 goblins of a specific vnum to exist in the world - the encounter table can place additional mobs of the same kind elsewhere in the world, or even in the same area file, thus going over the maximum allotted by the resets.)

  2.      G     give an object to a mobile

    The format for giving objects to mobiles into your area is as follows:

    G [copies] [table vnum] [item vnum]

    1.slot: G signifies that an item is being given to a mobile.

    2.slot: the number of copies given to the mobile.

    3.slot: the table from which to draw the object (if [item vnum] not used).

    4.slot: the vnum of the object (if [table vnum] not used).

    Examples:

    G 1d1+0  0 26
    G 2d1+0 15 0
    G 1d1+0  0 :13:4159
    

    The first example gives one copy of a specific item (26) from the area file to the mobile.

    The second example gives two objects from a different table in the area file, which may or may not have randomly chosen objects in it, to the mobile.

    The third example gives one copy of a specific item from a different area file to the mobile. This means any object from any file may be given to the mobile.

    Note: Limits on items are respected, so by randomly placing that awesome (and limited) battleaxe on a mobile, you run the risk of that item not appearing on the mobile because the limit of the object has been reached.

  3.      E     equip an object to a mobile

    The format for equipping objects to mobiles into your area is as follows:

    E [wear location] [table vnum] [item vnum]

    1.slot: E signifies that an item is being equipped to a mobile.

    2.slot: the wear location of the mobile.

    3.slot: the table from which to draw the object (if [item vnum] not used).

    4.slot: the vnum of the object (if [table vnum] not used).

    Examples:

    E  0  0 119
    E  9  8 0
    E 16  :27:8 0
    

    The first example equips an object from the area file (119) to the "light" wear location of mobile.

    The second example equips an object from a table within the area file (table 8) to the mobile's "hand" wear location. The table may have random objects to choose from.

    The third example equips an object from an encounter table within a different area file to the mobile's "wield" wear location.

    Note: Limits on items are respected, so by equipping that legendary (and limited) sheath to a mobile, you run the risk of that item not appearing on the mobile because the limit of the object has been reached.

  4.      R     create a random object

    The format for creating random objects is as follows:

    R [chance] [copies] [wearflag] [imbue]

    1.slot: R signifies the creation of a random object.

    2.slot: the chance a random object is created.

    3.slot: the number of random objects created in terms of ndn+n.

    4.slot: the wearflag of the object(s) created.

    4.slot: chance that the random item will be imbued (rarely above 1).

    Example:

    R 30 1d2+0 16 1
    

    The example above gives a 30 percent chance of creating one or two random weapons, which have a one percent chance of being imbued. Random items are the items created by the mud's random item creator.

    Note: you should use this command ONLY in sub-tables for the give and equip commands.

  5.      O     load an object into a room or sub-table

    The format for loading objects into your area is as follows:

    O [chance] [room limit] [area limit] [copies] [table vnum] [object vnum]

    1.slot: O signifies that an object is being loaded.

    2.slot: the chance an object is loaded into the room or table.

    3.slot: total number of copies of that object that may exist in the room.

    4.slot: total number of copies of that object that may exist in the area.

    5.slot: the number of objects placed in the room, given in terms of ndn+n.

    6.slot: the table from which to draw the object (if [object vnum] not used).

    7.slot: the vnum of the specific object (if [table vnum] not used).

    Examples:

    0 35 2  5 1d1+0 0 70
    0 20 2 10 1d2+0 63 0
    0 15 1  2 1d1+0 :92:13 0
    

    The first example has a 35% chance of creating an object from the area file (70). If two of that object already exist in the room, however, no others will be made there. Similarly, if five objects of the same vnum already exist in the area, no others will appear.

    The second example is similar to the first except it draws an object from an encounter table within the area file (table 63).

    The third example is similar to the other two except it draws an object from an encounter table in a different area file. Yes, you can create objects that exist in one area and place them in another.

    Note: Limits on items are respected, so by creating that powerful (and limited) breastplate, you run the risk of that item not appearing because the limit of the object has been reached.

    Note: if used in a sub-table for give, equip, and put commands, the object will not load into the room, but onto the mobile or into the object, respectively. By default objects load into rooms.

  6.      P     put an object in an object

    The format for putting objects in objects into your area is as follows:

    P [copies] [table vnum] [item vnum]

    1.slot: P signifies that an object is being put into another object.

    2.slot: the number of copies of the object put into the object.

    3.slot: the table from which to draw the object (if [item vnum] not used).

    4.slot: the vnum of the object (if [table vnum] not used).

    Examples:

    P 1d2+0  0 48
    P 1d1+0  7 0
    P 1d1+0  :121:6 0
    

    The first example puts two copies of an object from the area file (48) into another object.

    The second example does the same as the first, but uses a table from the area file (table 7).

    The third example does much the same as the second object, but uses a table from a different area file (table :121:6).

    Note: Limits on items are respected, so by placing that wondrous (and limited) wand into a dresser full of clothes, you run the risk of that item not appearing because the limit of the object has been reached.

  7.      D     execute a mobprog after the player enters the room

    The format for executing an encounter mobprog in your area is as follows:

    D [chance] [mobprog]

    1.slot: D signifies that a mobprog will execute after the new room is displayed to the character.

    2.slot: the chance the mud will call the mobprog.

    3.slot: the name of the mobprog itself.

    Example:

    D 10 mShamrockCafeEncounters02

    The mobprog above has a ten percent chance of calling the mobprog named "mShamrockCafeEncounters02". This mobprog will activate after the player's new room is displayed. This is very useful for atmospheric programs (like animals running at the approach of a player). These kinds of mobprogs will activate only for the player entering the room with the encounter.

  8.      X     execute a mobprog before the player enters the room

    The format for executing an encounter mobprog in your area is as follows:

    X [chance] [mobprog]

    1.slot: X signifies that a mobprog will execute before the new room is displayed to the character.

    2.slot: the chance the mud will call the mobprog.

    3.slot: the name of the mobprog itself.

    Example:

    X 20 mHaonDorEncounters01

    The mobprog above has a twenty percent chance of calling the mobprog named "mHaonDorEncounters01". This mobprog will activate before the player's new room is displayed. This is very useful for atmospheric programs (like telling a player the new smells she's coming into as she enters the room.) These kinds of mobprogs will activate only for the player entering the room with the encounter.

    Note: Keep in mind the mobprog will execute whether the player scans or enters the room - it executes before the room is displayed, whether she enters the room or not. A tricky detail, but one you should keep in mind nonetheless (the "D" command will not execute until after the player has moved into the room.)

  9.      T     choose from another encounter table

    The format for choosing from another encounter table is as follows:

    T [chance] [copies] [table vnum]

    1.slot: T signifies a call to a new table.

    2.slot: the chance a new table will be called.

    3.slot: calls made to the new table.

    4.slot: the vnum of the new table.

    Examples:

    T 15 3 12
    T 35 2 :34:5
    

    Both examples are set up the same, differing only to where they make their call. The first example, which has a fifteen percent chance of making three calls out to a new table, if successful will make the call to an encounter table in the area file. The second example, if successful, will make its call to a table in a different area file.

  10.      A     choose from another encounter table - all entries checked once

    This way of choosing from another encounter table follows the exact format of the "T" encounter table command:

    A [chance] [copies] [table vnum]

    1.slot: A signifies a call to a new table.

    2.slot: the chance a new table will be called.

    3.slot: calls made to the new table.

    4.slot: the vnum of the new table.

    Examples:

    A 20 2 8
    A 25 4 :162:10
    

    The setup of the examples above is the same as the setup of the examples found under the "T" encounter table command. The difference is if a call is made to the new table via the "A" command, every entry in that new table will be checked at least once, as opposed to the "T" command, which will check entries only so far as it fulfills its structure. Also, the "A" command allows you to create a table whose sum of chances can exceed 100. There's more on this below.

Hints for using encounter tables