Skip to content

Interface: IXR_level ​

Global helpers for the currently loaded level.

This namespace covers object lookup, time/weather control, navigation queries, map spots, and effectors.

Source ​

namespace level

Methods ​

add_call() ​

Call Signature ​

ts
add_call(
   this: void, 
   condition: (this: void) => boolean, 
   action: (this: void) => boolean): void;

Register a conditional level callback.

Parameters ​
ParameterTypeDescription
thisvoid-
condition(this: void) => booleanCallback polled by the engine.
action(this: void) => booleanCallback called when the condition is satisfied.
Returns ​

void

Remarks ​

The physics commander polls this callback pair. Remove it with the same condition and action callbacks when the owner no longer needs it.

Call Signature ​

ts
add_call(
   this: void, 
   object: object, 
   condition: (this: void) => boolean, 
   action: (this: void) => boolean): void;

Register a conditional level callback owned by an object.

Parameters ​
ParameterTypeDescription
thisvoid-
objectobjectOwner object used for later removal.
condition(this: void) => booleanCallback polled by the engine.
action(this: void) => booleanCallback called when the condition is satisfied.
Returns ​

void

Remarks ​

The owner is used only for callback lookup and bulk removal. Keep the object alive while the callback can run.

Call Signature ​

ts
add_call(
   this: void, 
   object: object, 
   condition: string, 
   action: string): void;

Register named object methods as a conditional level callback.

Parameters ​
ParameterTypeDescription
thisvoid-
objectobjectOwner object used for callback lookup and removal.
conditionstringMethod name used as condition callback.
actionstringMethod name called when the condition is satisfied.
Returns ​

void

Remarks ​

This overload registers a unique callback pair for the object and method names.


add_cam_effector() ​

ts
add_cam_effector(
   this: void, 
   effect: string, 
   id: number, 
   is_cyclic: boolean, 
   callback: string): number;

Start a camera effector.

Parameters ​

ParameterTypeDescription
thisvoid-
effectstringCamera effector animation file.
idnumberEffector id used for replacement and removal.
is_cyclicbooleanWhether the effector loops.
callbackstringLua callback name called when the effector finishes.

Returns ​

number

Effector animation length.

Remarks ​

Requires an actor. The binding adds the effector to Actor().Cameras().


add_cam_effector2() ​

ts
add_cam_effector2(
   this: void, 
   effect: string, 
   id: number, 
   is_cyclic: boolean, 
   callback: string, 
   camera_fov?: number): number;

Start a camera effector with custom field of view.

Parameters ​

ParameterTypeDescription
thisvoid-
effectstringCamera effector animation file.
idnumberEffector id used for replacement and removal.
is_cyclicbooleanWhether the effector loops.
callbackstringLua callback name called when the effector finishes.
camera_fov?numberOptional field of view for the effector.

Returns ​

number

Effector animation length.

Since ​

OpenXRay 2019-05-07, 2d1b946a, PR #382

Remarks ​

Requires an actor. The binding adds the effector to Actor().Cameras().


add_complex_effector() ​

ts
add_complex_effector(
   this: void, 
   section: string, 
   id: number): void;

Start a named complex effector.

Parameters ​

ParameterTypeDescription
thisvoid-
sectionstringEffector section name.
idnumberEffector id used for replacement and removal.

Returns ​

void

Remarks ​

Requires an actor. The effector is attached to the current actor object.


add_dialog_to_render() ​

ts
add_dialog_to_render(this: void, window: CUIDialogWnd): void;

Add a dialog window to the render list.

Parameters ​

ParameterTypeDescription
thisvoid-
windowCUIDialogWndDialog window to render.

Returns ​

void


add_pp_effector() ​

ts
add_pp_effector(
   this: void, 
   file_name: string, 
   id: number, 
   is_cyclic: boolean): void;

Start a post-process effector.

Parameters ​

