QuestLine ​
Inherits: DatabaseResource < Resource
A sequence of quests organized into steps that form a complete storyline or mission chain
Properties ​
Dictionary | quest_steps | {} |
Array[Reward] | completion_rewards | [] |
Array[EventAction] | on_start_actions | [] |
Array[EventAction] | on_complete_actions | [] |
Variables ​
int | current_step | 0 |
QuestLineState | state | QuestLineState.INACTIVE |
Methods ​
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.