Difference between revisions of "Manual:DIL Manual/reset race()"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
(checked against the compiler and the interpreter; example compiles)
 
Line 1: Line 1:
−
<span id="bpresetrace"></span>
+
= reset race() =
 +
'''Procedure.''' Rolls a player's body again from the race's values: weight, height, lifespan and age.
  
−
  '''Function:'''  <i><!--CODE-->reset_race( u : unitptr ) ;</i><!--ENDCODE-->
+
  reset_race(pc : unitptr)
  
−
<!--TERM--> '''u'''
+
The player keeps their race and sex. The server takes that race's entry in <code>races.def</code> (the male or female values, by the player's sex) and rolls the numbers again with its dice, the same way as when a character is made:
−
<!--DEFINITION-->        player your resetting
+
* weight and base weight: the race's weight plus its weight dice;
 +
* height: the race's height plus its height dice;
 +
* lifespan: the race's lifespan plus its lifespan dice;
 +
* birth: the character's creation time minus the race's starting age plus its age dice, in mud years. The player's age is counted from that.
  
−
Reset a characters race, weight, height, age, lifespan, and costs for training.
+
Use it after changing <code>pc.race</code>, or in a reroll together with [[Manual:DIL Manual/reset level()|reset level()]] and [[Manual:DIL Manual/reset vlevel()|reset vlevel()]].
−
As if you first log on the character.  Great for reroll along with 'reset_level' and 'reset_vlevel'.
 
−
'''Example: '''<i><!--CODE-->reset_race (u);</i><!--ENDCODE-->
 
−
'''See Also'''
 
−
<i><!--CODE-->
 
−
[[#bpresetlevel|reset a players level]] and
 
−
[[#bpresetvlevel|reset a players virtual level]]</i><!--ENDCODE-->
 
  
 +
== Parameters ==
 +
{| class="wikitable"
 +
! Name !! Type !! Meaning
 +
|-
 +
| pc || unitptr || The player to roll again.
 +
|}
  
 +
== Notes ==
 +
* Only a program in a zone with access level 0 or 1 (the fourth column of <code>vme/etc/zonelist</code>) may call it. Elsewhere it writes "DIL '...' attempt to reset race w/o access." to the zone log and the program stops.
 +
* Players only. On an NPC, an object or a room it does nothing.
 +
* A unitptr variable that is null writes "reset_race with no unit." to the zone log and does nothing. vmc refuses a literal <code>null</code>.
 +
* It does not change the race, abilities, skills, training costs or level. (The old page said it also reset training costs: it doesn't.)
 +
* The player's race must be one of the races (0 to 99). With a larger value in <code>pc.race</code> the server stops on an assertion.
  
−
---~---~---~---~---~---~---~---~---
+
== Example ==
−
<span id="bpresetrace"></span>
+
<pre>
 +
dilbegin reroll_body(pc : unitptr);
 +
code
 +
{
 +
  if (pc.type != UNIT_ST_PC)
 +
      return;
 +
  reset_race(pc);
 +
  sendtext("Your body changes. You are now " + itoa(pc.height) + " cm tall and weigh " +
 +
            itoa(pc.weight) + " pounds.<br/>", pc);
 +
}
 +
dilend
 +
</pre>
 +
Rolls a player's body again and tells them their new height and weight.
  
−
'''Function:'''  <i><!--CODE-->reset_race( u : unitptr ) ;</i><!--ENDCODE-->
+
== See also ==
−
 
+
* [[Manual:DIL Manual/reset level()|reset level()]]
−
<!--TERM-->  '''u'''
+
* [[Manual:DIL Manual/reset vlevel()|reset vlevel()]]
−
<!--DEFINITION-->        player your resetting
+
* [[Manual:DIL Manual/race|race]]
−
 
+
* [[Manual:DIL Manual/height|height]]
−
Reset a characters race, weight, height, age, lifespan, and costs for training.
+
* [[Manual:DIL Manual/weight|weight]]
−
As if you first log on the character.  Great for reroll along with 'reset_level' and 'reset_vlevel'.
+
* [[Manual:DIL Manual/baseweight|baseweight]]
−
'''Example: '''<i><!--CODE-->reset_race (u);</i><!--ENDCODE-->
+
* [[Manual:DIL Manual/lifespan|lifespan]]
−
'''See Also'''
+
* [[Manual:DIL Manual/birth|birth]]
−
<i><!--CODE-->
+
* [[Manual:DIL Manual/access|access]]
−
[[#bpresetlevel|reset a players level]] and
 
−
[[#bpresetvlevel|reset a players virtual level]]</i><!--ENDCODE-->
 
−
 
 
−
 
 
−
 
 
−
---~---~---~---~---~---~---~---~---
 

Latest revision as of 23:07, 14 November 2026

reset race()

Procedure. Rolls a player's body again from the race's values: weight, height, lifespan and age.

reset_race(pc : unitptr)

The player keeps their race and sex. The server takes that race's entry in races.def (the male or female values, by the player's sex) and rolls the numbers again with its dice, the same way as when a character is made:

  • weight and base weight: the race's weight plus its weight dice;
  • height: the race's height plus its height dice;
  • lifespan: the race's lifespan plus its lifespan dice;
  • birth: the character's creation time minus the race's starting age plus its age dice, in mud years. The player's age is counted from that.

Use it after changing pc.race, or in a reroll together with reset level() and reset vlevel().

Parameters

Name Type Meaning
pc unitptr The player to roll again.

Notes

  • Only a program in a zone with access level 0 or 1 (the fourth column of vme/etc/zonelist) may call it. Elsewhere it writes "DIL '...' attempt to reset race w/o access." to the zone log and the program stops.
  • Players only. On an NPC, an object or a room it does nothing.
  • A unitptr variable that is null writes "reset_race with no unit." to the zone log and does nothing. vmc refuses a literal null.
  • It does not change the race, abilities, skills, training costs or level. (The old page said it also reset training costs: it doesn't.)
  • The player's race must be one of the races (0 to 99). With a larger value in pc.race the server stops on an assertion.

Example

dilbegin reroll_body(pc : unitptr);
code
{
   if (pc.type != UNIT_ST_PC)
      return;
   reset_race(pc);
   sendtext("Your body changes. You are now " + itoa(pc.height) + " cm tall and weigh " +
            itoa(pc.weight) + " pounds.<br/>", pc);
}
dilend

Rolls a player's body again and tells them their new height and weight.

See also