The objects section
With rooms and NPCs alone you could build a world of naked people fighting with their bare hands. Objects fill it with everything else: weapons and armour for the NPCs, food and drink, keys, chests, boats and the junk lying about in the rooms.
Objects go in the %objects section of a zone file. Like rooms and NPCs, each object is a symbolic name, then its fields in any order, then end:
%objects
big_rock
names {"big rock", "rock"}
title "a big rock"
descr "A big rock is lying in the road."
manipulate {MANIPULATE_TAKE}
weight 40
end
This page lists the fields an object can have and what each one does in the game. Object macros shows the macros that set up weapons, armour, containers, drinks and the other kinds of objects; Building your first object walks through a complete object.
Object fields
| Field
|
Value
|
Default
|
What it is
|
names
|
string list
|
none
|
The words players use to act on the object.
|
title
|
string
|
none
|
The short name: "a big rock".
|
descr
|
string
|
none
|
What players see when the object lies in a room.
|
inside_descr
|
string
|
none
|
What players see when they are inside the object (a coffin, a boat).
|
extra
|
string list, string
|
none
|
Descriptions to look at, special messages, and data for DIL.
|
type
|
ITEM_*
|
ITEM_OTHER
|
The kind of object. Usually set by a macro.
|
manipulate
|
MANIPULATE_* flags
|
none
|
Whether it can be taken, entered, worn (and where), wielded or held.
|
flags
|
UNIT_FL_* flags
|
none
|
Unit flags: invisible, buried, magic, not saved...
|
romflags
|
OBJ_* flags
|
none
|
Object flags.
|
weight
|
number
|
1
|
Weight in pounds, 0 to 32767.
|
height
|
number
|
180
|
Size in centimetres; decides who it fits.
|
capacity
|
number
|
0
|
How many pounds it can hold, -1 to 32767 (-1 is endless).
|
value[0] .. value[4]
|
number
|
0
|
Five numbers whose meaning depends on the type. Usually set by a macro.
|
cost
|
money
|
0
|
What it is worth in a shop.
|
rent
|
money
|
0
|
What it costs per day to keep it while logged off.
|
open
|
EX_* flags
|
none
|
Whether it opens, closes and locks. May be followed by difficulty n.
|
key
|
symbolic name
|
none
|
The object that locks and unlocks it.
|
bright
|
-6 to 6
|
0
|
How much light it gives off.
|
light
|
-6 to 6
|
0
|
Light inside the object.
|
minv
|
number
|
0
|
Administrator invisibility level.
|
alignment
|
-1000 to 1000
|
0
|
Stored, but nothing in the game reads an object's alignment.
|
spell
|
0 to 255
|
0
|
Magic resistance.
|
dilcopy, dilbegin
|
DIL
|
none
|
Scripts that run on the object.
|
affect
|
affect block
|
none
|
Bonuses and curses. Use the macros, never write it yourself.
|
Fields can come in any order. manipulate, flags, romflags and open add up when you give them more than once; every other field keeps the last value it was given. A macro such as WEAPON_DEF sets type, value[] and other fields, so put the macro first and change things after it.
Flags are written in braces and separated by commas: manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD}. A single flag needs no braces. Numbers may be sums such as 2*12+1.
All the constants on this page come from vme/include/vme.h and values.h; start your zone with #include <macros.h>, which includes them.
Description of the object fields
- symbolic name
- The name the object is known by in the zone, such as
dragon_head. Administrators use it to load and wstat the object, and other fields (key) and the resets refer to it. Use a name that matches the title so it is easy to find. The rules for symbols are in Unit Building Blocks: letters, digits and _, at most 15 characters, unique among the rooms, objects and NPCs of the zone.
- title
- What the game shows when the object is picked up, dropped, given, listed in an inventory or used in a fight. Start it in lower case with an article, and don't end it with punctuation: vmc warns about a title that ends in something other than a letter, and about one that starts with a capitalised word such as "The".
title "a big rock"
title "the flame tongue"
title "an oval hover car"
- descr
- What players see when the object lies in the room they are in, or when they look around. One line is usually enough.
descr "A green bloody sword is lying here."
descr "A massive round wooden table stands here."
- names
- The words players type to pick the object up, drop it, look at it and so on. Every word a player might use from the title and the description should be in the list, and nothing that isn't. Put longer names first: vmc refuses a list where a name starts with an earlier one ("rock" before "big rock"). A name can't end in
's or start with self.
title "an old twisted staff"
descr "An old twisted staff has been thrown away here."
names {"old twisted staff", "twisted staff", "old staff", "staff"}
- On a drink container the last name must be the liquid, as in
{"waterskin", "skin", "water"}: when the container is drunk empty, the game removes the last name.
- inside_descr
- What players see when they are inside the object, for objects that can be entered (a coffin, a boat). It can be several lines long, like a room description.
inside_descr
"You are inside a black coffin with red velvet padding. Scary!"
- extra
- Extra descriptions. An extra with an empty name list is what players see when they look at the object:
extra {}
"The ice cube is about 40 meters on each side. It seems to be melting
slightly, but waiting for it to finish would be like waiting for the
ice age to end."
- An extra with names describes a part of the object, for
look at crack:
extra {"crack"}
"There is a big crack in the side of the ice cube."
- Extras whose name starts with
$ are not for players to look at. Some of them replace the game's standard messages when something is done to the object. In them $1n is the character who does it and $2n the object; the codes are explained under act().
Message extras
| Extra
|
Replaces the message...
|
$get_s / $get_o
|
to the character / to the others in the room, when it is picked up from the floor
|
$drop_s / $drop_o
|
when it is dropped
|
$wear_s / $wear_o
|
when it is worn, wielded or held
|
$rem_s / $rem_o
|
when it is removed
|
$enter_s / $enter_o
|
when someone enters it
|
$exit_s / $exit_o
|
when someone leaves it
|
extra {"$get_s"}
"You pick up $2n. It is very cold and starts to melt in your hands."
extra {"$get_o"}
"$1n picks up $2n. A drop of water hits the ground."
- Other
$ extras hold data: $identify is shown by the identify spell, the MATERIAL_* macros write $material, the drink macros write $drink_color and friends, and DIL programs keep their own. The extra must start with $: extra {"drop_o"} is just a description of a part called "drop_o".
- type
- The kind of object, one of the
ITEM_* constants. Only one type can be set. The macros on Object macros set it for you, together with the values that type needs.
Item types
| Type
|
Used by the game
|
ITEM_WEAPON
|
A weapon to wield. WEAPON_DEF.
|
ITEM_ARMOR
|
Armour. ARMOUR_DEF and the ARMOUR_* macros.
|
ITEM_SHIELD
|
A shield. SHIELD_DEF.
|
ITEM_WORN
|
Clothes and jewellery that give no protection.
|
ITEM_CONTAINER
|
Things to put things in. CONTAINER_DEF.
|
ITEM_DRINKCON
|
A drink container for drink and pour. LIQ_DEF and the liquid macros.
|
ITEM_FOOD
|
Food for eat. FOOD_DEF.
|
ITEM_LIGHT
|
A torch or lantern for light and extinguish. LIGHT_DEF.
|
ITEM_MONEY
|
Coins. MONEY.
|
ITEM_POTION
|
A potion for quaff. POTION_DEF.
|
ITEM_SCROLL
|
A scroll for recite. SCROLL_DEF.
|
ITEM_WAND, ITEM_STAFF
|
Held and used with use. WAND_DEF, STAFF_DEF.
|
ITEM_FIREWEAPON
|
A bow, crossbow or sling for shoot. RANGED_DEF.
|
ITEM_TRAP
|
A trap for the trap skill. TRAP_DEF.
|
ITEM_NOTE
|
Paper to write on, and to post on boards or send as mail.
|
ITEM_BOARD
|
A bulletin board (see vme/zone/boards.zon).
|
ITEM_BOAT
|
Something to enter and sail over water.
|
ITEM_KEY
|
A key. A lock only checks the key's symbolic name, so the type is just for shops and players.
|
ITEM_TREASURE
|
Gems and other valuables, worth only their price.
|
ITEM_TRASH
|
Junk. Broken weapons and armour become trash.
|
ITEM_OTHER
|
Anything else. The default.
|
ITEM_MISSILE, ITEM_PEN, ITEM_SPELL, ITEM_BOOK, ITEM_SKIN
|
Defined, but no command treats them specially. Arrows are ITEM_WEAPON (MISSILE_DEF).
|
- You can give your own DIL commands their own meaning for a type, but the built-in commands only know the ones above.
- manipulate
- What can be done with the object.
MANIPULATE_TAKE lets it be picked up: without it the object can't be taken at all, which is right for a fountain or a statue. MANIPULATE_ENTER lets players put things into it, and enter it if it is big enough (a coffin, a boat). The rest say where it is used:
| Flag
|
Position
|
Flag
|
Position
|
MANIPULATE_WIELD
|
wielded as a weapon
|
MANIPULATE_HOLD
|
held in the hand
|
MANIPULATE_WEAR_HEAD
|
head
|
MANIPULATE_WEAR_NECK
|
neck (two)
|
MANIPULATE_WEAR_BODY
|
body
|
MANIPULATE_WEAR_CHEST
|
across the chest (a baldric)
|
MANIPULATE_WEAR_ABOUT
|
about the body (a cloak)
|
MANIPULATE_WEAR_BACK
|
back
|
MANIPULATE_WEAR_ARMS
|
arms
|
MANIPULATE_WEAR_WRIST
|
wrist (two)
|
MANIPULATE_WEAR_HANDS
|
hands
|
MANIPULATE_WEAR_FINGER
|
finger (two)
|
MANIPULATE_WEAR_WAIST
|
waist
|
MANIPULATE_WEAR_LEGS
|
legs
|
MANIPULATE_WEAR_FEET
|
feet
|
MANIPULATE_WEAR_ANKLE
|
ankle (two)
|
MANIPULATE_WEAR_EAR
|
ear (two)
|
MANIPULATE_WEAR_SHIELD
|
shield arm
|
- Give an object one wear position; if it has several,
wear uses only one of them. Combine it with MANIPULATE_TAKE, and with MANIPULATE_ENTER for a backpack:
// an earring
manipulate {MANIPULATE_TAKE, MANIPULATE_WEAR_EAR}
// a backpack
manipulate {MANIPULATE_TAKE, MANIPULATE_ENTER, MANIPULATE_WEAR_BACK}
- Whether an item fits depends on its
height compared with the wearer's: body armour must be 60% to 140% of the wearer's height, everything else 50% to 150%. Held objects that aren't weapons always fit.
- flags
- Unit flags, the same
UNIT_FL_* flags rooms and NPCs use. Only UNIT_FL_* constants belong here. vmc only sees numbers, so an object flag written here sets a different unit flag without a word: flags {OBJ_NO_DUAL} makes the object load buried.
Unit flags on objects
| Flag
|
On an object
|
UNIT_FL_INVISIBLE
|
Only characters who detect invisible can see it.
|
UNIT_FL_BURIED
|
It loads buried in the ground, hidden until someone digs it up.
|
UNIT_FL_MAGIC
|
It shows a magic aura to characters who detect magic, and can't be resized. The magic macros set it.
|
UNIT_FL_NOSAVE
|
It isn't saved with a player's inventory. Use it for quest items and keys that must not leave the game.
|
UNIT_FL_TRANS
|
Transparent: characters inside it (a boat, a cart) see out and are seen.
|
UNIT_FL_NO_TELEPORT
|
Nobody can teleport into or out of it.
|
UNIT_FL_SACRED
|
Characters inside it regain hit points, mana and endurance twice as fast.
|
UNIT_FL_NO_WEATHER
|
Characters inside it get no weather messages.
|
UNIT_FL_PRIVATE
|
At most two characters can goto into it.
|
UNIT_FL_NO_MOB, UNIT_FL_INDOORS, UNIT_FL_NO_BURY
|
Room flags; they do nothing on an object.
|
manipulate {MANIPULATE_TAKE}
flags {UNIT_FL_NOSAVE}
- romflags
- Object flags (
OBJ_*).
| Flag
|
Effect
|
OBJ_NO_DUAL
|
A weapon that can't be held as the second weapon when fighting with two.
|
OBJ_TWO_HANDS
|
Read by a few skills that need a free hand. Whether a weapon needs both hands comes from its weapon type, not from this flag.
|
OBJ_NO_UNEQUIP
|
Meant to make an item impossible to remove, but the remove command doesn't check it. Use CURSED_OBJECT instead.
|
OBJ_NOCOVER
|
Not used.
|
- weight
- The weight in pounds, 0 to 32767. A character can carry only so much, and a container only its
capacity.
- height
- The object's size in centimetres. It decides who can wear or wield it (see
manipulate). When a reset equips an NPC with the object, the object is resized to fit that NPC.
- capacity
- How many pounds of things a container can hold, or how much liquid a drink container holds; -1 means endless (a fountain). Only objects with
MANIPULATE_ENTER can have things put into them.
- cost
- What the object is worth in a shop. Write the number of coins, then the coin, separated by commas:
cost 5 GOLD_PIECE
cost 2 SILVER_PIECE, 4 COPPER_PIECE
- The coins are
IRON_PIECE, COPPER_PIECE, SILVER_PIECE, GOLD_PIECE and PLATINUM_PIECE; each is worth eight of the one before. A bare number (cost 25600) and cost 5*GOLD_PIECE are syntax errors, and money is an NPC field, not an object field. An object without a cost is worth nothing.
- rent
- What the object costs per real day while its owner is logged off, written like
cost. The server charges a percentage of it set by rent in server.cfg; the default configuration has 0, no rent at all.
- open
- Lets the object be opened, closed and locked, like a door:
| Flag
|
Effect
|
EX_OPEN_CLOSE
|
It can be opened and closed.
|
EX_CLOSED
|
It is closed when it loads.
|
EX_LOCKED
|
It is locked when it loads.
|
EX_PICKPROOF
|
The lock can't be picked.
|
EX_INSIDE_OPEN
|
It can be opened and locked from inside (a coffin).
|
difficulty after the flags sets how hard the lock is to pick, 0 to 250. A lock needs a key field: without one, lock, unlock and pick all say there is no keyhole.
open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED} difficulty 40
key brass_key
- key
- The symbolic name of the object that locks and unlocks this one. Write
key brass_key for a key in the same zone and key brass_key@otherzone for one in another zone. The player must carry an object with that symbolic name; its type doesn't matter. vmc doesn't check that the key exists.
- bright, light
bright is how much light the object gives off: lying in a room it lights the room, and worn or held it lights the room its wearer is in. bright 2 makes a light that never goes out and can't be put out. A torch made with LIGHT_DEF has no bright until someone lights it. light is the light inside the object, for objects players can enter. Both are -6 to 6.
- minv
- The administrator invisibility level: only administrators of at least this level can see the object. Use it for objects that run DIL programs and should not be seen by players.
minv 239
- alignment
- A number from -1000 to 1000. No command uses an object's alignment, but DIL programs can read it.
- spell
- The object's magic resistance, 0 to 255: how well it resists spells cast on it. For potions, scrolls, wands and staffs,
value[0] (the spell power) is used instead.
- value
- Five numbers,
value[0] to value[4], whose meaning depends on the type: for a weapon they are the weapon type, craftsmanship, magic bonus and slaying race. Let the macros set them unless a DIL program of your own needs a value. Object macros lists what each type keeps in them.
value[0] 5
value[4] 12
- affect
- Bonuses and penalties the object gives its wearer, and curses. Don't write
affect blocks yourself: vmc checks them and refuses anything the game doesn't know. Use the transfer macros and CURSED_OBJECT on Object macros.
- dilcopy, dilbegin
- DIL programs on the object.
dilcopy runs a template from another zone with arguments; vme/zone/function.zon has many made for objects, such as restrictions on who can use an item:
dilcopy level_restrict@function(10, 0, 25, "");
- DIL functions for objects describes them, and More complex objects puts some to work. vmc doesn't check a template's name or arguments; read the template's
dilbegin line in its zone before you use it. How to write DIL of your own is in the DIL manual.