Difference between revisions of "Manual:DIL Manual/reset vlevel()"
Jump to navigation
Jump to search
(XML import) |
(checked against the compiler and the interpreter; example compiles) |
||
| Line 1: | Line 1: | ||
| − | + | = reset_vlevel() = | |
| + | '''Procedure.''' Sets a mortal player's virtual level back to 1. | ||
| − | + | reset_vlevel(pc : unitptr) | |
| − | + | Sets [[Manual:DIL Manual/vlevel|vlevel]] to 1 and changes nothing else. Experience, abilities, skills and hit points stay as they are; a reroll changes those separately. | |
| − | |||
| − | + | Only a program started in a zone with access level 0 or 1 (the fourth column of <code>vme/etc/zonelist</code>) can use it. What counts is the zone of the program's first template, the one that was <code>dilcopy</code>'d or run as a command. Elsewhere the zone log gets "attempt to reset vlevel w/o access" and the program stops. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | == Parameters == | |
| + | {| class="wikitable" | ||
| + | ! Name !! Type !! Meaning | ||
| + | |- | ||
| + | | pc || unitptr || The player. | ||
| + | |} | ||
| − | + | == Notes == | |
| − | + | * Nothing happens to NPCs, objects and rooms, or to immortals (level <code>IMMORTAL_LEVEL</code> and up). | |
| + | * A null unit variable is logged ("reset_vlevel with no unit") and nothing happens. | ||
| − | + | == Example == | |
| − | + | <pre> | |
| − | + | dilbegin back_to_one(pc : unitptr); | |
| − | + | code | |
| − | + | { | |
| − | + | if ((pc.type != UNIT_ST_PC) or (pc.level >= IMMORTAL_LEVEL)) | |
| − | + | return; | |
| + | reset_level(pc); | ||
| + | reset_vlevel(pc); | ||
| + | reset_race(pc); | ||
| + | sendtext("You are back at level 1.<br/>", pc); | ||
| + | } | ||
| + | dilend | ||
| + | </pre> | ||
| + | Puts a mortal player back to level 1, and resets the virtual level and the race's values (<code>reset_race()</code>) too. | ||
| + | |||
| + | == See also == | ||
| + | * [[Manual:DIL Manual/reset level()|reset_level()]] | ||
| + | * [[Manual:DIL Manual/reset race()|reset_race()]] | ||
| + | * [[Manual:DIL Manual/level|level]] | ||
| + | * [[Manual:DIL Manual/vlevel|vlevel]] | ||
Latest revision as of 23:17, 14 November 2026
reset_vlevel()
Procedure. Sets a mortal player's virtual level back to 1.
reset_vlevel(pc : unitptr)
Sets vlevel to 1 and changes nothing else. Experience, abilities, skills and hit points stay as they are; a reroll changes those separately.
Only a program started in a zone with access level 0 or 1 (the fourth column of vme/etc/zonelist) can use it. What counts is the zone of the program's first template, the one that was dilcopy'd or run as a command. Elsewhere the zone log gets "attempt to reset vlevel w/o access" and the program stops.
Parameters
| Name | Type | Meaning |
|---|---|---|
| pc | unitptr | The player. |
Notes
- Nothing happens to NPCs, objects and rooms, or to immortals (level
IMMORTAL_LEVELand up). - A null unit variable is logged ("reset_vlevel with no unit") and nothing happens.
Example
dilbegin back_to_one(pc : unitptr);
code
{
if ((pc.type != UNIT_ST_PC) or (pc.level >= IMMORTAL_LEVEL))
return;
reset_level(pc);
reset_vlevel(pc);
reset_race(pc);
sendtext("You are back at level 1.<br/>", pc);
}
dilend
Puts a mortal player back to level 1, and resets the virtual level and the race's values (reset_race()) too.