Skip to content

Class: CGameTask ​

Game task with one or more objectives.

Source ​

C++ class CGameTask : SGameTaskObjective

Custom Constructor ​

CGameTask

Remarks ​

A task is also its root objective. Methods inherited from SGameTaskObjective operate on that root objective.

Extends ​

Constructors ​

Constructor ​

ts
new CGameTask(): CGameTask;

Create an empty game task.

Returns ​

CGameTask

Overrides ​

SGameTaskObjective.constructor

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.

Inherited from ​

SGameTaskObjective.add_complete_func


add_complete_info() ​

ts
add_complete_info(value: string): void;

Require an info portion for objective completion.

Parameters ​

ParameterTypeDescription
valuestringInfo portion id.

Returns ​

void

Inherited from ​

SGameTaskObjective.add_complete_info


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.

Inherited from ​

SGameTaskObjective.add_fail_func


add_fail_info() ​

ts
add_fail_info(value: string): void;

Require an info portion for objective failure.

Parameters ​

ParameterTypeDescription
valuestringInfo portion id.

Returns ​

void

Inherited from ​

SGameTaskObjective.add_fail_info


add_objective() ​

ts
add_objective(objective: SGameTaskObjective): void;

Add an objective to this task.

Parameters ​

ParameterTypeDescription
objectiveSGameTaskObjectiveObjective to adopt into the task.

Returns ​

void

Remarks ​

The native binding adopts the objective and copies its current data into the task objective list. Mutating the original objective after this call does not update the stored copy.


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.

Inherited from ​

SGameTaskObjective.add_on_complete_func


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

Inherited from ​

SGameTaskObjective.add_on_complete_info


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.

Inherited from ​

SGameTaskObjective.add_on_fail_func


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

Inherited from ​

SGameTaskObjective.add_on_fail_info


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.

Inherited from ​

SGameTaskObjective.change_map_location


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.

Inherited from ​

SGameTaskObjective.create_map_location


get_description() ​

ts
get_description(): string;

Returns ​

string

Objective description text or string table id.

Inherited from ​

SGameTaskObjective.get_description


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.

Inherited from ​

SGameTaskObjective.get_icon_name


get_id() ​

ts
get_id(): string;

Returns ​

string

Task id.


get_idx() ​

ts
get_idx(): number;

Get objective index inside the parent task.

Returns ​

number

Objective index.

Inherited from ​

SGameTaskObjective.get_idx


get_map_location() ​

ts
get_map_location(): string;

Returns ​

string

Target map location of task object.

Inherited from ​

SGameTaskObjective.get_map_location


get_map_object_id() ​

ts
get_map_object_id(): number;

Returns ​

number

Target map object ID of task object.

Inherited from ​

SGameTaskObjective.get_map_object_id


get_objective() ​

ts
get_objective(objective_id: number): SGameTaskObjective;

Get objective by index.

Parameters ​

ParameterTypeDescription
objective_idnumberObjective index.

Returns ​

SGameTaskObjective

Objective instance.

Remarks ​

Index 0 returns the root objective. Other indices access native storage without a bounds check.


get_objectives_cnt() ​

ts
get_objectives_cnt(): number;

Count task objectives including the root objective.

Returns ​

number

Objective count.


get_priority() ​

ts
get_priority(): number;

Returns ​

number

Task priority.


get_state() ​

ts
get_state(): TXR_TaskState;

Returns ​

TXR_TaskState

Current objective state.

Inherited from ​

SGameTaskObjective.get_state


get_title() ​

ts
get_title(): string;

Returns ​

string

Objective title.

Inherited from ​

SGameTaskObjective.get_title


get_type() ​

ts
get_type(): TXR_TaskType;

Returns ​

TXR_TaskType

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

Inherited from ​

SGameTaskObjective.get_type


load() ​

ts
load(id: string): void;

Load task data from configs.

Parameters ​

ParameterTypeDescription
idstringTask id.

Returns ​

void

Remarks ​

Reads from gameplay/game_tasks.xml. Task XML function names are resolved immediately.

Throws ​

If the task id is missing from game_tasks.xml or a referenced task function cannot be resolved.


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.

Inherited from ​

SGameTaskObjective.remove_map_locations


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

Inherited from ​

SGameTaskObjective.set_article_id


set_article_key() ​

ts
set_article_key(key: string): void;

Set encyclopedia article key for this objective.

Parameters ​

ParameterTypeDescription
keystringArticle key.

Returns ​

void

Inherited from ​

SGameTaskObjective.set_article_key


set_description() ​

ts
set_description(description: string): void;

Set objective description text.

Parameters ​

ParameterTypeDescription
descriptionstringDescription text or string table id.

Returns ​

void

Inherited from ​

SGameTaskObjective.set_description


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

Inherited from ​

SGameTaskObjective.set_icon_name


set_id() ​

ts
set_id(id: string): void;

Set task id.

Parameters ​

ParameterTypeDescription
idstringTask 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

Inherited from ​

SGameTaskObjective.set_map_hint


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

Inherited from ​

SGameTaskObjective.set_map_location


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

Inherited from ​

SGameTaskObjective.set_map_object_id


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

Inherited from ​

SGameTaskObjective.set_object_id


set_priority() ​

ts
set_priority(priority: number): void;

Set task priority used by task UI ordering.

Parameters ​

ParameterTypeDescription
prioritynumberNew priority.

Returns ​

void


set_title() ​

ts
set_title(title: string): void;

Set objective title.

Parameters ​

ParameterTypeDescription
titlestringTitle text or string table id.

Returns ​

void

Inherited from ​

SGameTaskObjective.set_title


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

Inherited from ​

SGameTaskObjective.set_type

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.

Inherited from ​

SGameTaskObjective.def_ml_enabled