Zone Template Commands - torilmud/docs GitHub Wiki

Zone Template Commands

These commands are used in zone .tpl files. See the Zone Template documentation for more information on standard fields like roomTarget, and flags.

Command: load npc

Loads one or more NPCs in the zone.

  • vnum: The vnum of the NPC to load.
  • room (optional): The vnum of the room to load in. Either this or the roomTarget field must be set.
  • loadRooms (optional): The standard room target field. Used to random distribute the NPC load.
  • quantity (optional): The number of NPCs to load. Defaults to 1.
  • resetTime (optional): The number of minutes until refreshing the command. Defaults to the zone refresh time. Set this to -1 to prevent an NPC from reloading.
  • equipment (optional): An array of item vnums to load on the NPC. These will be automatically worn in the best slots.
  • weapons (optional): An array of weapon vnums. At load time, one of the weapons will be selected at random for the NPC.
  • flags (optional): The standard flags field. Any NPC flags set here will be set on the NPC at load time in addition to the flags set in the mob file.
  • leaders (optional): An array of NPC vnums. This NPC will automatically follow any of those NPCs in the room when loaded.
  • followers (optional): An array of NPC vnums. The listed NPCs will automatically follow the NPC loaded by this command in the room upon loading.
  • lootTables (optional): An array of loot tables the npc may have. See Loot Tables for more information.

The following simple example will load 1 NPC 98301 in room 98325.

  {
    "command": "load npc",
    "vnum": 98301,
    "room": 98325
  }

This more complex example will load 10 of 98301 and distribute them throughout forest sectors in a range of vnums, with some standard gear, a random weapon, and the aggressive flag:

{  
  "command": "load npc",
  "vnum": 98301,
  "quantity": 10,
  "loadRooms": [
    {"vnumStart": 98300},
    {"vnumEnd": 98350},
    {"sector": "forest"}
  ],
  "resetTime": 5,
  "equipment": [98310, 98309, 98311],
  "weapons": [98335, 98336, 98337],
  "flags": {
    "npc": ["aggressive"]
  }
}

Command: load item

Loads one or more items in the zone.

  • vnum: The vnum of the item to load.
  • room (optional): The vnum of the room to load in. Either this or the roomTarget field must be set.
  • loadRooms (optional): The standard room target field. Used to random distribute the item load.
  • quantity (optional): The number of items to load. Defaults to 1.
  • resetTime (optional): The number of minutes until refreshing the command. Defaults to the zone refresh time. Set this to -1 to prevent an item from reloading.
  • equipment (optional): A list of item vnums to load inside the loaded item. Only works if the item is a container.
  • contentQuantity (optional): The quantity of items to load inside the container.

This simple example loads 98301 in room 98325:

{
  "command": "load item",
  "vnum": 98301,
  "room": 98325
}

This loads 10 of 98301 and scatters them throughout a range of rooms:

{
  "command": "load item",
  "vnum": 98301,
  "quantity": 10,
  "loadRooms": [
    {"vnumStart": 98300},
    {"vnumEnd": 98350}
  ],
}

This will load a chest (98310) with 20 arrows (98315) inside of it:

{
  "command": "load item",
  "vnum": 98310,
  "equipment": [98315],
  "contentQuantity": 20,
  "room": 98325
}

Command: load squad

Loads one or more squads in the zone.

  • vnum: The vnum of the squad to load.
  • room (optional): The vnum of the room to load in. Either this or the roomTarget field must be set.
  • loadRooms (optional): The standard room target field. Used to random distribute the squad load.
  • quantity (optional): The number of squads to load. Defaults to 1.
  • resetTime (optional): The number of minutes until refreshing the command. Defaults to the zone refresh time. Set this to -1 to prevent a squad from reloading.
  • val1: The size of the squad to load. See the squad docs for details.
{
  "command": "load squad",
  "vnum": 98300,
  "room": 98325,
  "val1": 5
}

Command: resize squad

