Difference between revisions of "Proc:Trap"

From SlothMUD Wiki
Jump to: navigation, search
(ToggleDoor)
(Effects)
 
(30 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
= Overview =
 
= Overview =
  
The trap procedure allows builders to combine a single trigger with multiple effects.  Some effects maybe be harmful, while others helpful.  The settings for the trap are assigned via the setproc command.
+
The trap procedure allows builders to combine a single trigger with multiple effects.  Some effects maybe be harmful, while others helpful.  The settings for the trap are assigned via the setproc command. The trap proc can be added to rooms or mobiles.
 +
 
  
 
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
 
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
Line 22: Line 23:
 
| Arrival
 
| Arrival
 
| Activates when players enter the room.
 
| Activates when players enter the room.
 +
|-
 +
| Cast
 +
| Activates when the specified spell is cast at a particular target.
 
|-
 
|-
 
| Command
 
| Command
Line 29: Line 33:
 
| Activates when players attempt to leave the room.
 
| Activates when players attempt to leave the room.
 
|-
 
|-
| Every
+
| HourOfDay
| Activates when the every interval occurs.
+
| Activates once or every interval during a particular range of time each mud day.
 
|-
 
|-
 
| MobileDeath
 
| MobileDeath
Line 40: Line 44:
 
| PressurePlate
 
| PressurePlate
 
| Activates when the sum of the weights of all players/mobiles in the room reach a particular threshhold.
 
| Activates when the sum of the weights of all players/mobiles in the room reach a particular threshhold.
 +
|-
 +
| Timer
 +
| Activates when the MUD's internal timer goes off.  This occurs approximately every 10 seconds.
 +
|-
 +
| ZoneReset
 +
| Activates immediately after the zone reset occurs.
 
|}
 
|}
  
Line 74: Line 84:
 
| 0 (FALSE)
 
| 0 (FALSE)
 
| Indicates whether independant mobiles should be able to activate the trigger.  If this value is left at zero, wandering mobiles will not activate the trap nor count toward cumulative activations such as pressure plate weights.  Mobile followers (supplications, summoned undead, etc) are always able to activate the trigger unless their master's prime level falls outside the trigger's boundaries or unless the follower is affected by a spell in the spell exemption list.
 
| Indicates whether independant mobiles should be able to activate the trigger.  If this value is left at zero, wandering mobiles will not activate the trap nor count toward cumulative activations such as pressure plate weights.  Mobile followers (supplications, summoned undead, etc) are always able to activate the trigger unless their master's prime level falls outside the trigger's boundaries or unless the follower is affected by a spell in the spell exemption list.
 +
|-
 +
| TRIGGER_INCLUDE_SELF
 +
| 0 (FALSE)
 +
| Indicates whether a mobile with the trap procedure attached can trigger the procedure itself.  Then must be TRUE if a mobile wishes to trigger on it's own death, for example.
 
|-
 
|-
 
| TRIGGER_INCLUDE_IMMORTALS
 
| TRIGGER_INCLUDE_IMMORTALS
Line 86: Line 100:
 
| No message
 
| No message
 
| Message sent to the room when the trigger is activated.
 
| Message sent to the room when the trigger is activated.
 +
|}
 +
 +
== Cast ==
 +
 +
The cast trigger will activate if one of the specified spells is cast at one or more target keywords.
 +
 +
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
 +
! Key !! Default !! Description
 +
|-
 +
| CAST_SPELL_LIST
 +
| None
 +
| Colon (:) separated list of spell names.
 +
|-
 +
| CAST_COMMAND_NAME
 +
| None
 +
| Either PLAY or SING if you want to force that command to be used.  Otherwise the method used to cast the spell or sing/play the song is irrelevant.
 +
|-
 +
| CAST_TARGET_LIST
 +
| None
 +
| Colon (:) separated list of potential targets for the spell.  Each value contains one or more keywords that must be specified to activate the trap.  If this value is left empty, then the arguments are ignored and any matching spell will activate the trap. Leaving this field out of your script also uses the default setting which is 'no target' or 'None', and therefore spells that don't use a target can (and should) thus be used this way.
 
|}
 
|}
  
Line 102: Line 136:
  
 
For example, a value of '''push tomb:push stone:push tombstone''' would trigger on any of the three commands listed.
 
For example, a value of '''push tomb:push stone:push tombstone''' would trigger on any of the three commands listed.
 +
 +
 +
== HourOfDay ==
 +
 +
The HourOfDay trigger will activate either once or once every interval during a range of hours during the day.  It ignores most of the trigger settings including TRIGGER_MIN_PRIME_LEVEL, TRIGGER_MAX_PRIME_LEVEL, and TRIGGER_SPELL_EXEMPTION_LIST.
 +
 +
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
 +
! Key !! Default !! Description
 +
|-
 +
| HOUR_OF_DAY_START
 +
| None
 +
| Start of the range.
 +
|-
 +
| HOUR_OF_DAY_START_MESSAGE
 +
| No message
 +
| Message to display when the hour range begins.  This message is sent to the room.
 +
|-
 +
| HOUR_OF_DAY_STOP
 +
| None
 +
| End of the range.  This value may not be the same as the start value otherwise the range is considered empty.
 +
|-
 +
| HOUR_OF_DAY_STOP_MESSAGE
 +
| No message
 +
| Message to display when the hour range ends.  This message is sent to the room.
 +
|-
 +
| HOUR_OF_DAY_RUN_MULTIPLE
 +
| TRUE
 +
| Whether to run every interval (the default) or just once when the range begins.
 +
|}
  
  
Line 116: Line 179:
 
|}
 
|}
  
 +
Note that if the trap procedure is added to a mobile and the TRIGGER_INCLUDE_SELF flag is set to TRUE, the MobileDeath trigger will activate the trap regardless of the MOBILE_DEATH_VNUM settings.
  
 
== Password ==
 
== Password ==
Line 141: Line 205:
 
| The amount of weight needed to activate the trigger.
 
| The amount of weight needed to activate the trigger.
 
|}
 
|}
 +
 +
 +
