Manual:DIL Manual/experience()
Jump to navigation
Jump to search
experience()
Procedure. Gives a player experience points, or takes them away.
experience(amount : integer, pc : unitptr)
Adds amount to the player's experience (pc.exp); a negative amount takes experience away. The player doesn't gain a level from it: when the experience reaches the next level they are told "You can now raise a level by using the 'level' command!" and raise it themselves.
Parameters
| Name | Type | Meaning |
|---|---|---|
| amount | integer | Experience to add; negative to take away. |
| pc | unitptr | The player. |
Notes
- Only mortal players: on an NPC, an object, a room or null nothing happens, and a god (level
IMMORTAL_LEVEL, 200, or more) keeps the experience they have. - Every call on a player is logged in vme.log: "name gained amount experience from unit symname."
- Experience taken away never drops below what level 1 needs.
Example
dilbegin quest_reward(pc : unitptr, xp : integer);
code
{
if (pc.type != UNIT_ST_PC)
return;
if (xp > 0)
{
experience(xp, pc);
act("You receive $2t experience points.", A_ALWAYS, pc, itoa(xp), null, TO_CHAR);
}
return;
}
dilend
Rewards a player at the end of a quest. Adapted from quests.zon.