ParameterTypeDescription
thisvoid-
file_namestringPost-process effector file.
idnumberEffector id used for replacement and removal.
is_cyclicbooleanWhether the effector loops.

Returns ​

void

Remarks ​

Requires an actor. The effector is attached to the actor camera manager.


change_game_time() ​

ts
change_game_time(
   this: void, 
   days: number, 
   hours: number, 
   minutes: number): void;

Move game time forward.

Parameters ​

ParameterTypeDescription
thisvoid-
daysnumberDays to add.
hoursnumberHours to add.
minutesnumberMinutes to add.

Returns ​

void

Remarks ​

Works only on a single-player server with ALife available. Otherwise the binding returns without changing time.


check_object() ​

ts
check_object(this: void, object: game_object): void;

Validate a game object pointer in the engine.

Parameters ​

ParameterTypeDescription
thisvoid-
objectgame_objectObject to check.

Returns ​

void

Remarks ​

Exported only in debug builds.


client_spawn_manager() ​

ts
client_spawn_manager(this: void): client_spawn_manager;

Get the level client spawn manager.

Parameters ​

ParameterType
thisvoid

Returns ​

client_spawn_manager

Client spawn manager.


debug_actor() ​

ts
debug_actor(this: void): Nullable<game_object>;

Get the current actor object used by debug helpers.

Parameters ​

ParameterType
thisvoid

Returns ​

Nullable<game_object>

Actor game object, or null when no actor is current.

Source ​

src/xrGame/level_script.cpp, debug_actor binding.

Remarks ​

Exported only in debug builds. The native helper logs a warning on first use and returns null when the current level entity is not an actor.


debug_object() ​

ts
debug_object(this: void, name: string): Nullable<game_object>;

Find an online object by debug name.

Parameters ​

ParameterTypeDescription
thisvoid-
namestringRuntime object name.

Returns ​

Nullable<game_object>

Matching online object, or null when no object with this name is loaded.

Source ​

src/xrGame/level_script.cpp, debug_object binding.

Remarks ​

Exported only in debug builds. The native helper logs a warning on first use and searches loaded level objects by runtime name.


disable_input() ​

ts
disable_input(this: void): void;

Disable player input.

Parameters ​

ParameterType
thisvoid

Returns ​

void

Remarks ​

Does nothing while the actor exists and permanent god mode is enabled.


enable_input() ​

ts
enable_input(this: void): void;

Enable player input.

Parameters ​

ParameterType
thisvoid

Returns ​

void


environment() ​

ts
environment(this: void): CEnvironment;

Get the active weather environment controller.

Parameters ​

ParameterType
thisvoid

Returns ​

CEnvironment

Engine-owned environment controller.


game_id() ​

ts
game_id(this: void): TXR_EGameID;

Get current game state id.

Parameters ​

ParameterType
thisvoid

Returns ​

TXR_EGameID

Game id bitmask.


get_active_cam() ​

ts
get_active_cam(this: void): number;

Get active camera id.

Parameters ​

ParameterType
thisvoid

Returns ​

number

Camera id.

Since ​

OpenXRay 2015-07-07, 6e703b4c

Remarks ​

Returns 255 when the current view entity is not an actor.


get_actor_body_state() ​

ts
get_actor_body_state(this: void): number;

Get current actor body state.

Parameters ​

ParameterType
thisvoid

Returns ​

number

Current actor body state id, or 0 when unavailable.

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Source ​

src/xrGame/level_script.cpp, level.get_actor_body_state binding.

Remarks ​

Returns 0 when there is no actor object.


get_actor_body_state_wishful() ​

ts
get_actor_body_state_wishful(this: void): number;

Get body state currently requested by actor movement.

Parameters ​

ParameterType
thisvoid

Returns ​

number

Desired actor body state id, or 0 when unavailable.

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Source ​

src/xrGame/level_script.cpp, level.get_actor_body_state_wishful binding.

Remarks ​

Returns 0 when there is no actor object.