== Zone Reset ==
 +
 +
There are no additional settings for this trigger.
  
 
= Effects =
 
= Effects =
Line 162: Line 231:
 
|-
 
|-
 
| EFFECTS_AFFECT_MOBILES
 
| EFFECTS_AFFECT_MOBILES
| 0
+
| 0 (FALSE)
 
| Boolean value indicating whether unrelated mobiles should be affected by the trap.  If this value is left at zero, wandering mobiles will not be affected.  Mobile followers (supplications, summoned undead, etc) will always be eligible unless their master's prime level falls outside the trigger's boundaries or unless the follower is affected by a spell in the spell exemption list.
 
| Boolean value indicating whether unrelated mobiles should be affected by the trap.  If this value is left at zero, wandering mobiles will not be affected.  Mobile followers (supplications, summoned undead, etc) will always be eligible unless their master's prime level falls outside the trigger's boundaries or unless the follower is affected by a spell in the spell exemption list.
 +
|-
 +
| EFFECTS_AFFECT_SELF
 +
| 0 (FALSE)
 +
| Boolean value indicating whether the mobile the trap is attached to should be affected by the trap.
 
|-
 
|-
 
| EFFECTS_AFFECT_OBJECTS
 
| EFFECTS_AFFECT_OBJECTS
| 0
+
| 0 (FALSE)
 
| Boolean value indicating whether objects in the room should be affected by the trap.
 
| Boolean value indicating whether objects in the room should be affected by the trap.
 
|-
 
|-
Line 184: Line 257:
 
| 0
 
| 0
 
| Boolean value indicating whether activation of the trap should stop the affected players from looking when arriving at their destination.  Only relevant if the trap is triggered and activated during arrival into a new room.
 
| Boolean value indicating whether activation of the trap should stop the affected players from looking when arriving at their destination.  Only relevant if the trap is triggered and activated during arrival into a new room.
 +
|-
 +
| EFFECTS_SKIP_REMAINING_PROCS
 +
| 0
 +
| Boolean value indicating whether activation of the trap should stop any further procs from running for this event.
 +
|-
 +
| EFFECTS_RETURN_SUCCESS
 +
| 0
 +
| Boolean value indicating whether the proc returns success.  Currently this is only used during the CAST trigger to return whether the cast of the spell was successful or not.  This allows the game to determine how much mana to subtract from the player.
 
|}
 
|}
  
Line 195: Line 276:
 
| Does damage to the selected targets.
 
| Does damage to the selected targets.
 
|-
 
|-
| DoorState
+
| DoorState (obsolete)
 
| Changes the state of up to 100 doors.
 
| Changes the state of up to 100 doors.
 
|-
 
|-
Line 204: Line 285:
 
| Opens a portal between two rooms.
 
| Opens a portal between two rooms.
 
|-
 
|-
| SpawnMobiles
+
| SpawnMobiles (obsolete)
 
| Spawns one or more mobiles.
 
| Spawns one or more mobiles.
 
|-
 
|-
| SpawnObjects
+
| SpawnObjects (obsolete)
 
| Spawns one or more objects.
 
| Spawns one or more objects.
 +
|-
 +
| Spell
 +
| Casts a spell on the selected targets.
 
|-
 
|-
 
| Teleport
 
| Teleport
 
| Teleports the selected targets from one room to another.
 
| Teleports the selected targets from one room to another.
 
|-
 
|-
| ZoneAlarm
+
| ZoneAlarm (obsolete)
 
| Either sets or clears the zone alarm.
 
| Either sets or clears the zone alarm.
 +
|-
 +
| ZoneCommands
 +
| Runs a series of "new" zone commands.
 
|}
 
|}
  
Line 250: Line 337:
 
|}
 
|}
  
 +
Regardless of settings, a mobile with the trap procedure will not do damage to itself.
  
 
== DoorState ==
 
== DoorState ==
Line 357: Line 445:
 
== SpawnObjects ==
 
== SpawnObjects ==
  
NOTE: This functionality is better performed by the ZoneCommands effect and any new procs should use that instead of the SpawnMobiles effect.
+
NOTE: This functionality is better performed by the ZoneCommands effect and any new procs should use that instead of the SpawnObjects effect.
  
 
The spawnobjects effect will create mobiles in one or more rooms.
 
The spawnobjects effect will create mobiles in one or more rooms.
Line 379: Line 467:
 
| No message
 
| No message
 
| Message sent to the room for each object spawned.  This message does not support $ replacement.
 
| Message sent to the room for each object spawned.  This message does not support $ replacement.
 +
|}
 +
 +
 +
== Spell ==
 +
 +
The spell effect casts a spell on one or more targets.
 +
 +
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
 +
! Key !! Default !! Description
 +
|-
 +
| SPELL_NAME
 +
| None
 +
| Name of the spell.  If unspecified or set to an invalid value, the effect will not happen.
 +
|-
 +
| SPELL_LEVEL
 +
| 0
 +
| Caster level of the spell.  If unspecified or below 1, the effect will not happen.
 +
|-
 +
| SPELL_SILENT
 +
| False
 +
| Whether the owner of the proc will utter the words to cast the spell.  If the owner is not a mobile, this value is ignored and the spell is always silent.
 +
|-
 +
| SPELL_ARGUMENTS
 +
| None
 +
| Any additional arguments required by t he spell.
 
|}
 
|}
  
Line 384: Line 497:
 
== Teleport ==
 
== Teleport ==
  
The teleport effect telports players and/or mobiles from one room to another.
+
The teleport effect teleports players and/or mobiles from one room to another.
  
 
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
 
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
Line 417: Line 530:
 
== ZoneAlarm ==
 
== ZoneAlarm ==
  
 +
NOTE: This functionality is better performed by the ZoneCommands effect and any new procs should use that instead of the ZoneAlarm effect.
 
The ZoneAlarm effect either sets or clears the current zone's alarm.
 
The ZoneAlarm effect either sets or clears the current zone's alarm.
  
Line 436: Line 550:
  
  
= ZoneCommands =
+
== ZoneCommands ==
  
