Traps - torilmud/docs GitHub Wiki

Traps

TorilMUD has two different ways to add traps to your zone, trapped exits and trapped items, we'll go into detail below.

Note Currently, only rogues may find and disable traps. This might change in the future but for now, plan accordingly.

Trapped Exits

Trap Fields

[trap state] [type] [min damage] [max damage] [effect] [difficulty] [activation %]

Trap State

Allowed values are 0 for disabled, 1 for enabled. Set it always to 1 unless you want to permanently disable the trap. Doesn't make much sense now, but will in the future. (quoth our coders)

Trap Type

Trap types are:

0 none (DON'T USE IT)
1 blade
2 poison
3 rock
4 fireball
5 lightning
6 magic missile (level 50 magic missile hits single or multiple depending on effect set below. Ignores min/max damage settings, but you'll still need to put something into the field)
10 RANDOM (EVERY time a trap triggers it randomly chooses a trap type from type 1 to type 5) Note that more can be added easily. If you have suggestions, email us.
11 FALLING (If the distance is great enough, the PCs might die. If not, they might just be knocked out for a few minutes.

Trap Minimum/Maximum Damage

Can be any value but keep in mind the difficulty of your zone, and the likely hit point range of the players that will be getting zapped.

Trap Effect

Allowed values are: 0 (player effect: the trap hits just the one who triggered it) or 1 (area effect: the trap hits everyone in the room -- Gods and mobs excluded)

Trap Difficulty

This value can shift from -100 to +100: a positive number indicates that a trap is most difficult to detect and disarm, and it also applies to saving throws for the players, a negative number is, of course, the opposite.

Trap Activation %

If 100, this means that this trap has a 100% probability of being activated at boot time (and upon zone repop? verify).

Notes: A trap triggers when a player tries to open or pick it. No trapped door can be opened without being disarmed first. Saving throws are calculated by the mud when a trap triggers: for trap types like blade, rock, and falling it's a 1d100 agility check against player's halved agility score. For trap type poison it's a PARA saving throw, and for trap types fireball and lightning it's a SPELL saving throw. Saving throws are modified by the trap difficulty value. Players who have FIRESHIELD, PROT_FIRE, GLOBE or METAGLOBE are immune from trap type fireball, while those who have PROT_LIGHTNING, GLOBE or METAGLOBE are immune from trap type lightning UNLESS the trap difficulty value is more than 39.

For FALLING traps you'll need a room in the down direction from the trapped room into which the player (or group) will fall. Traps of type FALLING flagged as having an area effect won't allow any saving throws and all the objects in the room (including static objects like fountains etc...) will fall into the room below, taking normal falling damage depending on the distance fallen.


Trapped Items

These work similar to door traps but are a part of an object, and can trigger several different ways. Any object can be a trap, limited only by your imagination. This works like this:

In the obj file: After the extra description fields and before the apply fields there's a field for trapped objects. These fields are optional and just like the 'E' and 'A' field, although you can have only one 'T' field per object. Example:

E 
red dragonscale~ 
It looks like a red dragonscale! 
~ 
T                   <-- Indicates there is a trap on object
512 11 5 25 5 7     <-- trigger type, damage type, charges, level, topdice, bottomdice
A 18 2              <-- Normal affect flags follow
A 19 2 

Format: T

[trigger type] [damage type] [charges] [level] [#die] [die damage]

So the example above is a trigger on open trap of type 11 (sleep), has 5 charges, is level 25, and does 5d7 damage.

Trigger Type

This is the action that will cause the trap to fire. The bit fields are additive, so you can set any number of these to a single trap.

TRAP_EFF_MOVE 1 trigger on movement
TRAP_EFF_OBJECT 2 trigger on get or put
TRAP_EFF_ROOM 4 affect all in room
TRAP_EFF_NORTH 8 movement in this dir
TRAP_EFF_EAST 16
TRAP_EFF_SOUTH 32
TRAP_EFF_WEST 64
TRAP_EFF_UP 128
TRAP_EFF_DOWN 256
TRAP_EFF_OPEN 512 trigger on open
TRAP_EFF_SEARCH 1024 trigger on search
TRAP_EFF_PICK 2048 trigger on pick lock

Damage Type

The type of damage the trap will do to PCs. Pick one and only one.

TRAP_DAM_BLUNT 1
TRAP_DAM_PIERCE 2
TRAP_DAM_SLASH 3
TRAP_DAM_VENOM_L 4
TRAP_DAM_VENOM_M 5
TRAP_DAM_VENOM_H 6
TRAP_DAM_EXPLODE 7 your basic explosion
TRAP_DAM_SLEEP 11
TRAP_DAM_TELEPORT 12 if the room or zone is flagged NO_TELE it will not work
TRAP_DAM_FIRE 13
TRAP_DAM_COLD 14
TRAP_DAM_ACID 15
TRAP_DAM_LIGHTNING 16
TRAP_DAM_RANDOM_R 30 Random REGULAR trap (pierce, slash, venom, explode, etc)
TRAP_DAM_RANDOM_M 31 Random MAGIC trap (lightning,fireball, sleep, teleport, etc)

The first 6 are non-magical types, with some room left for more. The last 5 are magical traps with spell-like affects.

Trap Charges

Number between 1 and 32768, with -1 being infinite charges. Unlike with door traps, object traps allow you to set a number of charges, which when spent, will allow the commands to be performed on the objects or room with the object. Be very careful setting your trap charges. Keep in mind that stopping to disarm a trap will break the flow of a zone and an infinite trap with a very high level can turn out to be more of an annoying time-sink than an enjoyable zone mechanic.

Trap Level

Number between 1-100. This field determines damage if top/bottom dice are not set, as well as difficulty in disarming/detecting the trap. Be reasonable, do not add high level traps in low level areas without a very good reason.

NOTE: Trap level affects the duration of a sleep trap. Keep this in mind for your random magical traps, as a seemingly harmless trap could put a group to sleep for an hour and change.

trap level sleep duration
wtb values!

#Die & Die Damage

Also referred to as top die/bottom die, these fields will determine the damage of a trap just like they would on weapons. If they're set to 0, the trap damage will be automatically calculated by the trap level.