Working With...Area Zones
Area zones are containers for area scenery and area events that can be shared across rooms in the zone. For instance, you might create a desert zone with sandy wastes and dry air, or a dungeon zone with crumbling stone walls.
MyGame.createAsset({
class: "Room",
name: "Southern Dunes",
zone: "Desert Zone"
});
MyGame.createAsset({
class: "Zone",
name: "Desert Zone",
area_scenery: {
air: { enabled: true, description: "The air is searingly dry. " },
sky: {
enabled: true,
description: "Even the sky is burnt to a pale sandy color. ",
},
sun: {
enabled: true,
description: "The sun burns in the sky. ",
},
floor: { enabled: true, description: "Nothing but endless sand. " },
sound: { enabled: true, description: "A constant dry whisper of shifting sands. " },
},
area_events: {
frequency: 0.1,
randomize: true,
array: [
"Sands shift beneath your feet. ",
"A brief dry breeze does nothing to cool you. ",
"Heat haze shimmers over distant dunes. ",
],
},
});
String Array Function
Zone descriptions are subject to String Array Function which means that they can be set to return dynamic results. For instance, if you had a day/night cycle, you might set certain phenomena to appear differently during day and night.
MyGame.createAsset({
class: "Zone",
name: "Desert Zone",
area_scenery: {
sun: {
enabled: true,
description: function () {
if( MyGame.getVar(is_night) ) { // using a world variable
return `The sun lies somewhere below the horizon. `;
}
else {
return `The sun bakes the desert floor. `;
}
},
},
moon: {
enabled: true,
description: function () {
if( MyGame.getVar(is_night) ) {
return `A big red desert moon illuminates the sands. `;
}
else {
return `The moon is hidden beyond the horizon. `;
}
},
},
stars: {
enabled: true,
description: function () {
if( MyGame.getVar(is_night) ) {
return `Stars in their millions dot the coal blue night sky. `;
}
else {
return `The stars are hidden by the blazing sun. `;
}
},
},
},
Further Reference
- Working with Area Events
- Working with Area Scenery
- Zone class in Reference Manual
- Basic Scripting: String Array Function in Author's Manual
- Basic Scripting: World Variables in Author's Manual