The ZoneCommands effect executes a number of zone commands in a specified list of rooms.  Note that these zone commands are similar to the zone commands added to rooms but not identical.
+
The ZoneCommands effect executes a number of [[KVP Zone Commands]] in a specified list of rooms.  Note that these zone commands are similar to the zone commands added to rooms but not identical.
  
 
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
 
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
Line 452: Line 566:
 
|}
 
|}
  
All zone commands contain a number of parameters specified on a single line.  Some commands contain additional lines that specify text to be displayed when the zone command is run.  Commmands may be separated by blank lines and comments may be specified using the hash sign (#).
+
A list of KVP zone commands can be found at [[KVP Zone Commands]].
 
+
All zone commands start with the following:
+
 
+
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
+
! Parameter !! Description
+
|-
+
| Command Name
+
| The name of the command.  A list of command names can be found in the sections below.
+
|-
+
| Dependency Index
+
| The index number of a previous command that this command is dependant upon.  If the dependency index is a positive value and that command did not execute for any reason, this command will not execute.  The EquipMobile and AffectMobile commands must have a positive index that refers to the mobile that should be equipped or affected.  The EquipContainer command must have a positive index that refers to the container item that the new item should be placed inside.  If this value is zero or negative, there is assumed to be no dependency and this command will run regardless of any previous commands.  The first command in the command list is considered command #1.
+
|-
+
| Chance
+
| Percentage change that this command will run.  This value is checked after the dependency index is validated.
+
|}
+
 
+
 
+
== Affect Mobile ==
+
 
+
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
+
! Line 1 Parameter !! Description
+
|-
+
| Command Name
+
| AffectMobile
+
|-
+
| Dependency Index
+
| See above.  This value must be > 0 and refer to a mobile command.
+
|-
+
| Chance
+
| See above.
+
|-
+
| Affect Type
+
| The type of affect.
+
|-
+
| Affect Amount
+
| The amount of the affect.
+
|-
+
| Affect Level
+
| The level of the affect.
+
|}
+
 
+
 
+
== Equip Container ==
+
 
+
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
+
! Line 1 Parameter !! Description
+
|-
+
| CommandName
+
| EquipContainer
+
|-
+
| Dependency Index
+
| See above.  This value must be > 0 and refer to an item command.
+
|-
+
| Chance
+
| See above.
+
|-
+
| Item Virtual Number
+
| Virtual number of the item to be placed in the container.
+
|}
+
 
+
 
+
== Equip Mobile ==
+
 
+
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
+
! Line 1 Parameter !! Description
+
|-
+
| CommandName
+
| EquipMobile
+
|-
+
| Dependency Index
+
| See above.  This value must be > 0 and refer to a mobile command.
+
|-
+
| Chance
+
| See above.
+
|-
+
| Item Virtual Number
+
| Virtual number of the item to be placed in the player's inventory.
+
|-
+
| Wear Position Index
+
| Integer value that refers to the location where the item should be worn.  May be < 0 to specify carried in inventory.
+
|}
+
 
+
 
+
== Equip Player ==
+
 
+
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
+
! Line 1 Parameter !! Description
+
|-
+
| CommandName
+
| EquipPlayer
+
|-
+
| Dependency Index
+
| See above.  This value may be <= 0.
+
|-
+
| Chance
+
| See above.
+
|-
+
| Item Virtual Number
+
| Virtual number of the item to be placed in the player's inventory.
+
|-
+
! Line 2 Parameter !! Description
+
|-
+
| Actor Message
+
| Message displayed to the player who receives the item.  This message
+
may contain $ codes such as $p to refer to the item.  This line may be blank if no message is desired.
+
|-
+
! Line 3 Parameter !! Description
+
|-
+
| Room Message
+
| Message displayed to the room when the item is spawned.  This message
+
may contain $ codes such as $n, $e to refer to the player or $p to refer to the item.  This line may be blank if no message is desired.
+
|}
+
 
+
 
+
== Spawn Item ==
+
 
+
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
+
! Line 1 Parameter !! Description
+
|-
+
| CommandName
+
| SpawnItem
+
|-
+
| Dependency Index
+
| See above.  This value may be <= 0.
+
|-
+
| Chance
+
| See above.
+
|-
+
| Max in World
+
| Integer value indicating the maximum number of this mobile that may exist in the world at any time.  May be <= 0 to specify infinite.
+
|-
+
| Max in Room
+
| Integer value indicating the maximum number of this mobile that may exist in this room at any time.  May be <= 0 to specify infinite.
+
|-
+
! Line 2 Parameter !! Description
+
|-
+
| Room Message
+
| Message displayed when the mobile is spawned to the room.  This message
+
may contain $ codes such as $p to refer to the item.  This line may be blank if no message is desired.
+
|}
+
 
+
 
+
== Spawn Mobile ==
+
 
+
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
+
! Line 1 Parameter !! Description
+
|-
+
| CommandName
+
| SpawnMobile
+
|-
+
| Dependency Index
+
| See above.  This value may be <= 0.
+
|-
+
| Chance
+
| See above.
+
|-
+
| Max in World
+
| Integer value indicating the maximum number of this mobile that may exist in the world at any time.  May be <= 0 to specify infinite.
+
|-
+
| Max in Room
+
| Integer value indicating the maximum number of this mobile that may exist in this room at any time.  May be <= 0 to specify infinite.
+
|-
+
| Aggressive Mode
+
| String value indicating how the mobile should attack, if aggressive.  Possible values are "Point", "Front", "Back", and "Random".  An invalid value will default to "Point".
+
|-
+
| Treasure Category
+
| String value indicating what treasure category should be used to spawn random treasure items on the mobile.  To use the zone default, specify an empty string by using two double-quotes ("").
+
|-
+
! Line 2 Parameter !! Description
+
|-
+
| Room Message
+
| Message displayed when the mobile is spawned to the room.  This message
+
may contain $ codes such as $n, $e, etc to refer to the mobile.  This line may be blank if no message is desired.
+
|}
+
 
+
 
+
== Toggle Door ==
+
 
