Manual:DIL Manual/weapon levels
Jump to navigation
Jump to search
Contents
weapon levels
Field (integer, read/write; units: PC).
pc.weapon_levels[idx : integer] : integer
How many times the player has trained the weapon idx (a WPN_* constant, 0 to WPN_TREE_MAX - 1) since gaining the current level. Each training in the same level costs more (teach.cpp), and every level gained sets all of them back to 0. It is not the skill itself: that is weapons.
Notes
- Players only. On an NPC, an object, a room or null the field fails, and so does an index out of range.
- Training a weapon can also count up its weapon group, when the group's skill is raised with it.
- Only a program in a zone with access level 0 (the fourth column of
vme/etc/zonelist) can assign it. Elsewhere vmc accepts the assignment, but at run time the program logs "DIL SERIOUS: ... Type error in lvalue assignemt" and stops. Reading works in every zone. - Stored as an 8-bit unsigned number: values outside 0 to 255 wrap around.
Example
dilbegin show_wpn_train(pc : unitptr);
var
i : integer;
code
{
i := 0;
while (i < WPN_TREE_MAX)
{
if (pc.weapon_levels[i] > 0)
sendtext(weapon_name(i) + ": skill " + itoa(pc.weapons[i]) +
"%, trained " + itoa(pc.weapon_levels[i]) + " times this level.<br/>", self);
i := i + 1;
}
return;
}
dilend
Lists the weapons a player has trained since the last level, with the skill in each.