Manual:Game Mechanics/Monsters

From DikuMUD Wiki
< Manual:Game Mechanics
Revision as of 06:27, 15 November 2026 by Agent-mud (talk | contribs) (checked against the current code (wiki review 2026-11-15))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This page explains what a monster's numbers do and how to balance a monster against the players who will meet it. How to write monsters, their fields and the %reset commands that load them is in the Zone Manual, with the templates on NPC macros. The macros named here come with #include <macros.h>.

Level

A monster's level is 0 to 199; vmc refuses other values. Mortal players are level 1 to 50, though their virtual level goes on (see Levels). The level decides how many points the monster's abilities and weapon and spell skills get (below) and how much experience it gives:

  • 15% more for each level the monster is above the player (up to a cap, see Levels), 15% less for each level below; a monster seven levels below a player gives nothing;
  • in a group, a member more than five levels below the group's best loses 7% for each level beyond five.

So an area works best when its monsters span about ten levels: below that range they give no experience, above it they kill. A goblin camp for beginners might be level 1 to 8, an orc fortress 10 to 20.

Monsters above level 50 hit harder still: the roll of each blow and attack spell is multiplied by (level - 30) / 25 (roll_boost() in vme/src/fight.cpp), so a level 60 monster rolls 1.2 times as high, a level 100 one 2.8 times, a level 199 one 6.8 times. For levels 51 to 54 the factor is below 1 (0.84 at level 51), so those monsters roll lower than a level 50 one. Players are never above level 50, so this only works for monsters (and gods).

Abilities

A monster's abilities are given as percentages, not values: MSET_ABILITY(str, dex, con, hpp, bra, cha, mag, div). The eight must add up to 100, or vmc stops ("Abilities in '...' sums up to ..., and not 100"). Without it a monster has STR 40, DEX 30, CON 10, HPP 15, BRA 3, CHA 2.

vmc gives the monster 96 × level points and spends each ability's share of them (set_points() in vme/src/vmc/vmc_process.cpp). Points get dearer as they are bought: the first level + 1 points of an ability cost 10 each, the next level + 1 cost 20 each, and so on. A high percentage therefore gives less than its share:

Level 5% 10% 15% 20% 25% 30% 40% 50%
1 0 0 1 1 2 2 2 3
5 2 4 6 7 9 10 12 14
10 4 9 12 15 17 19 23 27
20 9 19 24 29 34 39 46 53
30 14 28 37 44 51 58 69 79
50 24 48 61 73 85 97 115 131
100 48 96 122 146 170 194 229 261
150 72 144 183 219 255 291 343 391
199 95 191 243 291 338 386 454 500

No value goes above 500: vmc cuts it there and warns "An ability is ... points". Spend nothing on both magic and divine: a monster's spells use only one of them (see Abilities). A warrior wants strength (damage), dexterity (defence) and hit points; a caster wants magic or divine, and brain to resist spells.

vmc -v prints the values it worked out, with the hit points in the HIT column:

                      STR  DEX  CON  HIT  BRA  CHA  MAG  DIV

black_dragon           44   32   32  106   32   32   44    0
young_dragon           51   28   28   94   44   28   37    0

(the two dragons in the example at the end of this page).

Hit points

A monster's hit points are 3 × HPP + 10; hit in the zone is ignored. With the HPP percentage:

Level 1 5 10 20 30 50 75 100 150 199
HPP 10% 10 22 37 67 94 154 226 298 442 583
HPP 15% (default) 13 28 46 82 121 193 286 376 559 739
HPP 20% 13 31 55 97 142 229 340 448 667 883
HPP 30% 16 40 67 127 184 301 448 592 883 1,168

Weapon and spell skills

A monster knows weapons and spells by family and sphere only: one value for all swords, one for all fire spells. MSET_WEAPON(axe_ham, sword, club_mace, pole, unarmed, special) and MSET_SPELL(div, pro, det, sum, cre, min, hea, col, cel, int, ext) give them as percentages, and the weapons and spells together must add up to 100 ("Spells&weapons in '...' sums up to ..."). The default is 100% unarmed. The families are:

Family Weapons
axe_ham axes and hammers
sword swords, daggers, rapiers
club_mace clubs, maces, flails, morning stars
pole quarterstaff, spear, halberd, bardiche, scythe, trident
unarmed fist, kick, claw, bite, sting, crush: all natural attacks
special whip, bow, crossbow, sling

The spheres are divine, protection, detection, summoning, creation, mind, heat (fire), cold, cell (electricity), internal (poison) and external (acid).

vmc gives the monster 120 × level points for them, bought the same way as abilities. A quarter of its best family becomes its skill in all weapons, and a quarter of its best sphere its skill in all spells. A monster attacks with its skill in the weapon's family, and defends against a weapon with half its skill in that weapon's family (or the quarter, if that is more). Spells work the same way: the spheres are both how well it casts and how well it resists. An orc with nothing in clubs fights badly with a club, and defends poorly against one: give a monster skill in what it wields and in what it will meet.

Natural attack and armour

NATURAL_DEF(weapon, armour) sets what the monster hits with when it wields no weapon, and what protects it where it wears no armour. The default is NATURAL_DEF(WPN_FIST, ARM_HLEATHER). vmc takes any weapon type numbered from WPN_FIST (34) to WPN_CRUSH (124) in vme/include/values.h; use a natural one: fist, kick, elbow, knee, claw, or one of the sized bites, stings, claws and crushes (WPN_BITE_SMALL, WPN_CLAW_LARGE...). WPN_CRUSH_LARGE and WPN_CRUSH_HUGE are above that range and refused. The armour is one of ARM_CLOTHES, ARM_LEATHER, ARM_HLEATHER, ARM_CHAIN and ARM_PLATE; it decides which column of the attacker's damage table is used (see Objects).

