Manual:DIL Manual/skill costs
Jump to navigation
Jump to search
Contents
skill_costs
Field (integer, read-only; units: PC).
pc.skill_costs[index] : integer
Despite the name, not a price: the player's racial modifier for the skill with that index, from -3 to +3. It comes from the skill's race <race> = <n> lines in vme/etc/commands.def; a race without such a line gets 0. A positive modifier makes training the skill cheaper and lets it go higher; a negative one does the opposite (teach.cpp). The indexes are the SKI_* constants in vme/include/values.h, from 0 to SKI_TREE_MAX - 1.
Notes
- Players only. On an NPC, an object, a room or null the field fails; so does an index outside 0 to
SKI_TREE_MAX - 1. - It depends only on the player's race: two players of the same race get the same values.
- vmc accepts an assignment, but at run time it fails in every zone: the program logs "DIL SERIOUS: ... Type error in lvalue assignemt" and stops.
Example
dilbegin string race_talent(pc : unitptr, ski : integer);
code
{
if (pc.type != UNIT_ST_PC)
return ("");
if (pc.skill_costs[ski] > 0)
return ("Your race has a talent for " + skill_name(ski) + ".");
if (pc.skill_costs[ski] < 0)
return ("Your race finds " + skill_name(ski) + " hard to learn.");
return ("Your race has no gift for " + skill_name(ski) + ", nor trouble with it.");
}
dilend
Describes how a player's race affects learning a skill.