Manual:Zone Manual/The Reset Section/Reset walk through
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.