Difference between revisions of "Manual:Game Mechanics/Skills"
(→Swim) |
(checked against the current code (wiki review 2026-11-15)) |
||
| Line 1: | Line 1: | ||
| − | + | This page explains how skills, spells and weapon skills are kept, raised and checked, with the checks the game makes for swimming, climbing, searching, picking locks and fleeing as examples. How to write a check of your own in DIL is in the section on the skill check. The players' side is in [[Help/Skills|help skills]]. | |
| − | |||
| − | + | == Four trees == | |
| + | A character's knowledge is kept in four trees: abilities, skills (<code>SKI_*</code>), spells (<code>SPL_*</code>) and weapons (<code>WPN_*</code>). The constants are in <code>vme/include/values.h</code>; the names and the race and profession modifiers in <code>vme/etc/</code>: <code>abilities.def</code>, <code>spells.def</code>, <code>weapons.def</code>, and for skills <code>commands.def</code>. Spells and weapons are grouped in categories: the spell spheres (fire, frost, mind...) and the weapon families (axe and hammer, sword, club and mace, polearm, natural, special). See [[Manual:Zone Manual/Appendices/Skill definitions in values.h|skills]], [[Manual:Zone Manual/Appendices/Spell definitions in values.h|spells]] and [[Manual:Zone Manual/Appendices/weapon definitions in values.h|weapons]]. | ||
| − | Players | + | === Players === |
| + | A player has a value in every skill, spell and weapon, and trains them one at a time with skill points (see [[Manual:Game Mechanics/Levels#Training|Levels]]). A practice raises a skill by 5 while it is below 10, by 4 below 20, by 3 below 40, by 2 below 75 and by 1 from 75. Practised once every level, a skill reaches 40 after 11 practices, 75 after 29 and 100 after 53. A practice also raises the category above it (such as "sword" above "long sword") to half the new value, when the category is lower. | ||
| − | + | === Monsters === | |
| + | A monster has no skills. Where a player would use a skill, a monster uses the ability that goes with it: in a climb, its dexterity; when it swims, its constitution. A monster has weapon and spell skills only by category: one value for all swords, one for all fire spells. They are set as percentages in the zone, see [[Manual:Game Mechanics/Monsters|Monsters]]. | ||
| − | + | == What a value means == | |
| + | Skills and difficulties use the same scale. As a rule of thumb for choosing a difficulty: | ||
| + | {| class="wikitable" | ||
| + | ! Value !! Meaning | ||
| + | |- | ||
| + | | 0 || No idea how to do it. | ||
| + | |- | ||
| + | | 40 || An ordinary person, an ordinary swimmer. | ||
| + | |- | ||
| + | | 100 || The best a human could be. | ||
| + | |- | ||
| + | | 200 || Far beyond any human. | ||
| + | |} | ||
| + | A player can train a skill to about 110 at most, and much less in skills their race and profession don't suit (see [[Manual:Game Mechanics/Levels#How far a player can train|Levels]]); magic can add to it. | ||
| − | + | == The skill check == | |
| − | + | A check against a difficulty (see [[Manual:Game Mechanics/Introduction|Introduction]]): | |
| − | |||
| − | |||
| − | + | result = open-ended 1d100 + skill - difficulty - 50 | |
| + | It succeeds when the result is above 0, which is half the time when skill and difficulty are equal. For a player, "skill" is (2 × skill + ability) / 3; for a monster it is the ability. The result is also a measure of how well or how badly it went. | ||
| − | = | + | In DIL, use the functions in <code>skills.zon</code>: |
| − | + | {| class="wikitable" | |
| + | ! Function !! What it checks | ||
| + | |- | ||
| + | | <code>skillchecksa@skills(skill, ability, difficulty)</code> || <code>self</code> against a difficulty, as above. | ||
| + | |- | ||
| + | | <code>skillchecksau@skills(u, skill, ability, difficulty)</code> || the same for the character <code>u</code>. | ||
| + | |- | ||
| + | | <code>skillbattle1@skills(skill, ability, opponent, ability2)</code> || <code>self</code> against an opponent: roll + own ability + own skill - opponent's ability - opponent's skill (in the same skill) - 50. A monster's skill counts as its ability. | ||
| + | |- | ||
| + | | <code>skillbattle2@skills(skill, abil1, abil2, opponent, oabil1, oabil2)</code> || <code>self</code> against an opponent, each side with two abilities (two parts the first, one part the second), and for a player two parts skill to one part those abilities. | ||
| + | |- | ||
| + | | <code>skillresist@function(aa, ad, sa, sd)</code> || the opposed check from numbers: roll + aa + sa - ad - sd - 50. | ||
| + | |} | ||
| + | They all roll [[Manual:DIL Manual/openroll()|openroll(100, 5)]] and return the result; above 0 is a success. A check of your own, in a template put on a room: | ||
| + | <pre> | ||
| + | dilbegin lift_rock(); | ||
| + | external | ||
| + | integer skillchecksau@skills(u : unitptr, skillidx : integer, abiidx : integer, difficulty : integer); | ||
| + | var | ||
| + | hm : integer; | ||
| + | code | ||
| + | { | ||
| + | :start: | ||
| + | wait(SFB_CMD, command("lift")); | ||
| + | block; | ||
| + | // the one who typed it: climbing skill and strength, against a difficulty of 60 | ||
| + | hm := skillchecksau@skills(activator, SKI_CLIMB, ABIL_STR, 60); | ||
| + | if (hm > 0) | ||
| + | act("You lift the rock.", A_ALWAYS, activator, null, null, TO_CHAR); | ||
| + | else | ||
| + | act("The rock doesn't move.", A_ALWAYS, activator, null, null, TO_CHAR); | ||
| + | goto start; | ||
| + | } | ||
| + | dilend | ||
| + | </pre> | ||
| + | In a template on a room, <code>self</code> is the room, so use <code>skillchecksau@skills</code> with the character; <code>skillchecksa@skills</code> checks <code>self</code> and fits a template running on the character. | ||
| − | + | == Difficulties on exits == | |
| − | + | An exit has one <code>difficulty</code>, 0 to 250, which every check through that exit uses: searching for it if it is hidden, climbing it, swimming through it and picking its lock. | |
| − | + | <pre> | |
| − | + | west to cave difficulty 30 open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED, EX_HIDDEN} | |
| + | keyword {"boulder"} key cave_key; | ||
| + | </pre> | ||
| + | == Examples from the game == | ||
| − | + | === Swimming === | |
| − | + | A character moving into or out of a room with <code>movement SECT_WATER_SWIM</code> must have <code>swim on</code> or use <code>swim <direction></code>. Each move makes a check (<code>vme/src/act_movement.cpp</code>): | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | roll + (2 × swimming + CON) / 3 - (difficulty of the exit - bonus) - 50 | |
| − | + | The bonus is 50 for the arthropod races, 80 for an amphibian and 100 for a fish (the extras <code>$is_amphib</code> and <code>$is_fish</code>). A result below 0 means the swimmer flounders: they don't move, and lose a hit point for each full 10 points below 0; it can drown them. Rooms with <code>SECT_WATER_SAIL</code> are deep water: a character can't enter them without a boat, and swimming out of them to land adds 150 to the difficulty. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | A | + | A river can carry swimmers along with <code>watercurrent@basemove(direction, messages, beats)</code>: every 5 seconds it counts up, and after ''beats'' counts it carries everyone and everything in the room through the exit. Characters make the swimming check against that exit's difficulty first (in DIL, so with <code>openroll(100, 5)</code>); one who fails loses the hit points but is carried along all the same. From the forest of Haon-Dor in <code>haon_dor.zon</code>, shortened: |
| − | + | <pre> | |
| − | + | lightriver | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
title "On the River in Haon-Dor" | title "On the River in Haon-Dor" | ||
| − | descr "The river slowly flows east towards the village of Udgaard | + | descr |
| − | + | "The river slowly flows east towards the village of Udgaard." | |
| − | movement | + | movement SECT_WATER_SWIM |
| − | + | west to darkriver difficulty 20 descr | |
| − | + | "Much further upstream the forest becomes more dense."; | |
| − | west | + | east to river@udgaard difficulty 0 descr "The river continues to the east."; |
| − | east | + | dilcopy watercurrent@basemove(DIR_EAST, |
| − | + | {"The river current gently takes you east.", "$1n gently flows away to the east.", | |
| − | + | "You gently flow a little further eastwards.", "$1n flows in from the west."}, 5); | |
| − | dilcopy watercurrent@basemove(DIR_EAST,{ | + | end |
| − | + | </pre> | |
| − | + | Swimming east with the current is easy (0); west, upstream, is harder (20). See [[Help/Swimming|help swimming]]. | |
| − | |||
| − | |||
| − | |||
| − | end</ | ||
| − | === | + | === Climbing === |
| + | <code>climb <direction></code> through an exit with <code>EX_CLIMB</code> checks the climb skill and dexterity against the exit's difficulty, with 5 more for each point the climber is drunk, and costs 6 endurance. A failed climber falls and takes 5 hit points for each full 10 points of failure (another number with an extra <code>$climb_<direction></code> on the room). See [[Manual:Zone Manual/The Room Section/Climbing|Climbing]]. | ||
| − | + | === Searching === | |
| + | <code>search <direction or exit name></code> looks for an exit with <code>EX_HIDDEN</code>: a check of the search skill and brain against the exit's difficulty (<code>search_dil@basemove</code>). Each search costs 10 endurance (<code>SEARCH_DRAIN_AMOUNT</code>), and a player with less than 10 can't search. A found exit stays found for that player only. Gods always find it. See [[Manual:Game Mechanics/Rooms#Secret doors|Rooms]] and [[Help/Search|help search]]. | ||
| − | + | === Picking locks === | |
| − | + | <code>pick</code> checks the pick lock skill and dexterity against the exit's difficulty, or a container's own <code>difficulty</code>. A result below 0 fails and costs that much endurance. <code>EX_PICKPROOF</code> can't be picked, and a door without a key has no keyhole to pick. | |
| − | |||
| − | + | === Fleeing === | |
| − | + | <code>flee</code> (<code>flee@skills</code>) needs 20 endurance and costs 20. It is an opposed check: the flee skill, dexterity and brain of the one fleeing against the dexterity and brain of their opponent (<code>skillbattle2</code>, so a monster's flee skill is its dexterity and brain). The result doesn't decide whether the flight succeeds, but how it goes: | |
| + | * above -35: a clean escape; | ||
| + | * -35 or worse: the opponent gets a free blow as the character flees, with 50 minus the result added to its roll; | ||
| + | * -50 or worse: in one case of five the character panics instead, and stays in the fight. | ||
| + | The direction is random, among the exits that can be used; an extra made with <code>NO_FLEE_LEAVE</code> on the room blocks the directions it names. See [[Help/Fleeing|help fleeing]]. | ||
| − | == | + | == Weapon and spell skills == |
| + | A player's skill in a weapon is how well they attack with it; half of it is how well they defend against it. With a weapon they haven't practised, they use the skill of its family, and with neither they attack at -25. A monster attacks with its family skill and defends with half of it. | ||
| − | + | Spells are much the same: a player casts with their skill in the spell itself, and resists a spell with half their skill in it or their skill in its sphere, whichever is higher; a monster casts with its sphere skill and resists with half of it. The numbers are on [[Manual:Game Mechanics/Combat|Combat]]. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Latest revision as of 06:27, 15 November 2026
This page explains how skills, spells and weapon skills are kept, raised and checked, with the checks the game makes for swimming, climbing, searching, picking locks and fleeing as examples. How to write a check of your own in DIL is in the section on the skill check. The players' side is in help skills.
Contents
Four trees
A character's knowledge is kept in four trees: abilities, skills (SKI_*), spells (SPL_*) and weapons (WPN_*). The constants are in vme/include/values.h; the names and the race and profession modifiers in vme/etc/: abilities.def, spells.def, weapons.def, and for skills commands.def. Spells and weapons are grouped in categories: the spell spheres (fire, frost, mind...) and the weapon families (axe and hammer, sword, club and mace, polearm, natural, special). See skills, spells and weapons.
Players
A player has a value in every skill, spell and weapon, and trains them one at a time with skill points (see Levels). A practice raises a skill by 5 while it is below 10, by 4 below 20, by 3 below 40, by 2 below 75 and by 1 from 75. Practised once every level, a skill reaches 40 after 11 practices, 75 after 29 and 100 after 53. A practice also raises the category above it (such as "sword" above "long sword") to half the new value, when the category is lower.
Monsters
A monster has no skills. Where a player would use a skill, a monster uses the ability that goes with it: in a climb, its dexterity; when it swims, its constitution. A monster has weapon and spell skills only by category: one value for all swords, one for all fire spells. They are set as percentages in the zone, see Monsters.
What a value means
Skills and difficulties use the same scale. As a rule of thumb for choosing a difficulty:
| Value | Meaning |
|---|---|
| 0 | No idea how to do it. |
| 40 | An ordinary person, an ordinary swimmer. |
| 100 | The best a human could be. |
| 200 | Far beyond any human. |
A player can train a skill to about 110 at most, and much less in skills their race and profession don't suit (see Levels); magic can add to it.
The skill check
A check against a difficulty (see Introduction):
result = open-ended 1d100 + skill - difficulty - 50
It succeeds when the result is above 0, which is half the time when skill and difficulty are equal. For a player, "skill" is (2 × skill + ability) / 3; for a monster it is the ability. The result is also a measure of how well or how badly it went.
In DIL, use the functions in skills.zon:
| Function | What it checks |
|---|---|
skillchecksa@skills(skill, ability, difficulty) |
self against a difficulty, as above.
|
skillchecksau@skills(u, skill, ability, difficulty) |
the same for the character u.
|
skillbattle1@skills(skill, ability, opponent, ability2) |
self against an opponent: roll + own ability + own skill - opponent's ability - opponent's skill (in the same skill) - 50. A monster's skill counts as its ability.
|
skillbattle2@skills(skill, abil1, abil2, opponent, oabil1, oabil2) |
self against an opponent, each side with two abilities (two parts the first, one part the second), and for a player two parts skill to one part those abilities.
|
skillresist@function(aa, ad, sa, sd) |
the opposed check from numbers: roll + aa + sa - ad - sd - 50. |
They all roll openroll(100, 5) and return the result; above 0 is a success. A check of your own, in a template put on a room:
dilbegin lift_rock();
external
integer skillchecksau@skills(u : unitptr, skillidx : integer, abiidx : integer, difficulty : integer);
var
hm : integer;
code
{
:start:
wait(SFB_CMD, command("lift"));
block;
// the one who typed it: climbing skill and strength, against a difficulty of 60
hm := skillchecksau@skills(activator, SKI_CLIMB, ABIL_STR, 60);
if (hm > 0)
act("You lift the rock.", A_ALWAYS, activator, null, null, TO_CHAR);
else
act("The rock doesn't move.", A_ALWAYS, activator, null, null, TO_CHAR);
goto start;
}
dilend
In a template on a room, self is the room, so use skillchecksau@skills with the character; skillchecksa@skills checks self and fits a template running on the character.
Difficulties on exits
An exit has one difficulty, 0 to 250, which every check through that exit uses: searching for it if it is hidden, climbing it, swimming through it and picking its lock.
west to cave difficulty 30 open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED, EX_HIDDEN}
keyword {"boulder"} key cave_key;
Examples from the game
Swimming
A character moving into or out of a room with movement SECT_WATER_SWIM must have swim on or use swim <direction>. Each move makes a check (vme/src/act_movement.cpp):
roll + (2 × swimming + CON) / 3 - (difficulty of the exit - bonus) - 50
The bonus is 50 for the arthropod races, 80 for an amphibian and 100 for a fish (the extras $is_amphib and $is_fish). A result below 0 means the swimmer flounders: they don't move, and lose a hit point for each full 10 points below 0; it can drown them. Rooms with SECT_WATER_SAIL are deep water: a character can't enter them without a boat, and swimming out of them to land adds 150 to the difficulty.
A river can carry swimmers along with watercurrent@basemove(direction, messages, beats): every 5 seconds it counts up, and after beats counts it carries everyone and everything in the room through the exit. Characters make the swimming check against that exit's difficulty first (in DIL, so with openroll(100, 5)); one who fails loses the hit points but is carried along all the same. From the forest of Haon-Dor in haon_dor.zon, shortened:
lightriver
title "On the River in Haon-Dor"
descr
"The river slowly flows east towards the village of Udgaard."
movement SECT_WATER_SWIM
west to darkriver difficulty 20 descr
"Much further upstream the forest becomes more dense.";
east to river@udgaard difficulty 0 descr "The river continues to the east.";
dilcopy watercurrent@basemove(DIR_EAST,
{"The river current gently takes you east.", "$1n gently flows away to the east.",
"You gently flow a little further eastwards.", "$1n flows in from the west."}, 5);
end
Swimming east with the current is easy (0); west, upstream, is harder (20). See help swimming.
Climbing
climb <direction> through an exit with EX_CLIMB checks the climb skill and dexterity against the exit's difficulty, with 5 more for each point the climber is drunk, and costs 6 endurance. A failed climber falls and takes 5 hit points for each full 10 points of failure (another number with an extra $climb_<direction> on the room). See Climbing.
Searching
search <direction or exit name> looks for an exit with EX_HIDDEN: a check of the search skill and brain against the exit's difficulty (search_dil@basemove). Each search costs 10 endurance (SEARCH_DRAIN_AMOUNT), and a player with less than 10 can't search. A found exit stays found for that player only. Gods always find it. See Rooms and help search.
Picking locks
pick checks the pick lock skill and dexterity against the exit's difficulty, or a container's own difficulty. A result below 0 fails and costs that much endurance. EX_PICKPROOF can't be picked, and a door without a key has no keyhole to pick.
Fleeing
flee (flee@skills) needs 20 endurance and costs 20. It is an opposed check: the flee skill, dexterity and brain of the one fleeing against the dexterity and brain of their opponent (skillbattle2, so a monster's flee skill is its dexterity and brain). The result doesn't decide whether the flight succeeds, but how it goes:
- above -35: a clean escape;
- -35 or worse: the opponent gets a free blow as the character flees, with 50 minus the result added to its roll;
- -50 or worse: in one case of five the character panics instead, and stays in the fight.
The direction is random, among the exits that can be used; an extra made with NO_FLEE_LEAVE on the room blocks the directions it names. See help fleeing.
Weapon and spell skills
A player's skill in a weapon is how well they attack with it; half of it is how well they defend against it. With a weapon they haven't practised, they use the skill of its family, and with neither they attack at -25. A monster attacks with its family skill and defends with half of it.
Spells are much the same: a player casts with their skill in the spell itself, and resists a spell with half their skill in it or their skill in its sphere, whichever is higher; a monster casts with its sphere skill and resists with half of it. The numbers are on Combat.