HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Stacking Sounds?

01-29-2006, 06:29 PM#1
Immoralis
If I make a sound play on attack, and the cooldown is really fast, it only plays it once while it attacks. How do i make it so the sounds overlap?
01-29-2006, 06:48 PM#2
Tim.
Replace the default attack sound, that should do it.
01-29-2006, 07:00 PM#3
Immoralis
thanks for the reply but i have 36 different heros that use the same model and they all need different sounds..lol
01-29-2006, 07:03 PM#4
Jacek
Its because when one sound hasn't finished, new one is going to play and can't.
01-29-2006, 07:36 PM#5
iNfraNe
Either make multiple sound variables and play each one according to if the other one is finished or just play the sound from path, creating a new sound variable each time.
01-29-2006, 07:48 PM#6
SnaKy
Collapse JASS:
function UnitSound takes unit u, string id, integer volume, real d returns nothing
    local sound snd=CreateSound(id,false,true,false,10,10,"")
    call SetSoundPitch(snd,GetRandomReal(0.8,1.2))
    call SetSoundVolume(snd,volume)
    call SetSoundDistances(snd,600,d)
    call AttachSoundToUnit(snd,u)
    call StartSound(snd)
    call KillSoundWhenDone(snd)
    set snd=null
endfunction
And then ...
Trigger:
Custom script: call UnitSound(udg_hero,"Units\\Human\\Rifleman\\RiflemanAttack1.wav",125,4500)
01-29-2006, 08:31 PM#7
Immoralis
i have no idea how to put that in
01-30-2006, 01:50 PM#8
SnaKy
Put jass to the Custom Script and the trigger you should use in trigger when your hero attacks.
Trigger:
Hero sound1
Collapse Events
Unit - A unit Is attacked
Collapse Conditions
(Unit-type of (Attacking unit)) Equal to Mountain King
Collapse Actions
Custom script: call UnitSound(GetAttacker(),"YourSound.wav",125,4500)
Pretty easy me thinks.
01-30-2006, 01:53 PM#9
Jacek
Sorry, but damage problem allows this trigger to be abused. If you stop unit before she starts anim, sound will play but she won't attack.
01-30-2006, 02:03 PM#10
SnaKy
That's true, but he told that he using very fast cooldown so it's isn't a really issue.
01-31-2006, 01:28 AM#11
Immoralis
and that will make it stack?

syntax error?
Custom script: call UnitSound(GetAttacker(),"war3mapImported\tacticalshotgun.wav",125,4500)
Expected Function Name?
01-31-2006, 06:13 AM#12
PCPharaoh
That's because you either:
A: Didn't put the JASS function mentioned above in at all, or
B: Put it later in the code then when you try to call it.

Quick JASS tutorial.
Jass has things called functions. You call a function by saying
Collapse JASS:
call MyFunc(arg1, arg2, argn)
If MyFunc is above MyFunc2 in the code, it can be called from MyFunc. Otherwise, it can't. Example:
Collapse JASS:
function MyFunc takes nothing returns nothing
endfunction

function MyFunc2 takes nothing returns nothing
call MyFunc()
endfunction
The above works, however. This doesn't:
Collapse JASS:
function MyFunc takes nothing returns nothing
call MyFunc2
endfunction

function MyFunc2 takes nothing returns nothing
endfunction

So make sure when that when you define the UnitSound function, it is above the places in the code where you call it.

P.S. - Learn JASS: It's easier, faster, better than GUI, and it makes you feel better about yourself. JASS FTW!
01-31-2006, 07:18 AM#13
Anitarf
Just copy the function to your map's custom script section (in the trigger editor, in the treeview on the left, click on your map name). Then call it from your trigger. Also, in Jass, you must use "\\" in filenames, not just "\".
01-31-2006, 07:59 AM#14
Pheonix-IV
Couldn't you just use 3D sounds?
01-31-2006, 08:04 AM#15
Anitarf
How would that change... anything?