Difference between revisions of "Skills (Programming)"
(New page: ---++Programming with Skills Sometimes when a player tries to do something, you want to allow the possibility of failure. This is usually done via a skill check. Skills in the HellMOO s...) |
imported>Zell (Mediawiki formatting) |
||
| Line 1: | Line 1: | ||
=Programming with Skills= | |||
Sometimes when a player tries to do something, you want to allow the possibility of failure. This is usually done via a skill check. | Sometimes when a player tries to do something, you want to allow the possibility of failure. This is usually done via a skill check. | ||
| Line 7: | Line 7: | ||
To actually make a "skill roll" (roll the dice vs. a player's skill to see what happened), you use one simple verb call: | To actually make a "skill roll" (roll the dice vs. a player's skill to see what happened), you use one simple verb call: | ||
'''$skill:check(OBJ creature, INT modifier [,INT dont-improve]) => INT success-value''' | |||
This check rolls 3d6 against the creature's calculated skill total (including such things as encumbrance and drug penalties), applies the modifier, and returns a success value -- 0 or greater being a success, less than 0 a failure. It will also possibly give the player an improvement point, unless the third arg is passed and true (dont-improve). You may want to do this for situations where a skill would be checked a large number of times, to prevent abuse. | This check rolls 3d6 against the creature's calculated skill total (including such things as encumbrance and drug penalties), applies the modifier, and returns a success value -- 0 or greater being a success, less than 0 a failure. It will also possibly give the player an improvement point, unless the third arg is passed and true (dont-improve). You may want to do this for situations where a skill would be checked a large number of times, to prevent abuse. | ||
==What's a modifier, and what's the result?== | |||
As detailed in SystemSkills, 3d6 are rolled on a skill check -- if the roll is less than or equal to the creature's skill total <i>plus the modifier</i>, the creature made it. So the modifier is effectively a one-time bonus to the creature's skill. | As detailed in SystemSkills, 3d6 are rolled on a skill check -- if the roll is less than or equal to the creature's skill total <i>plus the modifier</i>, the creature made it. So the modifier is effectively a one-time bonus to the creature's skill. | ||
| Line 19: | Line 19: | ||
The result value is similarly scaled -- this is simply the amount by which they made (or if negative, missed) their skill roll on 3d6. | The result value is similarly scaled -- this is simply the amount by which they made (or if negative, missed) their skill roll on 3d6. | ||
==Preventing abuse== | |||
One major problem in skill-check programming is avoiding the 'try again' syndrome -- what in your object prevents the player from simply trying again and again until they succeed? Generally this is achieved by checking for a 'critical failure' -- a result roll of less than -7 or so -- and causing some unpleasant result, such as injury or the loss of some item involved in the activity. It's important to provide some kind of negative outcome to avoid 'try again' syndrome. | One major problem in skill-check programming is avoiding the 'try again' syndrome -- what in your object prevents the player from simply trying again and again until they succeed? Generally this is achieved by checking for a 'critical failure' -- a result roll of less than -7 or so -- and causing some unpleasant result, such as injury or the loss of some item involved in the activity. It's important to provide some kind of negative outcome to avoid 'try again' syndrome. | ||
==Reading a skill total== | |||
Occasionally, you don't actually want a skill check; you just want to know a player's skill rating, perhaps to restrict attempts at some task to people of a minimum level. | Occasionally, you don't actually want a skill check; you just want to know a player's skill rating, perhaps to restrict attempts at some task to people of a minimum level. | ||
'''$skill:total(OBJ creature) => INT skill-total''' | |||
This verb simply returns the creature's total for that skill, adjusted by encumbrance and drugs and so forth. No skill improvement happens on this call. | This verb simply returns the creature's total for that skill, adjusted by encumbrance and drugs and so forth. No skill improvement happens on this call. | ||
Revision as of 08:46, 1 January 2009
Programming with Skills
Sometimes when a player tries to do something, you want to allow the possibility of failure. This is usually done via a skill check.
Skills in the HellMOO system are objects -- leaves of $skill, all referenced by name on $skills ($skills.dodge, $skills.repair, etc). If your object needs to keep track of what skill a player uses to interact with it, you can store object-number references to these skill objects.
To actually make a "skill roll" (roll the dice vs. a player's skill to see what happened), you use one simple verb call:
$skill:check(OBJ creature, INT modifier [,INT dont-improve]) => INT success-value
This check rolls 3d6 against the creature's calculated skill total (including such things as encumbrance and drug penalties), applies the modifier, and returns a success value -- 0 or greater being a success, less than 0 a failure. It will also possibly give the player an improvement point, unless the third arg is passed and true (dont-improve). You may want to do this for situations where a skill would be checked a large number of times, to prevent abuse.
What's a modifier, and what's the result?
As detailed in SystemSkills, 3d6 are rolled on a skill check -- if the roll is less than or equal to the creature's skill total <i>plus the modifier</i>, the creature made it. So the modifier is effectively a one-time bonus to the creature's skill.
In practice, this means a 2 or 3 represents an average not-too-difficult task, although creatures without any points in the skill will still probably fail. A 0 represents a task that is somewhat challenging for someone of average skill. A -3 would be a fairly hard task -- someone with a 10 skill total would fail this task about 70% of the time.
The result value is similarly scaled -- this is simply the amount by which they made (or if negative, missed) their skill roll on 3d6.
Preventing abuse
One major problem in skill-check programming is avoiding the 'try again' syndrome -- what in your object prevents the player from simply trying again and again until they succeed? Generally this is achieved by checking for a 'critical failure' -- a result roll of less than -7 or so -- and causing some unpleasant result, such as injury or the loss of some item involved in the activity. It's important to provide some kind of negative outcome to avoid 'try again' syndrome.
Reading a skill total
Occasionally, you don't actually want a skill check; you just want to know a player's skill rating, perhaps to restrict attempts at some task to people of a minimum level.
$skill:total(OBJ creature) => INT skill-total
This verb simply returns the creature's total for that skill, adjusted by encumbrance and drugs and so forth. No skill improvement happens on this call.
-- Main.GilMore - 03 May 2004