Difference between revisions of "Manual:Game Mechanics/Objects"

From DikuMUD Wiki
Jump to navigation Jump to search
(checked against the current code (wiki review 2026-11-15))
 
Line 1: Line 1:
−
This might belong better in a builders tutorial
+
This page explains what the numbers on weapons, armour, shields and magic items do in the game, and gives guidelines for choosing them. How to write the objects themselves is in the [[Manual:Zone Manual/The Objects Section|Zone Manual]], with all the macros on [[Manual:Zone Manual/The Objects Section/Object macros|Object macros]]. The macros named here are in <code>vme/include/wmacros.h</code>, which <code>macros.h</code> includes.
  
−
1. Object Creator Documentation
+
== Craftsmanship and magic ==
−
Document Name:           objects.doc (was wpn_arm.doc)
+
Weapons, armour and shields have two numbers: '''craftsmanship''' (<code>value[1]</code>), how well the item was made and of what, and the '''magic bonus''' (<code>value[2]</code>). Both are on the bonus scale from -7 to +7, with names in <code>vme/include/values.h</code>. vmc refuses a value outside it ("Illegal bonus (-7..+7 allowed)") and the zone doesn't compile.
−
Version:                7.10
 
−
Author:                  Michael Seifert (seifert@diku.dk)
 
−
Questions to:            seifert@diku.dk
 
−
Document intended for:  World Creators
 
  
−
This  document  describes how the world creator specifies  objects
+
When the item is loaded into the game, the server turns each into a combat bonus (<code>bonus_map_a()</code> in <code>vme/src/common.cpp</code>):
−
such as weapons, shields, armours, potions, scrolls, wands, staffs
 
−
and  how  to apply magical properties to items. Also included  are
 
−
guidelines for creating magical items.
 
  
−
2.   General notes about craftsmanship, material and magic bonuses
+
{| class="wikitable"
 +
! Constant !! Value !! In the game
 +
|-
 +
| <code>BONUS_ARTIFACT</code> || 7 || +20
 +
|-
 +
| <code>BONUS_SUPERIOR</code> || 6 || +17
 +
|-
 +
| <code>BONUS_EXCELLENT_PLUS</code> || 5 || +14
 +
|-
 +
| <code>BONUS_EXCELLENT</code> || 4 || +11
 +
|-
 +
| <code>BONUS_GOOD_PLUS</code> || 3 || +8
 +
|-
 +
| <code>BONUS_GOOD</code> || 2 || +5
 +
|-
 +
| <code>BONUS_AVERAGE_PLUS</code> || 1 || +2
 +
|-
 +
| <code>BONUS_AVERAGE</code> || 0 || 0
 +
|-
 +
| <code>BONUS_AVERAGE_MINUS</code> || -1 || -2
 +
|-
 +
| <code>BONUS_BAD</code> || -2 || -5
 +
|-
 +
| <code>BONUS_BAD_MINUS</code> || -3 || -8
 +
|-
 +
| <code>BONUS_TERRIBLE</code> || -4 || -11
 +
|-
 +
| <code>BONUS_TERRIBLE_MINUS</code> || -5 || -14
 +
|-
 +
| <code>BONUS_JUNK_ALMOST</code> || -6 || -17
 +
|-
 +
| <code>BONUS_JUNK</code> || -7 || -20
 +
|}
 +
A value that isn't 0 gets twice the open-ended roll divided by 100 added, so now and then an item comes out 2 or 4 points better (rarely worse). Craftsmanship and magic count the same in a fight: on a weapon they are added to the attack, on armour and shields to the defence (see [[Manual:Game Mechanics/Combat|Combat]]). The old manual's scale of -25% to +25%, with tables of materials, is gone; choose the craftsmanship from what the item is made of and how well. As a guide:
 +
* an ordinary item is <code>BONUS_AVERAGE</code>; don't punish a club for being wood, or a spear for having a wooden shaft;
 +
* rusty, cracked or makeshift items are below average; a sword made of wood is junk;
 +
* fine work, or a better material such as steel, is good; mithril or the work of a master is excellent or better;
 +
* a magic bonus makes an item magic: the item should also have <code>flags {UNIT_FL_MAGIC}</code> so that detect magic finds it.
  
−
Note: In general each +5 / -5 could be said to equal AD&D +1 / -1 bonuses.
+
=== Wear and breaking ===
 +
Craftsmanship also sets how much wear an item takes before it breaks. vmc gives it hit points (<code>set_hits()</code>; a <code>hit</code> field on the object is ignored):
 +
{| class="wikitable"
 +
! Craftsmanship !! -7 !! -5 !! -3 !! -1 !! 0 !! +1 !! +3 !! +5 !! +7
 +
|-
 +
| Hit points || 755 || 825 || 895 || 965 || 1,000 || 1,200 || 1,600 || 2,000 || 2,400
 +
|}
 +
That is 1,000 + 200 per point above average, or 1,000 - 35 per point below. In a fight (<code>damage_object()</code> in <code>vme/src/fight.cpp</code>):
 +
* a weapon that hits loses a quarter of the damage it does;
 +
* the armour on the place that was hit loses the damage;
 +
