Playsound3d unable to play 2 sounds in a row in an activation script within a trigger.
Description
Details
- Legacy ID
- 3080325556
- Severity
- None
- Resolution
- Not A Bug
- Reproducibility
- Always
- Category
- Sound
Start the Editor.
Choose Stratis.
Insert a Rifleman AT as Player (BLUFOR/Blue/Men/Rifleman (AT)).
Insert a Trigger away from player that activates on BLUFOR entering area
Group the trigger to the Player rifleman
In the "On Act." script for the trigger, paste:
playSound3D ["a3\sounds_f\weapons\Rockets\explosion_missile_04.wav", player]; sleep 10; playSound3D ["a3\sounds_f\weapons\Rockets\explosion_missile_05.wav", player];
Launch scenario, walk into the trigger area.
Expected it to play the sounds separated by 10 seconds. It plays the first, but never the second.
Event Timeline
Never mind, figured it out ... Sleep doesn't work in scripts and it was playing both sounds.
Solution:
null=[] spawn {playSound3D ["a3\sounds_f\weapons\Rockets\explosion_missile_05.wav", player]; hint "sound played..."; sleep 10;hint "sleep finished..."; playSound3D ["a3\sounds_f\weapons\Rockets\explosion_missile_04.wav", player]; hint "second sound played...";};
Please close as not a bug... Or change to a bug Sleep doesn't work in activation script.
There are certain places where you cannot use interruption, trigger's on activation being one of them. With -showScripErrors enabled you'll be alerted to that fact.