Difference between revisions of "Manual:Zone Manual/The Reset Section/Reset walk through"

From DikuMUD Wiki
Jump to navigation Jump to search
(checked against the current code (wiki review 2026-11-15))
 
Line 1: Line 1:
 
=== Reset walk through ===
 
=== Reset walk through ===
  
−
The dragon station is almost finished.  All you have to do now is
+
The dragon station is almost finished: all it lacks is its reset section. The zone doesn't have much in it, but enough to show how resets work. As said at the start of this chapter, a good order is doors first, then objects in rooms, then NPCs. Nothing forces you to do it that way, but it helps you keep track of your objects and NPCs. The whole zone is in [[Manual:Zone Manual/The Reset Section/The complete dragon station|The complete dragon station]].
−
create the resets for it. We don't have a lot of stuff in the zone but
 
−
we have enough to make a decent example of how the resets work. As I
 
−
mentioned at the start of the chapter on resets I like to do the doors
 
−
first, the objects in rooms second, then the NPCs. again this is
 
−
nothing we force you to do but I find it helps me keep track of my items
 
−
and NPCs.
 
  
−
With that in mind we will start by resetting our doors.  In the
+
The zone header has <code>lifespan 20</code> and <code>reset RESET_ANYHOW</code>, so these commands run when the game boots and then about every 20 minutes.
−
zone there is two doors.  One is a regular door that is closed when the
 
−
mud reboots and the other is a hidden and locked door when the mud
 
−
reboots.  We will not block the rooms in and show you them again but
 
−
if you want to you can see the rooms in (Link to finishedzone).
 
−
the resets for these doors would look like this.
 
−
<nowiki>
 
−
//Office door reset
 
−
door hallway EAST {EX_OPEN_CLOSE, EX_CLOSED,EX_LOCKED}
 
−
door office WEST {EX_OPEN_CLOSE, EX_CLOSED,EX_LOCKED}
 
  
−
//secret door reset
+
==== Doors ====
−
door office SOUTH {EX_OPEN_CLOSE, EX_CLOSED,EX_LOCKED,EX_HIDDEN}
 
−
door portal_room  NORTH {EX_OPEN_CLOSE, EX_CLOSED,EX_LOCKED}</nowiki>
 
−
<blockquote style="background-color: #E8E8E8; font-style: italic; ">Both sides of the door don't have to have the exact same flags the door in the office is hidden but the one on the ship is not.</blockquote>
 
  
−
The next thing to build resets for is the two items we are loading
+
The zone has two doors. The air lock between the hallway and the office is an ordinary door that should be closed again at every reset. The door between the office and the portal room is a secret door: hidden and locked. Its exits have <code>key nokey</code>, a key that doesn't exist, so it can only be picked open.
−
directly into rooms and their contents if they have any. The two items
 
−
we are loading into rooms are the board and the weapons locker. I am
 
−
just going to stick the board in the main chamber and the weapons locker
 
−
in the office. The reset for these two items looks like this.
 
−
<nowiki>
 
−
load info_board into chamber
 
  
−
load wpn_locker into office
+
<pre>
−
  {
+
// The office door: closed again at every reset
−
  load w_stiletto
+
door hallway EAST {EX_OPEN_CLOSE, EX_CLOSED}
−
  }</nowiki>
+
door office WEST {EX_OPEN_CLOSE, EX_CLOSED}
−
Notice we also loaded a stiletto into the weapons locker and it will
 
−
only load once a reboot since the cabinet will never be removed and
 
−
unless the cabinet reloads the stiletto will not reload.
 
  
−
finally we get to the NPcs and their equipment.  We only have 3
+
// The secret door: hidden and locked on the office side,
−
NPCs in our zone so it shouldn't be any problem especially since we don't
+
// only locked on the portal room side
−
have that much close.  I am going to load the dragon into the ship on a
+
door office SOUTH {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED, EX_HIDDEN}
−
percentage chance basis and then load the Janitor into the station so he
+
door portal_room NORTH {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED}
−
can get to cleaning it up.  Finally I will load Bob into the office so
+
</pre>
−
he can sit and count his money.
 
