SoundObjectSetPosition

From NWN Lexicon



Contents

[edit] SoundObjectSetPosition(object, vector)

Sets the position of a sound object relative to the player(s).

void SoundObjectSetPosition(
    object oSound,
    vector vPosition
);

[edit] Parameters

oSound

The sound to be played.

vPosition

The vector where the sound should originate from.


[edit] Description

This function can be used to change the position of the sound object that is placed in the module. For instance, a sound of moaning could be placed on a player when they open a chest.



[edit] Remarks

For people using surround sound in their game environment, this can be very effective.


[edit] Version

1.22

[edit] Example

// assumes CryptMoans Sound is placed nearby
// this script placed in the OnDisturbed section of the chest
//
//  puts the sound of moaning crypt noises right on the person 
//  that disturbs the contents of the chest -  sccccaaaarrrrryyyy
 
void main()
{
     vector vPlayer = GetPosition(GetLastDisturbed());
     // location in vector format
     object mySound = GetObjectByTag("CryptMoans");
     SoundObjectSetPosition(mySound, vPlayer);
}

[edit] See Also

functions: 

SoundObjectSetVolume



 author: Bill Castello, editor: Jeremy Spilinek
 

Personal tools
Categories