Difference between revisions of "Manual:Zone Manual/The Reset Section/Reset walk through"
(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 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]]. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | 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. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | ==== 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 <code>key nokey</code>, a key that doesn't exist, so it can only be picked open. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | <pre> | |
| − | + | // 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} | |
| − | + | </pre> | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | 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. | |
| − | |||
| − | |||
| − | |||
| − | + | ==== 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, <code>black_key</code>, is given to Bob below. | |
| − | + | ||
| − | + | <pre> | |
| − | + | load info_board into chamber | |
| − | + | ||
| − | + | load wpn_locker into office | |
| − | + | { | |
| − | + | load w_stiletto | |
| − | + | } | |
| − | + | </pre> | |
| − | + | ||
| − | + | 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]]). | |
| − | + | ||
| + | ==== 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.