+
Note that the Toggle Door command toggles both sides of the door, unlike the original "D" zone command.
+
 
+
{|class="abilitiestable" border="0" cellspacing="0" cellpadding="0"
+
! Line 1 Parameter !! Description
+
|-
+
| CommandName
+
| ToggleDoor
+
|-
+
| Dependency Index
+
| See above.  This value may be <= 0.
+
|-
+
| Chance
+
| See above.
+
|-
+
| Direction
+
| The name or number of the direction.  Can be something like "north", "south", etc or the numeric index (0-5).
+
|-
+
| State
+
| The state the door should toggle to.  Can be OPEN, CLOSED, or LOCKED.
+
|-
+
! Line 2 Parameter !! Description
+
|-
+
| Open/Close Message
+
| Message displayed when the door is either opened or closed.  Since the command will only perform one of those actions you can make the message specific to what the command is actually doing.  This line may be left blank if no message is to be sent.
+
|-
+
! Line 3 Parameter !! Description
+
|-
+
| Lock/Unlock Message
+
| Message displayed when the door is either locked or unlocked.  Since the command will only perform one of those actions you can make the message specific to what the command is actually doing.  This line may be left blank if no message is to be sent.
+
|}
+
  
 
= Enabling the Trap =
 
= Enabling the Trap =
  
Before the trap will be enabled, you must run the following commands:
+
Before the trap will be enabled, you must run the following command:
 
* setproc room # PROC_ENABLED 1
 
* setproc room # PROC_ENABLED 1
  
Line 690: Line 596:
 
</pre>
 
</pre>
  
== Command / Door ==
+
== Cast / ZoneCommands ==
 +
<pre>
 +
addproc room trap
 +
setproc room 0 TRAP_INITIAL_CHARGES -1
 +
 
 +
setproc room 0 TRIGGER_TYPE Cast
 +
setproc room 0 TRIGGER_INCLUDE_IMMORTALS 1
 +
 
 +
setproc room 0 CAST_SPELL_LIST fireball
 +
setproc room 0 CAST_TARGET_LIST door
 +
 
 +
setproc room 0 EFFECTS_LIST ZoneCommands
 +
setproc room 0 ZONE_COMMANDS_ROOM_LIST 8028
 +
setproc room 0 ZONE_COMMANDS_8028_LIST
 +
ToggleDoor 0 100 south closed      # 1
 +
The door slams shut!
 +
 
 +
# End of commands
 +
@
 +
 
 +
setproc room 0 PROC_ENABLED 1
 +
</pre>
 +
 
 +
== Command / ZoneCommands ==
 
<pre>
 
<pre>
 
addproc room trap
 
addproc room trap
Line 697: Line 626:
 
setproc room 0 TRIGGER_TYPE Command
 
setproc room 0 TRIGGER_TYPE Command
 
setproc room 0 TRIGGER_INCLUDE_IMMORTALS 1
 
setproc room 0 TRIGGER_INCLUDE_IMMORTALS 1
 +
setproc room 0 TRIGGER_MESSAGE_ACTOR You pull the lever.
 +
setproc room 0 TRIGGER_MESSAGE_ROOM $n pulls the lever.
 +
 
setproc room 0 COMMAND_LIST pull lever:foo lever
 
setproc room 0 COMMAND_LIST pull lever:foo lever
  
setproc room 0 EFFECTS_LIST DoorState
+
setproc room 0 EFFECTS_LIST ZoneCommands
 
setproc room 0 EFFECTS_OVERRIDE_COMMAND 1
 
setproc room 0 EFFECTS_OVERRIDE_COMMAND 1
setproc room 0 DOOR_STATE_8054_NORTH_STATE LOCKED
 
setproc room 0 DOOR_STATE_8054_NORTH_MESSAGE_CLOSING The door slams shut!
 
setproc room 0 DOOR_STATE_8054_NORTH_MESSAGE_LOCKING You hear the lock click!
 
  
 +
setproc room 0 ZONE_COMMANDS_ROOM_LIST 8054
 +
setproc room 0 ZONE_COMMANDS_8054_LIST
 +
ToggleDoor 0 100 north locked      # 1
 +
The door slams shut!
 +
You hear the lock click!
 +
 +
SendMessages -1 100 FALSE          # 2
 +
Nothing seems to happen.
 +
Nothing seems to happen.
 +
@
  
 
setproc room 0 PROC_ENABLED 1
 
setproc room 0 PROC_ENABLED 1
Line 714: Line 653:
 
setproc room 1 TRIGGER_TYPE Command
 
setproc room 1 TRIGGER_TYPE Command
 
setproc room 1 TRIGGER_INCLUDE_IMMORTALS 1
 
setproc room 1 TRIGGER_INCLUDE_IMMORTALS 1
 +
setproc room 1 TRIGGER_MESSAGE_ACTOR You push the lever.
 +
setproc room 1 TRIGGER_MESSAGE_ROOM $n pushes the lever.
 +
 
setproc room 1 COMMAND_LIST push lever:bar lever
 
setproc room 1 COMMAND_LIST push lever:bar lever
  
setproc room 1 EFFECTS_LIST DoorState
+
setproc room 1 EFFECTS_LIST ZoneCommands
 
setproc room 1 EFFECTS_OVERRIDE_COMMAND 1
 
setproc room 1 EFFECTS_OVERRIDE_COMMAND 1
setproc room 1 DOOR_STATE_8054_NORTH_STATE OPEN
+
 
setproc room 1 DOOR_STATE_8054_NORTH_MESSAGE_OPENING The door swings open!
+
setproc room 1 ZONE_COMMANDS_ROOM_LIST 8054
setproc room 1 DOOR_STATE_8054_NORTH_MESSAGE_UNLOCKING *Click*
+
setproc room 1 ZONE_COMMANDS_8054_LIST
 +
ToggleDoor 0 100 north open        # 1
 +
The door swings open!
 +
*Click*
 +
 
 +
SendMessages -1 100 FALSE          # 2
 +
Nothing seems to happen.
 +
Nothing seems to happen.
 +
