Skip to content

Class: CHelicopter

Script-controlled helicopter object.

Source

src/xrGame/helicopter_script.cpp, CHelicopter binding.

Custom Constructor

CHelicopter

Remarks

Helicopter controls require a helicopter object. Movement, enemy, lighting, and fire-trail setters are direct native control hooks and do not validate scenario logic.

Extends

Constructors

Constructor

ts
new CHelicopter(): CHelicopter;

Create a helicopter object wrapper.

Returns

CHelicopter

Overrides

CGameObject.constructor

Methods

_construct()

ts
_construct(): DLL_Pure;

Construct engine-side object state.

Returns

DLL_Pure

Constructed base object.

Remarks

Lifecycle hook used by the engine. Calling it from gameplay scripts can reinitialize native state unexpectedly.

Inherited from

CGameObject._construct


ClearEnemy()

ts
ClearEnemy(): void;

Clear current enemy target and switch hunt state to CHelicopter.eEnemyNone.

Returns

void


Die()

ts
Die(): void;

Switch the helicopter to dead state and enable its falling physics.

Returns

void

Remarks

This stops the engine sound and starts the broken-loop sound, but it is separate from Explode().


Explode()

ts
Explode(): void;

Explode the helicopter.

Returns

void


GetBodyState()

ts
GetBodyState(): TXR_helicopter_body_state;

Returns

TXR_helicopter_body_state

Current body aiming state.


GetCurrVelocity()

ts
GetCurrVelocity(): number;

Returns

number

Current scalar velocity.


GetCurrVelocityVec()

ts
GetCurrVelocityVec(): vector;

Returns

vector

Current velocity vector.


GetDistanceToDestPosition()

ts
GetDistanceToDestPosition(): number;

Returns

number

Distance to destination position.


getEnabled()

ts
getEnabled(): boolean;

Returns

boolean

Whether the object is enabled in the client object loop.

Inherited from

CGameObject.getEnabled


GetfHealth()

ts
GetfHealth(): number;

Returns

number

Helicopter health.


GetHuntState()

ts
GetHuntState(): TXR_helicopter_hunt_state;

Returns

TXR_helicopter_hunt_state

Current enemy tracking state.


GetMaxVelocity()

ts
GetMaxVelocity(): number;

Returns

number

Maximum movement velocity.


GetMovementState()

ts
GetMovementState(): TXR_helicopter_movement_state;

Returns

TXR_helicopter_movement_state

Current movement state.


GetOnPointRangeDist()

ts
GetOnPointRangeDist(): number;

Returns

number

Distance at which the helicopter treats a point as reached.


GetRealAltitude()

ts
GetRealAltitude(): number;

Returns

number

Current real altitude above terrain.


GetSafeAltitude()

ts
GetSafeAltitude(): number;

Returns

number

Safe altitude configured for the movement manager.


GetSpeedInDestPoint()

ts
GetSpeedInDestPoint(value: number): number;

Get desired speed near the destination point.

Parameters

ParameterTypeDescription
valuenumberIgnored by native code.

Returns

number

Speed used near the destination point.

Remarks

The native binding requires one numeric argument, but the implementation ignores it and returns the configured destination speed.


GetState()

ts
GetState(): TXR_helicopter_state;

Returns

TXR_helicopter_state

Alive/dead state.


getVisible()

ts
getVisible(): boolean;

Returns

boolean

Whether the object is visible.

Inherited from

CGameObject.getVisible


GoPatrolByPatrolPath()

ts
GoPatrolByPatrolPath(path_name: string, start_point: number): void;

Move by a named patrol path and switch movement state to CHelicopter.eMovPatrolPath.

Parameters

ParameterTypeDescription
path_namestringPatrol path name.
start_pointnumberStarting patrol vertex id.

Returns

void


GoPatrolByRoundPath()

ts
GoPatrolByRoundPath(
   center: vector, 
   radius: number, 
   clockwise: boolean): void;

Move around a point by a generated round patrol path and switch movement state to CHelicopter.eMovRoundPath.

Parameters

ParameterTypeDescription
centervectorRound path center.
radiusnumberPath radius.
clockwisebooleanWhether to move clockwise.

Returns

void

Remarks

