Skip to content

Events ​

An event is a small script made of blocks: when this happens (triggers), if this is true (conditions), do this (actions). Events > Events is where you make them. The demo project has none: events are yours to build.

An event looks like this in the editor:

text
Event: The mill is haunted
├─ Triggers     Trigger area Detection Player: The Old Mill, enters
├─ Conditions   Global Variable: mill_cleared is false
└─ Actions      1. Spawn Entity: Ghost, at the mill door
                2. Popup: "You hear a cold whisper..." (wait until closed)
                3. Set Global Variable: mill_haunted = true

The editor ​

The list on the left has every event. Add makes a new one. The right side has the properties and the tree.

FieldWhat it doesDefault
Name, Description, IconFor you. The name shows in the list and in the debug tools
EnabledAn event that is not enabled never startson
Run onceAfter the event has completed, its triggers no longer start itoff
Local variablesNamed values that belong to this event only (see below)none
Triggers, Conditions, ActionsThe tree: right-click a heading to Add one; right-click an entry to Edit, Duplicate or delete itnone

Triggers: when ​

A trigger is something the game can notice: an NPC dies, the party enters a trigger area, a quest completes, the clock reaches 06:00. Event triggers lists all of them by category.

  • An event can have several triggers. Any one of them starts it.
  • Each trigger has its own fields (which NPC, which trigger area, how many).
  • Triggers are set up when the game starts and set up again after every change of world; a trigger does not forget what it counted.

Conditions: if ​

When a trigger fires, the event checks its conditions. They are the same conditions you use elsewhere: Is level, Quest completed, Has item, Game time, Global variable, Player trigger area presence. All of them must be true (use the Or condition to say "any of these"). If one is not true, the event does not start, and nothing else happens.

Actions: do ​

The actions run in order, one after another: each one finishes before the next one starts. A Wait action really waits, a Popup action can wait until the player closes it, a Cutscene action waits until the cutscene ends. Event actions lists all of them by category.

  • If and Switch actions branch: they hold conditions and their own lists of actions. An If has a "true" list and a "false" list; a Switch has a list for each case and a default.
  • An action that cannot do its job fails: a quest that does not exist, an object that does not exist, an NPC that is not there. The event fails with it. The rest of its actions do not run. The Godot output shows a warning for the action and for the event ("Event action failed: ...", "Event 12 (name) failed"), so a developer can see why an event stopped.
  • An event decides. The quest actions do not ask the quest for permission: Activate Quest starts the quest even if the player does not meet its requirements, it is on a cooldown, it was done and is not repeatable, or it failed for good (it starts again from the beginning), and the limit of active quests does not stop it. Complete Quest on a quest that is not running starts it first. If a quest must not change under some conditions, put those conditions on the event. A quest that is already running is left as it is. Two things an event still cannot do: change a quest that is not running with Fail Quest or Complete Quest Objective (there is nothing to change: the action fails with a warning), and start a quest of a quest line before the line reaches its step.

How often an event runs ​

By default an event runs every time: when it finishes, it is ready again, and the next time one of its triggers fires (and the conditions hold) it runs again from its first action. An event does not run while it is already running.

Tick Run once to make it happen one time only. Once the event has completed, its triggers no longer start it. An event that failed is not used up and can still run. The state is saved with the game, so a loaded game remembers that it is done, and a new game starts it fresh.

An event that is not "run once" can still be made to happen once by a condition that its own actions turn false: a Global Variable condition with a flag that one of the actions sets (Set Global Variable: mill_haunted = true). A Game Start trigger fires once per game on its own.

Local variables ​

Each event has its own local variables: named values of type int, float, bool or string, with a starting value. Use them for what the event needs to remember between runs or between its actions: how many times it ran, whether the first wave came. Click Add Variable to make one; right-click to edit or delete.

  • The Local Variable actions set, change or toggle one. The Local Variable Change and Local Variable Reach triggers fire when one changes.
  • Local variables are saved with the game and are not visible to other events. For a value that several events, conditions or quests share, use a global variable.

Examples ​

A door that opens when a switch is flipped. Trigger: Object Switch State Change (the switch, turned on). Action: Control Door (the door, open). (For small things like this inside one place, the Local Events tab makes the same rule with the world open and draws its wires.)

A trap on the road. Trigger: Trigger area Detection Player (the road, enters). Condition: Global Variable ambush_done is false. Actions: Spawn Entity (three bandits), Popup ("Ambush!"), Set Global Variable ambush_done = true.

Hand out a quest at sunrise. Trigger: Game Time 06:00. Action: Activate Quest (the daily quest). A quest that is already running is left as it is; one that was done or is on a cooldown starts again, because the event decides.

The king's death changes the world. Trigger: Entity Death Unique (the king). Actions: Set Global Variable king_dead = true; Set Entity Faction (the guards, hostile); Fail Quest (Serve the Crown).

See also ​