Skip to content

QuestLine ​

Inherits: DatabaseResource < Resource

A sequence of quests organized into steps that form a complete storyline or mission chain

Properties ​

Dictionaryquest_steps{}
Array[Reward]completion_rewards[]
Array[EventAction]on_start_actions[]
Array[EventAction]on_complete_actions[]

Variables ​

intcurrent_step0
QuestLineStatestateQuestLineState.INACTIVE

Methods ​

voidactivate()
voidcomplete()
voidreset_to_initial_state()
voidfail()
voidactivate_step( step_number: int )
voidupdate_current_step()
intget_next_step( current: int )
voidon_quest_state_changed( quest: Quest )
voidadd_completion_reward( reward: Reward )
boolremove_completion_reward( reward: Reward )
voidclear_completion_rewards()
Stringget_completion_rewards_summary()
boolhas_completion_rewards()
intget_completion_reward_count()
boolis_completed()
boolis_failed()
boolis_active()
boolis_inactive()
Arrayget_quest_ids_for_step( step_number: int )
Array[Quest]get_quests_for_step( step_number: int )
intget_current_step()
Arrayget_all_steps()
intget_max_step()
boolhas_step( step_number: int )
voidadd_quest_to_step( quest_id: int, step_number: int )
boolremove_quest_from_step( quest_id: int, step_number: int )
boolmove_quest_between_steps( quest_id: int, from_step: int, to_step: int )
intget_step_for_quest( quest_id: int )
boolcontains_quest( quest_id: int )
intget_total_quest_count()
intcreate_new_step()
boolrename_step( old_step: int, new_step: int )
booldelete_step( step_number: int )
Array[Dictionary]validate()
boolis_valid()
Dictionarysave_questline_data()
voidload_questline_data( data: Dictionary )
Dictionaryget_summary()

Signals ​

questline_state_changed( questline: QuestLine ) ​

Emitted when questline state changes

quest_completed( questline: QuestLine, quest: Quest ) ​

Emitted when a quest in this questline is completed

step_completed( questline: QuestLine, step: int ) ​

Emitted when all quests in a step are completed

reward_applied( questline: QuestLine, reward: Reward ) ​

Emitted when a reward is applied

quest_activation_requested( questline: QuestLine, quest_id: int ) ​

Emitted when questline needs a quest activated (handled by EventManager)

Enumerations ​

enum QuestLineState ​

The options of quest line state: inactive, active, completed, failed.

  • INACTIVE = 0
  • ACTIVE = 1
  • COMPLETED = 2
  • FAILED = 3

Property descriptions ​

Dictionary quest_steps = ​

Dictionary organizing quests by step number - step_number: Array[quest_id]

Array[Reward] completion_rewards = [] ​

Rewards granted when the entire questline is completed (bonus rewards)

Array[EventAction] on_start_actions = [] ​

Triggers executed when questline is activated (for world-state changes)

Array[EventAction] on_complete_actions = [] ​

Triggers executed when questline is completed (for world-state changes)

Variable descriptions ​

int current_step = 0 ​

Current active step in the questline

QuestLineState state = QuestLineState.INACTIVE ​

Current state of the questline

Method descriptions ​

void activate() ​

Activates the questline and its first step

void complete() ​

Marks the questline as completed and grants rewards

void reset_to_initial_state() ​

Everything as in a new game: not started, at the first step, hearing no quest

void fail() ​

Marks the questline as failed

void activate_step( step_number: int ) ​

Activates all quests in the specified step

void update_current_step() ​

Checks if all quests in the current step are completed to advance to next step

int get_next_step( current: int ) ​

Get the next step after the given step

void on_quest_state_changed( quest: Quest ) ​

Called when a quest's state changes (to be connected by EventManager)

void add_completion_reward( reward: Reward ) ​

Add a reward to this questline's completion rewards

bool remove_completion_reward( reward: Reward ) ​

Remove a reward from this questline's completion rewards

void clear_completion_rewards() ​

Clear all completion rewards

String get_completion_rewards_summary() ​

Get a summary of all completion rewards

bool has_completion_rewards() ​

Check if questline has completion rewards

int get_completion_reward_count() ​

Get completion reward count

bool is_completed() ​

Returns true if questline is completed

bool is_failed() ​

Returns true if questline is failed

bool is_active() ​

Returns true if questline is active

bool is_inactive() ​

Returns true if questline is inactive

Array get_quest_ids_for_step( step_number: int ) ​

Get all quest IDs for a specific step

Array[Quest] get_quests_for_step( step_number: int ) ​

Get all quest objects for a specific step

int get_current_step() ​

Get the current active step

Array get_all_steps() ​

Get all step numbers in this questline

int get_max_step() ​

Get the highest step number in the questline

bool has_step( step_number: int ) ​

Check if a step exists in this questline

void add_quest_to_step( quest_id: int, step_number: int ) ​

Add a quest to a specific step

bool remove_quest_from_step( quest_id: int, step_number: int ) ​

Remove a quest from a specific step

bool move_quest_between_steps( quest_id: int, from_step: int, to_step: int ) ​

Move a quest from one step to another

int get_step_for_quest( quest_id: int ) ​

Get which step contains a specific quest

bool contains_quest( quest_id: int ) ​

Check if a quest is in this questline

int get_total_quest_count() ​

Get total number of quests in the questline

int create_new_step() ​

Create a new step with the next available number

bool rename_step( old_step: int, new_step: int ) ​

Rename a step (change its number)

bool delete_step( step_number: int ) ​

Delete a step and all its quests

Array[Dictionary] validate() ​

Checks the quest line. Gives the problems found (empty when it is fine).

bool is_valid() ​

Is the quest line free of errors?

Dictionary save_questline_data() ​

Save questline state to a dictionary

void load_questline_data( data: Dictionary ) ​

Load questline state from saved data

Dictionary get_summary() ​

A short summary of the quest line (id, name, steps ...) as a dictionary.