diff options
| author | historia <[not public]> | 2026-07-07 16:24:27 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-07 16:24:27 -0400 |
| commit | ab2597b22ccdb71116992aec78080d9858358d04 (patch) | |
| tree | 8beae4060c2831c4a68f92b682b5350cfa1d0afb /building_guide/triggers.md | |
| parent | 3f30fa3eec9c2e2acf9a984ccefb9529a25e688a (diff) | |
| download | thehouseoficarus-ab2597b22ccdb71116992aec78080d9858358d04.tar.gz | |
rename flags to global_flags (differentiate from player_flags)
Diffstat (limited to 'building_guide/triggers.md')
| -rw-r--r-- | building_guide/triggers.md | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/building_guide/triggers.md b/building_guide/triggers.md index b88f16d..0d227bd 100644 --- a/building_guide/triggers.md +++ b/building_guide/triggers.md @@ -8,7 +8,7 @@ value. They come in two flavors: - **Global triggers** — defined in `data/triggers/<id>.yaml`. These fire regardless of where the flag-setting player is, and can broadcast to all online players. -A trigger watches one flag (`on_player_flag` or `on_flag`). When that flag's value +A trigger watches one flag (`on_player_flag` or `on_global_flag`). When that flag's value actually changes (from unset/falsy to a truthy/new value), the trigger's steps begin executing. Setting a flag to the same value it already has does **not** re-fire the trigger. @@ -61,7 +61,7 @@ elapses. | `message` | player | Text sent to the triggering player only. Supports `%p` (player name) and `%v` (flag value) templates. | | `broadcast` | room | Text sent to everyone in the room. Inline color tags work; `\n` prefix is added automatically. | | `broadcast_global` | world | Text sent to every online player. Useful for server-wide announcements. | -| `set_flags` | world | Mutates world flags (shared by all players). | +| `set_global_flags` | global | Mutates global flags (shared by all players). | | `set_player_flags` | player | Mutates player flags (per-character). Only valid for `on_player_flag` triggers. | | `spawn_mob` | room | Spawns a **transient** mob from a mob definition. See Transient Mobs below. | | `despawn_mob` | room | Removes all trigger-spawned mobs matching the given mob ID (and optionally owner). | @@ -127,24 +127,24 @@ The final step uses both `broadcast` (everyone in the ritual room sees the flash and `teleport` + `message` (the triggering player is moved and sees a personal message). -#### Example 3: World-flag room trigger — shared environmental event +#### Example 3: Global-flag room trigger — shared environmental event -A player pulls a lever (sets world flag `floodgate_open`). The room trigger +A player pulls a lever (sets global flag `floodgate_open`). The room trigger broadcasts to everyone in the dam control room: ```yaml # data/rooms/wilderness/dam_control.yaml triggers: - - on_flag: floodgate_open + - on_global_flag: floodgate_open steps: - broadcast: "Ancient gears grind as the floodgate slowly opens..." - delay: 15 broadcast: "Water thunders through the opening!" - - set_flags: + - set_global_flags: valley_flooded: true ``` -Because this watches a **world** flag (`on_flag`), it fires once globally when +Because this watches a **global** flag (`on_global_flag`), it fires once globally when the flag is first set — not per-player. Everyone in the room sees the messages. #### Example 4: "Push button" — trigger that resets itself @@ -189,26 +189,26 @@ PlayerName has reached level 99 attack! #### Example 6: World-first boss kill — global broadcast -A boss mob's death sets world flag `world_boss_slain`. A global trigger +A boss mob's death sets global flag `world_boss_slain`. A global trigger announces it to everyone: ```yaml # data/triggers/world_boss_slain.yaml -on_flag: world_boss_slain +on_global_flag: world_boss_slain steps: - broadcast_global: "The Ancient One has been vanquished! The land stirs with new life." - - set_flags: + - set_global_flags: ancient_lands_access: true # opens a zone for everyone ``` #### Example 7: Global trigger with room context A global trigger can specify a `room` for broadcasts and mob spawns. This is -useful when a world flag should trigger effects in a specific location: +useful when a global flag should trigger effects in a specific location: ```yaml # data/triggers/obelisk_activated.yaml -on_flag: desert_obelisk_charged +on_global_flag: desert_obelisk_charged room: 1200 steps: - broadcast: "The obelisk hums with stored power." @@ -310,7 +310,7 @@ triggers: ``` `despawn_mob` with an owner only removes mobs spawned by that player. Without an -owner (in world-flag triggers), it removes all matching mobs. +owner (in global-flag triggers), it removes all matching mobs. #### Example 11: Fixed-lifetime mob @@ -357,7 +357,7 @@ triggers: value: 3 steps: - message: "Stage 3 begins — the temple doors swing open." - - set_flags: + - set_global_flags: temple_open: true ``` @@ -453,18 +453,18 @@ flag is already at that value. ### Full Scenario: Server-Wide World Event -A server event progresses through stages. A global trigger chains world flags to +A server event progresses through stages. A global trigger chains global flags to advance the event for everyone. **Phase 1 trigger:** ```yaml # data/triggers/event_phase1.yaml -on_flag: event_phase1_start +on_global_flag: event_phase1_start steps: - broadcast_global: "The sky darkens as an eclipse begins..." - delay: 100 - set_flags: + set_global_flags: event_phase2_start: true ``` @@ -472,11 +472,11 @@ steps: ```yaml # data/triggers/event_phase2.yaml -on_flag: event_phase2_start +on_global_flag: event_phase2_start steps: - broadcast_global: "Monsters pour from the shadows across the land!" - delay: 300 - set_flags: + set_global_flags: event_phase3_start: true ``` @@ -484,11 +484,11 @@ steps: ```yaml # data/triggers/event_phase3.yaml -on_flag: event_phase3_start +on_global_flag: event_phase3_start steps: - broadcast_global: "The eclipse passes. The monsters retreat." - delay: 50 - set_flags: + set_global_flags: event_active: false ``` @@ -528,7 +528,7 @@ All of these paths activate triggers: the same trigger running simultaneously. Starting a new one replaces the old. 4. **Player must be online.** Player-flag triggers only fire for connected - players. World-flag triggers fire regardless. + players. Global-flag triggers fire regardless. 5. **Room triggers check room.** Room-level triggers only fire when the flag-setting player is in that room. This keeps local events local. @@ -544,6 +544,6 @@ Startup validation checks that trigger `spawn_mob.id` references an existing mob definition, `give_item`/`take_item` reference existing items, `teleport` and `despawn_rooms` reference existing rooms, and that global trigger IDs are unique. -Validation does NOT check that the watched flags (`on_player_flag` / `on_flag`) +Validation does NOT check that the watched flags (`on_player_flag` / `on_global_flag`) are ever set — those are dynamic, set by runtime gameplay, and can't be statically verified. |