get_bounding_volume() ​

ts
get_bounding_volume(this: void): Fbox;

Get the level bounding box.

Parameters ​

ParameterType
thisvoid

Returns ​

Fbox

Level bounds.


get_fov() ​

ts
get_fov(this: void): number;

Get global world field of view.

Parameters ​

ParameterType
thisvoid

Returns ​

number

Current world FOV value.

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Source ​

src/xrGame/level_script.cpp, level.get_fov binding.


get_game_difficulty() ​

ts
get_game_difficulty(this: void): TXR_game_difficulty;

Get active single-player difficulty.

Parameters ​

ParameterType
thisvoid

Returns ​

TXR_game_difficulty

Current game_difficulty enum value.

Source ​

src/xrGame/level_script.cpp, get_game_difficulty.


get_ph_time_factor() ​

ts
get_ph_time_factor(this: void): number;

Get the current physics time factor.

Parameters ​

ParameterType
thisvoid

Returns ​

number

Physics simulation time factor.

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Source ​

src/xrPhysics/PHWorldScript.cpp, level.get_ph_time_factor binding.


get_snd_volume() ​

ts
get_snd_volume(this: void): number;

Get sound volume.

Parameters ​

ParameterType
thisvoid

Returns ​

number

Sound volume.


get_start_time() ​

ts
get_start_time(this: void): CTime;

Get the level start game time.

Parameters ​

ParameterType
thisvoid

Returns ​

CTime

Start game time value.

Since ​

OpenXRay 2022-08-09, a2d264fc, PR #1032

Source ​

src/xrGame/level_script.cpp, level.get_start_time binding.


get_target_dist() ​

ts
get_target_dist(this: void): number;

Get distance to the object or surface under the crosshair.

Parameters ​

ParameterType
thisvoid

Returns ​

number

Target distance.

Since ​

OpenXRay 2017-08-15, 565b39e5


get_target_element() ​

ts
get_target_element(this: void): number;

Get targeted model element under the crosshair.

Parameters ​

ParameterType
thisvoid

Returns ​

number

Target element id.

Since ​

OpenXRay 2015-06-03, 7213550c

Remarks ​

Returns 0 when the current ray query has no model element.


get_target_obj() ​

ts
get_target_obj(this: void): Nullable<game_object>;

Get the object under the crosshair.

Parameters ​

ParameterType
thisvoid

Returns ​

Nullable<game_object>

Target object, or null when nothing is targeted.

Since ​

OpenXRay 2017-08-15, 565b39e5

Source ​

src/xrGame/level_script.cpp, g_get_target_obj.

Remarks ​

Reads the current HUD ray query. Returns null when the ray hit has no object or the hit object is not a CGameObject.


get_time_days() ​

ts
get_time_days(this: void): number;

Get current game day count.

Parameters ​

ParameterType
thisvoid

Returns ​

number

Current day count.


get_time_factor() ​

ts
get_time_factor(this: void): number;

Get game time speed multiplier.

Parameters ​

ParameterType
thisvoid

Returns ​

number

Time factor.


get_time_hours() ​

ts
get_time_hours(this: void): number;

Get current game hour.

Parameters ​

ParameterType
thisvoid

Returns ​

number

Hour of day.


get_time_minutes() ​

ts
get_time_minutes(this: void): number;

Get current game minute.

Parameters ​

ParameterType
thisvoid

Returns ​

number

Minute of hour.


get_weather() ​

ts
get_weather(this: void): string;

Get current weather cycle name.

Parameters ​

ParameterType
thisvoid

Returns ​

string

Weather name.


get_wfx_time() ​

ts
get_wfx_time(this: void): number;

Get active weather effect time.

Parameters ​

ParameterType
thisvoid

Returns ​

number

Weather effect time.


hide_indicators() ​

ts
hide_indicators(this: void): void;

Hide HUD indicators.

Parameters ​

ParameterType
thisvoid

