Living Tool
Browse the docs
Docs/Guides

Event scripts

Every conversation, chest, shop and story warp in Guardian's Crusade is a small program inside an NPC pack. Events & scripts shows each one as readable rows, lets you edit it from a right-click menu or as text, and names the story flags it uses.

v0.1.27 · updated 16 Oct 2026 · 6 min read

How scripts are organised

The game's event programs live in the 50 NPC packs, npc/0 to npc/49. Each pack serves one area and holds its actors, their dialogue and their bytecode. npc/0 and npc/17 are the same file on the disc, so there are 49 distinct packs.

Open Events & scripts and pick a pack. The tree on the left shows what's in it:

GroupWhat it holds
Triggers · chunk NThe trigger ladder for one chunk: flag tests checked top to bottom, where the first true rung wins. A rung can make an actor talk, which is how most cutscenes start.
Doors · chunksThe doors of each chunk. Click one to change where it sends the Knight: the chunk, the arrival point and the facing.
Actors · talk scriptsOne row per actor slot (slot 0 is the Knight, 1 the Baby). An actor's talk script runs when you talk to it or when a trigger starts it. Tags mark scenes, chests, inns and warps.
Unreferenced codeBytes in the code region that no actor, GOTO or trigger reaches. Read-only.

Click an actor to open its program. A blue dot marks one your project has changed.

The structured view

Structured is the default view. Each row is one instruction: its offset from the pack's D-block, the mnemonic, its operands and what they resolve to. Text operands show the line itself, chunk ids show the place, and flags show what they mean. IF_FLAG, IF_ITEM, IF_RUBIES, IF_YES and CHOICE draw as blocks with a then lane and an else lane.

The right panel explains the selected instruction: what it does, its bytes and its operands. Under it, Simulate with flags runs the program against a preset (New game, Chapter 1 to Chapter 4, All flags clear) and marks the lanes that run. The chapter presets set only the chapter flags, so they're approximate. Raw bytes shows the same program as hex.

For what each opcode does, see Event opcodes.

Guided editing

You can change a script without knowing the opcodes. Open a project first, then right-click a row.

Right-click a row and pick Insert after, a group, then an action.
Right-click a row and pick Insert after, a group, then an action.
  • Insert before and Insert after open 46 actions in seven groups: Dialogue, Story flags, Items & rubies, Party, Places, Actors & camera, and Sound & scene. Other instruction… lists every opcode the assembler takes. On a block you can also Add to the then lane or Add to the else lane, and under the last row, Add at the end.
  • Wrap in If puts a row, or a selection of rows, inside a new condition: a flag is set, a yes-or-no question, an item, rubies, or two choices. Swap then and else flips the lanes, and Remove the condition keeps one of them.
  • Move up (⌥↑), Move down (⌥↓), Duplicate (⌘D), Copy, Cut, Paste and Delete work on one row or a shift-click selection. You can also drag rows to a new place, into or out of a block. Pasting into another pack turns the lines into new text there.
  • Edit… (or ↵) opens the row in its form.

Each action opens a form in the right panel with pickers for its operands: flags with their meanings, items, shops, battles, actors, and dialogue with the same in-game preview as Text & dialogue. Insert (or ⌘↵) saves it.

The Say a line form: the text, the box, an in-game preview and the bytes it writes.
The Say a line form: the text, the box, an in-game preview and the bytes it writes.

Warp somewhere… and the other actions that take a place have a map picker. Known places lists the warps and doors the pack already uses. Pick on the map draws the chunk from above, and a click sets x and z.

Every action saves to the project at once. ⌘Z and ⇧⌘Z undo and redo, separately for each actor.

DSL and assembling

DSL shows the program as text and lets you edit it directly. Mnemonics are the opcode names in lower case, blocks are written with braces, and chunks are written chunk/78.

npc/7 · actor 3, the wake-up scene (shortened)
// npc/7 · actor 3 · D+0x2024
if flag(0x004) {
  say @0x0D4C
  set 0x081
  clear 0x0FC
} else {
  cutscene 11
  say "Up you get, $A!{nl}The Mayor wants{nl}to see you."
  give 5
  warp facing:0 chunk/78 x:-32 z:-880 flags:0x0201
}

@0x0D4C keeps a string the pack already has, and a quoted string becomes a new line. Strings use the same markup as Text & dialogue, listed in Text control codes. The text is checked a moment after you stop typing, and problems are marked on their lines and listed under the editor.

Assembling a DSL edit: the plan and the pack's budget after saving.
Assembling a DSL edit: the plan and the pack's budget after saving.

In DSL mode the right panel is Assemble. It shows the new program's size against retail, where it goes, the actor that runs it, any new strings, and the pack against its 0x31000-byte loader cap and the 0xFFFF reach of its offsets. Save to project assembles it: the program is written at the end of the pack's D-span and the actor's record points at it. The retail bytes stay, so GOTOs from other programs still work. Discard changes drops your text and Revert to retail brings the original back.

Flags

Story progress is 512 bits, 0x000 to 0x1FF, and the game never names them. Living Tool ships a curated list of 320 named flags with 623 meanings, read from every retail script, trigger and placement and from the decomp's engine code.

  • In the structured view, every IF_FLAG, SET and CLEAR shows the flag's meaning: what's true while it's set. The inspector adds its name, the detail and how sure the meaning is: confirmed, likely or guess.
  • Flags 0x000 to 0x03F are scratch flags. Each pack gives them its own meaning, and wipe_scratch (SET 0xFD) clears them all, so their meanings are listed per pack.
Flag list names each flag and says what's true while it's set, with its area, chapter and confidence.
Flag list names each flag and says what's true while it's set, with its area, chapter and confidence.

Flag list, under World in the sidebar, groups every meaning by band, area or chapter, with filters for area and confidence. Open a row for the detail, related flags and Open in Event flags. Free ids lists the story flags nothing uses, for your own quests. Name a flag and Rename for this project keep your names in the project, and Copy list exports the list as Markdown, CSV or JSON.

Event flags draws all 512 bits as a grid and compares two sources: a save from a memory card, New game or a chapter preset. Click a flag to see every script, trigger, placement and walk script that sets, clears or tests it. The Live emulator source isn't connected in v0.1.6, so you can't watch or flip flags in a running game yet. To start a test at a story point, set the flags in a save with Save editor.