Native code refuses radii smaller than the current speed and angular-speed constraints allow.


isVisible()

ts
isVisible(game_object: game_object): boolean;

Check whether an object is visible to the helicopter.

Parameters

ParameterTypeDescription
game_objectgame_objectObject to test.

Returns

boolean

Whether the object is visible.


LookAtPoint()

ts
LookAtPoint(position: vector, is_smooth: boolean): void;

Aim the helicopter body at a point or return aiming to path direction.

Parameters

ParameterTypeDescription
positionvectorPoint to look at when enabled.
is_smoothbooleanWhether point aiming is enabled.

Returns

void

Remarks

Native code treats the boolean as an enable flag: true switches body state to eBodyToPoint, while false switches it back to eBodyByPath.


net_Export()

ts
net_Export(net_packet: net_packet): void;

Export network state to a packet.

Parameters

ParameterTypeDescription
net_packetnet_packetDestination network packet.

Returns

void

Inherited from

CGameObject.net_Export


net_Import()

ts
net_Import(net_packet: net_packet): void;

Import network state from a packet.

Parameters

ParameterTypeDescription
net_packetnet_packetSource network packet.

Returns

void

Inherited from

CGameObject.net_Import


net_Spawn()

ts
net_Spawn(cse_abstract: cse_abstract): boolean;

Spawn the client object from its server object.

Parameters

ParameterTypeDescription
cse_abstractcse_abstractServer object used for spawn data.

Returns

boolean

Whether spawn succeeded.

Remarks

Lifecycle hook used during network spawn. Return false to reject spawn in custom subclasses.

Inherited from

CGameObject.net_Spawn


SetBarrelDirTolerance()

ts
SetBarrelDirTolerance(value: number): void;

Set allowed barrel direction tolerance.

Parameters

ParameterTypeDescription
valuenumberTolerance value.

Returns

void


SetDestPosition()

ts
SetDestPosition(position: vector): void;

Set movement destination and switch movement state to CHelicopter.eMovToPoint.

Parameters

ParameterTypeDescription
positionvectorDestination world position.

Returns

void


SetEnemy()

Call Signature

ts
SetEnemy(game_object: game_object): void;

Track an enemy object by its engine id.

Parameters
ParameterTypeDescription
game_objectgame_objectEnemy object to track.
Returns

void

Remarks

Passing nullish values is not safe for the native object overload. Use ClearEnemy() to clear the current enemy.

Call Signature

ts
SetEnemy(position: vector): void;

Track an enemy point.

Parameters
ParameterTypeDescription
positionvectorEnemy world position.
Returns

void

Remarks

Sets the hunt state to CHelicopter.eEnemyPoint and stores the provided world position.


SetfHealth()

ts
SetfHealth(health: number): number;

Set helicopter health.

Parameters

ParameterTypeDescription
healthnumberNew health value.

Returns

number

Applied health value.


SetFireTrailLength()

ts
SetFireTrailLength(value: number): void;

Set fire trail length.

Parameters

ParameterTypeDescription
valuenumberTrail length.

Returns

void


SetLinearAcc()

ts
SetLinearAcc(min: number, max: number): void;

Set forward and braking linear acceleration values.

Parameters

ParameterTypeDescription
minnumberForward acceleration.
maxnumberBraking acceleration.

Returns

void


SetMaxVelocity()

ts
SetMaxVelocity(value: number): void;

Set maximum movement velocity.

Parameters

ParameterTypeDescription
valuenumberMaximum velocity.

Returns

void


SetOnPointRangeDist()

ts
SetOnPointRangeDist(distance: number): void;

Set point reach distance.

Parameters

ParameterTypeDescription
distancenumberReach distance.

Returns

void


SetSpeedInDestPoint()

ts
SetSpeedInDestPoint(value: number): void;

Set desired speed near the destination point.

Parameters

ParameterTypeDescription
valuenumberSpeed value.

Returns

void

Remarks

Used by the movement manager while approaching the current destination or patrol point.


StartFlame()

ts
StartFlame(): void;

Start smoke/flame particle effects if they are not already active.

Returns

void


TurnEngineSound()

ts
TurnEngineSound(enabled: boolean): void;

Turn engine sound on or off.

Parameters

