Difference between revisions of "Manual:Zone Manual/The Objects Section/More complex objects"
(checked against the current code (wiki review 2026-11-15)) |
|||
| Line 1: | Line 1: | ||
=== More complex objects === | === More complex objects === | ||
| − | + | The earlier pages showed the object fields and how to build a basic object. This page uses them, | |
| − | + | with the macros from [[Manual:Zone Manual/The Objects Section/Object macros|Object macros]] and the | |
| − | + | DIL functions from [[Manual:Zone Manual/The Objects Section/DIL functions for objects|DIL functions for objects]], | |
| − | + | to make the objects of the dragon station zone: a board, a locker with its key, a drink, some food, | |
| − | + | a weapon, a piece of armour and a ring. | |
| − | |||
| − | + | Every finished object on this page is part of the zone on the next page, | |
| − | + | [[Manual:Zone Manual/The Objects Section/Dragon station with rooms NPCs and objects|Dragon station with rooms, NPCs and objects]], | |
| − | + | and compiles there. Two rules to keep in mind while reading them: | |
| − | + | * A type macro (<code>WEAPON_DEF</code>, <code>ARMOUR_DEF</code>, <code>LIQ_WINE</code>...) sets <code>type</code>, <code>value[]</code> and sometimes <code>weight</code>. These fields keep the last value written, so put the macro first and change things after it. <code>manipulate</code>, <code>flags</code> and <code>open</code> add up instead, so a <code>manipulate</code> line after the macro adds to what the macro set. | |
| + | * Give every object a material with one of the <code>MATERIAL_*</code> macros from wmacros.h. The text appears when a player identifies the item, and DIL can test the material (for example <code>"$mat_metal" in item.extra</code>). | ||
| − | + | ==== Making a communication board ==== | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | A board is an object with the <code>board@boards</code> DIL function on it. The function and its | |
| − | + | arguments are explained in [[Manual:Zone Manual/The Objects Section/DIL functions for objects|DIL functions for objects]]. | |
| + | As with every object, first name and describe it: | ||
| + | <pre> | ||
| + | info_board | ||
| + | names {"merchant information board", "information board", "merchant board", | ||
| + | "board"} | ||
| + | title "a merchant information board" | ||
| + | descr "A merchant information board is mounted on a wall here." | ||
| + | extra {} | ||
| + | "A large flashy black steel board." | ||
| + | MATERIAL_METAL("A very fine quality black steel") | ||
| + | </pre> | ||
| − | + | Then the board itself: the type and the DIL function. Here everyone may read and post, but only | |
| − | + | administrators may remove other people's posts (<code>rem_res@boards</code>), and the board holds | |
| − | + | up to 100 posts. It has no <code>MANIPULATE_TAKE</code>, so nobody can walk off with it. | |
| − | + | <pre> | |
| − | + | type ITEM_BOARD | |
| − | + | dilcopy board@boards("info", "", "rem_res@boards", "", 100); | |
| − | + | </pre> | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | The finished board: | |
| − | + | <pre> | |
| + | info_board | ||
| + | names {"merchant information board", "information board", "merchant board", | ||
| + | "board"} | ||
| + | title "a merchant information board" | ||
| + | descr "A merchant information board is mounted on a wall here." | ||
| + | extra {} | ||
| + | "A large flashy black steel board." | ||
| + | MATERIAL_METAL("A very fine quality black steel") | ||
| + | type ITEM_BOARD | ||
| + | dilcopy board@boards("info", "", "rem_res@boards", "", 100); | ||
| + | end | ||
| + | </pre> | ||
| − | + | The first argument, <code>"info"</code>, names the files the posts are kept in. Every board with the | |
| − | + | same name shows the same posts, so give a board of your own a name no other board uses. | |
| − | |||
| − | |||
==== Making a container ==== | ==== Making a container ==== | ||
| − | + | The station gets a small weapons locker. It hangs on the wall, so it can't be taken; it can be | |
| − | + | opened, closed and locked, and a black key opens it. The description comes first, as always: | |
| − | + | <pre> | |
| − | + | wpn_locker | |
| − | + | names {"weapons locker", "weapon locker", "locker"} | |
| + | title "a weapons locker" | ||
| + | descr "A small weapons locker hangs on the wall here." | ||
| + | extra {} | ||
| + | "It is an ordinary weapons locker that looks like it holds any illegal | ||
| + | weapons that are taken on the station." | ||
| + | MATERIAL_METAL("A very fine quality steel") | ||
| + | </pre> | ||
| − | + | Then what makes it a container: | |
| − | + | <pre> | |
| − | + | CONTAINER_DEF(50) | |
| − | + | manipulate {MANIPULATE_ENTER} | |
| − | + | open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED} | |
| + | key black_key | ||
| + | weight 400 | ||
| + | </pre> | ||
| − | + | * <code>CONTAINER_DEF(50)</code> sets the type and the capacity, here 50 pounds. It sets nothing else. | |
| − | + | * <code>MANIPULATE_ENTER</code> is what lets players put things in; without it nothing can be put in the locker. A player can also <code>enter</code> an open object with this flag if he and all he carries fit in its capacity, so keep the capacity of a small container small. | |
| + | * There is no <code>MANIPULATE_TAKE</code>, so the locker stays on the wall. The high weight is only a second guard against that. | ||
| + | * <code>open</code> takes the same <code>EX_*</code> flags as a door: <code>EX_OPEN_CLOSE</code> makes it something you can open and close, <code>EX_CLOSED</code> and <code>EX_LOCKED</code> say how it is when it is loaded. | ||
| + | * <code>key</code> is the symbolic name of the key object. To unlock, a player must carry an object with that symbolic name. vmc doesn't check that the key exists; if it doesn't, only the pick lock skill opens the locker. | ||
| − | + | So the key has to be made too. A key has no macro: it is <code>type ITEM_KEY</code> and something you | |
| + | can take and hold. | ||
| + | <pre> | ||
| + | black_key | ||
| + | names {"small black key", "black key", "key"} | ||
| + | title "a small black key" | ||
| + | descr "A small black key has been dropped here." | ||
| + | extra {} | ||
| + | "It is a plain key of black steel. It looks like it fits a locker." | ||
| + | MATERIAL_METAL("Black steel") | ||
| + | type ITEM_KEY | ||
| + | manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD} | ||
| + | weight 1 | ||
| + | end | ||
| + | </pre> | ||
| − | + | The finished locker: | |
| − | + | <pre> | |
| − | + | wpn_locker | |
| − | + | names {"weapons locker", "weapon locker", "locker"} | |
| − | + | title "a weapons locker" | |
| − | + | descr "A small weapons locker hangs on the wall here." | |
| − | + | extra {} | |
| − | + | "It is an ordinary weapons locker that looks like it holds any illegal | |
| − | + | weapons that are taken on the station." | |
| − | + | MATERIAL_METAL("A very fine quality steel") | |
| − | + | CONTAINER_DEF(50) | |
| − | + | manipulate {MANIPULATE_ENTER} | |
| − | + | open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED} | |
| − | + | key black_key | |
| − | + | weight 400 | |
| − | + | end | |
| − | + | </pre> | |
| − | |||
| − | |||
| − | + | Loading things into the locker, and keeping the key somewhere a player can find it, is done in the | |
| − | + | reset section (see [[Manual:Zone Manual/The Reset Section/Loading objects and NPCs|Loading objects and NPCs]]). | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
==== Creating drinks ==== | ==== Creating drinks ==== | ||
| − | + | A drink container has a few rules of its own for the title, descriptions and names, because the | |
| + | liquid in it can change: a player can drink it empty and fill it with something else. | ||
| − | + | The title and descriptions must not mention the liquid. A bag full of wine is "a red bag", not "a | |
| − | + | bag of wine": once a player has drunk the wine and filled the bag with water, a title saying wine | |
| − | + | would be wrong. | |
| − | + | <pre> | |
| − | + | liq_ration | |
| − | + | title "a red bag" | |
| − | + | descr "A red bag has been gently placed here." | |
| − | + | </pre> | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | The name of the liquid must be the '''last''' name in the names list. When the container is | |
| − | + | emptied, the game removes the last name; when it is filled, the name of the new liquid is added at | |
| − | The | + | the end. |
| − | + | <pre> | |
| − | + | names {"red bag", "bag", "wine"} | |
| − | + | </pre> | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | The liquid comes from a macro in liquid.h (included by macros.h). The four arguments are the weight | |
| − | + | of the empty container, its capacity, how much is in it, and how poisonous the liquid is (0: not | |
| + | at all). The macro also sets the weight, to the container plus its contents. | ||
| + | <pre> | ||
| + | LIQ_WINE(1, 2, 2, 0) | ||
| + | </pre> | ||
| − | + | To finish it, add a material, <code>MANIPULATE_TAKE</code> so it can be picked up, a price, and an | |
| − | + | <code>$identify</code> extra. A player who casts identify on the bag sees the text of | |
| − | + | <code>$identify</code>; improved identify shows <code>$improved identify</code> as well. The finished | |
| − | + | drink container: | |
| + | <pre> | ||
| + | liq_ration | ||
| + | names {"red bag", "bag", "wine"} | ||
| + | title "a red bag" | ||
| + | descr "A red bag has been gently placed here." | ||
| + | extra {} | ||
| + | "A small label reads: Tassel Grove's finest. Year 321." | ||
| + | MATERIAL_ORGANIC("a soft plastic") | ||
| + | LIQ_WINE(1, 2, 2, 0) | ||
| + | manipulate {MANIPULATE_TAKE} | ||
| + | cost 2 IRON_PIECE | ||
| − | + | extra {"$identify"} | |
| − | + | "It's the special wine from Tassel Grove, a small halfling village on the | |
| − | + | planet Valhalla. It seems like a great vintage." | |
| + | end | ||
| + | </pre> | ||
| − | |||
==== Creating food ==== | ==== Creating food ==== | ||
| − | + | Food is a plain object with <code>FOOD_DEF(amount, poison)</code>: how filling it is, and how | |
| − | + | poisonous (0: not at all). Here is a stick of dried beef that might be lying around a space station: | |
| − | + | <pre> | |
| − | + | beef_stick | |
| − | + | names {"tough leathery stick", "tough leather stick", "leathery stick", | |
| − | + | "leather stick", "tough stick", "stick"} | |
| − | + | title "a tough leathery stick" | |
| − | + | descr "A tough leathery looking stick is lying here." | |
| − | + | extra {} | |
| − | + | "This has the word BEEF burnt into it." | |
| − | + | MATERIAL_ORGANIC("tough beef") | |
| − | + | FOOD_DEF(5, 0) | |
| − | + | manipulate {MANIPULATE_TAKE} | |
| − | + | weight 1 | |
| − | + | cost 1 COPPER_PIECE | |
| − | + | end | |
| − | + | </pre> | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
==== Making a weapon ==== | ==== Making a weapon ==== | ||
| − | + | This stiletto uses the weapon macro, a skill bonus while it is wielded, and a restriction: only | |
| − | + | players with enough dexterity can wield it. First the description and the material: | |
| − | + | <pre> | |
| − | + | w_stiletto | |
| − | + | names {"deadly looking stiletto", "deadly stiletto", "stiletto", "dagger"} | |
| − | + | title "a stiletto" | |
| − | + | descr "A deadly looking stiletto has been left here." | |
| − | + | extra {} | |
| − | + | "This looks like a thief's dream come true." | |
| − | + | MATERIAL_METAL("A very fine quality steel") | |
| − | + | </pre> | |
| − | |||
| − | |||
| − | + | Then what makes it a special weapon: | |
| − | + | <pre> | |
| + | WEAPON_DEF(WPN_DAGGER, BONUS_AVERAGE_PLUS, BONUS_GOOD) | ||
| + | SKILL_TRANSFER(SKI_BACKSTAB, 2) | ||
| + | dilcopy abi_restrict@function(ABIL_DEX, 10, 0, 25, ""); | ||
| + | </pre> | ||
| − | + | * <code>WEAPON_DEF(weapon, craftsmanship, magic bonus)</code> makes it a dagger with a craftsmanship of +1 (<code>BONUS_AVERAGE_PLUS</code>) and a magic bonus of +2 (<code>BONUS_GOOD</code>). Both bonuses go from -7 to +7, named <code>BONUS_JUNK</code> to <code>BONUS_ARTIFACT</code> in values.h; vmc refuses anything outside. The macro also sets <code>MANIPULATE_TAKE</code> and <code>MANIPULATE_WIELD</code>. | |
| − | + | * <code>SKILL_TRANSFER(SKI_BACKSTAB, 2)</code> raises the backstab skill by 2 while the stiletto is wielded. | |
| − | + | * <code>abi_restrict@function</code> makes a player with a dexterity below 10 drop it again. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | To finish it, a weight, a price, the rent, and the two identify extras. The finished weapon: | |
| − | + | <pre> | |
| + | w_stiletto | ||
| + | names {"deadly looking stiletto", "deadly stiletto", "stiletto", "dagger"} | ||
| + | title "a stiletto" | ||
| + | descr "A deadly looking stiletto has been left here." | ||
| + | extra {} | ||
| + | "This looks like a thief's dream come true." | ||
| + | MATERIAL_METAL("A very fine quality steel") | ||
| + | WEAPON_DEF(WPN_DAGGER, BONUS_AVERAGE_PLUS, BONUS_GOOD) | ||
| + | SKILL_TRANSFER(SKI_BACKSTAB, 2) | ||
| + | dilcopy abi_restrict@function(ABIL_DEX, 10, 0, 25, ""); | ||
| + | weight 2 | ||
| + | cost 2 GOLD_PIECE | ||
| + | rent 1 COPPER_PIECE | ||
| − | + | extra {"$identify"} | |
| + | "The stiletto looks magical in nature and seems really sharp. You can | ||
| + | tell that if you wield it you would be able to backstab someone really | ||
| + | easily." | ||
| − | + | extra {"$improved identify"} | |
| − | + | "The stiletto has a magic bonus of +2 and a craftsmanship of +1. It | |
| − | + | also raises your backstab skill by 2. You need a dexterity of at least | |
| − | + | 10 to wield it." | |
| − | + | end | |
| − | + | </pre> | |
| − | |||
| − | + | <code>rent</code> is what a player pays per real day for keeping the item while logged off. It is | |
| − | + | multiplied by the <code>rent</code> percentage in the server's server.cfg, which is 0 (no rent at all) in | |
| − | + | the configuration that comes with the code. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
==== Making armour ==== | ==== Making armour ==== | ||
| − | + | When a character is hit in melee, the game picks the part of the body that was hit, and only armour | |
| − | + | (<code>type ITEM_ARMOR</code>) worn on that part protects. There are six such parts: | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
{| class="wikitable" | {| class="wikitable" | ||
| − | |+Armour positions | + | |+ Armour positions |
| + | ! Position !! Manipulate flag !! Chance to be hit | ||
|- | |- | ||
| − | + | | body || <code>MANIPULATE_WEAR_BODY</code> || 34% | |
| − | |||
|- | |- | ||
| − | | | + | | legs || <code>MANIPULATE_WEAR_LEGS</code> || 28% |
| − | | | ||
|- | |- | ||
| − | | | + | | arms || <code>MANIPULATE_WEAR_ARMS</code> || 23% |
| − | | | ||
|- | |- | ||
| − | | | + | | head || <code>MANIPULATE_WEAR_HEAD</code> || 5% |
| − | | | ||
|- | |- | ||
| − | | | + | | hands || <code>MANIPULATE_WEAR_HANDS</code> || 5% |
| − | | | ||
|- | |- | ||
| − | | | + | | feet || <code>MANIPULATE_WEAR_FEET</code> || 5% |
| − | | | ||
| − | |||
| − | |||
| − | |MANIPULATE_WEAR_FEET | ||
| − | |||
| − | | | ||
| − | | | ||
|} | |} | ||
| − | |||
| − | + | A cloak (<code>MANIPULATE_WEAR_ABOUT</code>) is not one of them. A shield is made with | |
| − | + | <code>SHIELD_DEF</code> and worn with <code>MANIPULATE_WEAR_SHIELD</code>; it blocks blows in its own way. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | We will make a breast plate. First the name, descriptions and material: | |
| − | + | <pre> | |
| − | + | pol_plate | |
| + | names {"polished breast plate", "polished plate", "breast plate", "plate"} | ||
| + | title "a polished breast plate" | ||
| + | descr "A polished breast plate has been left here." | ||
| + | extra {} | ||
| + | "This is one shiny plate. It seems to be made out of one perfect piece | ||
| + | of metal. There don't even seem to be any marks of ownership." | ||
| + | MATERIAL_METAL("A high lustre silver coloured metal") | ||
| + | </pre> | ||
| − | + | Then the armour: plate, with a craftsmanship of +4 (<code>BONUS_EXCELLENT</code>) and a magic bonus | |
| + | of +3 (<code>BONUS_GOOD_PLUS</code>). The armour macros only set <code>MANIPULATE_TAKE</code>; the | ||
| + | position where it is worn has to be added, here the body. | ||
| + | <pre> | ||
| + | ARMOUR_DEF(ARM_PLATE, BONUS_EXCELLENT, BONUS_GOOD_PLUS) | ||
| + | manipulate {MANIPULATE_WEAR_BODY} | ||
| + | </pre> | ||
| − | + | All that is left is a strength restriction, the weight, cost, rent and the identify extras. The | |
| − | + | finished armour: | |
| + | <pre> | ||
| + | pol_plate | ||
| + | names {"polished breast plate", "polished plate", "breast plate", "plate"} | ||
| + | title "a polished breast plate" | ||
| + | descr "A polished breast plate has been left here." | ||
| + | extra {} | ||
| + | "This is one shiny plate. It seems to be made out of one perfect piece | ||
| + | of metal. There don't even seem to be any marks of ownership." | ||
| + | MATERIAL_METAL("A high lustre silver coloured metal") | ||
| + | ARMOUR_DEF(ARM_PLATE, BONUS_EXCELLENT, BONUS_GOOD_PLUS) | ||
| + | manipulate {MANIPULATE_WEAR_BODY} | ||
| + | dilcopy abi_restrict@function(ABIL_STR, 40, 0, 25, ""); | ||
| + | weight 25 | ||
| + | cost 2 GOLD_PIECE | ||
| + | rent 3 COPPER_PIECE | ||
| − | + | extra {"$identify"} | |
| − | + | "This is a high quality plate with a magical feeling." | |
| − | |||
| − | + | extra {"$improved identify"} | |
| − | + | "The plate has a magic bonus of +3 and a craftsmanship of +4. You need | |
| + | a strength of at least 40 to wear it." | ||
| + | end | ||
| + | </pre> | ||
| − | |||
| − | |||
| − | |||
| − | |||
==== Making non-armour worn objects ==== | ==== Making non-armour worn objects ==== | ||
| − | + | Clothing and jewellery don't protect in a fight, but they can carry bonuses that help in the long | |
| − | + | run. These are the other places an object can be worn: | |
| − | + | ||
| − | |||
| − | |||
| − | |||
{| class="wikitable" | {| class="wikitable" | ||
| − | |+ | + | |+ Other worn positions |
| + | ! Position !! Manipulate flag !! How many | ||
|- | |- | ||
| − | + | | finger || <code>MANIPULATE_WEAR_FINGER</code> || 2 | |
| − | |||
|- | |- | ||
| − | | | + | | neck || <code>MANIPULATE_WEAR_NECK</code> || 2 |
| − | | | ||
|- | |- | ||
| − | | | + | | wrist || <code>MANIPULATE_WEAR_WRIST</code> || 2 |
| − | | | ||
|- | |- | ||
| − | | | + | | ear || <code>MANIPULATE_WEAR_EAR</code> || 2 |
| − | | | ||
|- | |- | ||
| − | | | + | | ankle || <code>MANIPULATE_WEAR_ANKLE</code> || 2 |
| − | | | ||
|- | |- | ||
| − | | | + | | about the body (cloak) || <code>MANIPULATE_WEAR_ABOUT</code> || 1 |
| − | | | ||
|- | |- | ||
| − | | | + | | waist || <code>MANIPULATE_WEAR_WAIST</code> || 1 |
| − | | | ||
|- | |- | ||
| − | | | + | | chest || <code>MANIPULATE_WEAR_CHEST</code> || 1 |
| − | | | ||
|- | |- | ||
| − | | | + | | back || <code>MANIPULATE_WEAR_BACK</code> || 1 |
| − | | | ||
|} | |} | ||
| − | |||
| − | + | A player can wear two rings, two necklaces, two bracelets, two earrings and two anklets. Any | |
| − | + | bonus you put on such an item can be doubled when a player gets two of them. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | A worn object is made like armour, with two differences: there is no <code>ARMOUR_DEF</code>, and | |
| − | + | its type is <code>ITEM_WORN</code>. This ring adds 1 to the wearer's strength: | |
| − | + | <pre> | |
| − | + | maskwa | |
| − | + | names {"maskwa platinum ring", "platinum ring", "maskwa ring", "maskwa", | |
| − | + | "ring"} | |
| − | + | title "a Maskwa ring" | |
| − | + | descr "A Maskwa platinum ring is lying here." | |
| − | + | extra {} | |
| − | + | "The ring has a large bear head. Could this be the legendary head of | |
| − | + | Maskwa? Anything formed with its head on it is said to strengthen the | |
| − | + | wearer." | |
| − | + | MATERIAL_METAL("Platinum, and other precious metals") | |
| − | + | type ITEM_WORN | |
| − | + | manipulate {MANIPULATE_TAKE, MANIPULATE_WEAR_FINGER} | |
| − | + | STR_TRANSFER(+1) | |
| + | weight 1 | ||
| + | cost 100 COPPER_PIECE | ||
| + | rent 50 IRON_PIECE | ||
| + | end | ||
| + | </pre> | ||
| − | <div style='padding-top: 30px; padding-bottom: 20px; text-align: left;float:left;width:50%;'>[[Manual: | + | <div style='padding-top: 30px; padding-bottom: 20px; text-align: left;float:left;width:50%;'>[[Manual:Zone Manual/The Objects Section/DIL functions for objects|Previous: DIL functions for objects]]</div> |
| − | <div style='padding-top: 30px; padding-bottom: 20px; text-align: right;float:right;width:50%;'>[[Manual: | + | <div style='padding-top: 30px; padding-bottom: 20px; text-align: right;float:right;width:50%;'>[[Manual:Zone Manual/The Objects Section/Dragon station with rooms NPCs and objects|Next: Dragon station with rooms, NPCs and objects]]</div> |
Latest revision as of 06:14, 15 November 2026
Contents
More complex objects
The earlier pages showed the object fields and how to build a basic object. This page uses them, with the macros from Object macros and the DIL functions from DIL functions for objects, to make the objects of the dragon station zone: a board, a locker with its key, a drink, some food, a weapon, a piece of armour and a ring.
Every finished object on this page is part of the zone on the next page, Dragon station with rooms, NPCs and objects, and compiles there. Two rules to keep in mind while reading them:
- A type macro (
WEAPON_DEF,ARMOUR_DEF,LIQ_WINE...) setstype,value[]and sometimesweight. These fields keep the last value written, so put the macro first and change things after it.manipulate,flagsandopenadd up instead, so amanipulateline after the macro adds to what the macro set. - Give every object a material with one of the
MATERIAL_*macros from wmacros.h. The text appears when a player identifies the item, and DIL can test the material (for example"$mat_metal" in item.extra).
Making a communication board
A board is an object with the board@boards DIL function on it. The function and its
arguments are explained in DIL functions for objects.
As with every object, first name and describe it:
info_board
names {"merchant information board", "information board", "merchant board",
"board"}
title "a merchant information board"
descr "A merchant information board is mounted on a wall here."
extra {}
"A large flashy black steel board."
MATERIAL_METAL("A very fine quality black steel")
Then the board itself: the type and the DIL function. Here everyone may read and post, but only
administrators may remove other people's posts (rem_res@boards), and the board holds
up to 100 posts. It has no MANIPULATE_TAKE, so nobody can walk off with it.
type ITEM_BOARD
dilcopy board@boards("info", "", "rem_res@boards", "", 100);
The finished board:
info_board
names {"merchant information board", "information board", "merchant board",
"board"}
title "a merchant information board"
descr "A merchant information board is mounted on a wall here."
extra {}
"A large flashy black steel board."
MATERIAL_METAL("A very fine quality black steel")
type ITEM_BOARD
dilcopy board@boards("info", "", "rem_res@boards", "", 100);
end
The first argument, "info", names the files the posts are kept in. Every board with the
same name shows the same posts, so give a board of your own a name no other board uses.
Making a container
The station gets a small weapons locker. It hangs on the wall, so it can't be taken; it can be opened, closed and locked, and a black key opens it. The description comes first, as always:
wpn_locker
names {"weapons locker", "weapon locker", "locker"}
title "a weapons locker"
descr "A small weapons locker hangs on the wall here."
extra {}
"It is an ordinary weapons locker that looks like it holds any illegal
weapons that are taken on the station."
MATERIAL_METAL("A very fine quality steel")
Then what makes it a container:
CONTAINER_DEF(50)
manipulate {MANIPULATE_ENTER}
open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED}
key black_key
weight 400
CONTAINER_DEF(50)sets the type and the capacity, here 50 pounds. It sets nothing else.MANIPULATE_ENTERis what lets players put things in; without it nothing can be put in the locker. A player can alsoenteran open object with this flag if he and all he carries fit in its capacity, so keep the capacity of a small container small.- There is no
MANIPULATE_TAKE, so the locker stays on the wall. The high weight is only a second guard against that. opentakes the sameEX_*flags as a door:EX_OPEN_CLOSEmakes it something you can open and close,EX_CLOSEDandEX_LOCKEDsay how it is when it is loaded.keyis the symbolic name of the key object. To unlock, a player must carry an object with that symbolic name. vmc doesn't check that the key exists; if it doesn't, only the pick lock skill opens the locker.
So the key has to be made too. A key has no macro: it is type ITEM_KEY and something you
can take and hold.
black_key
names {"small black key", "black key", "key"}
title "a small black key"
descr "A small black key has been dropped here."
extra {}
"It is a plain key of black steel. It looks like it fits a locker."
MATERIAL_METAL("Black steel")
type ITEM_KEY
manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD}
weight 1
end
The finished locker:
wpn_locker
names {"weapons locker", "weapon locker", "locker"}
title "a weapons locker"
descr "A small weapons locker hangs on the wall here."
extra {}
"It is an ordinary weapons locker that looks like it holds any illegal
weapons that are taken on the station."
MATERIAL_METAL("A very fine quality steel")
CONTAINER_DEF(50)
manipulate {MANIPULATE_ENTER}
open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED}
key black_key
weight 400
end
Loading things into the locker, and keeping the key somewhere a player can find it, is done in the reset section (see Loading objects and NPCs).
Creating drinks
A drink container has a few rules of its own for the title, descriptions and names, because the liquid in it can change: a player can drink it empty and fill it with something else.
The title and descriptions must not mention the liquid. A bag full of wine is "a red bag", not "a bag of wine": once a player has drunk the wine and filled the bag with water, a title saying wine would be wrong.
liq_ration title "a red bag" descr "A red bag has been gently placed here."
The name of the liquid must be the last name in the names list. When the container is emptied, the game removes the last name; when it is filled, the name of the new liquid is added at the end.
names {"red bag", "bag", "wine"}
The liquid comes from a macro in liquid.h (included by macros.h). The four arguments are the weight of the empty container, its capacity, how much is in it, and how poisonous the liquid is (0: not at all). The macro also sets the weight, to the container plus its contents.
LIQ_WINE(1, 2, 2, 0)
To finish it, add a material, MANIPULATE_TAKE so it can be picked up, a price, and an
$identify extra. A player who casts identify on the bag sees the text of
$identify; improved identify shows $improved identify as well. The finished
drink container:
liq_ration
names {"red bag", "bag", "wine"}
title "a red bag"
descr "A red bag has been gently placed here."
extra {}
"A small label reads: Tassel Grove's finest. Year 321."
MATERIAL_ORGANIC("a soft plastic")
LIQ_WINE(1, 2, 2, 0)
manipulate {MANIPULATE_TAKE}
cost 2 IRON_PIECE
extra {"$identify"}
"It's the special wine from Tassel Grove, a small halfling village on the
planet Valhalla. It seems like a great vintage."
end
Creating food
Food is a plain object with FOOD_DEF(amount, poison): how filling it is, and how
poisonous (0: not at all). Here is a stick of dried beef that might be lying around a space station:
beef_stick
names {"tough leathery stick", "tough leather stick", "leathery stick",
"leather stick", "tough stick", "stick"}
title "a tough leathery stick"
descr "A tough leathery looking stick is lying here."
extra {}
"This has the word BEEF burnt into it."
MATERIAL_ORGANIC("tough beef")
FOOD_DEF(5, 0)
manipulate {MANIPULATE_TAKE}
weight 1
cost 1 COPPER_PIECE
end
Making a weapon
This stiletto uses the weapon macro, a skill bonus while it is wielded, and a restriction: only players with enough dexterity can wield it. First the description and the material:
w_stiletto
names {"deadly looking stiletto", "deadly stiletto", "stiletto", "dagger"}
title "a stiletto"
descr "A deadly looking stiletto has been left here."
extra {}
"This looks like a thief's dream come true."
MATERIAL_METAL("A very fine quality steel")
Then what makes it a special weapon:
WEAPON_DEF(WPN_DAGGER, BONUS_AVERAGE_PLUS, BONUS_GOOD) SKILL_TRANSFER(SKI_BACKSTAB, 2) dilcopy abi_restrict@function(ABIL_DEX, 10, 0, 25, "");
WEAPON_DEF(weapon, craftsmanship, magic bonus)makes it a dagger with a craftsmanship of +1 (BONUS_AVERAGE_PLUS) and a magic bonus of +2 (BONUS_GOOD). Both bonuses go from -7 to +7, namedBONUS_JUNKtoBONUS_ARTIFACTin values.h; vmc refuses anything outside. The macro also setsMANIPULATE_TAKEandMANIPULATE_WIELD.SKILL_TRANSFER(SKI_BACKSTAB, 2)raises the backstab skill by 2 while the stiletto is wielded.abi_restrict@functionmakes a player with a dexterity below 10 drop it again.
To finish it, a weight, a price, the rent, and the two identify extras. The finished weapon:
w_stiletto
names {"deadly looking stiletto", "deadly stiletto", "stiletto", "dagger"}
title "a stiletto"
descr "A deadly looking stiletto has been left here."
extra {}
"This looks like a thief's dream come true."
MATERIAL_METAL("A very fine quality steel")
WEAPON_DEF(WPN_DAGGER, BONUS_AVERAGE_PLUS, BONUS_GOOD)
SKILL_TRANSFER(SKI_BACKSTAB, 2)
dilcopy abi_restrict@function(ABIL_DEX, 10, 0, 25, "");
weight 2
cost 2 GOLD_PIECE
rent 1 COPPER_PIECE
extra {"$identify"}
"The stiletto looks magical in nature and seems really sharp. You can
tell that if you wield it you would be able to backstab someone really
easily."
extra {"$improved identify"}
"The stiletto has a magic bonus of +2 and a craftsmanship of +1. It
also raises your backstab skill by 2. You need a dexterity of at least
10 to wield it."
end
rent is what a player pays per real day for keeping the item while logged off. It is
multiplied by the rent percentage in the server's server.cfg, which is 0 (no rent at all) in
the configuration that comes with the code.
Making armour
When a character is hit in melee, the game picks the part of the body that was hit, and only armour
(type ITEM_ARMOR) worn on that part protects. There are six such parts:
| Position | Manipulate flag | Chance to be hit |
|---|---|---|
| body | MANIPULATE_WEAR_BODY |
34% |
| legs | MANIPULATE_WEAR_LEGS |
28% |
| arms | MANIPULATE_WEAR_ARMS |
23% |
| head | MANIPULATE_WEAR_HEAD |
5% |
| hands | MANIPULATE_WEAR_HANDS |
5% |
| feet | MANIPULATE_WEAR_FEET |
5% |
A cloak (MANIPULATE_WEAR_ABOUT) is not one of them. A shield is made with
SHIELD_DEF and worn with MANIPULATE_WEAR_SHIELD; it blocks blows in its own way.
We will make a breast plate. First the name, descriptions and material:
pol_plate
names {"polished breast plate", "polished plate", "breast plate", "plate"}
title "a polished breast plate"
descr "A polished breast plate has been left here."
extra {}
"This is one shiny plate. It seems to be made out of one perfect piece
of metal. There don't even seem to be any marks of ownership."
MATERIAL_METAL("A high lustre silver coloured metal")
Then the armour: plate, with a craftsmanship of +4 (BONUS_EXCELLENT) and a magic bonus
of +3 (BONUS_GOOD_PLUS). The armour macros only set MANIPULATE_TAKE; the
position where it is worn has to be added, here the body.
ARMOUR_DEF(ARM_PLATE, BONUS_EXCELLENT, BONUS_GOOD_PLUS)
manipulate {MANIPULATE_WEAR_BODY}
All that is left is a strength restriction, the weight, cost, rent and the identify extras. The finished armour:
pol_plate
names {"polished breast plate", "polished plate", "breast plate", "plate"}
title "a polished breast plate"
descr "A polished breast plate has been left here."
extra {}
"This is one shiny plate. It seems to be made out of one perfect piece
of metal. There don't even seem to be any marks of ownership."
MATERIAL_METAL("A high lustre silver coloured metal")
ARMOUR_DEF(ARM_PLATE, BONUS_EXCELLENT, BONUS_GOOD_PLUS)
manipulate {MANIPULATE_WEAR_BODY}
dilcopy abi_restrict@function(ABIL_STR, 40, 0, 25, "");
weight 25
cost 2 GOLD_PIECE
rent 3 COPPER_PIECE
extra {"$identify"}
"This is a high quality plate with a magical feeling."
extra {"$improved identify"}
"The plate has a magic bonus of +3 and a craftsmanship of +4. You need
a strength of at least 40 to wear it."
end
Making non-armour worn objects
Clothing and jewellery don't protect in a fight, but they can carry bonuses that help in the long run. These are the other places an object can be worn:
| Position | Manipulate flag | How many |
|---|---|---|
| finger | MANIPULATE_WEAR_FINGER |
2 |
| neck | MANIPULATE_WEAR_NECK |
2 |
| wrist | MANIPULATE_WEAR_WRIST |
2 |
| ear | MANIPULATE_WEAR_EAR |
2 |
| ankle | MANIPULATE_WEAR_ANKLE |
2 |
| about the body (cloak) | MANIPULATE_WEAR_ABOUT |
1 |
| waist | MANIPULATE_WEAR_WAIST |
1 |
| chest | MANIPULATE_WEAR_CHEST |
1 |
| back | MANIPULATE_WEAR_BACK |
1 |
A player can wear two rings, two necklaces, two bracelets, two earrings and two anklets. Any bonus you put on such an item can be doubled when a player gets two of them.
A worn object is made like armour, with two differences: there is no ARMOUR_DEF, and
its type is ITEM_WORN. This ring adds 1 to the wearer's strength:
maskwa
names {"maskwa platinum ring", "platinum ring", "maskwa ring", "maskwa",
"ring"}
title "a Maskwa ring"
descr "A Maskwa platinum ring is lying here."
extra {}
"The ring has a large bear head. Could this be the legendary head of
Maskwa? Anything formed with its head on it is said to strengthen the
wearer."
MATERIAL_METAL("Platinum, and other precious metals")
type ITEM_WORN
manipulate {MANIPULATE_TAKE, MANIPULATE_WEAR_FINGER}
STR_TRANSFER(+1)
weight 1
cost 100 COPPER_PIECE
rent 50 IRON_PIECE
end