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
new SGameTaskObjective(task: CGameTask, id: number): SGameTaskObjective;Parameters
| Parameter | Type | Description |
|---|---|---|
task | CGameTask | Parent task. |
id | number | Objective index. |
Returns
SGameTaskObjective
Remarks
The objective stores a pointer to task; keep the parent task alive while using this objective.
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.
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
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.
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
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.
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
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.
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
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.
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.
get_description()
get_description(): string;Returns
string
Objective description text or string table id.
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.
get_idx()
get_idx(): number;Get objective index inside the parent task.
Returns
number
Objective index.
get_map_location()
get_map_location(): string;Returns
string
Target map location of task object.
get_map_object_id()
get_map_object_id(): number;Returns
number
Target map object ID of task object.
get_state()
get_state(): TXR_TaskState;Returns
Current objective state.
get_title()
get_title(): string;Returns
string
Objective title.
get_type()
get_type(): TXR_TaskType;Returns
Task type, such as task.storyline or task.additional.
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.
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
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
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
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
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
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
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
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
set_title()
set_title(title: string): void;Set objective title.
Parameters
| Parameter | Type | Description |
|---|---|---|
title | string | Title text or string table id. |
Returns
void
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
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.