Difference between revisions of "Manual:Zone Manual/The NPC Section/Suggested NPC exercises"

From DikuMUD Wiki
Jump to navigation Jump to search
(checked against the current code (wiki review 2026-11-15))
 
Line 1: Line 1:
 
=== Suggested NPC exercises ===
 
=== Suggested NPC exercises ===
  
−
1. Using the DIL function for team work found in (Link to npcdilfunc) create a guard that will help all other guards.
+
The DIL functions named here are described, with their arguments, in
 +
[[Manual:Zone Manual/The NPC Section/DIL functions for NPCs|DIL functions for NPCs]].
 +
Compile each exercise, then load the NPCs in the game and try them out.
  
−
2. Using the DIL function for rescue found in
+
# Using <code>teamwork@function</code>, create a guard that helps all the other guards of your zone when they are attacked.
−
(Link to npcdilfunc) add to your guard from exercise one and make it so
+
# Add <code>rescue@function</code> to the guard from exercise 1, so that it rescues the other guards as well as helping them.
−
will now rescue as well as help.
+
# Using <code>shopkeepernew@function</code> (with <code>give_shopfix@function</code>, 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.
−
 
+
# Turn the shopkeeper from exercise 3 into a wandering salesman. (Look at the <code>shophome</code> argument.)
−
3. Using the shop keeper function from (Link to npcdilfunc);
+
# Using <code>aggressive@function</code>, create a dwarf that attacks any orc (<code>RACE_ORC</code>) that walks into the room.
−
make a shop keeper that sells two types of food.  The shop keeper should
+
# Build the same NPC twice, once field by field with <code>MSET_ABILITY</code>, <code>MSET_WEAPON</code> and <code>MSET_SPELL</code>, and once from a template in <code>macros.h</code>. Compare the two with <code>vmc -v</code>.
−
make 5 of them a day and it should only buy items of the food type. For all other arguments be creative.
 
−
 
 
−
4. Using the shop keeper you created from exercise three, turn your shop keeper into a global wondering sales person.
 
−
 
 
−
5. Using the DIL function for agressive found in
 
−
(Link to npcdilfunc) create a Dwarf agressive to any Orc that
 
−
walks into the room.
 
  
 
<div style='padding-top: 30px; padding-bottom: 20px; text-align: left;float:left;width:50%;'>[[Manual:Zone_Manual/The_NPC_Section/Dragon_station_with_rooms_and_NPCs|Previous: Dragon station with rooms and NPCs]]</div>
 
<div style='padding-top: 30px; padding-bottom: 20px; text-align: left;float:left;width:50%;'>[[Manual:Zone_Manual/The_NPC_Section/Dragon_station_with_rooms_and_NPCs|Previous: Dragon station with rooms and NPCs]]</div>
 
<div style='padding-top: 30px; padding-bottom: 20px; text-align: right;float:right;width:50%;'>[[Manual:Zone_Manual/The_Objects_Section|Next: The Objects Section]]</div>
 
<div style='padding-top: 30px; padding-bottom: 20px; text-align: right;float:right;width:50%;'>[[Manual:Zone_Manual/The_Objects_Section|Next: The Objects Section]]</div>

Latest revision as of 06:20, 15 November 2026

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