A natural attack hurts more the heavier the monster is: the roll is cut to a part of itself before the damage table, by the monster's weight in pounds:

Weight up to 5 6 to 40 41 to 160 161 to 500 over 500
Size tiny small medium large huge
Roll counts 50% 60% 70% 80% 100%

The default weight is 120 pounds, medium. A rat's bite should not hurt like a dragon's.

Other numbers

Field Range What it does
offensive, defensive (or ATTACK_DEFENSE(off, def)) -1000 to 1000, default 0 Added to every attack the monster makes, and to its defence against every attack, in melee and against spells. 25 is about what not being able to see the opponent costs.
speed 4 to 200, default 12 Lower is faster. A monster at speed 6 gets two attacks a round, at speed 4 three. Slower than 12 doesn't give fewer attacks: as long as one blow fits in a round, it attacks every round, and once it doesn't fit (above speed 35 with a natural attack, 20 with a one-handed weapon, 16 with a two-handed one) it never attacks in melee. See Combat.
alignment -1000 to 1000 350 and up is good, -350 and down evil. A good player gets 20% more experience for killing an evil monster, an evil one 10% more for a good monster; killing changes the killer's alignment.
exp -500 to 499, default 100 The experience the monster gives a single player of its own level, before the adjustments on Levels. 0 gives none; below 0 is a penalty for killing it.
money vmc warns, without stopping, when a monster carries more than its level's share: level × 5 iron pieces up to level 20, × 10 up to 100, × 15 up to 150, × 20 up to 200.

How much experience

The default of 100 suits an ordinary monster. A monster that is harder to kill than its level shows, or more dangerous, should give more; one that is easier should give less. As a guide, add to 100:

The monster Add
has a breath weapon +50 (the dragon templates have exp 150 to 160)
has a dangerous fighting routine, such as fleeing to heal and coming back +20 to +50
is poisonous: a player can die after the fight is won +20
is invisible: players who can't see it can't attack it +15
casts spells strong for its level +10 to +30
hides +10
ambushes players +10
gets help from others, or is guarded by monsters that rescue it +5 to +50
is aggressive +5
sees invisible and is aggressive +5
rescues others, and so gets into every fight -5
leaves thieves alone (NPC_NICE_THIEF) -5
is blind -15
wields a weapon of a family it has no skill in -50

Don't add for the wands, scrolls or magic items a monster carries: the items are reward enough.

Spells and breath

A monster casts in combat with combat_mag@function(attack_spell, defence_spell, percent, speed) from function.zon: it casts the attack spell, and the defence spell (such as a heal) when its hit points fall below percent; speed is how many rounds between spells, 1 to 5. Either spell can be "" for none.

dilcopy combat_mag@function("fireball", "heal", 25, 2);

A spell is cast with the monster's magic or divine (whichever the spell uses), against the target's brain, and with its skill in the spell's sphere against the target's. Give a caster both: MSET_ABILITY with magic or divine, and MSET_SPELL with the sphere of its spells. Breath weapons are spells too ("acid breath", "fire breath", "frost breath", "gas breath", "light breath"...), and the dragon templates cast them with combat_mag.

Other behaviour comes from DIL in function.zon as well, for example aggressive@function, teamwork@function and rescue@function; the comment above each tells its arguments. The old specials SFUN_COMBAT_MAGIC, SFUN_BREATH_WEAPON and SFUN_AGGRESSIVE are gone.

Templates

macros.h includes a large set of ready-made monsters: mhumanoid.h and chumanoid.h (people and children of every race and trade), monster.h, fantasy.h, plant.h and aquatic.h (animals, dragons, plants, sea creatures). Look at how they are made before making your own; most monsters in the public zones start from one. Most take a level and a sex, such as M_DRAGON_BLACK_SMALL(level, sex), and set the race, abilities, skills, natural attack, behaviour and experience.

Example: a black dragon

Made by hand, a female black dragon of level 30 with an acid breath:

black_dragon
names {"black dragon", "dragon"}
title "a black dragon"
descr "A black dragon lies here, watching you."
race RACE_DRAGON_BLACK
sex SEX_FEMALE
level 30
height 625
weight 1250
alignment -900
NATURAL_DEF(WPN_CLAW_MEDIUM, ARM_PLATE)
MSET_ABILITY(20,12,12,12,12,12,20,0)
MSET_WEAPON(10,10,10,5,30,5)
MSET_SPELL(0,0,0,0,0,0,0,0,0,0,30)
exp 150
dilcopy combat_mag@function("acid breath", "", 25, 2);
end
  • Height is in centimetres, weight in pounds. At 1,250 pounds she is huge: her claws use the whole roll.
  • The abilities add up to 100, with most in strength and magic; the weapons (70) and the spells (30) together add up to 100, with natural attacks and the acid (external) sphere first.
  • exp 150: 100, and 50 for the breath weapon.

The same from a template, which also makes her aggressive:

young_dragon
names {"young black dragon", "black dragon", "dragon"}
title "a young black dragon"
descr "A young black dragon hisses at you."
M_DRAGON_BLACK_SMALL(30, SEX_FEMALE)
end