* a shield that blocks loses twice the damage the blow would have done;
 +
in each case less the item's magic bonus, and then divided by 10. When its hit points go below 0, the item breaks: it gets "(broken)" after its title and becomes worthless trash.
  
−
2.1  Craftsmanship (%, Table 1)
+
== Weapons ==
−
The  craftsmanship expresses of what material a weapon, shield  or
+
<pre>
−
armor  is made and how well it has been constructed. The material
+
WEAPON_DEF(weapon_type, craftsmanship, magic_bonus)
−
is  calculated  by selecting appropriate material &  craftsmanship
+
</pre>
−
percentages from Table 1 and Table 2 below.   The result is an overall
+
<code>weapon_type</code> is one of the <code>WPN_*</code> weapon types in <code>vme/include/values.h</code>, such as <code>WPN_LONG_SWORD</code> or <code>WPN_DAGGER</code>. The families (<code>WPN_SWORD</code>, <code>WPN_AXE_HAM</code>...) are not weapon types, and vmc refuses them. The macro also sets the type, <code>MANIPULATE_TAKE</code> and <code>MANIPULATE_WIELD</code>. See [[Manual:Zone Manual/Appendices/weapon definitions in values.h|weapon definitions]].
−
craftsmanship in the range [-25% ..                             +25%].
 
−
Table  1  is  relative to the iron material. Notice  that  a  clubs
 
−
should not get  penalties because it made of wood, nor  should  a
 
−
spear  (with an iron tip). However obviously a sword would  get  a
 
−
huge penalty for being made of wood. In general there should be no
 
−
modification  on  a  weapons  default material.  A  wooden  shield
 
−
should not get -15% - it should just have fewer hitpoints  -  hope
 
−
you catch the drift...
 
  
−
  Material  Qty  Weight        Cost              Mul.        Mul.
+
Everything else about a weapon type is in <code>vme/etc/weapons.def</code>:
−
  Wood      -15%          ?    x 0.2                 (differs)
+
{| class="wikitable"
−
  Bone      -14%          ?    x 0.3
+
! Field !! What it is
−
  Ebony    -13%          ?    x 1.7
+
|-
−
  Gold      -11%      19.30    x 512
+
| <code>sphere</code> || the family, which decides the skill a player falls back on
−
  Stone      -8%          ?    x 0.2
+
|-
−
  Silver    -10%      10.50   x 64.0
+
| <code>hands</code> || 1 or 2
−
  Bronze    -5%        8.50    x 0.8
+
|-
−
  Iron        0%        7.90    x 1.0
+
| <code>speed</code> || how much of a combat round a blow takes: 9 for two-handed weapons, 7 for one-handed, 4 for light ones like the dagger, 2 for natural attacks (4 is the least that counts)
−
  Steel      5%        9.00    x 200                    (rare)
+
|-
−
  Mithril    10%        6.00    x 4096                  (rarer)
+
| <code>fumble</code> || a roll of this or less is a fumble: the blow misses and costs half a round
−
  Diamond    15%          ?  x 32768                (extreme)
+
|-
−
  Table 1
+
| <code>ability</code> || the three abilities averaged for the attack, mostly strength, strength, dexterity
 +
|-
 +
| <code>shield</code> || whether a shield can block the blow (<code>SHIELD_M_BLOCK</code>), only soften it (<code>SHIELD_M_REDUCE</code>), or not help at all (<code>SHIELD_M_USELESS</code>)
 +
|-
 +
| <code>attack clothes</code> ... <code>attack plate</code> || the damage table against each kind of armour
 +
|}
 +
Each damage entry is three numbers {''offset'', ''base'', ''step''}: a blow whose result reaches the offset does ''base'' + (result - offset) / ''step'' damage; below the offset it does none. For example:
 +
{| class="wikitable"
 +
! Weapon !! Speed !! Fumble !! vs clothes !! vs soft leather !! vs hard leather !! vs chain !! vs plate
 +
|-
 +
| battle axe (2 hands) || 9 || 5 || {60, 10, 4} || {50, 9, 5} || {40, 8, 6} || {35, 7, 7} || {30, 6, 8}
 +
|-
 +
| long sword || 7 || 7 || {50, 7, 6} || {50, 6, 7} || {50, 5, 8} || {50, 4, 9} || {50, 3, 10}
 +
|-
 +
| dagger || 4 || 2 || {40, 3, 12} || {50, 2, 13} || {60, 1, 14} || {80, 1, 15} || {100, 1, 16}
 +
|}
 +
Light weapons are fast and seldom fumble but do little against heavy armour; two-handed weapons hit hardest. Many weapon types share the same table: the comment at the top of <code>weapons.def</code> lists which.
  
 +
Examples:
 +
<pre>
 +
rusty_dagger
 +
names {"rusty dagger", "dagger"}
 +
title "a rusty dagger"
 +
descr "A rusty dagger lies here."
 +
WEAPON_DEF(WPN_DAGGER, BONUS_BAD, BONUS_AVERAGE)
 +
weight 1
 +
cost 4 COPPER_PIECE
 +
end
  
