• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Sound Trigger

Status
Not open for further replies.
Level 4
Joined
Aug 5, 2011
Messages
94
I have two different sounds for an ablity.

Example

Set Sound_For_Spell[0]= fire_beam_sound1<gen>
Set Sound_For_Spell[1]= fire_beam_sound2<gen>

Every time i use a certain spell i want to Play : fire_beam_sound1 for the first time and the second time casting the spell to listen to fire_beam_sound2.

I was trying to make a var to do the following :

Sound_var = (Sound_var+1)

And the condition was

IF (Sound_var x 1) equals to 0

Then

play fire_beam_sound1

Else

play fire_beam_sound2

But i know how i will create a var to save sounds and use them as real or integer so i can put them in the condition
 
Level 7
Joined
Mar 6, 2006
Messages
282
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • SoundToggle Equal to True
    • Then - Actions
      • Sound - Play fire_beam_sound1<gen>
      • Set SoundToggle = False
    • Else - Actions
      • Sound - Play fire_beam_sound2<gen>
      • Set SoundToggle = True

Or if you want to randomly play one of the two sounds (like how WC3 treats most combat sounds):

  • Sound - Play Sound_For_Spell[(Random integer number between 0 and 1)]
 

Kazeon

Hosted Project: EC
Level 33
Joined
Oct 12, 2011
Messages
3,449
in that thread, maybe this is the answer you are looking for
JASS:
function PlaySoundAtPoint takes string f, real x, real y returns nothing
    local sound s = CreateSound( f, false, true, true, 10, 10, "" )
    call SetSoundDuration( s, GetSoundFileDuration(f) )
    call SetSoundChannel( s, 0 )
    call SetSoundVolume( s, 127 )
    call SetSoundPitch( s, 1.0 )
    call SetSoundPosition(s, x, y, 0)
    call StartSound(s)
    call KillSoundWhenDone(s)
    set s = null
endfunction
but I'm not sure, I have another way, just PM me if the solution above doesn't work..
 
There are certain limitations to sounds in WC3:

1) You can only play the same sound handle once (I needs to be stopped or finish in order to play it again)
2) You can only play the same sound file path (when using the same file path with multiple sound handles) once within a certain interval (around 0.1 seconds)
3) You can play only up to 4 different sound handles with the same sound filepath at the same time - note that 2) still applies so you need to delay them by 0.1 seconds each.
4) You can only play up to 16 sounds, no matter the handle or filepath in general
 
Status
Not open for further replies.
Top