@
  
 
setproc room 1 PROC_ENABLED 1
 
setproc room 1 PROC_ENABLED 1
 +
 
</pre>
 
</pre>
  
Line 730: Line 681:
  
 
setproc room 0 TRIGGER_TYPE Password
 
setproc room 0 TRIGGER_TYPE Password
setproc room 1 TRIGGER_INCLUDE_IMMORTALS 1
+
setproc room 0 TRIGGER_INCLUDE_IMMORTALS 1
 
setproc room 0 PASSWORD_VALUE muhahaha
 
setproc room 0 PASSWORD_VALUE muhahaha
  
Line 764: Line 715:
  
 
setproc room 0 PROC_ENABLED 1
 
setproc room 0 PROC_ENABLED 1
 +
</pre>
 +
 +
== Zone Reset / Zone Commands ==
 +
<pre>
 +
setproc room 0 TRAP_INITIAL_CHARGES -1
 +
 +
setproc room 0 TRIGGER_TYPE ZoneReset
 +
 +
setproc room 0 EFFECTS_LIST ZoneCommands
 +
 +
setproc room 0 ZONE_COMMANDS_ROOM_LIST 5804
 +
setproc room 0 ZONE_COMMANDS_5804_LIST
 +
SpawnMobile 0 100 12000 1000 10 Point ""    # 1 - kobold
 +
$n appears in a puff of smoke!
 +
 +
#
 +
# 50% chance kobold has a sword, if not, 100% chance it has a mace
 +
#
 +
EquipMobile 1 50 2004 16                    # 2 - sword
 +
EquipMobile -2 100 2002 16                  # 3 - mace
 +
 +
EquipMobile 1 50 1403 -1                    # 4 - 50% chance of bag
 +
#
 +
# 50% chance bag has a loaf of bread, if not, 100% chance it has rations
 +
#
 +
EquipContainer 4 50 1000                    # 5 - bread
 +
EquipContainer -5 100 1007                  # 6 - rations
 +
 +
#
 +
# 50% chance kobold has infravision, if not, 100% chance of darksight
 +
#
 +
AffectMobile 1 50 32 0 45                  # 7 - infravision
 +
AffectMobile -7 100 110 0 45                # 8 - darksight
 +
@
 +
 +
setproc room 0 PROC_ENABLED 1
 +
 
</pre>
 
</pre>
  
 
[[Category:Building]]
 
[[Category:Building]]
 
[[Category:Room Procedures]]
 
[[Category:Room Procedures]]
 +
[[Category:Mobile Procedures]]

Latest revision as of 17:55, 25 March 2017

Overview

The trap procedure allows builders to combine a single trigger with multiple effects. Some effects maybe be harmful, while others helpful. The settings for the trap are assigned via the setproc command. The trap proc can be added to rooms or mobiles.


Key Default Description
TRAP_INITIAL_CHARGES 1 The number of charges the trap has per zone reset. If this value is negative, the trap has infinite charges.


Triggers

The trap may only have one trigger which is set in the TRIGGER_TYPE key value.

Value Description
Arrival Activates when players enter the room.
Cast Activates when the specified spell is cast at a particular target.
Command Activates when players enter a particular command.
Departure Activates when players attempt to leave the room.
HourOfDay Activates once or every interval during a particular range of time each mud day.
MobileDeath Activates when a particular mobile is killed.
Password Activates when a player says a particular word.
PressurePlate Activates when the sum of the weights of all players/mobiles in the room reach a particular threshhold.
Timer Activates when the MUD's internal timer goes off. This occurs approximately every 10 seconds.
ZoneReset Activates immediately after the zone reset occurs.


Trigger Settings

Global settings that may be applied to the trigger.

Key Default Description
TRIGGER_CHANCE 100 The percentage chance that the trigger will activate.
TRIGGER_MIN_PRIME_LEVEL 0 The minimum prime level required to activate the trigger.
TRIGGER_MAX_PRIME_LEVEL 50 The maximum prime level allowed to activate the trigger. Note that immortals will only trigger the trap if TRIGGER_INCLUDE_IMMORTALS is also set.
TRIGGER_ACTIVATION_DELAY 0 Approximate number of seconds to delay the effects after the trigger is activated. Note that setting this value allows for the player activating the trigger to escape - which means they may not be present for any of the effects.
TRIGGER_SPELL_EXEMPTION_LIST No exemptions A colon (:) separated list of spells/skills that make the player exempt from activating the trigger.
TRIGGER_INCLUDE_MOBILES 0 (FALSE) Indicates whether independant mobiles should be able to activate the trigger. If this value is left at zero, wandering mobiles will not activate the trap nor count toward cumulative activations such as pressure plate weights. Mobile followers (supplications, summoned undead, etc) are always able to activate the trigger unless their master's prime level falls outside the trigger's boundaries or unless the follower is affected by a spell in the spell exemption list.
TRIGGER_INCLUDE_SELF 0 (FALSE) Indicates whether a mobile with the trap procedure attached can trigger the procedure itself. Then must be TRUE if a mobile wishes to trigger on it's own death, for example.
TRIGGER_INCLUDE_IMMORTALS 0 (FALSE) Indicates whether immortals can trigger the trap. Best used when debugging or for helpful traps that perform tasks like opening doors.
TRIGGER_MESSAGE_ACTOR No message Message sent to the player who activates the trigger.
TRIGGER_MESSAGE_ROOM No message Message sent to the room when the trigger is activated.

Cast

The cast trigger will activate if one of the specified spells is cast at one or more target keywords.

Key Default Description
CAST_SPELL_LIST None Colon (:) separated list of spell names.
CAST_COMMAND_NAME None Either PLAY or SING if you want to force that command to be used. Otherwise the method used to cast the spell or sing/play the song is irrelevant.
CAST_TARGET_LIST None Colon (:) separated list of potential targets for the spell. Each value contains one or more keywords that must be specified to activate the trap. If this value is left empty, then the arguments are ignored and any matching spell will activate the trap. Leaving this field out of your script also uses the default setting which is 'no target' or 'None', and therefore spells that don't use a target can (and should) thus be used this way.