Returns ​

void

Remarks ​

Also enables the runtime god-mode flag used while HUD indicators are hidden.


hide_indicators_safe() ​

ts
hide_indicators_safe(this: void): void;

Hide HUD indicators if the HUD is available.

Parameters ​

ParameterType
thisvoid

Returns ​

void

Remarks ​

Also enables the runtime god-mode flag used while HUD indicators are hidden.


hide_minimap() ​

ts
hide_minimap(this: void): void;

Hide the HUD minimap.

Parameters ​

ParameterType
thisvoid

Returns ​

void

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Source ​

src/xrGame/level_script.cpp, level.hide_minimap binding.

Remarks ​

Requires an active game UI and main in-game HUD window.


high_cover_in_direction() ​

ts
high_cover_in_direction(
   this: void, 
   vertex_id: number, 
   direction: vector): number;

Sample high cover from a level vertex in a direction.

Parameters ​

ParameterTypeDescription
thisvoid-
vertex_idnumberLevel vertex id.
directionvectorDirection to sample.

Returns ​

number

Cover value.


is_wfx_playing() ​

ts
is_wfx_playing(this: void): boolean;

Check whether a weather effect is playing.

Parameters ​

ParameterType
thisvoid

Returns ​

boolean

Whether a weather effect is active.


iterate_online_objects() ​

ts
iterate_online_objects(this: void, cb: (this: void, object: game_object) => boolean | void): void;

Iterate objects currently online on the level.

Parameters ​

ParameterTypeDescription
thisvoid-
cb(this: void, object: game_object) => boolean | voidCallback called for each online object.

Returns ​

void

Since ​

OpenXRay 2019-04-28, 13c5c022


iterate_sounds() ​

Call Signature ​

ts
iterate_sounds(
   this: void, 
   section: string, 
   max_count: number, 
   cb: (this: void, name: string) => void): void;

Iterate sounds from a sound collection.

Parameters ​
ParameterTypeDescription
thisvoid-
sectionstringSound collection section.
max_countnumberNumbered suffixes to probe for each base name.
cb(this: void, name: string) => voidCallback called with each sound name.
Returns ​

void

Remarks ​

section may contain a comma-separated list of base names. The callback receives each existing sound name found in $game_sounds$, including numbered variants from 0 up to max_count - 1.

Call Signature ​

ts
iterate_sounds(
   this: void, 
   section: string, 
   max_count: number, 
   object: object, 
   cb: (this: void, name: string) => void): void;

Iterate sounds from a sound collection with an owner object.

Parameters ​
ParameterTypeDescription
thisvoid-
sectionstringSound collection section.
max_countnumberNumbered suffixes to probe for each base name.
objectobjectOwner object.
cb(this: void, name: string) => voidCallback called with each sound name.
Returns ​

void

Remarks ​

section may contain a comma-separated list of base names. The callback receives each existing sound name found in $game_sounds$, including numbered variants from 0 up to max_count - 1.


low_cover_in_direction() ​

ts
low_cover_in_direction(
   this: void, 
   vertex_id: number, 
   direction: vector): number;

Sample low cover from a level vertex in a direction.

Parameters ​

ParameterTypeDescription
thisvoid-
vertex_idnumberLevel vertex id.
directionvectorDirection to sample.

Returns ​

number

Cover value.


main_input_receiver() ​

ts
main_input_receiver(this: void): CUIDialogWnd;

Get the main UI input receiver.

Parameters ​

ParameterType
thisvoid

Returns ​

CUIDialogWnd

Active dialog window.


map_add_object_spot() ​

ts
map_add_object_spot(
   this: void, 
   object_id: number, 
   spot_type: string, 
   hint: string): void;

Add a PDA map spot for an object.

Parameters ​

ParameterTypeDescription
thisvoid-
object_idnumberTarget object id.
spot_typestringSpot type from map spot config.
hintstringSpot hint text.

Returns ​

void


