Skip to content

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

ts
new sound(): sound;

Create an empty sound action.

Returns

sound

Overrides

EngineBinding.constructor

Constructor

ts
new sound(value1: string, value2: string): sound;

Play a sound by prefix and name.

Parameters

ParameterTypeDescription
value1stringSound prefix or collection.
value2stringSound name.

Returns

sound

Overrides

ts
EngineBinding.constructor

Constructor

ts
new sound(
   value1: string, 
   value2: string, 
   vector: vector): sound;

Play a sound at a position.

Parameters

ParameterTypeDescription
value1stringSound prefix or collection.
value2stringSound name.
vectorvectorPosition.

Returns

sound

Overrides

ts
EngineBinding.constructor

Constructor

ts
new sound(
   value1: string, 
   value2: string, 
   vector: vector, 
   vector2: vector): sound;

Play a sound at a position with angles.

Parameters

ParameterTypeDescription
value1stringSound prefix or collection.
value2stringSound name.
vectorvectorPosition.
vector2vectorAngles.

Returns

sound

Overrides

ts
EngineBinding.constructor

Constructor

ts
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

ParameterTypeDescription
value1stringSound prefix or collection.
value2stringSound name.
vectorvectorPosition.
vector2vectorAngles.
value3booleanWhether playback should loop.

Returns

sound

Overrides

ts
EngineBinding.constructor

Constructor

ts
new sound(value1: string, vector: vector): sound;

Play a sound by name at a position.

Parameters

ParameterTypeDescription
value1stringSound name.
vectorvectorPosition.

Returns

sound

Overrides

ts
EngineBinding.constructor

Constructor

ts
new sound(
   value1: string, 
   vector: vector, 
   vector2: vector): sound;

Play a sound by name at a position with angles.

Parameters

ParameterTypeDescription
value1stringSound name.
vectorvectorPosition.
vector2vectorAngles.

Returns

sound

Overrides

ts
EngineBinding.constructor

Constructor

ts
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

ParameterTypeDescription
value1stringSound name.
vectorvectorPosition.
vector2vectorAngles.
value3booleanWhether playback should loop.

Returns

sound

Overrides

ts
EngineBinding.constructor

Constructor

ts
new sound(
   sound_object: sound_object, 
   value1: string, 
   vector: vector): sound;

Play a sound_object with a bone at a position.

Parameters

ParameterTypeDescription
sound_objectsound_objectSound object.
value1stringBone name.
vectorvectorPosition.

Returns

sound

Overrides

ts
EngineBinding.constructor

Constructor

ts
new sound(
   sound_object: sound_object, 
   value1: string, 
   vector: vector, 
   vector2: vector): sound;

Play a sound_object with a bone, position, and angles.

Parameters

ParameterTypeDescription
sound_objectsound_objectSound object.
value1stringBone name.
vectorvectorPosition.
vector2vectorAngles.

Returns

sound

Overrides

ts
EngineBinding.constructor

Constructor

ts
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

ParameterTypeDescription
sound_objectsound_objectSound object.
value1stringBone name.
vectorvectorPosition.
vector2vectorAngles.
valuebooleanWhether playback should loop.

Returns

sound

Overrides

ts
EngineBinding.constructor

Constructor

ts
new sound(sound_object: sound_object, vector1: vector): sound;

Play a sound_object at a position.

Parameters

ParameterTypeDescription
sound_objectsound_objectSound object.
vector1vectorPosition.

Returns

sound

Overrides

ts
EngineBinding.constructor

Constructor

ts
new sound(
   sound_object: sound_object, 
   vector1: vector, 
   vector2: vector): sound;

Play a sound_object at a position with angles.

Parameters

ParameterTypeDescription
sound_objectsound_objectSound object.
vector1vectorPosition.
vector2vectorAngles.

Returns

sound

Overrides

ts
EngineBinding.constructor

Constructor

ts
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

ParameterTypeDescription
sound_objectsound_objectSound object.
vector1vectorPosition.
vector2vectorAngles.
valuebooleanWhether playback should loop.

Returns

sound

Overrides

ts
EngineBinding.constructor

Constructor

ts
new sound(type: TXR_sound_type): sound;

Play a monster sound by type.

Parameters

ParameterTypeDescription
typeTXR_sound_typeMonster sound type id.

Returns

sound

Remarks

Monster-only overload using MonsterSound::EType values exposed on sound.

Overrides

ts
EngineBinding.constructor

Constructor

ts
new sound(type: TXR_sound_type, value: number): sound;

Play a monster sound by type with extra value.

Parameters

ParameterTypeDescription
typeTXR_sound_typeMonster sound type id.
valuenumberExtra sound value.

Returns

sound

Remarks

Monster-only overload. The value is the engine delay passed to the monster sound action.

Overrides

ts
EngineBinding.constructor

Constructor

ts
new sound(
   value1: string, 
   value2: string, 
   type: TXR_monster_head_animation): sound;

Play a trader sound with a head animation.

Parameters

ParameterTypeDescription
value1stringSound prefix or collection.
value2stringSound name.
typeTXR_monster_head_animationMonster 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

ts
EngineBinding.constructor

Methods

completed()

ts
completed(): boolean;

Returns

boolean

Whether sound playback is complete.


set_angles()

ts
set_angles(vector: vector): void;

Set sound angles.

Parameters

ParameterTypeDescription
vectorvectorAngles.

Returns

void


set_bone()

ts
set_bone(value: string): void;

Set sound bone.

Parameters

ParameterTypeDescription
valuestringBone name.

Returns

void


set_position()

ts
set_position(vector: vector): void;

Set sound position.

Parameters

ParameterTypeDescription
vectorvectorPosition.

Returns

void


set_sound()

Call Signature

ts
set_sound(value: string): void;

Set sound by name.

Parameters
ParameterTypeDescription
valuestringSound name.
Returns

void

Call Signature

ts
set_sound(sound_object: sound_object): void;

Set sound object.

Parameters
ParameterTypeDescription
sound_objectsound_objectSound object.
Returns

void


set_sound_type()

ts
set_sound_type(type: TXR_snd_type): void;

Set sound type.

Parameters

ParameterTypeDescription
typeTXR_snd_typeSound type id.

Returns

void

Properties

__name

ts
readonly __name: string;

LuaBind instance constructor name.

Inherited from

EngineBinding.__name


__name

ts
readonly static __name: string;

LuaBind class constructor name.

Inherited from

EngineBinding.__name


attack

ts
readonly static attack: 3;

Engine enum value for sound.attack.


attack_hit

ts
readonly static attack_hit: 4;

Engine enum value for sound.attack_hit.


die

ts
readonly static die: 7;

Engine enum value for sound.die.


eat

ts
readonly static eat: 2;

Engine enum value for sound.eat.


idle

ts
readonly static idle: 1;

Engine enum value for sound.idle.


panic

ts
readonly static panic: 11;

Engine enum value for sound.panic.


steal

ts
readonly static steal: 10;

Engine enum value for sound.steal.


take_damage

ts
readonly static take_damage: 5;

Engine enum value for sound.take_damage.


threaten

ts
readonly static threaten: 9;

Engine enum value for sound.threaten.