Command

The command trigger will activate if a player enters the specified command and arguments.

Key Default Description
COMMAND_LIST None Colon (:) separated list of commands and their arguments.

For example, a value of push tomb:push stone:push tombstone would trigger on any of the three commands listed.


HourOfDay

The HourOfDay trigger will activate either once or once every interval during a range of hours during the day. It ignores most of the trigger settings including TRIGGER_MIN_PRIME_LEVEL, TRIGGER_MAX_PRIME_LEVEL, and TRIGGER_SPELL_EXEMPTION_LIST.

Key Default Description
HOUR_OF_DAY_START None Start of the range.
HOUR_OF_DAY_START_MESSAGE No message Message to display when the hour range begins. This message is sent to the room.
HOUR_OF_DAY_STOP None End of the range. This value may not be the same as the start value otherwise the range is considered empty.
HOUR_OF_DAY_STOP_MESSAGE No message Message to display when the hour range ends. This message is sent to the room.
HOUR_OF_DAY_RUN_MULTIPLE TRUE Whether to run every interval (the default) or just once when the range begins.


MobileDeath

The mobiledeath trigger will activate if a particular mobile is killed in this room. It ignores most of the trigger settings including TRIGGER_MIN_PRIME_LEVEL, TRIGGER_MAX_PRIME_LEVEL, and TRIGGER_SPELL_EXEMPTION_LIST.

Key Default Description
MOBILE_DEATH_VNUM -1 Vnum of the mobile to react to.

Note that if the trap procedure is added to a mobile and the TRIGGER_INCLUDE_SELF flag is set to TRUE, the MobileDeath trigger will activate the trap regardless of the MOBILE_DEATH_VNUM settings.

Password

The password trigger will activate if a player says a particular word.

Key Default Description
PASSWORD_VALUE (none) The password.


Pressure Plate

The pressure plate trigger activates when the weight of the applicable players and mobiles crosses a threshhold. Players/mobiles affected by the fly or wraithform spells are not counted.

Key Default Description
PRESSURE_PLATE_WEIGHT 0 The amount of weight needed to activate the trigger.


Zone Reset

There are no additional settings for this trigger.

Effects

Note that if a the trap has a non-zero activation time and is set to only affect the person triggering the trap, the person may be gone and the trap may affect noone.

Key Default Description
EFFECTS_SPELL_EXEMPTION_LIST Empty Colon (:) separated list of spells that exempt the player/mobile from being affected by any of the trap's effects.
EFFECTS_LIST Empty Colon (:) separated list of effects enabled for this trap. Effects are activated in the order they appear.
EFFECTS_TARGET Actor A string value of "Actor" to target the person triggering the trap, or "Room" for the entire room, or a number from 1 to 32 indicating how many random eligible players/mobiles should be selected and affected.
EFFECTS_AFFECT_MOBILES 0 (FALSE) Boolean value indicating whether unrelated mobiles should be affected by the trap. If this value is left at zero, wandering mobiles will not be affected. Mobile followers (supplications, summoned undead, etc) will always be eligible unless their master's prime level falls outside the trigger's boundaries or unless the follower is affected by a spell in the spell exemption list.
EFFECTS_AFFECT_SELF 0 (FALSE) Boolean value indicating whether the mobile the trap is attached to should be affected by the trap.
EFFECTS_AFFECT_OBJECTS 0 (FALSE) Boolean value indicating whether objects in the room should be affected by the trap.
EFFECTS_ALLOW_DEATH 0 Boolean value determining whether players/mobiles can be killed by the trap. By default the player/mobile will be taken down to 0 hit points and stunned. It is strongly recommended that this only be changed in the most harshest of areas.
EFFECTS_OVERRIDE_COMMAND 0 Boolean value indicating whether activation of the trap overrides the current command. Only relevant if a command triggers and activates the trap.
EFFECTS_BLOCK_DEPARTURE 0 Boolean value indicating whether activation of the trap blocks departure of the room. Only relevant if the trap is triggered and activated by attempting to exit the room.
EFFECTS_SKIP_LOOK_ON_ARRIVAL 0 Boolean value indicating whether activation of the trap should stop the affected players from looking when arriving at their destination. Only relevant if the trap is triggered and activated during arrival into a new room.
EFFECTS_SKIP_REMAINING_PROCS 0 Boolean value indicating whether activation of the trap should stop any further procs from running for this event.
EFFECTS_RETURN_SUCCESS 0 Boolean value indicating whether the proc returns success. Currently this is only used during the CAST trigger to return whether the cast of the spell was successful or not. This allows the game to determine how much mana to subtract from the player.


Supported effects:

Key Description
Damage Does damage to the selected targets.
DoorState (obsolete) Changes the state of up to 100 doors.
Lag Lags the selected targets.
Portal Opens a portal between two rooms.
SpawnMobiles (obsolete) Spawns one or more mobiles.
SpawnObjects (obsolete) Spawns one or more objects.
Spell Casts a spell on the selected targets.
Teleport Teleports the selected targets from one room to another.
ZoneAlarm (obsolete) Either sets or clears the zone alarm.
ZoneCommands Runs a series of "new" zone commands.


Damage

The damage effect does damage to the players/mobiles that the trap targets.

Key Default Description
DAMAGE_DICE 1 The number of dice used when calculating damage.
DAMAGE_DIE_SIZE 1 The size of the die or dice used when calculating damage.
DAMAGE_ADDITIONAL 0 An amount added (or subtracted) to the damage total.
DAMAGE_TYPE Undefined Type of damage done.
DAMAGE_MESSAGE_ACTOR No message Message shown to the player receiving damage.
DAMAGE_MESSAGE_ROOM No message Message shown to the room for the player receiving damage.

Regardless of settings, a mobile with the trap procedure will not do damage to itself.

DoorState

NOTE: This functionality is better performed by the ZoneCommands effect and any new procs should use that instead of the DoorState effect.

