QuestObjective ​
Inherits: Resource
Base class for all quest objectives that can be extended for different objective types
Properties ​
int | id | 0 |
bool | optional | false |
EventTrigger | event_trigger | |
bool | hide_description | false |
ProgressDisplay | progress_display | ProgressDisplay.TALLY_PROGRESS |
String | custom_description | "": |
Variables ​
String | description | "" |
String | progress_string | "" |
ObjectiveState | state | ObjectiveState.INACTIVE |
int | current_progress | 0 |
int | target_progress | 1 |
Methods ​
void | activate() |
void | reset() |
void | complete() |
void | fail() |
bool | is_completed() |
bool | is_failed() |
bool | is_active() |
void | connect_signals() |
void | disconnect_signals() |
void | update_description() |
void | set_progress( amount: int ) |
int | get_progress() |
int | get_total() |
float | get_progress_percentage() |
bool | update_progress( event_data: Variant = null ) |
void | update_signals() |
Dictionary | save_objective_data() |
void | load_objective_data( data: Dictionary ) |
Signals ​
objective_state_changed( objective: QuestObjective ) ​
Emitted when objective state changes
Enumerations ​
enum ObjectiveState ​
Possible states for objectives
- INACTIVE =
0 - ACTIVE =
1 - COMPLETED =
2 - FAILED =
3
enum ProgressDisplay ​
How progress should be displayed in the UI
- NO_PROGRESS =
0 - TALLY_PROGRESS =
1 - PERCENT_PROGRESS =
2
Property descriptions ​
int id = 0 ​
The number of the objective in its quest (1 is the first; 0 = its position): what a conversation or an action uses to complete or fail one
bool optional = false ​
An objective the player may leave undone: the quest completes without it, and failing it does not fail the quest
EventTrigger event_trigger ​
The event trigger that determines when this objective is completed
bool hide_description = false ​
If true, description won't be shown in quest UI
ProgressDisplay progress_display = ProgressDisplay.TALLY_PROGRESS ​
How progress should be displayed (none, X/Y, or percentage)
String custom_description = "": ​
Override for the auto-generated description
Variable descriptions ​
String description = "" ​
Current description text of the objective
String progress_string = "" ​
String representation of current progress
ObjectiveState state = ObjectiveState.INACTIVE ​
Current state of the objective
int current_progress = 0 ​
Tracking for progressive objectives
int target_progress = 1 ​
The count the objective needs (1 for a plain one).
Method descriptions ​
void activate() ​
Base activate function that all derived classes should call via super
void reset() ​
Back to the start: not listening, no progress (a quest that is activated or taken again starts its objectives like this)
void complete() ​
Base complete function that all derived classes should call via super
void fail() ​
Base fail function that all derived classes should call via super
bool is_completed() ​
State checking helper functions
bool is_failed() ​
Has the objective failed?
bool is_active() ​
Is the objective active now?
void connect_signals() ​
Signal management - connects to the event trigger
void disconnect_signals() ​
Stops listening to the trigger of the objective.
void update_description() ​
Generate dynamic description based on trigger type and properties
void set_progress( amount: int ) ​
Progress tracking interface
int get_progress() ​
The count so far.
int get_total() ​
The count the objective needs.
float get_progress_percentage() ​
The progress as a percentage of the total.
bool update_progress( event_data: Variant = null ) ​
Called when progress should be updated in response to game events
void update_signals() ​
Update signals when level changes - for EventManager compatibility
Dictionary save_objective_data() ​
Save objective data to Dictionary for serialization
void load_objective_data( data: Dictionary ) ​
Load objective data from Dictionary