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
new CGameTask(): CGameTask;Create an empty game task.
Returns
CGameTask
Overrides
SGameTaskObjective.constructor
Methods
add_complete_func()
add_complete_func(function_name: string): void;Add a script predicate used to decide objective completion.
Parameters
| Parameter | Type | Description |
|---|---|---|
function_name | string | Script 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()
add_complete_info(value: string): void;Require an info portion for objective completion.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | string | Info portion id. |
Returns
void
Inherited from
SGameTaskObjective.add_complete_info
add_fail_func()
add_fail_func(function_name: string): void;Add a script predicate used to decide objective failure.
Parameters
| Parameter | Type | Description |
|---|---|---|
function_name | string | Script 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()
add_fail_info(value: string): void;Require an info portion for objective failure.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | string | Info portion id. |
Returns
void
Inherited from
SGameTaskObjective.add_fail_info
add_objective()
add_objective(objective: SGameTaskObjective): void;Add an objective to this task.
Parameters
| Parameter | Type | Description |
|---|---|---|
objective | SGameTaskObjective | Objective 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()
add_on_complete_func(function_name: string): void;Add a script function called after objective completion.
Parameters
| Parameter | Type | Description |
|---|---|---|
function_name | string | Script 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()
add_on_complete_info(value: string): void;Give an info portion when objective completes.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | string | Info portion id. |
Returns
void
Inherited from
SGameTaskObjective.add_on_complete_info
add_on_fail_func()
add_on_fail_func(function_name: string): void;Add a script function called after objective failure.
Parameters
| Parameter | Type | Description |
|---|---|---|
function_name | string | Script 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()
add_on_fail_info(value: string): void;Give an info portion when objective fails.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | string | Info portion id. |
Returns
void
Inherited from
SGameTaskObjective.add_on_fail_info
change_map_location()
change_map_location(new_map_location: string, new_map_object_id: number): void;Replace linked map location data and recreate the spot.
Parameters
| Parameter | Type | Description |
|---|---|---|
new_map_location | string | New map location type. |
new_map_object_id | number | New 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()
create_map_location(on_load: boolean): void;Create the linked map location if the objective has a spot type and object id.
Parameters
| Parameter | Type | Description |
|---|---|---|
on_load | boolean | Whether 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()
get_description(): string;Returns
string
Objective description text or string table id.
Inherited from
SGameTaskObjective.get_description
get_icon_name()
get_icon_name<T>(): Nullable<T>;Type Parameters
| Type Parameter | Default type |
|---|---|
T extends string | string |
Returns
Nullable<T>
Objective icon name, or null when none is set.
Inherited from
SGameTaskObjective.get_icon_name
get_id()
get_id(): string;Returns
string
Task id.
get_idx()
get_idx(): number;Get objective index inside the parent task.
Returns
number
Objective index.
Inherited from
get_map_location()
get_map_location(): string;Returns
string
Target map location of task object.
Inherited from
SGameTaskObjective.get_map_location
get_map_object_id()
get_map_object_id(): number;Returns
number
Target map object ID of task object.
Inherited from
SGameTaskObjective.get_map_object_id
get_objective()
get_objective(objective_id: number): SGameTaskObjective;Get objective by index.
Parameters
| Parameter | Type | Description |
|---|---|---|
objective_id | number | Objective index. |
Returns
Objective instance.
Remarks
Index 0 returns the root objective. Other indices access native storage without a bounds check.
get_objectives_cnt()
get_objectives_cnt(): number;Count task objectives including the root objective.
Returns
number
Objective count.
get_priority()
get_priority(): number;Returns
number
Task priority.
get_state()
get_state(): TXR_TaskState;Returns
Current objective state.
Inherited from
get_title()
get_title(): string;Returns
string
Objective title.
Inherited from
get_type()
get_type(): TXR_TaskType;Returns
Task type, such as task.storyline or task.additional.
Inherited from
load()
load(id: string): void;Load task data from configs.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Task 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()
remove_map_locations(notify: boolean): void;Remove linked map locations.
Parameters
| Parameter | Type | Description |
|---|---|---|
notify | boolean | Whether 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()
set_article_id(id: string): void;Set encyclopedia article id unlocked with this objective.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Encyclopedia article id. |
Returns
void
Inherited from
SGameTaskObjective.set_article_id
set_article_key()
set_article_key(key: string): void;Set encyclopedia article key for this objective.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | Article key. |
Returns
void
Inherited from
SGameTaskObjective.set_article_key
set_description()
set_description(description: string): void;Set objective description text.
Parameters
| Parameter | Type | Description |
|---|---|---|
description | string | Description text or string table id. |
Returns
void
Inherited from
SGameTaskObjective.set_description
set_icon_name()
set_icon_name(icon_name: string): void;Set objective icon texture.
Parameters
| Parameter | Type | Description |
|---|---|---|
icon_name | string | Icon texture or string table id. |
Returns
void
Inherited from
SGameTaskObjective.set_icon_name
set_id()
set_id(id: string): void;Set task id.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Task id. |
Returns
void
set_map_hint()
set_map_hint(hint: string): void;Set hint text for the linked map location.
Parameters
| Parameter | Type | Description |
|---|---|---|
hint | string | Hint text or string table id. |
Returns
void
Inherited from
SGameTaskObjective.set_map_hint
set_map_location()
set_map_location(location: string): void;Set map spot type used by this objective.
Parameters
| Parameter | Type | Description |
|---|---|---|
location | string | Map location type. |
Returns
void
Inherited from
SGameTaskObjective.set_map_location
set_map_object_id()
set_map_object_id(id: number): void;Set object id tracked by the objective map spot.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | number | Game object id. |
Returns
void
Inherited from
SGameTaskObjective.set_map_object_id
set_object_id()
set_object_id(id: number): void;Shadow of Chernobyl alias for set_map_object_id.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | number | Game object id. |
Returns
void
Inherited from
SGameTaskObjective.set_object_id
set_priority()
set_priority(priority: number): void;Set task priority used by task UI ordering.
Parameters
| Parameter | Type | Description |
|---|---|---|
priority | number | New priority. |
Returns
void
set_title()
set_title(title: string): void;Set objective title.
Parameters
| Parameter | Type | Description |
|---|---|---|
title | string | Title text or string table id. |
Returns
void
Inherited from
set_type()
set_type(type: TXR_TaskType): void;Set task type.
Parameters
| Parameter | Type | Description |
|---|---|---|
type | TXR_TaskType | Task type, such as task.storyline or task.additional. |
Returns
void
Inherited from
Properties
def_ml_enabled
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.