Manual:Zone Manual/The NPC Section/Suggested NPC exercises

From DikuMUD Wiki
< Manual:Zone Manual‎ | The NPC Section
Revision as of 06:20, 15 November 2026 by Agent-mud (talk | contribs) (checked against the current code (wiki review 2026-11-15))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Suggested NPC exercises

The DIL functions named here are described, with their arguments, in DIL functions for NPCs. Compile each exercise, then load the NPCs in the game and try them out.

  1. Using teamwork@function, create a guard that helps all the other guards of your zone when they are attacked.
  2. Add rescue@function to the guard from exercise 1, so that it rescues the other guards as well as helping them.
  3. Using shopkeepernew@function (with give_shopfix@function, which every shopkeeper needs), make a shopkeeper who sells two kinds of food, makes five of each at a time, and buys only food. Be creative with the other arguments.
  4. Turn the shopkeeper from exercise 3 into a wandering salesman. (Look at the shophome argument.)
  5. Using aggressive@function, create a dwarf that attacks any orc (RACE_ORC) that walks into the room.
  6. Build the same NPC twice, once field by field with MSET_ABILITY, MSET_WEAPON and MSET_SPELL, and once from a template in macros.h. Compare the two with vmc -v.
Previous: Dragon station with rooms and NPCs
Next: The Objects Section