map_add_object_spot_ser() ​

ts
map_add_object_spot_ser(
   this: void, 
   object_id: number, 
   spot_type: string, 
   hint: string): void;

Add a serialized PDA map spot for an object.

Parameters ​

ParameterTypeDescription
thisvoid-
object_idnumberTarget object id.
spot_typestringSpot type from map spot config.
hintstringSpot hint text.

Returns ​

void


map_change_spot_hint() ​

ts
map_change_spot_hint(
   this: void, 
   object_id: number, 
   spot_type: string, 
   hint: string): void;

Change hint text for an object map spot.

Parameters ​

ParameterTypeDescription
thisvoid-
object_idnumberTarget object id.
spot_typestringSpot type from map spot config.
hintstringNew hint text.

Returns ​

void

Remarks ​

Does nothing when the object does not have a matching map spot.


map_has_object_spot() ​

ts
map_has_object_spot(
   this: void, 
   object_id: number, 
   spot_type: string): number;

Check if an object has a map spot registered with provided selector.

Parameters ​

ParameterTypeDescription
thisvoid-
object_idnumberGame object id to check.
spot_typestringMap spot type.

Returns ​

number

Non-zero count when the spot exists.


map_remove_object_spot() ​

ts
map_remove_object_spot(
   this: void, 
   object_id: number, 
   spot_type: string): void;

Remove an object map spot if it exists.

Parameters ​

ParameterTypeDescription
thisvoid-
object_idnumberGame object id to update.
spot_typestringMap spot type.

Returns ​

void


minimap_shown() ​

ts
minimap_shown(this: void): boolean;

Check whether the HUD minimap is visible.

Parameters ​

ParameterType
thisvoid

Returns ​

boolean

Whether the minimap is currently shown.

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Source ​

src/xrGame/level_script.cpp, level.minimap_shown binding.

Remarks ​

Requires an active game UI and main in-game HUD window.


name() ​

ts
name<T>(this: void): T;

Get current level name.

Type Parameters ​

Type ParameterDefault type
T extends stringstring

Parameters ​

ParameterType
thisvoid

Returns ​

T

Level name.


object_by_id() ​

ts
object_by_id(this: void, object_id: number): Nullable<game_object>;

Find an online object by runtime id.

Parameters ​

ParameterTypeDescription
thisvoid-
object_idnumberRuntime network object id.

Returns ​

Nullable<game_object>

Matching online object, or null when it is not loaded on the level.

Source ​

src/xrGame/level_script.cpp, object_by_id binding.

Remarks ​

Looks up the object in Level().Objects by network id. This does not search offline ALife objects.


patrol_path_exists() ​

ts
patrol_path_exists(this: void, path_name: string): boolean;

Check whether a patrol path exists on this level.

Parameters ​

ParameterTypeDescription
thisvoid-
path_namestringPatrol path name.

Returns ​

boolean

Whether the patrol path exists.


physics_world() ​

ts
physics_world(this: void): physics_world;

Get the level physics world.

Parameters ​

ParameterType
thisvoid

Returns ​

physics_world

Physics world object.


prefetch_sound() ​

ts
prefetch_sound(this: void, sound: string): void;

Preload a sound resource.

Parameters ​

ParameterTypeDescription
thisvoid-
soundstringSound resource name.

Returns ​

void


present() ​

ts
present(this: void): boolean;

Check whether a game level is loaded.

Parameters ​

ParameterType
thisvoid

Returns ​

boolean

Whether a level is present.


rain_factor() ​

ts
rain_factor(this: void): number;

Get current rain intensity.

Parameters ​

ParameterType
thisvoid

Returns ​

number

Rain intensity, or 0 when no rain is active.


ray_pick() ​

ts
ray_pick(
   this: void, 
   position: vector, 
   direction: vector, 
   range: number, 
   target: TXR_rq_target, 
   result: rq_result, 
   ignore_object: Nillable<game_object>): boolean;

