• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Looping sounds for individual players

Status
Not open for further replies.
Ok, basically I have very little experience using anything sound related in the editor.

I have a map with radiation and 7 "geiger counter" sound files of 2.04 sec length, each with a varried intensity (1 - 7).

I want those sound files to play when a player receives a certain level of radiation and loop until the exit the area with radiation in it. I only want the owner of the unit to be able to hear the sound. On top of that, the function has an intensity real that determines the sound being played, and the sound should change as that real changes.

Everything is setup, except the sound system.

How the heck do you do this?
 
play when a player receives a certain level of radiation and loop
use global sound array like this
set s_geigercounter[0] = gg_snd_yourSnd3 for example for player red
I assume player can hear only one from 7 possible sounds.
then
JASS:
function PlaySoundForPlayer takes sound s, player p returns nothing
    set s_geigercounter[GetPlayerId(p)] = s
    if s != null and GetLocalPlayer() == p then
        call StartSound(s)
    endif
endfunction

function has an intensity real that determines the sound being played
function SetSoundVolumeBJ takes sound soundHandle, real volumePercent returns nothingfor red player adjust:
call SetSoundVolumeBJ(s_geigercounter[0], volume)

In Sound Editor double click sound and tick "Looping"

when unit escape area - stop sound by (for red player):
call StopSoundBJ(s_geigercounter[0], true)
 
Level 13
Joined
May 10, 2009
Messages
868
I have one here (GUI) which changes a sound to another dynamically, including fading time between sounds. Though, Warcraft 3 is the one looping the sounds automatically - I've marked that loop button for each sound in my test map.

Here's a quick video about it:

Of course, you can define your own duration for every fading time, create the sound list the way you want. If you're interested in it, let me know.
 
Status
Not open for further replies.
Top