−
This table translates materials into a quality relative to iron.
+
orcbane
−
See  also  Table  2  for  craftsmanship  modifications.  The  cost
+
names {"orcbane", "long sword", "sword"}
−
multiplier is multiplied onto the base cost of an item  if  it  is
+
title "the long sword Orcbane"
−
made  from  other materials than listed as default (for example  a
+
descr "A long sword with runes on its blade lies here."
−
long sword of steel would have its price multiplied by  a  factor
+
WEAPON_DEF(WPN_LONG_SWORD, BONUS_GOOD, BONUS_GOOD_PLUS)
−
1.8).  The Weight Multiplier is included for your information,  to
+
WEAPON_SLAYER(RACE_ORC)
−
illustrate the relative weight of the various materials. The
+
weight 8
−
craftsmanship is a way of expressing the overall quality of a weapon.
+
cost 20 GOLD_PIECE
−
This  includes  both the skill of  the  black  smith  who created
+
end
−
the  weapon, the sharpness (where appropriate),  and  the weapon
+
</pre>
−
balance. Use Table 2 for this purpose. Of course it is  not possible
 
−
to have a “none” sword of metal. NONE only applies  to weapons
 
−
created by nature (for example a branch).  The  resulting
 
−
craftsmanship is a percentage in the range [-15%..+15%].
 
  
−
  Craftsmanship  QTY    Cost                  Mul.
+
=== Slaying weapons ===
−
  None          -15%      N/A
+
<code>WEAPON_SLAYER(race)</code> makes a weapon a slayer of one race; <code>WEAPON_SLAYER_DRAGONS</code> of all dragons (an extra <code>$slayer</code> with the range of races). Both also set <code>UNIT_FL_MAGIC</code>. Put them after <code>WEAPON_DEF</code>, which would otherwise overwrite them. Against that race, the attack gets 50 more, plus 1 for each level the victim is above 50, and a blow that hits is looked up in the damage table a fifth higher.
−
  Poor          -8%    x 0.6
 
−
  Average        0%    x 1.0
 
−
  Good            5%    x 1.5
 
−
  Exceptional    10%    x 2.5
 
−
  Divine        15%    x 4.0
 
−
  Table 2
 
  
 +
== Armour ==
 +
<pre>
 +
ARMOUR_CLOTHES(craftsmanship, magic_bonus)
 +
ARMOUR_LEATHER(...)    ARMOUR_HRD_LEATHER(...)    ARMOUR_CHAIN(...)    ARMOUR_PLATE(...)
 +
ARMOUR_DEF(ARM_CHAIN, craftsmanship, magic_bonus)
 +
</pre>
 +
The macros set only <code>MANIPULATE_TAKE</code>: add the place where it is worn. Armour protects only where a blow can land. Each blow lands on one place, found with 2d8:
 +
{| class="wikitable"
 +
! Place !! Wear flag !! Chance
 +
|-
 +
| 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%
 +
|}
 +
The armour worn there decides two things: which column of the weapon's damage table is used, and its craftsmanship and magic are added to the defence. Where nothing is worn, the character's natural armour is used (clothes for a player) with no bonus. Armour of another kind, a cloak about the body for instance, gives no protection.
  
−
This  table  shows which effect craftsmanship has  on  Weapon  and
+
Heavier armour lowers the wearer's dexterity in a fight, unless they are strong and practised in it; see [[Manual:Game Mechanics/Abilities#Armour and dexterity|Abilities]]. Plate is the best protection and the heaviest burden.
−
Armour quality. The cost multiplier is multiplied onto  the base
 
−
cost of a weapon.Examples:·    A bronze helmet made by a skilled
 
−
smithy would have -5% + 5% = 0% craftsmanship.·
 
−
An ordinary steel dagger would have 5% + 0% = 5%.
 
−
A rusty iron dagger would have -5% + 0% = -5%.
 
−
A normal reinforced wooden shield has 0% + 0% = 0%.·
 
−
A  diamond dagger made by a god would have no more than  25% even
 
−
though the tables would indicate 30%.
 
  
−
2.2  Magic Bonuses
+
<pre>
 +
chain_shirt
 +
names {"chain mail shirt", "chain shirt", "shirt"}
 +
title "a chain mail shirt"
 +
descr "A chain mail shirt lies here in a heap."
 +
ARMOUR_CHAIN(BONUS_AVERAGE_PLUS, BONUS_AVERAGE)
 +
manipulate {MANIPULATE_WEAR_BODY}
 +
weight 25
 +
cost 8 GOLD_PIECE
 +
end
 +
</pre>
  
−
Magic  bonuses can also be applied to weapons, shields &  armors.
+
== Shields ==
−
It  is  in the interval -25% to 25% (0% is no magic). Remember  to
+
<pre>
−
set the UNIT_FL_MAGIC if the weapon has any magic bonuses.
+
SHIELD_DEF(shield_type, craftsmanship, magic_bonus)
 +
</pre>
 +
The shield types are <code>SHIELD_SMALL</code>, <code>SHIELD_MEDIUM</code> and <code>SHIELD_LARGE</code>. The server also knows <code>SHIELD_TOWER</code>, but vmc refuses it. The macro sets <code>MANIPULATE_TAKE</code> and <code>MANIPULATE_WEAR_SHIELD</code>.
  