ParameterTypeDescription
enabledbooleanNew sound state.

Returns

void


TurnLighting()

ts
TurnLighting(is_enabled: boolean): void;

Turn helicopter lighting on or off.

Parameters

ParameterTypeDescription
is_enabledbooleanNew lighting state.

Returns

void


use()

ts
use(object: CGameObject): boolean;

Use another object through the engine interaction path.

Parameters

ParameterTypeDescription
objectCGameObjectObject being used.

Returns

boolean

Whether the use action was handled.

Inherited from

CGameObject.use


UseFireTrail()

Call Signature

ts
UseFireTrail(): boolean;
Returns

boolean

Whether fire trail rendering is enabled.

Call Signature

ts
UseFireTrail(is_enabled: boolean): void;

Enable or disable fire trail rendering and update fire dispersion settings.

Parameters
ParameterTypeDescription
is_enabledbooleanNew fire trail state.
Returns

void


Visual()

ts
Visual(): IXR_IRender_Visual;

Returns

IXR_IRender_Visual

Render visual assigned to the object.

Inherited from

CGameObject.Visual

Properties

__name

ts
readonly __name: string;

LuaBind instance constructor name.

Inherited from

CGameObject.__name


m_dead

ts
readonly m_dead: boolean;

Whether the helicopter is marked dead.


m_exploded

ts
readonly m_exploded: boolean;

Whether the helicopter explosion has already been triggered.


m_flame_started

ts
readonly m_flame_started: boolean;

Whether flame effects are currently started.


m_light_started

ts
readonly m_light_started: boolean;

Whether helicopter lights are currently started.


m_max_mgun_dist

ts
m_max_mgun_dist: number;

Maximum machine-gun attack distance.


m_max_rocket_dist

ts
m_max_rocket_dist: number;

Maximum rocket attack distance.


m_min_mgun_dist

ts
m_min_mgun_dist: number;

Minimum machine-gun attack distance.


m_min_rocket_dist

ts
m_min_rocket_dist: number;

Minimum rocket attack distance.


m_syncronize_rocket

ts
m_syncronize_rocket: boolean;

Whether rocket firing is synchronized with the helicopter attack logic.


m_time_between_rocket_attack

ts
m_time_between_rocket_attack: number;

Delay between rocket attacks.


m_use_mgun_on_attack

ts
m_use_mgun_on_attack: boolean;

Whether machine-gun attacks are enabled.


m_use_rocket_on_attack

ts
m_use_rocket_on_attack: boolean;

Whether rocket attacks are enabled.


__name

ts
readonly static __name: string;

LuaBind class constructor name.

Inherited from

CGameObject.__name


eAlive

ts
readonly static eAlive: 0;

Engine enum value for CHelicopter.eAlive.


eBodyByPath

ts
readonly static eBodyByPath: 0;

Engine enum value for CHelicopter.eBodyByPath.


eBodyToPoint

ts
readonly static eBodyToPoint: 1;

Engine enum value for CHelicopter.eBodyToPoint.


eDead

ts
readonly static eDead: 1;

Engine enum value for CHelicopter.eDead.


eEnemyEntity

ts
readonly static eEnemyEntity: 2;

Engine enum value for CHelicopter.eEnemyEntity.


eEnemyNone

ts
readonly static eEnemyNone: 0;

Engine enum value for CHelicopter.eEnemyNone.


eEnemyPoint

ts
readonly static eEnemyPoint: 1;

Engine enum value for CHelicopter.eEnemyPoint.


eMovLanding

ts
readonly static eMovLanding: 4;

Engine enum value for CHelicopter.eMovLanding.


eMovNone

ts
readonly static eMovNone: 0;

Engine enum value for CHelicopter.eMovNone.


eMovPatrolPath

ts
readonly static eMovPatrolPath: 2;

Engine enum value for CHelicopter.eMovPatrolPath.


eMovRoundPath

ts
readonly static eMovRoundPath: 3;

Engine enum value for CHelicopter.eMovRoundPath.


eMovTakeOff

ts
readonly static eMovTakeOff: 5;

Engine enum value for CHelicopter.eMovTakeOff.


eMovToPoint

ts
readonly static eMovToPoint: 1;

Engine enum value for CHelicopter.eMovToPoint.