Skip to content

QuestObjective ​

Inherits: Resource

Base class for all quest objectives that can be extended for different objective types

Properties ​

intid0
booloptionalfalse
EventTriggerevent_trigger
boolhide_descriptionfalse
ProgressDisplayprogress_displayProgressDisplay.TALLY_PROGRESS
Stringcustom_description"":

Variables ​

Stringdescription""
Stringprogress_string""
ObjectiveStatestateObjectiveState.INACTIVE
intcurrent_progress0
inttarget_progress1

Methods ​

voidactivate()
voidreset()
voidcomplete()
voidfail()
boolis_completed()
boolis_failed()
boolis_active()
voidconnect_signals()
voiddisconnect_signals()
voidupdate_description()
voidset_progress( amount: int )
intget_progress()
intget_total()
floatget_progress_percentage()
boolupdate_progress( event_data: Variant = null )
voidupdate_signals()
Dictionarysave_objective_data()
voidload_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