The doorstate effect can change the states of up to 100 doors. The effect automatically sets both sides of the door to match. In the table below, the key name uses #### to represent the virtual number of the room containing the door and XXXX to represent the direction of the door in that room.

Key Default Description
DOOR_STATE_####_XXXX_STATE none Sets the door's state to either "OPEN", "CLOSED", or "LOCKED".
DOOR_STATE_####_XXXX_MESSAGE_UNLOCKING No message Message sent to the room if the effect causes the door to unlock.
DOOR_STATE_####_XXXX_MESSAGE_OPENING No message Message sent to the room if the effect causes the door to open.
DOOR_STATE_####_XXXX_MESSAGE_CLOSING No message Message sent to the room if the effect causes the door to close.
DOOR_STATE_####_XXXX_MESSAGE_LOCKING No message Message sent to the room if the effect causes the door to lock.


Lag

The lag effect adds lag to the affected players.

Key Default Description
LAG_SECONDS 0 The number of seconds to lag the player.
LAG_MESSAGE_ACTOR No message Message sent to the player when they are lagged.
LAG_MESSAGE_ROOM No message Message sent to the room for each player that is lagged.


Portal

The portal effect creates a portal from one room to another.

Key Default Description
PORTAL_SOURCE -1 Source room to create the portal. If not specified or set to -1, the proc uses the current room as the source.
PORTAL_DESTINATION -1 Destination room used to create the portal. If not specified or set to -1, the proc will not run.
PORTAL_DURATION 3 hours Number of hours before the portal will disappear.
PORTAL_TWO_WAY 1 Boolean value indicating whether or not the portal should be two-way.


SpawnMobiles

NOTE: This functionality is better performed by the ZoneCommands effect and any new procs should use that instead of the SpawnMobiles effect.

The spawnmobiles effect will create mobiles in one or more rooms.

Key Default Description
SPAWN_MOBILE_LIST Empty Colon (:) separated list of mobile vnums to create. The same vnum may be listed more than once, but will use the same settings for all mobiles with the same vnum.
SPAWN_MOBILE_####_DESTINATION -1 Destination room to spawn the mobiles. If unspecified or set to -1, the current room is used.
SPAWN_MOBILE_####_QUANTITY 1 Number of mobiles to spawn with this vnum. The current maximum value is 10.
SPAWN_MOBILE_####_MESSAGE_ROOM No message Message sent to the room for each mobile spawned.


SpawnObjects

NOTE: This functionality is better performed by the ZoneCommands effect and any new procs should use that instead of the SpawnObjects effect.

The spawnobjects effect will create mobiles in one or more rooms.

Key Default Description
SPAWN_OBJECT_LIST Empty Colon (:) separated list of object vnums to create. The same vnum may be listed more than once, but will use the same settings for all objects with the same vnum.
SPAWN_OBJECT_####_DESTINATION -1 Destination room to spawn the objects. If unspecified or set to -1, the current room is used.
SPAWN_OBJECT_####_QUANTITY 1 Number of objects to spawn with this vnum. The current maximum value is 10.
SPAWN_OBJECT_####_MESSAGE_ROOM No message Message sent to the room for each object spawned. This message does not support $ replacement.


Spell

The spell effect casts a spell on one or more targets.

Key Default Description
SPELL_NAME None Name of the spell. If unspecified or set to an invalid value, the effect will not happen.
SPELL_LEVEL 0 Caster level of the spell. If unspecified or below 1, the effect will not happen.
SPELL_SILENT False Whether the owner of the proc will utter the words to cast the spell. If the owner is not a mobile, this value is ignored and the spell is always silent.
SPELL_ARGUMENTS None Any additional arguments required by t he spell.


Teleport

The teleport effect teleports players and/or mobiles from one room to another.

Key Default Description
TELEPORT_SOURCE -1 Source room to teleport from. If unspecified or set to -1 the proc uses the current room.
TELEPORT_DESTINATION -1 Destination room to teleport to. If unspecified or set to -1 the proc uses the current room.
TELEPORT_LOOK_AT_DESTINATION 1 Boolean value indicating whether players should automatically look in the room once they reach their destination.
TELEPORT_MESSAGE_ACTOR No message Message sent to the player when they are teleported.
TELEPORT_MESSAGE_SOURCE_ROOM No message Message sent to the source room when the player teleports away.
TELEPORT_MESSAGE_DESTINATION_ROOM No message Message sent to the destination room when the player arrives.


ZoneAlarm

NOTE: This functionality is better performed by the ZoneCommands effect and any new procs should use that instead of the ZoneAlarm effect. The ZoneAlarm effect either sets or clears the current zone's alarm.

Key Default Description
ZONE_ALARM_STATE 1 Boolean value indicating whether the alarm should be set (1) or cleared (0).
ZONE_ALARM_ACTIVATE_MESSAGE_ROOM No message Message sent to the room when the alarm is activated.
ZONE_ALARM_DEACTIVATE_MESSAGE_ROOM No message Message sent to the room when the alarm is deactivated.


ZoneCommands

The ZoneCommands effect executes a number of KVP Zone Commands in a specified list of rooms. Note that these zone commands are similar to the zone commands added to rooms but not identical.

Key Default Description
ZONE_COMMANDS_ROOM_LIST No Rooms A colon (:) separated list of room virtual numbers for which zone command lists exist.
ZONE_COMMANDS_####_LIST No commands A list of zone commands to be executed in the room with virtual number ####. A list of available commands can be found in the table below.

A list of KVP zone commands can be found at KVP Zone Commands.

Enabling the Trap

Before the trap will be enabled, you must run the following command:

  • setproc room # PROC_ENABLED 1

In addition, setting PROC_DEBUG to 1 will send extra debugging information to those in the room.


Samples

Arrival / Teleport

setproc room 0 TRAP_INITIAL_CHARGES -1

setproc room 0 TRIGGER_TYPE Arrival
setproc room 0 TRIGGER_INCLUDE_IMMORTALS 1

setproc room 0 EFFECTS_LIST Teleport
setproc room 0 EFFECTS_TARGET Room

