KVP Zone Commands

From SlothMUD Wiki
Jump to: navigation, search

Overview

KVP zone commands are small, simple commands built to automate scripting within the various Key-Value Pair procedures used throughout the game. This article documents the various commands and their uses.

These commands are similar in nature to the "normal" zone commands that are executed in rooms when the different game areas or zones reset. But there are a few main differences between the normal zone commands and KVP zone commands.

  • KVP zone commands can be called from a variety of special procedures.
  • KVP zone commands provide messaging capabilities so that players in the room see the command as it happens.

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. Commands may be separated by blank lines and comments may be specified using the hash sign (#).


KVP Zone Command Fields

All KVP zone commands start with the following:

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, this command will only run if the command specified in the index value also ran successfully. If the dependency index is a negative value, this command will only run if the command specified failed to run. If the dependency index is zero, the command will always run if it passes its chance test (see below) and if the command does not require a dependency index.

The AffectMobile and EquipMobile commands must have a positive index value that refers to the mobile that should be used as the target of the command. The EquipContainer command must have a positive index value that refers to the container item that the new item should be placed inside. If is value is zero the target for these commands can not be found and they will not run. 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

Line 1 Parameter Description
Command Name AffectMobile
Dependency Index See above. This value may not be 0. If the value is > 0, the dependent command must be a command that spawns a mobile. If the value is < 0, the command must be a previous AffectMobile command that failed.
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

Line 1 Parameter Description
Command Name EquipContainer
Dependency Index See above. This value may not be 0. If the value is > 0, the dependent command must be a command that spawns an item (the container). If the value is < 0, the command must be a previous EquipContainer command that failed.
Chance See above.
Item Virtual Number Virtual number of the item to be placed in the container.


Equip Mobile

Line 1 Parameter Description
Command Name EquipMobile
Dependency Index See above. This value may not be 0. If the value is > 0, the dependent command must be a command that spawns a mobile. If the value is < 0, the command must be a previous EquipMobile command that failed.
Chance See above.
Item Virtual Number Virtual number of the item to be given to the mobile.
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

Line 1 Parameter Description
Command Name 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.


Purge Items

This command can be used to destroy items in the room.

Line 1 Parameter Description
Command Name PurgeItems
Dependency Index See above. This value may be <= 0.
Chance See above.
Virtual Number Virtual number of the item(s) to destroy.
Maximum to Destroy A positive number indicating the maximum number of items with the specified virtual number to destroy. Can be -1 to indicate destroy all of the items with a matching virtual number.
Line 2 Parameter Description
Room Message Message sent to the room for each item that is destroyed. This line may be blank if no message is desired.


Purge Mobiles

This command can be used to destroy mobiles in the room. Mobiles will not leave corpses and all of their items will also be destroyed.

Line 1 Parameter Description
Command Name PurgeMobiles
Dependency Index See above. This value may be <= 0.
Chance See above.
Virtual Number Virtual number of the mobile(s) to destroy.
Maximum to Destroy A positive number indicating the maximum number of mobiles with the specified virtual number to destroy. Can be -1 to indicate destroy all of the mobiles with a matching virtual number.
Line 2 Parameter Description
Room Message Message sent to the room for each mobile that is destroyed. This line may be blank if no message is desired.


Send Messages

This command can be used to send messages to players in the room or the entire zone.

Line 1 Parameter Description
Command Name SendMessages
Dependency Index See above. This value may be <= 0.
Chance See above.
Send to Zone TRUE (1) or FALSE (0) indicating whether the 2nd message below should be sent to the entire zone rather than just the room.
Line 2 Parameter Description
Actor Message Message sent to the person that triggered the trap. This only applies if the player is still in the room when the trap is activated. This line may be blank if no message is desired.
Line 3 Parameter Description
Room/Zone Message Message sent to the room/zone when the command is run. This line may be blank if no message is desired.


Spawn Item

Line 1 Parameter Description
Command Name SpawnItem
Dependency Index See above. This value may be <= 0.
Chance See above.
Item Virtual Number Virtual Number of the item to spawn.
Max in World Integer value indicating the maximum number of this item 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 item 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 item 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

Line 1 Parameter Description
Command Name SpawnMobile
Dependency Index See above. This value may be <= 0.
Chance See above.
Mobile Virtual Number Virtual Number of the mobile to spawn.
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 single-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 Alarm

This command sets or clears the zone alarm.

Line 1 Parameter Description
Command Name ToggleAlarm
Dependency Index See above. This value may be <= 0.
Chance See above.
Trigger TRUE (1) if the alarm should be triggered or FALSE (0) if the alarm should be cleared.


Toggle Door

Note that the Toggle Door command toggles both sides of the door, unlike the original "C" zone command. This command is considered successful only if the door's state is changed.

Line 1 Parameter Description
Command Name 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 these 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 these 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.


Additional Information

Wear Locations

The following table lists the wear locations for the EquipMobile zone command.

Location Value
Light 0
Right Finger 1
Left Finger 2
Neck 1 3
Neck 2 4
Body 5
Head 6
Legs 7
Feet 8
Hands 9
Arms 10
Shield 11
About 12
Waist 13
Right Wrist 14
Left Wrist 15
Wield 16
Held 17
Loaded 19
Instrument 20


Samples

ToggleDoor

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.
# End of commands
ToggleDoor 0 100 north open         # 1
The door swings open!
*Click*

SendMessages -1 100 FALSE           # 2
Nothing seems to happen.
Nothing seems to happen.
# End of commands


SpawnMobile, AffectMobile, EquipMobile, EquipContainer

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
# End of commands