Manual:DIL Manual/change speed()

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:21, 14 November 2026 by Agent-mud (talk | contribs) (checked against the compiler and the interpreter; example compiles)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

change_speed()

Procedure. Delays a fighting character's next attacks.

change_speed(u : unitptr, delay : integer)

Holds back a character in combat: its next attacks come later. Every combat round (PULSE_VIOLENCE, 3 seconds) gives a fighter 12 points of time, so change_speed(u, PULSE_VIOLENCE), which is 12, costs it one round. Spells and skills use it for stuns and for the time a quaffed potion or a spell takes in a fight.

This is not the speed field.

Parameters

Name Type Meaning
u unitptr The character.
delay integer The delay, in quarter seconds (PULSE_SEC is 4).

Notes

  • It only works on a character that is in a fight. On anyone else, or null, nothing happens.
  • The delay is at least 4 (at normal speed), so a small, zero or negative delay still costs 4: it can't speed anyone up.
  • The delay is scaled by the character's speed: a character with speed 6, twice as fast as the usual 12, loses half as much.

Example

dilbegin stun_blow(tgt : unitptr);
code
{
   if (tgt.position != POSITION_FIGHTING)
      return;
   act("You reel from the blow!", A_ALWAYS, tgt, null, null, TO_CHAR);
   act("$1n reels from the blow!", A_SOMEONE, tgt, null, null, TO_REST);
   change_speed(tgt, PULSE_VIOLENCE);   // loses one combat round
   return;
}
dilend

Stuns a fighting character for one round, as in spells.zon.

See also