setproc room 0 TELEPORT_DESTINATION 8000
setproc room 0 TELEPORT_MESSAGE_ACTOR You are blinded for a moment.
setproc room 0 TELEPORT_MESSAGE_SOURCE_ROOM $n disappears in a flash of light!
setproc room 0 TELEPORT_MESSAGE_DESTINATION_ROOM $n appears in a flash of light!

setproc room 0 PROC_ENABLED 1

Cast / ZoneCommands

addproc room trap
setproc room 0 TRAP_INITIAL_CHARGES -1

setproc room 0 TRIGGER_TYPE Cast
setproc room 0 TRIGGER_INCLUDE_IMMORTALS 1

setproc room 0 CAST_SPELL_LIST fireball
setproc room 0 CAST_TARGET_LIST door

setproc room 0 EFFECTS_LIST ZoneCommands
setproc room 0 ZONE_COMMANDS_ROOM_LIST 8028
setproc room 0 ZONE_COMMANDS_8028_LIST
ToggleDoor 0 100 south closed       # 1
The door slams shut!

# End of commands
@

setproc room 0 PROC_ENABLED 1

Command / ZoneCommands

addproc room trap
setproc room 0 TRAP_INITIAL_CHARGES -1

setproc room 0 TRIGGER_TYPE Command
setproc room 0 TRIGGER_INCLUDE_IMMORTALS 1
setproc room 0 TRIGGER_MESSAGE_ACTOR You pull the lever.
setproc room 0 TRIGGER_MESSAGE_ROOM $n pulls the lever.

setproc room 0 COMMAND_LIST pull lever:foo lever

setproc room 0 EFFECTS_LIST ZoneCommands
setproc room 0 EFFECTS_OVERRIDE_COMMAND 1

setproc room 0 ZONE_COMMANDS_ROOM_LIST 8054
setproc room 0 ZONE_COMMANDS_8054_LIST
ToggleDoor 0 100 north locked       # 1
The door slams shut!
You hear the lock click!

SendMessages -1 100 FALSE           # 2
Nothing seems to happen.
Nothing seems to happen.
@

setproc room 0 PROC_ENABLED 1


addproc room trap
setproc room 1 TRAP_INITIAL_CHARGES -1

setproc room 1 TRIGGER_TYPE Command
setproc room 1 TRIGGER_INCLUDE_IMMORTALS 1
setproc room 1 TRIGGER_MESSAGE_ACTOR You push the lever.
setproc room 1 TRIGGER_MESSAGE_ROOM $n pushes the lever.

setproc room 1 COMMAND_LIST push lever:bar lever

setproc room 1 EFFECTS_LIST ZoneCommands
setproc room 1 EFFECTS_OVERRIDE_COMMAND 1

setproc room 1 ZONE_COMMANDS_ROOM_LIST 8054
setproc room 1 ZONE_COMMANDS_8054_LIST
ToggleDoor 0 100 north open         # 1
The door swings open!
*Click*

SendMessages -1 100 FALSE           # 2
Nothing seems to happen.
Nothing seems to happen.
@

setproc room 1 PROC_ENABLED 1

Password / Teleport

setproc room 0 TRAP_INITIAL_CHARGES -1

setproc room 0 TRIGGER_TYPE Password
setproc room 0 TRIGGER_INCLUDE_IMMORTALS 1
setproc room 0 PASSWORD_VALUE muhahaha

setproc room 0 EFFECTS_LIST Teleport
setproc room 0 EFFECTS_AFFECT_ROOM 1

setproc room 0 TELEPORT_DESTINATION 8000
setproc room 0 TELEPORT_MESSAGE_ACTOR You are blinded for a moment.
setproc room 0 TELEPORT_MESSAGE_SOURCE_ROOM $n disappears in a flash of light!
setproc room 0 TELEPORT_MESSAGE_DESTINATION_ROOM $n appears in a flash of light!

setproc room 0 PROC_ENABLED 1

Pressure Plate / Portal and Teleport

setproc room 0 TRAP_INITIALCHARGES 1

setproc room 0 TRIGGER_TYPE PressurePlate
setproc room 0 TRIGGER_ACTIVATIONDELAY 5
setproc room 0 TRIGGER_MESSAGE_ACTOR You hear a click and then a thunk.
setproc room 0 TRIGGER_MESSAGE_ROOM $n does something.

setproc room 0 EFFECTS_LIST Damage:Portal
setproc room 0 EFFECTS_TARGET Room
setproc room 0 DAMAGE_DICE 3
setproc room 0 DAMAGE_DIESIZE 5
setproc room 0 DAMAGE_ADDITIONAL 1
setproc room 0 DAMAGE_MESSAGE_ACTOR You take damage!
setproc room 0 DAMAGE_MESSAGE_ROOM $n takes damage!

setproc room 0 PORTAL_DESTINATION 8000

setproc room 0 PROC_ENABLED 1

Zone Reset / Zone Commands

setproc room 0 TRAP_INITIAL_CHARGES -1

setproc room 0 TRIGGER_TYPE ZoneReset

setproc room 0 EFFECTS_LIST ZoneCommands

setproc room 0 ZONE_COMMANDS_ROOM_LIST 5804
setproc room 0 ZONE_COMMANDS_5804_LIST
SpawnMobile 0 100 12000 1000 10 Point ""    # 1 - kobold
$n appears in a puff of smoke!

#
# 50% chance kobold has a sword, if not, 100% chance it has a mace
#
EquipMobile 1 50 2004 16                    # 2 - sword
EquipMobile -2 100 2002 16                  # 3 - mace

EquipMobile 1 50 1403 -1                    # 4 - 50% chance of bag
#
# 50% chance bag has a loaf of bread, if not, 100% chance it has rations
#
EquipContainer 4 50 1000                    # 5 - bread
EquipContainer -5 100 1007                  # 6 - rations

#
# 50% chance kobold has infravision, if not, 100% chance of darksight
#
AffectMobile 1 50 32 0 45                   # 7 - infravision
AffectMobile -7 100 110 0 45                # 8 - darksight
@

setproc room 0 PROC_ENABLED 1