Cast a ray through the level collision world.

Parameters ​

ParameterTypeDescription
thisvoid-
positionvectorRay origin.
directionvectorRay direction.
rangenumberRay range.
targetTXR_rq_targetRay query target flags.
resultrq_resultRay query result placeholder.
ignore_objectNillable<game_object>Object ignored by the query, or null.

Returns ​

boolean

Whether the ray hit anything.

Remarks ​

result is updated only when this returns true. Use rq_target flags to choose static, object, or dynamic collision targets.


remove_call() ​

Call Signature ​

ts
remove_call(
   this: void, 
   condition: (this: void) => boolean, 
   action: (this: void) => void): void;

Remove a conditional level callback.

Parameters ​
ParameterTypeDescription
thisvoid-
condition(this: void) => booleanCondition callback originally registered.
action(this: void) => voidAction callback originally registered.
Returns ​

void

Remarks ​

The callbacks must match the original registered pair.

Call Signature ​

ts
remove_call(
   this: void, 
   object: object, 
   condition: (this: void) => boolean, 
   action: (this: void) => void): void;

Remove an object-owned conditional level callback.

Parameters ​
ParameterTypeDescription
thisvoid-
objectobjectOwner object.
condition(this: void) => booleanCondition callback originally registered.
action(this: void) => voidAction callback originally registered.
Returns ​

void

Remarks ​

The owner and callbacks must match the original registered pair.

Call Signature ​

ts
remove_call(
   this: void, 
   object: object, 
   condition: string, 
   action: string): void;

Remove named object methods registered as a level callback.

Parameters ​
ParameterTypeDescription
thisvoid-
objectobjectOwner object.
conditionstringCondition method name.
actionstringAction method name.
Returns ​

void

Remarks ​

The owner and method names must match the original registered pair.


remove_calls_for_object() ​

ts
remove_calls_for_object(this: void, object: object): void;

Remove all registered level callbacks for an object.

Parameters ​

ParameterTypeDescription
thisvoid-
objectobjectOwner object.

Returns ​

void


remove_cam_effector() ​

ts
remove_cam_effector(this: void, id: number): void;

Stop a camera effector.

Parameters ​

ParameterTypeDescription
thisvoid-
idnumberEffector id.

Returns ​

void

Remarks ​

Requires an actor. The binding removes the effector from Actor().Cameras().


remove_complex_effector() ​

ts
remove_complex_effector(this: void, id: number): void;

Stop a complex effector.

Parameters ​

ParameterTypeDescription
thisvoid-
idnumberEffector id.

Returns ​

void

Remarks ​

Requires an actor. The binding removes the effector from the current actor object.


remove_dialog_to_render() ​

ts
remove_dialog_to_render(this: void, window: CUIDialogWnd): void;

Remove a dialog window from the render list.

Parameters ​

ParameterTypeDescription
thisvoid-
windowCUIDialogWndDialog window to stop rendering.

Returns ​

void


remove_pp_effector() ​

ts
remove_pp_effector(this: void, id: number): void;

Stop a post-process effector.

Parameters ​

ParameterTypeDescription
thisvoid-
idnumberEffector id.

Returns ​

void

Remarks ​

Requires an actor. Does nothing when no post-process effector exists for the id.


send() ​

ts
send(
   this: void, 
   packet: net_packet, 
   reliable: boolean, 
   sequential: boolean, 
   high_priority: boolean, 
   send_immediately: boolean): void;

Send a network packet through the level.

Parameters ​

ParameterTypeDescription
thisvoid-
packetnet_packetPacket to send.
reliablebooleanWhether the packet is reliable.
sequentialbooleanWhether the packet is sequential.
high_prioritybooleanWhether to send with high priority.
send_immediatelybooleanWhether to flush immediately.

Returns ​

void

Since ​

OpenXRay 2017-08-15, 565b39e5


set_active_cam() ​

