| name | dialogic-event |
| description | Create a new custom Dialogic 2 event class for RPG gameplay in .dtl timelines |
Custom Dialogic Event Creation
Create a new Dialogic 2 custom event. Argument: event name and purpose.
Steps
-
Create the event script at game/scripts/dialogic/<event_name>_event.gd:
- Extend
DialogicEvent
- Add
class_name (e.g., class_name StatCheckEvent)
- Implement required methods:
_execute() — the event logic
_init() — set event_name for the timeline syntax
_get_as_text() -> String — serialize to .dtl text format
_from_text(string: String) — parse from .dtl text format
_is_valid_event(string: String) -> bool — validate .dtl syntax
-
Follow the timeline syntax convention:
[event_name param="value" other_param=number]
- Use
[square_brackets] for the event tag
- String params use quotes:
param="value"
- Numeric params are bare:
param=30
- Boolean params:
param=true
-
Access autoloads for game state:
var game_manager = Engine.get_singleton("GameManager") # or get via autoload
var inventory = Engine.get_singleton("Inventory")
-
Register with Dialogic:
- Add the event script to Dialogic's custom events list in project settings
- Verify it appears in the Dialogic timeline editor
-
Write a test timeline at game/dialogic/timelines/test_<event_name>.dtl that exercises the new event
Existing Events Reference
| Event | Syntax | Purpose |
|---|
| StatCheckEvent | [stat_check skill="strength" difficulty=30] | Branch on skill roll |
| SkillGrowthEvent | [skill_growth skill="communication" amount=5] | Increase skill |
| InventoryEvent | [give_item item="tavern_key"] | Add/remove items |
| ClassGateEvent | [class_gate class="thief"] | Show/hide by class |
New events should follow the same patterns for consistency.