Skip to content

Class: SGameTaskObjective ​

One objective inside a game task.

Source ​

C++ class SGameTaskObjective

Custom Constructor ​

SGameTaskObjective

Remarks ​

Objective 0 is the task root objective. Additional objectives start at 1.

Extended by ​

Constructors ​

Constructor ​

ts
new SGameTaskObjective(task: CGameTask, id: number): SGameTaskObjective;

Parameters ​

ParameterTypeDescription
taskCGameTaskParent task.
idnumberObjective index.

Returns ​

SGameTaskObjective

Remarks ​

The objective stores a pointer to task; keep the parent task alive while using this objective.

Methods ​

add_complete_func() ​

ts
add_complete_func(function_name: string): void;

Add a script predicate used to decide objective completion.

Parameters ​

ParameterTypeDescription
function_namestringScript function name.

Returns ​

void

Remarks ​

Function names are resolved when a script-created objective is added to a task. Missing functions are logged and then skipped by the engine.


add_complete_info() ​

ts
add_complete_info(value: string): void;

Require an info portion for objective completion.

Parameters ​

ParameterTypeDescription
valuestringInfo portion id.

Returns ​

void


add_fail_func() ​

ts
add_fail_func(function_name: string): void;

Add a script predicate used to decide objective failure.

Parameters ​

ParameterTypeDescription
function_namestringScript function name.

Returns ​

void

Remarks ​

Function names are resolved when a script-created objective is added to a task. Missing functions are logged and then skipped by the engine.


add_fail_info() ​

ts
add_fail_info(value: string): void;

Require an info portion for objective failure.

Parameters ​

ParameterTypeDescription
valuestringInfo portion id.

Returns ​

void


add_on_complete_func() ​

ts
add_on_complete_func(function_name: string): void;

Add a script function called after objective completion.

Parameters ​

ParameterTypeDescription
function_namestringScript function name.

Returns ​

void

Remarks ​

Function names are resolved when a script-created objective is added to a task. Missing functions are logged and then skipped by the engine.


add_on_complete_info() ​

ts
add_on_complete_info(value: string): void;

Give an info portion when objective completes.

Parameters ​

ParameterTypeDescription
valuestringInfo portion id.

Returns ​

void


add_on_fail_func() ​

ts
add_on_fail_func(function_name: string): void;

Add a script function called after objective failure.

Parameters ​

ParameterTypeDescription
function_namestringScript function name.

Returns ​

void

Remarks ​

Function names are resolved when a script-created objective is added to a task. Missing functions are logged and then skipped by the engine.


add_on_fail_info() ​

ts
add_on_fail_info(value: string): void;

Give an info portion when objective fails.

Parameters ​

ParameterTypeDescription
valuestringInfo portion id.

Returns ​

void


change_map_location() ​

ts
change_map_location(new_map_location: string, new_map_object_id: number): void;

Replace linked map location data and recreate the spot.

Parameters ​

ParameterTypeDescription
new_map_locationstringNew map location type.
new_map_object_idnumberNew target object id.

Returns ​

void

Remarks ​

Removes the current linked spot, sets the objective back to task.in_progress, then creates a new map spot.


create_map_location() ​

ts
create_map_location(on_load: boolean): void;

Create the linked map location if the objective has a spot type and object id.

Parameters ​

ParameterTypeDescription
on_loadbooleanWhether creation happens during save loading.

Returns ​

void

Remarks ​

During load, the objective tries to reattach to an existing serializable spot owned by the task. During normal creation, it creates a new serializable spot and disables its pointer. The objective must already have a map location type and a valid game object id.


get_description() ​

ts
get_description(): string;

Returns ​

string

Objective description text or string table id.


get_icon_name() ​

ts
get_icon_name<T>(): Nullable<T>;

Type Parameters ​

Type ParameterDefault type
T extends stringstring

Returns ​

Nullable<T>

Objective icon name, or null when none is set.


get_idx() ​

ts
get_idx(): number;

Get objective index inside the parent task.

Returns ​

number

Objective index.


get_map_location() ​

ts
get_map_location(): string;

Returns ​

string

Target map location of task object.


get_map_object_id() ​

ts
get_map_object_id(): number;

Returns ​

number

Target map object ID of task object.


get_state() ​

ts
get_state(): TXR_TaskState;

Returns ​

TXR_TaskState

Current objective state.


get_title() ​

ts
get_title(): string;

Returns ​

string

Objective title.


get_type() ​

ts
get_type(): TXR_TaskType;

Returns ​

TXR_TaskType

Task type, such as task.storyline or task.additional.


remove_map_locations() ​

ts
remove_map_locations(notify: boolean): void;

Remove linked map locations.

Parameters ​

ParameterTypeDescription
notifybooleanWhether to notify task manager that the location was released.

Returns ​

void

Remarks ​

When notify is false, the linked map location is removed from the level map manager. The objective then clears its stored location type and object id.


set_article_id() ​

ts
set_article_id(id: string): void;

Set encyclopedia article id unlocked with this objective.

Parameters ​

ParameterTypeDescription
idstringEncyclopedia article id.

Returns ​

void


set_article_key() ​

ts
set_article_key(key: string): void;

Set encyclopedia article key for this objective.

Parameters ​

ParameterTypeDescription
keystringArticle key.

Returns ​

void


set_description() ​

ts
set_description(description: string): void;

Set objective description text.

Parameters ​

ParameterTypeDescription
descriptionstringDescription text or string table id.

Returns ​

void


set_icon_name() ​

ts
set_icon_name(icon_name: string): void;

Set objective icon texture.

Parameters ​

ParameterTypeDescription
icon_namestringIcon texture or string table id.

Returns ​

void


set_map_hint() ​

ts
set_map_hint(hint: string): void;

Set hint text for the linked map location.

Parameters ​

ParameterTypeDescription
hintstringHint text or string table id.

Returns ​

void


set_map_location() ​

ts
set_map_location(location: string): void;

Set map spot type used by this objective.

Parameters ​

ParameterTypeDescription
locationstringMap location type.

Returns ​

void


set_map_object_id() ​

ts
set_map_object_id(id: number): void;

Set object id tracked by the objective map spot.

Parameters ​

ParameterTypeDescription
idnumberGame object id.

Returns ​

void


set_object_id() ​

ts
set_object_id(id: number): void;

Shadow of Chernobyl alias for set_map_object_id.

Parameters ​

ParameterTypeDescription
idnumberGame object id.

Returns ​

void


set_title() ​

ts
set_title(title: string): void;

Set objective title.

Parameters ​

ParameterTypeDescription
titlestringTitle text or string table id.

Returns ​

void


set_type() ​

ts
set_type(type: TXR_TaskType): void;

Set task type.

Parameters ​

ParameterTypeDescription
typeTXR_TaskTypeTask type, such as task.storyline or task.additional.

Returns ​

void

Properties ​

def_ml_enabled ​

ts
def_ml_enabled: boolean;

Whether the default map location should be visible for this objective.

Remarks ​

This mirrors the native def_ml_enabled field used by loaded task objectives.