ts
set_active_cam(this: void, id: number): void;

Set active camera id.

Parameters ​

ParameterTypeDescription
thisvoid-
idnumberCamera id.

Returns ​

void

Since ​

OpenXRay 2015-07-07, 6e703b4c

Remarks ​

Does nothing when the current view entity is not an actor or when the id is outside the actor camera range.


set_fov() ​

ts
set_fov(this: void, fov: number): void;

Set global world field of view.

Parameters ​

ParameterTypeDescription
thisvoid-
fovnumberWorld FOV value to assign.

Returns ​

void

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Source ​

src/xrGame/level_script.cpp, level.set_fov binding.


set_game_difficulty() ​

ts
set_game_difficulty(this: void, difficulty: TXR_game_difficulty): void;

Set active single-player difficulty.

Parameters ​

ParameterTypeDescription
thisvoid-
difficultyTXR_game_difficultygame_difficulty enum value.

Returns ​

void

Source ​

src/xrGame/level_script.cpp, set_game_difficulty.

Remarks ​

Updates the global difficulty and notifies the active single-player game state. The native binding verifies that the current game state is game_cl_Single.

Throws ​

If the active game state is not single-player.


set_ph_time_factor() ​

ts
set_ph_time_factor(this: void, factor: number): number;

Set physics simulation time factor.

Parameters ​

ParameterTypeDescription
thisvoid-
factornumberPhysics time factor to assign.

Returns ​

number

Applied physics time factor.

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Source ​

src/xrPhysics/PHWorldScript.cpp, level.set_ph_time_factor binding.


set_pp_effector_factor() ​

ts
set_pp_effector_factor(
   this: void, 
   id: number, 
   factor: number, 
   speed?: number): void;

Set a post-process effector factor.

Parameters ​

ParameterTypeDescription
thisvoid-
idnumberEffector id.
factornumberTarget factor.
speed?numberOptional transition speed.

Returns ​

void

Remarks ​

Requires an actor. Does nothing when no post-process effector exists for the id.


set_snd_volume() ​

ts
set_snd_volume(this: void, volume: number): void;

Set sound volume.

Parameters ​

ParameterTypeDescription
thisvoid-
volumenumberSound volume.

Returns ​

void

Remarks ​

The engine clamps the value to the 0..1 range.


set_time_factor() ​

ts
set_time_factor(this: void, factor: number): void;

Set game time speed multiplier.

Parameters ​

ParameterTypeDescription
thisvoid-
factornumberTime factor.

Returns ​

void

Remarks ​

Works only on the server and outside editor mode. Otherwise the binding returns without changing the time factor.


set_weather() ​

ts
set_weather(
   this: void, 
   weather_name: string, 
   is_forced: boolean): void;

Change active game weather.

Parameters ​

ParameterTypeDescription
thisvoid-
weather_namestringName of weather config to apply.
is_forcedbooleanWhether weather change should be forced.

Returns ​

void

Remarks ​

Does nothing in editor mode.


set_weather_fx() ​

ts
set_weather_fx(this: void, weather_fx_name: string): boolean;

Start a weather effect by name.

Parameters ​

ParameterTypeDescription
thisvoid-
weather_fx_namestringWeather effect config name.

Returns ​

boolean

Whether the effect started.

Remarks ​

Returns false in editor mode.


show_indicators() ​

ts
show_indicators(this: void): void;

Show HUD indicators.

Parameters ​

ParameterType
thisvoid

Returns ​

void

Remarks ​

Clears the runtime god-mode flag set by hide_indicators() and hide_indicators_safe().


show_minimap() ​

ts
show_minimap(this: void): void;

Show the HUD minimap.

Parameters ​

ParameterType
thisvoid

Returns ​

void

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Source ​

src/xrGame/level_script.cpp, level.show_minimap binding.

Remarks ​

Requires an active game UI and main in-game HUD window.


show_weapon() ​

ts
show_weapon(this: void, is_visible: boolean): void;