−
<nowiki>
 
−
load bob into office
 
−
  {
 
−
  equip pol_plate WEAR_BODY
 
−
  }
 
  
−
  load janitor into chamber
+
The two sides of a door needn't have the same flags. The door is hidden in the office, where players have to <code>search</code> for it, but from the portal room it can be seen. The reset also hides it again after someone found it.
−
    {
 
−
equip pol_plate WEAR_BODY
 
−
}
 
  
−
random 50
+
==== Objects in rooms ====
−
  {
+
 
−
  load bldragon
+
Two objects are loaded straight into rooms: the information board goes into the main chamber and the weapons locker into the office, with a stiletto in it. The locker is defined closed and locked, and is loaded that way; its key, <code>black_key</code>, is given to Bob below.
−
      {
+
 
−
  load maskwa
+
<pre>
−
  }
+
load info_board into chamber
−
  }</nowiki>
+
 
−
Only a couple final things to point out. It doesn't matter if you
+
load wpn_locker into office
−
load the same type of plate or same type of clothing on every NPC. It
+
{
−
would look pretty silly if everyone was wearing the same clothes but I
+
  load w_stiletto
−
wanted to make sure you understood you didn't have to make one set for
+
}
−
everyone. Also you don't have to equip wearable things you can load
+
</pre>
−
them into the inventory like we did with the ring on the dragon. That
+
 
−
about covers it all. The resets are now done and we can now put them
+
Neither has a limit, so each gets <code>local 1</code>: the board is loaded only when there is no board in the chamber, and the locker only when there is no locker in the office. The locker can't be taken (it has no <code>MANIPULATE_TAKE</code>), so after the first reset it is always there, its block never runs again, and the stiletto is loaded once per reboot. If you want the stiletto back in the locker at every reset, start with <code>remove wpn_locker in office</code> (see [[Manual:Zone Manual/The Reset Section/Special reset functions|Special reset functions]]).
−
all together with the zone and complete our dragon station.
+
 
 +
==== NPCs ====
 +
 
 +
There are three NPCs. Bob the banker sits in the office, the janitor starts in the chamber and wanders the station, and the dragon has an even chance at each reset of turning up on his ship.
 +
 
 +
<pre>
 +
load bob into office
 +
{
 +
  equip pol_plate position WEAR_BODY
 +
  load black_key
 +
}
 +
 
 +
load janitor into chamber
 +
{
 +
  equip pol_plate position WEAR_BODY
 +
  load beef_stick
 +
  load liq_ration
 +
}
 +
 
 +
random 50
 +
{
 +
  load bldragon into ship
 +
  {
 +
      load maskwa
 +
  }
 +
}
 +
</pre>
 +
 
 +
The NPCs have no limits, so each gets <code>max 1</code>: there is never more than one Bob, one janitor or one dragon in the game. Each block runs only when its NPC is loaded, so a killed janitor comes back with a new plate, beef stick and wine, but a living one keeps whatever he has left. The same goes for Bob and the locker key: a player who wants the stiletto has to get the key from Bob, and Bob gets a new one only when he is loaded again.
 +
 
 +
Bob and the janitor wear the same plate. Any number of NPCs can be dressed from one object definition; each <code>equip</code> loads a copy of its own and fits it to the NPC.
 +
 
 +
The ring goes into the dragon's inventory, not on his finger: a <code>load</code> in an NPC's block puts the object in the inventory, even if the object could be worn.
 +
 
 +
The dragon's <code>load</code> has <code>into ship</code>. The block of <code>random</code> has no unit of its own, so every <code>load</code> directly in it must say which room it goes into. The ring needs no <code>into</code>, because it is in the dragon's block.
 +
 
 +
That's all the resets. Put them at the end of the zone, after <code>%reset</code> and before <code>%end</code>, and the dragon station is finished.
  
 
<div style='padding-top: 30px; padding-bottom: 20px; text-align: left;float:left;width:50%;'>[[Manual:Zone_Manual/The_Reset_Section/Special_reset_functions|Previous: Special reset functions]]</div>
 