Resizes a squads in the zone.

  • vnum: The vnum of the squad to resize.
  • val1: The new squad size to resize to. See the squad documentation for more information.
  • resetTime (optional): The number of minutes until refreshing the command. Defaults to the zone refresh time.
  • room (optional): The vnum of the room the squad is in. Omit this to resize all of the squads.
{
  "command": "resize squad",
  "vnum": 98300,
  "val1": 3
}

Command: set exit

Set exit flags on an exit in the zone.

  • room (optional): The vnum of the room to set the exit flags in. Either this or the roomTarget field must be set.
  • loadRooms (optional): The standard room target field.
  • resetTime (optional): The number of minutes until refreshing the command. Defaults to the zone refresh time. Set this to -1 to only set the exit once.
  • exit: The direction to set the flags on. Can be one of: north, south, east, west, up, or down.
  • flags: Set the exitFlags field within the standard flag field to specify the exit flags to be set. Exit flag values are nobits, is door, closed, locked, pickable, secret, blocked, pickproof, trapped.

This example sets the south exit in room 98325 to closed:

{
  "command": "set exit",
  "room": 98325,
  "exit": "south",
  "flags": {
    "exitFlags": ["closed"]
  }
}

Command: remove npc

Remove an NPC from the zone, or from a specific room.

  • vnum: The vnum of the NPC to remove.
  • room (optional): If set, the NPC will only be removed from this room.
  • loadRooms (optional): The standard room target field. If set, the NPC will only be removed from rooms that match.
  • resetTime (optional): The number of minutes until refreshing the command. Defaults to the zone refresh time. Set this to -1 to only remove the NPC(s) once.

The following example will remove NPC 98301 from the rooms 98325 and 98350.

{
  "command": "remove npc",
  "vnum": 98301,
  "loadRooms": [
    {"vnums": [98325, 98350]}
  ]
}

Command: remove item

Remove an item from the zone, or from a specific room.

  • vnum: The vnum of the item to remove.
  • room (optional): If set, the item will only be removed from this room.
  • loadRooms (optional): The standard room target field. If set, the item will only be removed from rooms that match.
  • resetTime (optional): The number of minutes until refreshing the command. Defaults to the zone refresh time. Set this to -1 to only remove the item(s) one time.

The following example will remove OBJ 98301 from the room 98325

{
  "command": "remove item",
  "vnum": 98301,
  "room": 98325
}

Command: remove squad

Remove a squad from the zone, or from a specific room.

  • vnum: The vnum of the squad to remove.
  • room (optional): If set, the squad will only be removed from this room.
  • loadRooms (optional): The standard room target field. If set, the squad will only be removed from rooms that match.
  • resetTime (optional): The number of minutes until refreshing the command. Defaults to the zone refresh time. Set this to -1 to only remove the squad one time.
{
  "command": "remove squad",
  "vnum": 98301,
  "room": 98325
}

Command: apply template

Load and apply a zone template. Typically used from triggers, but can also be used as a regular command. There will be no effect if the template is already applied in the zone.

  • template: A standard templateLoad field.
  • resetTime (optional): The number of minutes until refreshing the command. Defaults to the zone refresh time.

The following example will load the template "Extra Rares" in overlay mode.

{
  "command": "apply template",
  "template": {
    "name": "Extra Rares",
    "mode": "overlay"
  }
}

Command: remove template

Remove a zone template. Typically used from triggers, but can also be used as a regular command. There will be no effect if the template is already applied in the zone. Otherwise, all items and NPCs loaded by the template will be removed along with the template, not including items that have been picked up by players.

  • template: A standard templateLoad field.
  • resetTime (optional): The number of minutes until refreshing the command. Defaults to the zone refresh time.

The following example will remove the template "Extra Rares".

{
  "command": "remove template",
  "template": {
    "name": "Extra Rares"
  }
}

Command: message

Shows a message in the zone. Can be limited to just a single room or a pattern of rooms.

  • text: The text of the message to show. Works with all color types.
  • room (optional): If set, the message will only be shown in this room.
  • loadRooms (optional): The standard room target field.
  • resetTime (optional): The number of minutes until refreshing the command. Defaults to the zone refresh time. Set this to -1 to only show the message one time.
{
  "command": "message",
  "text": "Everyone gazes in wonder at the fantastical zone message."
}