Show or hide actor weapon.

Parameters ​

ParameterTypeDescription
thisvoid-
is_visiblebooleanWhether weapon should be visible.

Returns ​

void

Remarks ​

Does nothing while the actor exists and permanent god mode is enabled.


spawn_item() ​

ts
spawn_item(
   this: void, 
   section: string, 
   position: vector, 
   level_vertex_id: number, 
   parent_id: number, 
   return_item: boolean): void;

Spawn an item on the level.

Parameters ​

ParameterTypeDescription
thisvoid-
sectionstringItem section name.
positionvectorSpawn position.
level_vertex_idnumberTarget level vertex.
parent_idnumberParent object id, or 0xffff for none.
return_itembooleanEngine spawn flag passed through to Level().spawn_item.

Returns ​

void

Since ​

OpenXRay 2015-01-18, 3ee7401d

Remarks ​

Uses the level spawn path, which is suitable for sections that are unsafe to create through alife():create(), such as bolts, phantoms, and ammo.


spawn_phantom() ​

ts
spawn_phantom(this: void, position: vector): void;

Spawn a phantom at a position.

Parameters ​

ParameterTypeDescription
thisvoid-
positionvectorSpawn position.

Returns ​

void


start_stop_menu() ​

ts
start_stop_menu(
   this: void, 
   dialog: CUIDialogWnd, 
   should_hide_indicators: boolean): void;

Start or stop a menu dialog.

Parameters ​

ParameterTypeDescription
thisvoid-
dialogCUIDialogWndDialog window.
should_hide_indicatorsbooleanWhether showing the dialog should hide HUD indicators.

Returns ​

void

Remarks ​

Hides the dialog when it is already shown. Otherwise shows it and applies should_hide_indicators.


start_weather_fx_from_time() ​

ts
start_weather_fx_from_time(
   this: void, 
   weather_fx_name: string, 
   time: number): boolean;

Start a weather effect from a specific time.

Parameters ​

ParameterTypeDescription
thisvoid-
weather_fx_namestringWeather effect config name.
timenumberStart time.

Returns ​

boolean

Whether the effect started.

Remarks ​

Returns false in editor mode.


stop_weather_fx() ​

ts
stop_weather_fx(this: void): void;

Stop the active weather effect.

Parameters ​

ParameterType
thisvoid

Returns ​

void


valid_vertex() ​

ts
valid_vertex(this: void, vertex_id: number): boolean;

Check whether a level vertex id is valid.

Parameters ​

ParameterTypeDescription
thisvoid-
vertex_idnumberLevel vertex id to check.

Returns ​

boolean

Whether the level graph contains the vertex.

Since ​

OpenXRay 2022-08-09, a2d264fc, PR #1032

Source ​

src/xrGame/level_script.cpp, level.valid_vertex binding.


vertex_id() ​

ts
vertex_id(this: void, position: vector): number;

Get nearest level vertex for a position.

Parameters ​

ParameterTypeDescription
thisvoid-
positionvectorWorld position.

Returns ​

number

Level vertex id.

Remarks ​

The binding preserves original Lua behavior for invalid vertices and returns 4294967296 instead of u32(-1).


vertex_in_direction() ​

ts
vertex_in_direction(
   this: void, 
   vertex_id: number, 
   direction: vector, 
   distance: number): number;

Move from a level vertex in a direction.

Parameters ​

ParameterTypeDescription
thisvoid-
vertex_idnumberStart level vertex id.
directionvectorDirection to move.
distancenumberDistance to move.

Returns ​

number

Result level vertex id.

Remarks ​

Returns the original vertex when the engine cannot find a valid vertex in the requested direction.


vertex_position() ​

ts
vertex_position(this: void, id: number): vector;

Get world position of a level vertex.

Parameters ​

ParameterTypeDescription
thisvoid-
idnumberLevel vertex id.

Returns ​

vector

Vertex position.