<div style='padding-top: 30px; padding-bottom: 20px; text-align: left;float:left;width:50%;'>[[Manual:Zone_Manual/The_Reset_Section/Special_reset_functions|Previous: Special reset functions]]</div>
 
<div style='padding-top: 30px; padding-bottom: 20px; text-align: right;float:right;width:50%;'>[[Manual:Zone_Manual/The_Reset_Section/The_complete_dragon_station|Next: The complete dragon station]]</div>
 
<div style='padding-top: 30px; padding-bottom: 20px; text-align: right;float:right;width:50%;'>[[Manual:Zone_Manual/The_Reset_Section/The_complete_dragon_station|Next: The complete dragon station]]</div>

Latest revision as of 06:23, 15 November 2026

Reset walk through

The dragon station is almost finished: all it lacks is its reset section. The zone doesn't have much in it, but enough to show how resets work. As said at the start of this chapter, a good order is doors first, then objects in rooms, then NPCs. Nothing forces you to do it that way, but it helps you keep track of your objects and NPCs. The whole zone is in The complete dragon station.

The zone header has lifespan 20 and reset RESET_ANYHOW, so these commands run when the game boots and then about every 20 minutes.

Doors

The zone has two doors. The air lock between the hallway and the office is an ordinary door that should be closed again at every reset. The door between the office and the portal room is a secret door: hidden and locked. Its exits have key nokey, a key that doesn't exist, so it can only be picked open.

// The office door: closed again at every reset
door hallway EAST {EX_OPEN_CLOSE, EX_CLOSED}
door office WEST {EX_OPEN_CLOSE, EX_CLOSED}

// The secret door: hidden and locked on the office side,
// only locked on the portal room side
door office SOUTH {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED, EX_HIDDEN}
door portal_room NORTH {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED}

The two sides of a door needn't have the same flags. The door is hidden in the office, where players have to search for it, but from the portal room it can be seen. The reset also hides it again after someone found it.

Objects in rooms

Two objects are loaded straight into rooms: the information board goes into the main chamber and the weapons locker into the office, with a stiletto in it. The locker is defined closed and locked, and is loaded that way; its key, black_key, is given to Bob below.

load info_board into chamber

load wpn_locker into office
{
   load w_stiletto
}

Neither has a limit, so each gets local 1: the board is loaded only when there is no board in the chamber, and the locker only when there is no locker in the office. The locker can't be taken (it has no MANIPULATE_TAKE), so after the first reset it is always there, its block never runs again, and the stiletto is loaded once per reboot. If you want the stiletto back in the locker at every reset, start with remove wpn_locker in office (see Special reset functions).

NPCs

There are three NPCs. Bob the banker sits in the office, the janitor starts in the chamber and wanders the station, and the dragon has an even chance at each reset of turning up on his ship.

load bob into office
{
   equip pol_plate position WEAR_BODY
   load black_key
}

load janitor into chamber
{
   equip pol_plate position WEAR_BODY
   load beef_stick
   load liq_ration
}

random 50
{
   load bldragon into ship
   {
      load maskwa
   }
}

The NPCs have no limits, so each gets max 1: there is never more than one Bob, one janitor or one dragon in the game. Each block runs only when its NPC is loaded, so a killed janitor comes back with a new plate, beef stick and wine, but a living one keeps whatever he has left. The same goes for Bob and the locker key: a player who wants the stiletto has to get the key from Bob, and Bob gets a new one only when he is loaded again.

Bob and the janitor wear the same plate. Any number of NPCs can be dressed from one object definition; each equip loads a copy of its own and fits it to the NPC.

The ring goes into the dragon's inventory, not on his finger: a load in an NPC's block puts the object in the inventory, even if the object could be worn.

The dragon's load has into ship. The block of random has no unit of its own, so every load directly in it must say which room it goes into. The ring needs no into, because it is in the dragon's block.

That's all the resets. Put them at the end of the zone, after %reset and before %end, and the dragon station is finished.

Previous: Special reset functions
Next: The complete dragon station