Class: sound
Sound action for scripted AI behavior.
Source
C++ class sound
Custom Constructor
sound
Remarks
String and sound_object overloads play regular script sounds. Numeric overloads use monster sound categories. The head-animation overload is intended for trader-style talking animations.
Extends
Constructors
Constructor
new sound(): sound;Create an empty sound action.
Returns
sound
Overrides
Constructor
new sound(value1: string, value2: string): sound;Play a sound by prefix and name.
Parameters
| Parameter | Type | Description |
|---|---|---|
value1 | string | Sound prefix or collection. |
value2 | string | Sound name. |
Returns
sound
Overrides
EngineBinding.constructorConstructor
new sound(
value1: string,
value2: string,
vector: vector): sound;Play a sound at a position.
Parameters
| Parameter | Type | Description |
|---|---|---|
value1 | string | Sound prefix or collection. |
value2 | string | Sound name. |
vector | vector | Position. |
Returns
sound
Overrides
EngineBinding.constructorConstructor
new sound(
value1: string,
value2: string,
vector: vector,
vector2: vector): sound;Play a sound at a position with angles.
Parameters
| Parameter | Type | Description |
|---|---|---|
value1 | string | Sound prefix or collection. |
value2 | string | Sound name. |
vector | vector | Position. |
vector2 | vector | Angles. |
Returns
sound
Overrides
EngineBinding.constructorConstructor
new sound(
value1: string,
value2: string,
vector: vector,
vector2: vector,
value3: boolean): sound;Play a sound at a position with angles and loop flag.
Parameters
| Parameter | Type | Description |
|---|---|---|
value1 | string | Sound prefix or collection. |
value2 | string | Sound name. |
vector | vector | Position. |
vector2 | vector | Angles. |
value3 | boolean | Whether playback should loop. |
Returns
sound
Overrides
EngineBinding.constructorConstructor
new sound(value1: string, vector: vector): sound;Play a sound by name at a position.
Parameters
| Parameter | Type | Description |
|---|---|---|
value1 | string | Sound name. |
vector | vector | Position. |
Returns
sound
Overrides
EngineBinding.constructorConstructor
new sound(
value1: string,
vector: vector,
vector2: vector): sound;Play a sound by name at a position with angles.
Parameters
| Parameter | Type | Description |
|---|---|---|
value1 | string | Sound name. |
vector | vector | Position. |
vector2 | vector | Angles. |
Returns
sound
Overrides
EngineBinding.constructorConstructor
new sound(
value1: string,
vector: vector,
vector2: vector,
value3: boolean): sound;Play a sound by name at a position with angles and loop flag.
Parameters
| Parameter | Type | Description |
|---|---|---|
value1 | string | Sound name. |
vector | vector | Position. |
vector2 | vector | Angles. |
value3 | boolean | Whether playback should loop. |
Returns
sound
Overrides
EngineBinding.constructorConstructor
new sound(
sound_object: sound_object,
value1: string,
vector: vector): sound;Play a sound_object with a bone at a position.
Parameters
| Parameter | Type | Description |
|---|---|---|
sound_object | sound_object | Sound object. |
value1 | string | Bone name. |
vector | vector | Position. |
Returns
sound
Overrides
EngineBinding.constructorConstructor
new sound(
sound_object: sound_object,
value1: string,
vector: vector,
vector2: vector): sound;Play a sound_object with a bone, position, and angles.
Parameters
| Parameter | Type | Description |
|---|---|---|
sound_object | sound_object | Sound object. |
value1 | string | Bone name. |
vector | vector | Position. |
vector2 | vector | Angles. |
Returns
sound
Overrides
EngineBinding.constructorConstructor
new sound(
sound_object: sound_object,
value1: string,
vector: vector,
vector2: vector,
value: boolean): sound;Play a sound_object with a bone, position, angles, and loop flag.
Parameters
| Parameter | Type | Description |
|---|---|---|
sound_object | sound_object | Sound object. |
value1 | string | Bone name. |
vector | vector | Position. |
vector2 | vector | Angles. |
value | boolean | Whether playback should loop. |
Returns
sound
Overrides
EngineBinding.constructorConstructor
new sound(sound_object: sound_object, vector1: vector): sound;Play a sound_object at a position.
Parameters
| Parameter | Type | Description |
|---|---|---|
sound_object | sound_object | Sound object. |
vector1 | vector | Position. |
Returns
sound
Overrides
EngineBinding.constructorConstructor
new sound(
sound_object: sound_object,
vector1: vector,
vector2: vector): sound;Play a sound_object at a position with angles.
Parameters
| Parameter | Type | Description |
|---|---|---|
sound_object | sound_object | Sound object. |
vector1 | vector | Position. |
vector2 | vector | Angles. |
Returns
sound
Overrides
EngineBinding.constructorConstructor
new sound(
sound_object: sound_object,
vector1: vector,
vector2: vector,
value: boolean): sound;Play a sound_object at a position with angles and loop flag.
Parameters
| Parameter | Type | Description |
|---|---|---|
sound_object | sound_object | Sound object. |
vector1 | vector | Position. |
vector2 | vector | Angles. |
value | boolean | Whether playback should loop. |
Returns
sound
Overrides
EngineBinding.constructorConstructor
new sound(type: TXR_sound_type): sound;Play a monster sound by type.
Parameters
| Parameter | Type | Description |
|---|---|---|
type | TXR_sound_type | Monster sound type id. |
Returns
sound
Remarks
Monster-only overload using MonsterSound::EType values exposed on sound.
Overrides
EngineBinding.constructorConstructor
new sound(type: TXR_sound_type, value: number): sound;Play a monster sound by type with extra value.
Parameters
| Parameter | Type | Description |
|---|---|---|
type | TXR_sound_type | Monster sound type id. |
value | number | Extra sound value. |
Returns
sound
Remarks
Monster-only overload. The value is the engine delay passed to the monster sound action.
Overrides
EngineBinding.constructorConstructor
new sound(
value1: string,
value2: string,
type: TXR_monster_head_animation): sound;Play a trader sound with a head animation.
Parameters
| Parameter | Type | Description |
|---|---|---|
value1 | string | Sound prefix or collection. |
value2 | string | Sound name. |
type | TXR_monster_head_animation | Monster head animation type. |
Returns
sound
Source
src/xrGame/script_sound_action_script.cpp, trader-specific sound constructor.
Remarks
Trader-specific overload. The head animation is one of the MonsterSpace.head_anim_* constants. The native enum also has -1 for no head animation, but that value is not exported as a named Lua constant.
Overrides
EngineBinding.constructorMethods
completed()
completed(): boolean;Returns
boolean
Whether sound playback is complete.
set_angles()
set_angles(vector: vector): void;Set sound angles.
Parameters
| Parameter | Type | Description |
|---|---|---|
vector | vector | Angles. |
Returns
void
set_bone()
set_bone(value: string): void;Set sound bone.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | string | Bone name. |
Returns
void
set_position()
set_position(vector: vector): void;Set sound position.
Parameters
| Parameter | Type | Description |
|---|---|---|
vector | vector | Position. |
Returns
void
set_sound()
Call Signature
set_sound(value: string): void;Set sound by name.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | string | Sound name. |
Returns
void
Call Signature
set_sound(sound_object: sound_object): void;Set sound object.
Parameters
| Parameter | Type | Description |
|---|---|---|
sound_object | sound_object | Sound object. |
Returns
void
set_sound_type()
set_sound_type(type: TXR_snd_type): void;Set sound type.
Parameters
| Parameter | Type | Description |
|---|---|---|
type | TXR_snd_type | Sound type id. |
Returns
void
Properties
__name
readonly __name: string;LuaBind instance constructor name.
Inherited from
__name
readonly static __name: string;LuaBind class constructor name.
Inherited from
attack
readonly static attack: 3;Engine enum value for sound.attack.
attack_hit
readonly static attack_hit: 4;Engine enum value for sound.attack_hit.
die
readonly static die: 7;Engine enum value for sound.die.
eat
readonly static eat: 2;Engine enum value for sound.eat.
idle
readonly static idle: 1;Engine enum value for sound.idle.
panic
readonly static panic: 11;Engine enum value for sound.panic.
steal
readonly static steal: 10;Engine enum value for sound.steal.
take_damage
readonly static take_damage: 5;Engine enum value for sound.take_damage.
threaten
readonly static threaten: 9;Engine enum value for sound.threaten.