−
  Power of Item Bonus  Maximum in World      Rent          Cost multiplier
+
When a blow hits, a defender who is awake and has a shield tries to use it (<code>shield_bonus()</code> in <code>vme/src/experience.cpp</code>). The shield's own value is 15 for a small shield, 20 medium, 25 large, 35 tower, plus its craftsmanship and magic. Then an opposed check: roll + shield value + the defender's shield skill - the attacker's shield skill - 50 (a monster uses its effective dexterity for the skill; behind a tower shield, the lowest of its strength, constitution and effective dexterity). A defender who can't see the attacker loses 12, and one the attacker can't see gains 12. If the result is 0 or more, the chance to block is a tenth of the result plus half the shield value. Then, depending on the weapon:
−
  Standard        +5        20-40          Approx. cost    x 1.0  Magic / 10
+
* <code>SHIELD_M_BLOCK</code>: within that chance the blow is stopped, and the shield takes the damage;
−
  Powerful      +10        10-20          Approx. cost    x 2.0 Magic / 10
+
* <code>SHIELD_M_REDUCE</code> (morning star, flail): within that chance the damage is cut by that many percent;
−
  Demi-god      +15        5-10          Approx. cost    x 4.0  Magic / 10
+
* <code>SHIELD_M_USELESS</code> (whip): the shield doesn't help.
−
  God-Magic      +20        2-5          Approx. cost    x 8.0        / 10
+
Attack spells are blocked the same way, each spell with its own method in <code>vme/etc/spells.def</code>. See [[Help/Shields|help shields]].
−
  Artifacts      +25        1-2          Approx. cost    x 16.0      / 10
 
  
−
3.  WEAPON CONSTRUCTION
+
<pre>
−
To  create  a  weapon  you must determine the  following  specific
+
oak_shield
−
information about your particular weapon. The means by  which  you
+
names {"oak shield", "shield"}
−
create  a weapon also applies to the definition of the hand  of  a
+
title "an oak shield"
−
monster.
+
descr "A round shield of oak lies here."
−
 
+
SHIELD_DEF(SHIELD_MEDIUM, BONUS_AVERAGE, BONUS_AVERAGE)
−
3.1  Weapon Category
+
weight 10
−
 
+
cost 2 GOLD_PIECE
−
Select a weapon type from the file values.h (one of the WPN_XXX
+
end
−
macros which is larger than (after) WPN_GROUP_MAX). For example
+
</pre>
−
WPN_DAGGER. The weapon category determines which skill is required
 
−
for using  (and defending against) the weapon.
 
−
 
 
−
3.2  Examples
 
−
 
 
−
A  standard  macro  WEAPON_DEF(weapon_category,  craftsmanship,
 
−
magic_bonus)  is available, and should be used for  defining  the
 
−
weapons values.Note  that both craftsmanship & magic bonuses are in
 
−
the range  [-25%..+25%].
 
−
 
 
−
A  flail (two handed) of non-pure iron (-3%), a little better than
 
−
average craftsmanship (5%) and no magic bonuses would have:
 
−
WEAPON_DEF(WPN_FLAIL, +2, 0)
 
−
 
 
−
A  rusty  (-5%) mean sacrificial dagger by a skilled smithy  (+5%)
 
−
and magically enchanted might be:    flags {UNIT_FL_MAGIC}
 
−
WEAPON_DEF(WPN_DAGGER, 0, +5)
 
−
 
 
−
An old shaky wooden stick could be:    WEAPON_DEF(WPN_CLUB, -5, 0)
 
−
 
 
−
A  wooden bastard sword would have considerable less craftsmanship
 
−
than  listed  since wood prevents the slashing effect,  also  it
 
−
would  be non-sense to apply better than average craftsmanship  in
 
−
this case:    WEAPON_DEF(WPN_BROAD_SWORD, -15, 0)
 
−
 
 
−
Very  special weapons ought to exist only in limited numbers  even
 
−
if  they are not magical, for example, it seems unreasonable  that
 
−
hundreds of daggers made from diamond exists in the world. Perhaps
 
−
only  one or two such weapons exist. Use the max field in the load
 
−
or equip reset-commands.
 
−
The  macro  automatically sets the following manipulate  flags  so
 
−
that the weapon can be picked up and wielded:
 
−
manipulate {MANIPULATE_TAKE, MANIPULATE_WEAR_WIELD}
 
−
 
 
−
4.  ARMOUR CONSTRUCTION
 
−
 
 
−
Armours  are  designed just as for weapons. A number  of general
 
−
things  ought  to be noted for armours. There are standard  macros
 
−
for  many  types of armour - use these unless you are designing
 
−
something  unique  (like  a set of T1000 liquid  armour).  Armours
 
−
protect differently against the three different basic attack types
 
−
(slash,  pierce  and bludgeon) and differently  against  different
 
−
spell  attacks (i.e. plate is best against acid but worst  against
 
−
electricity).
 
−
 
 
−
4.1  Location
 
−
 
 
−
Location  is where the armour is supposed to be used, for  example
 
