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
new CHelicopter(): CHelicopter;Create a helicopter object wrapper.
Returns
CHelicopter
Overrides
Methods
_construct()
_construct(): DLL_Pure;Construct engine-side object state.
Returns
Constructed base object.
Remarks
Lifecycle hook used by the engine. Calling it from gameplay scripts can reinitialize native state unexpectedly.
Inherited from
ClearEnemy()
ClearEnemy(): void;Clear current enemy target and switch hunt state to CHelicopter.eEnemyNone.
Returns
void
Die()
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()
Explode(): void;Explode the helicopter.
Returns
void
GetBodyState()
GetBodyState(): TXR_helicopter_body_state;Returns
Current body aiming state.
GetCurrVelocity()
GetCurrVelocity(): number;Returns
number
Current scalar velocity.
GetCurrVelocityVec()
GetCurrVelocityVec(): vector;Returns
Current velocity vector.
GetDistanceToDestPosition()
GetDistanceToDestPosition(): number;Returns
number
Distance to destination position.
getEnabled()
getEnabled(): boolean;Returns
boolean
Whether the object is enabled in the client object loop.
Inherited from
GetfHealth()
GetfHealth(): number;Returns
number
Helicopter health.
GetHuntState()
GetHuntState(): TXR_helicopter_hunt_state;Returns
Current enemy tracking state.
GetMaxVelocity()
GetMaxVelocity(): number;Returns
number
Maximum movement velocity.
GetMovementState()
GetMovementState(): TXR_helicopter_movement_state;Returns
Current movement state.
GetOnPointRangeDist()
GetOnPointRangeDist(): number;Returns
number
Distance at which the helicopter treats a point as reached.
GetRealAltitude()
GetRealAltitude(): number;Returns
number
Current real altitude above terrain.
GetSafeAltitude()
GetSafeAltitude(): number;Returns
number
Safe altitude configured for the movement manager.
GetSpeedInDestPoint()
GetSpeedInDestPoint(value: number): number;Get desired speed near the destination point.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | Ignored 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()
GetState(): TXR_helicopter_state;Returns
Alive/dead state.
getVisible()
getVisible(): boolean;Returns
boolean
Whether the object is visible.
Inherited from
GoPatrolByPatrolPath()
GoPatrolByPatrolPath(path_name: string, start_point: number): void;Move by a named patrol path and switch movement state to CHelicopter.eMovPatrolPath.
Parameters
| Parameter | Type | Description |
|---|---|---|
path_name | string | Patrol path name. |
start_point | number | Starting patrol vertex id. |
Returns
void
GoPatrolByRoundPath()
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
| Parameter | Type | Description |
|---|---|---|
center | vector | Round path center. |
radius | number | Path radius. |
clockwise | boolean | Whether to move clockwise. |
Returns
void
Remarks
Native code refuses radii smaller than the current speed and angular-speed constraints allow.
isVisible()
isVisible(game_object: game_object): boolean;Check whether an object is visible to the helicopter.
Parameters
| Parameter | Type | Description |
|---|---|---|
game_object | game_object | Object to test. |
Returns
boolean
Whether the object is visible.
LookAtPoint()
LookAtPoint(position: vector, is_smooth: boolean): void;Aim the helicopter body at a point or return aiming to path direction.
Parameters
| Parameter | Type | Description |
|---|---|---|
position | vector | Point to look at when enabled. |
is_smooth | boolean | Whether 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()
net_Export(net_packet: net_packet): void;Export network state to a packet.
Parameters
| Parameter | Type | Description |
|---|---|---|
net_packet | net_packet | Destination network packet. |
Returns
void
Inherited from
net_Import()
net_Import(net_packet: net_packet): void;Import network state from a packet.
Parameters
| Parameter | Type | Description |
|---|---|---|
net_packet | net_packet | Source network packet. |
Returns
void
Inherited from
net_Spawn()
net_Spawn(cse_abstract: cse_abstract): boolean;Spawn the client object from its server object.
Parameters
| Parameter | Type | Description |
|---|---|---|
cse_abstract | cse_abstract | Server 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
SetBarrelDirTolerance()
SetBarrelDirTolerance(value: number): void;Set allowed barrel direction tolerance.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | Tolerance value. |
Returns
void
SetDestPosition()
SetDestPosition(position: vector): void;Set movement destination and switch movement state to CHelicopter.eMovToPoint.
Parameters
| Parameter | Type | Description |
|---|---|---|
position | vector | Destination world position. |
Returns
void
SetEnemy()
Call Signature
SetEnemy(game_object: game_object): void;Track an enemy object by its engine id.
Parameters
| Parameter | Type | Description |
|---|---|---|
game_object | game_object | Enemy 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
SetEnemy(position: vector): void;Track an enemy point.
Parameters
| Parameter | Type | Description |
|---|---|---|
position | vector | Enemy world position. |
Returns
void
Remarks
Sets the hunt state to CHelicopter.eEnemyPoint and stores the provided world position.
SetfHealth()
SetfHealth(health: number): number;Set helicopter health.
Parameters
| Parameter | Type | Description |
|---|---|---|
health | number | New health value. |
Returns
number
Applied health value.
SetFireTrailLength()
SetFireTrailLength(value: number): void;Set fire trail length.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | Trail length. |
Returns
void
SetLinearAcc()
SetLinearAcc(min: number, max: number): void;Set forward and braking linear acceleration values.
Parameters
| Parameter | Type | Description |
|---|---|---|
min | number | Forward acceleration. |
max | number | Braking acceleration. |
Returns
void
SetMaxVelocity()
SetMaxVelocity(value: number): void;Set maximum movement velocity.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | Maximum velocity. |
Returns
void
SetOnPointRangeDist()
SetOnPointRangeDist(distance: number): void;Set point reach distance.
Parameters
| Parameter | Type | Description |
|---|---|---|
distance | number | Reach distance. |
Returns
void
SetSpeedInDestPoint()
SetSpeedInDestPoint(value: number): void;Set desired speed near the destination point.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | Speed value. |
Returns
void
Remarks
Used by the movement manager while approaching the current destination or patrol point.
StartFlame()
StartFlame(): void;Start smoke/flame particle effects if they are not already active.
Returns
void
TurnEngineSound()
TurnEngineSound(enabled: boolean): void;Turn engine sound on or off.
Parameters
| Parameter | Type | Description |
|---|---|---|
enabled | boolean | New sound state. |
Returns
void
TurnLighting()
TurnLighting(is_enabled: boolean): void;Turn helicopter lighting on or off.
Parameters
| Parameter | Type | Description |
|---|---|---|
is_enabled | boolean | New lighting state. |
Returns
void
use()
use(object: CGameObject): boolean;Use another object through the engine interaction path.
Parameters
| Parameter | Type | Description |
|---|---|---|
object | CGameObject | Object being used. |
Returns
boolean
Whether the use action was handled.
Inherited from
UseFireTrail()
Call Signature
UseFireTrail(): boolean;Returns
boolean
Whether fire trail rendering is enabled.
Call Signature
UseFireTrail(is_enabled: boolean): void;Enable or disable fire trail rendering and update fire dispersion settings.
Parameters
| Parameter | Type | Description |
|---|---|---|
is_enabled | boolean | New fire trail state. |
Returns
void
Visual()
Visual(): IXR_IRender_Visual;Returns
Render visual assigned to the object.
Inherited from
Properties
__name
readonly __name: string;LuaBind instance constructor name.
Inherited from
m_dead
readonly m_dead: boolean;Whether the helicopter is marked dead.
m_exploded
readonly m_exploded: boolean;Whether the helicopter explosion has already been triggered.
m_flame_started
readonly m_flame_started: boolean;Whether flame effects are currently started.
m_light_started
readonly m_light_started: boolean;Whether helicopter lights are currently started.
m_max_mgun_dist
m_max_mgun_dist: number;Maximum machine-gun attack distance.
m_max_rocket_dist
m_max_rocket_dist: number;Maximum rocket attack distance.
m_min_mgun_dist
m_min_mgun_dist: number;Minimum machine-gun attack distance.
m_min_rocket_dist
m_min_rocket_dist: number;Minimum rocket attack distance.
m_syncronize_rocket
m_syncronize_rocket: boolean;Whether rocket firing is synchronized with the helicopter attack logic.
m_time_between_rocket_attack
m_time_between_rocket_attack: number;Delay between rocket attacks.
m_use_mgun_on_attack
m_use_mgun_on_attack: boolean;Whether machine-gun attacks are enabled.
m_use_rocket_on_attack
m_use_rocket_on_attack: boolean;Whether rocket attacks are enabled.
__name
readonly static __name: string;LuaBind class constructor name.
Inherited from
eAlive
readonly static eAlive: 0;Engine enum value for CHelicopter.eAlive.
eBodyByPath
readonly static eBodyByPath: 0;Engine enum value for CHelicopter.eBodyByPath.
eBodyToPoint
readonly static eBodyToPoint: 1;Engine enum value for CHelicopter.eBodyToPoint.
eDead
readonly static eDead: 1;Engine enum value for CHelicopter.eDead.
eEnemyEntity
readonly static eEnemyEntity: 2;Engine enum value for CHelicopter.eEnemyEntity.
eEnemyNone
readonly static eEnemyNone: 0;Engine enum value for CHelicopter.eEnemyNone.
eEnemyPoint
readonly static eEnemyPoint: 1;Engine enum value for CHelicopter.eEnemyPoint.
eMovLanding
readonly static eMovLanding: 4;Engine enum value for CHelicopter.eMovLanding.
eMovNone
readonly static eMovNone: 0;Engine enum value for CHelicopter.eMovNone.
eMovPatrolPath
readonly static eMovPatrolPath: 2;Engine enum value for CHelicopter.eMovPatrolPath.
eMovRoundPath
readonly static eMovRoundPath: 3;Engine enum value for CHelicopter.eMovRoundPath.
eMovTakeOff
readonly static eMovTakeOff: 5;Engine enum value for CHelicopter.eMovTakeOff.
eMovToPoint
readonly static eMovToPoint: 1;Engine enum value for CHelicopter.eMovToPoint.