−
sleeves  are  usually put on the arms. To specify a location, set
 
−
the  appropriate  manipulate  flags (MAINPULATE_WEAR_XXX).  Armour
 
−
only offers protection on the following body locations:
 
−
Head    Hands    Arms    Body    Legs    Feet
 
−
 
 
−
4.2  Examples
 
−
 
 
−
Standard macros are available and are used exactly as for weapons:
 
−
    ARMOR_CLOTHES(...)    ARMOR_LEATHER(...)    ARMOR_HRD_LEATHER(...)
 
−
    ARMOR_CHAIN(...)    ARMOR_PLATE(...)
 
−
A magical mithril full plate armour of good craftsmanship could be
 
−
assigned:    flags {UNIT_FL_MAGIC}    ARMOR_PLATE(+15,+5)
 
−
 
 
−
5.  SHIELDS
 
−
 
 
−
Shields are designed just as for armours & weapons. Use the  macro
 
−
SHIELD_DEF.
 
−
 
 
−
5.1  Category
 
−
 
 
−
The  shield  category must be one of (SHIELD_XXX,  values.h).  The
 
−
larger  the  shield,  the better the chance of  blocking  attacks.
 
−
Remember  to put weight on your shield to encumber the  character.
 
−
Shields are defined just as weapons & armours.
 
−
 
 
−
Shield Type
 
−
Small Shield  Medium  Shield
 
−
Large Shield
 
−
 
 
−
Table 3
 
−
Available shield types.
 
−
 
 
−
5.2 Examples
 
−
A small magical wooden shield could be assigned:
 
−
    flags {UNIT_FL_MAGIC}    SHIELD_DEF(SHIELD_SMALL, 0, +5)
 
−
 
 
−
6.  Various
 
−
 
 
−
6.1  Notes, Signs, Papers (reading)
 
  
−
When  you create a note with written text upon it, the proper  way
+
== Magic items ==
−
is  to  make an extra description with an empty keyword. The empty
+
An item with magic should have <code>flags {UNIT_FL_MAGIC}</code>; the transfer macros and the potion, scroll, wand and staff macros set it themselves, <code>WEAPON_DEF</code>, <code>ARMOUR_*</code> and <code>SHIELD_DEF</code> don't.
−
keyword defaults to the name of the object itself.
 
  
−
Example:     note_7
+
=== Bonuses while worn ===
−
names {“old paper”, “paper”}
+
While an item is worn or wielded, transfers change the wearer:
−
.......
+
* <code>STR_TRANSFER(n)</code>, <code>DEX_TRANSFER</code>, <code>CON_TRANSFER</code>, <code>CHA_TRANSFER</code>, <code>BRA_TRANSFER</code>, <code>MAG_TRANSFER</code>, <code>DIV_TRANSFER</code>, <code>HIT_TRANSFER</code>: an ability;
−
extra  {}
+
* <code>SKILL_TRANSFER(SKI_x, n)</code>, <code>SPELL_TRANSFER(SPL_x, n)</code>, <code>WEAPON_TRANSFER(WPN_x, n)</code>: a skill, a spell or a weapon skill;
−
“The paper looks old and worn, and written in blood  you
+
* <code>SPEED_TRANSFER(n)</code>, <code>SLOW_TRANSFER(n)</code>, <code>CHAR_FLAG_TRANSFER(flags)</code>, <code>PROTECTION_FROM_GOOD</code>, <code>PROTECTION_FROM_EVIL</code>.
−
see  the words: Help free the world of the horrible evil
+
''n'' is on the bonus scale, -7 to +7; when the item is loaded it becomes -10 to +10 points (the table is on [[Manual:Game Mechanics/Abilities#Items that change abilities|Abilities]]). A player can wear many items at once, so even small bonuses add up: give large ones rarely. Magic that changes abilities or skills has to be taken off before a teacher will train the player.
−
lurking lurking behind these doors.
 
  
−
”Extra {“blood”} “The blood is red!”
+
=== Identifying ===
 +
The identify spells show an item's numbers, and two extras of your own:
 +
* <code>extra {"$identify"}</code> is shown by identify and improved identify;
 +
* <code>extra {"$improved identify"}</code> only by improved identify.
 +
Use them on every magic item to tell the player what they hold:
 +
<pre>
 +
crown_of_lich
 +
names {"black crown", "crown"}
 +
title "a black crown"
 +
descr "A black crown lies here."
 +
manipulate {MANIPULATE_TAKE, MANIPULATE_WEAR_HEAD}
 +
BRA_TRANSFER(BONUS_EXCELLENT)
 +
extra {"$identify"}
 +
"Once the crown of an undead king, it is said to sharpen the mind."
 +
extra {"$improved identify"}
 +
"The crown adds to the wearer's brain."
 +
weight 2
 +
cost 50 GOLD_PIECE
 
end
 
end
 +
</pre>
  
−
7.  MAGICAL ITEMS
+
=== Potions, scrolls, wands and staffs ===
−
 
+
<code>POTION_DEF(power, spell1, spell2, spell3)</code>, <code>SCROLL_DEF(power, spell1, spell2, spell3)</code>, <code>WAND_DEF(power, charges, spell1, spell2)</code> and <code>STAFF_DEF(power, charges, spell1, spell2)</code>. ''power'' takes the place of the caster's skill and ability. Use <code>SPL_NONE</code> for a spell that isn't used; 0 is a real spell.
−
This  chapter describes the rules by which magical items  must  be
 
−
created. The rules are made under the consideration that a  player
 
−
can equip a total of 17 items! It is therefore very important that
 
−
you carefully follow these guidelines.
 
−
 
 
−
Magical bonuses are applied to a player
 
−
 
 
−
whenever he equips a magical item.
 
−
When you create a magical item you should remember to set the unit-flag
 
−
UNIT_FL_MAGIC  so  that the detect  magic  spell will  work
 
−
properly. But most of the used macros automatically set the  magic
 
−
flag. (flags {UNIT_FL_MAGIC}).
 
−
 
 
−
7.1  Identifying Magical Items
 
  
−
It  is  always important for the players to get information about
+
== Notes and signs ==
−
magical  items. The following method gives you the possibility  of
+
An extra with no names, <code>extra {}</code>, is shown when someone looks at the object itself, so it is the text of a note or a sign; <code>read</code> does the same as <code>look</code>.
−
creating  textual identification descriptions for  the  “identify”
+
<pre>
−
and “improved identify” spells.
+
old_note
−
Add  an extra description with the keyword “$identify” and it will
+
names {"old note", "note", "paper"}
−
show the description when an identify spell is cast upon the item
+
title "an old note"
−
Add an extra description with the keyword “$improved identify” and
+
descr "An old note has been dropped here."
−
it  will  show the description when an improved identify spell  is
+
manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD}
−
cast upon the item.
+
extra {}
−
Example:
+
"Written in blood: Help free the world of the evil behind these doors."
−
crown_of_king
+
extra {"blood"}
−
bla bla......
+
"The blood is dried and brown."
−
extra {“$identify”}
+
weight 1
−
“This  once  used to be the crown of the evil lich king  Asmodeus,
 
−
the greatest  of the undead. The crown is a great  magical  item
 
−
rumored  to  give its posessor fantastic intellectual powers.  The
 
−
crown can only be used by evil persons.”
 
−
extra {“$improved identify”}
 
−
“The Crown of Asmodeus gives +5 to brain. Can only be used by evil
 
−
persons.”
 
 
end
 
end
−
As  you can see, the two types of descriptions associated with the
+
</pre>
−
magical  items  gives  a lot more flavor to  your  magical  items.
 
−
Please  always include both descriptions on any magical items  you
 
−
create (they can be used on any kind of item, even unmagical ones,
 
−
but  most  likely there is nothing special to be said  about
 
−
non-magical items).
 
  
−
7.2  Rent on limited items
+
== Limiting powerful items ==
−
Whenever  you create a magical item, you must specify the  maximum
+
Very good items should be rare. Load them with <code>max</code> in the <code>%reset</code> section, which counts the copies in the whole game, and from a monster that is hard to kill. The <code>rent</code> field charges players for keeping an item, per real day, but only when <code>rent</code> in <code>server.cfg</code> is above 0; it is 0 in the distributed configuration.
−
number  allowed in the world at any given time (the concept  world
 
−
includes  items  saved in the playerfile.). The  following  table
 
−
shows  the  allowed  number of items in the world  and  the  rent
 
−
compared with the items power:
 

Latest revision as of 06:27, 15 November 2026

This page explains what the numbers on weapons, armour, shields and magic items do in the game, and gives guidelines for choosing them. How to write the objects themselves is in the Zone Manual, with all the macros on Object macros. The macros named here are in vme/include/wmacros.h, which macros.h includes.

Craftsmanship and magic

Weapons, armour and shields have two numbers: craftsmanship (value[1]), how well the item was made and of what, and the magic bonus (value[2]). Both are on the bonus scale from -7 to +7, with names in vme/include/values.h. vmc refuses a value outside it ("Illegal bonus (-7..+7 allowed)") and the zone doesn't compile.

When the item is loaded into the game, the server turns each into a combat bonus (bonus_map_a() in vme/src/common.cpp):

Constant Value In the game
BONUS_ARTIFACT 7 +20
BONUS_SUPERIOR 6 +17
BONUS_EXCELLENT_PLUS 5 +14
BONUS_EXCELLENT 4 +11
BONUS_GOOD_PLUS 3 +8
BONUS_GOOD 2 +5
BONUS_AVERAGE_PLUS 1 +2
BONUS_AVERAGE 0 0
BONUS_AVERAGE_MINUS -1 -2
BONUS_BAD -2 -5
BONUS_BAD_MINUS -3 -8
BONUS_TERRIBLE -4 -11
BONUS_TERRIBLE_MINUS -5 -14
BONUS_JUNK_ALMOST -6 -17
BONUS_JUNK -7 -20

A value that isn't 0 gets twice the open-ended roll divided by 100 added, so now and then an item comes out 2 or 4 points better (rarely worse). Craftsmanship and magic count the same in a fight: on a weapon they are added to the attack, on armour and shields to the defence (see Combat). The old manual's scale of -25% to +25%, with tables of materials, is gone; choose the craftsmanship from what the item is made of and how well. As a guide:

  • an ordinary item is BONUS_AVERAGE; don't punish a club for being wood, or a spear for having a wooden shaft;
  • rusty, cracked or makeshift items are below average; a sword made of wood is junk;
  • fine work, or a better material such as steel, is good; mithril or the work of a master is excellent or better;
  • a magic bonus makes an item magic: the item should also have flags {UNIT_FL_MAGIC} so that detect magic finds it.

Wear and breaking

Craftsmanship also sets how much wear an item takes before it breaks. vmc gives it hit points (set_hits(); a hit field on the object is ignored):

Craftsmanship -7 -5 -3 -1 0 +1 +3 +5 +7
Hit points 755 825 895 965 1,000 1,200 1,600 2,000 2,400

That is 1,000 + 200 per point above average, or 1,000 - 35 per point below. In a fight (damage_object() in vme/src/fight.cpp):

  • a weapon that hits loses a quarter of the damage it does;
  • the armour on the place that was hit loses the damage;
  • a shield that blocks loses twice the damage the blow would have done;

in each case less the item's magic bonus, and then divided by 10. When its hit points go below 0, the item breaks: it gets "(broken)" after its title and becomes worthless trash.

Weapons

WEAPON_DEF(weapon_type, craftsmanship, magic_bonus)

weapon_type is one of the WPN_* weapon types in vme/include/values.h, such as WPN_LONG_SWORD or WPN_DAGGER. The families (WPN_SWORD, WPN_AXE_HAM...) are not weapon types, and vmc refuses them. The macro also sets the type, MANIPULATE_TAKE and MANIPULATE_WIELD. See weapon definitions.

Everything else about a weapon type is in vme/etc/weapons.def:

Field What it is
sphere the family, which decides the skill a player falls back on
hands 1 or 2
speed how much of a combat round a blow takes: 9 for two-handed weapons, 7 for one-handed, 4 for light ones like the dagger, 2 for natural attacks (4 is the least that counts)
fumble a roll of this or less is a fumble: the blow misses and costs half a round
ability the three abilities averaged for the attack, mostly strength, strength, dexterity
shield whether a shield can block the blow (SHIELD_M_BLOCK), only soften it (SHIELD_M_REDUCE), or not help at all (SHIELD_M_USELESS)
attack clothes ... attack plate the damage table against each kind of armour

Each damage entry is three numbers {offset, base, step}: a blow whose result reaches the offset does base + (result - offset) / step damage; below the offset it does none. For example:

Weapon Speed Fumble vs clothes vs soft leather vs hard leather vs chain vs plate
battle axe (2 hands) 9 5 {60, 10, 4} {50, 9, 5} {40, 8, 6} {35, 7, 7} {30, 6, 8}
long sword 7 7 {50, 7, 6} {50, 6, 7} {50, 5, 8} {50, 4, 9} {50, 3, 10}
dagger 4 2 {40, 3, 12} {50, 2, 13} {60, 1, 14} {80, 1, 15} {100, 1, 16}

Light weapons are fast and seldom fumble but do little against heavy armour; two-handed weapons hit hardest. Many weapon types share the same table: the comment at the top of weapons.def lists which.

Examples:

rusty_dagger
names {"rusty dagger", "dagger"}
title "a rusty dagger"
descr "A rusty dagger lies here."
WEAPON_DEF(WPN_DAGGER, BONUS_BAD, BONUS_AVERAGE)
weight 1
cost 4 COPPER_PIECE
end

orcbane
names {"orcbane", "long sword", "sword"}
title "the long sword Orcbane"
descr "A long sword with runes on its blade lies here."
WEAPON_DEF(WPN_LONG_SWORD, BONUS_GOOD, BONUS_GOOD_PLUS)
WEAPON_SLAYER(RACE_ORC)
weight 8
cost 20 GOLD_PIECE
end

Slaying weapons

WEAPON_SLAYER(race) makes a weapon a slayer of one race; WEAPON_SLAYER_DRAGONS of all dragons (an extra $slayer with the range of races). Both also set UNIT_FL_MAGIC. Put them after WEAPON_DEF, which would otherwise overwrite them. Against that race, the attack gets 50 more, plus 1 for each level the victim is above 50, and a blow that hits is looked up in the damage table a fifth higher.

Armour

ARMOUR_CLOTHES(craftsmanship, magic_bonus)
ARMOUR_LEATHER(...)    ARMOUR_HRD_LEATHER(...)    ARMOUR_CHAIN(...)    ARMOUR_PLATE(...)
ARMOUR_DEF(ARM_CHAIN, craftsmanship, magic_bonus)

The macros set only MANIPULATE_TAKE: add the place where it is worn. Armour protects only where a blow can land. Each blow lands on one place, found with 2d8:

Place Wear flag Chance
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%

The armour worn there decides two things: which column of the weapon's damage table is used, and its craftsmanship and magic are added to the defence. Where nothing is worn, the character's natural armour is used (clothes for a player) with no bonus. Armour of another kind, a cloak about the body for instance, gives no protection.

Heavier armour lowers the wearer's dexterity in a fight, unless they are strong and practised in it; see Abilities. Plate is the best protection and the heaviest burden.

chain_shirt
names {"chain mail shirt", "chain shirt", "shirt"}
title "a chain mail shirt"
descr "A chain mail shirt lies here in a heap."
ARMOUR_CHAIN(BONUS_AVERAGE_PLUS, BONUS_AVERAGE)
manipulate {MANIPULATE_WEAR_BODY}
weight 25
cost 8 GOLD_PIECE
end

Shields

SHIELD_DEF(shield_type, craftsmanship, magic_bonus)

The shield types are SHIELD_SMALL, SHIELD_MEDIUM and SHIELD_LARGE. The server also knows SHIELD_TOWER, but vmc refuses it. The macro sets MANIPULATE_TAKE and MANIPULATE_WEAR_SHIELD.

When a blow hits, a defender who is awake and has a shield tries to use it (shield_bonus() in vme/src/experience.cpp). The shield's own value is 15 for a small shield, 20 medium, 25 large, 35 tower, plus its craftsmanship and magic. Then an opposed check: roll + shield value + the defender's shield skill - the attacker's shield skill - 50 (a monster uses its effective dexterity for the skill; behind a tower shield, the lowest of its strength, constitution and effective dexterity). A defender who can't see the attacker loses 12, and one the attacker can't see gains 12. If the result is 0 or more, the chance to block is a tenth of the result plus half the shield value. Then, depending on the weapon:

  • SHIELD_M_BLOCK: within that chance the blow is stopped, and the shield takes the damage;
  • SHIELD_M_REDUCE (morning star, flail): within that chance the damage is cut by that many percent;
  • SHIELD_M_USELESS (whip): the shield doesn't help.

Attack spells are blocked the same way, each spell with its own method in vme/etc/spells.def. See help shields.

oak_shield
names {"oak shield", "shield"}
title "an oak shield"
descr "A round shield of oak lies here."
SHIELD_DEF(SHIELD_MEDIUM, BONUS_AVERAGE, BONUS_AVERAGE)
weight 10
cost 2 GOLD_PIECE
end

Magic items

An item with magic should have flags {UNIT_FL_MAGIC}; the transfer macros and the potion, scroll, wand and staff macros set it themselves, WEAPON_DEF, ARMOUR_* and SHIELD_DEF don't.

Bonuses while worn

While an item is worn or wielded, transfers change the wearer:

  • STR_TRANSFER(n), DEX_TRANSFER, CON_TRANSFER, CHA_TRANSFER, BRA_TRANSFER, MAG_TRANSFER, DIV_TRANSFER, HIT_TRANSFER: an ability;
  • SKILL_TRANSFER(SKI_x, n), SPELL_TRANSFER(SPL_x, n), WEAPON_TRANSFER(WPN_x, n): a skill, a spell or a weapon skill;
  • SPEED_TRANSFER(n), SLOW_TRANSFER(n), CHAR_FLAG_TRANSFER(flags), PROTECTION_FROM_GOOD, PROTECTION_FROM_EVIL.

n is on the bonus scale, -7 to +7; when the item is loaded it becomes -10 to +10 points (the table is on Abilities). A player can wear many items at once, so even small bonuses add up: give large ones rarely. Magic that changes abilities or skills has to be taken off before a teacher will train the player.

Identifying

The identify spells show an item's numbers, and two extras of your own:

  • extra {"$identify"} is shown by identify and improved identify;
  • extra {"$improved identify"} only by improved identify.

Use them on every magic item to tell the player what they hold:

crown_of_lich
names {"black crown", "crown"}
title "a black crown"
descr "A black crown lies here."
manipulate {MANIPULATE_TAKE, MANIPULATE_WEAR_HEAD}
BRA_TRANSFER(BONUS_EXCELLENT)
extra {"$identify"}
"Once the crown of an undead king, it is said to sharpen the mind."
extra {"$improved identify"}
"The crown adds to the wearer's brain."
weight 2
cost 50 GOLD_PIECE
end

Potions, scrolls, wands and staffs

POTION_DEF(power, spell1, spell2, spell3), SCROLL_DEF(power, spell1, spell2, spell3), WAND_DEF(power, charges, spell1, spell2) and STAFF_DEF(power, charges, spell1, spell2). power takes the place of the caster's skill and ability. Use SPL_NONE for a spell that isn't used; 0 is a real spell.

Notes and signs

An extra with no names, extra {}, is shown when someone looks at the object itself, so it is the text of a note or a sign; read does the same as look.

old_note
names {"old note", "note", "paper"}
title "an old note"
descr "An old note has been dropped here."
manipulate {MANIPULATE_TAKE, MANIPULATE_HOLD}
extra {}
"Written in blood: Help free the world of the evil behind these doors."
extra {"blood"}
"The blood is dried and brown."
weight 1
end

Limiting powerful items

Very good items should be rare. Load them with max in the %reset section, which counts the copies in the whole game, and from a monster that is hard to kill. The rent field charges players for keeping an item, per real day, but only when rent in server.cfg is above 0; it is 0 in the distributed configuration.