• 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.

Destroying Sounds

Status
Not open for further replies.
Level 5
Joined
Feb 21, 2009
Messages
136
  • Rain
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Sound - Play RollingThunder1 <gen>
      • Sound - Set volume of (Last played sound) to 100.00%
      • Sound - Destroy (Last played sound)
      • Wait (Random real number between 150.00 and 300.00) seconds
      • Trigger - Run (This trigger) (checking conditions)
The sound only works the first time, If you destroy a sound you can't play it again? how can I fix this?
 
Level 5
Joined
Feb 21, 2009
Messages
136
Okay, thanks +1
Edit: Like this?
  • Rain
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Sound - Play RollingThunder1 <gen>
      • Set Sound = (Last played sound)
      • Sound - Set volume of Sound to 100.00%
      • Sound - Destroy Sound
      • Wait (Random real number between 150.00 and 300.00) seconds
      • Trigger - Run (This trigger) (checking conditions)
 
100%. The JASS for playing sounds is this:
JASS:
function PlaySoundBJ takes sound soundHandle returns nothing
    set bj_lastPlayedSound = soundHandle
    if (soundHandle != null) then
        call StartSound(soundHandle)
    endif
endfunction
Basically, what this does is sets the last played sound to the sound you pass it, and if that sound exists, plays it. You create the sound via the sound editor. This function does not. It just plays a sound which has already been created.
 
Level 5
Joined
Feb 21, 2009
Messages
136
Hmm, mkay sorry for being a dummy :) just one question, is this right? or should I remove the Sound - Stop (Last played sound) After fading ?
  • Rain
    • Actions
      • Sound - Play RollingThunder1 <gen>
      • Sound - Set volume of (Last played sound) to 100.00%
      • Sound - Stop (Last played sound) After fading
 
Level 5
Joined
Jan 25, 2006
Messages
103
  • Rain
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Sound - Play RollingThunder1 <gen>
      • Sound - Set volume of (Last played sound) to 100.00%
      • Sound - Destroy (Last played sound)
      • Wait (Random real number between 150.00 and 300.00) seconds
      • Trigger - Run (This trigger) (checking conditions)
The sound only works the first time, If you destroy a sound you can't play it again? how can I fix this?

your trigger is fine, just use it and everything should be okay.
Though what is the wait for? It does not seem to have any function!
 
Level 5
Joined
Jan 25, 2006
Messages
103
SlickR, that trigger is not fine AT ALL. If it destroys the sound, how can you play it again? And that wait is so it makes a sound every 150-300 seconds... duh!

Don't post if you don't know what you're talking about!

can you behave?
whats your problem?
if i make a mistake somewhere because i wasn't paying that much attention is no big deal, you on the other hand really have some issues. Clear them out before you talk to me!

My bad about the wait, i saw it said checking conditions so i assumed he had another trigger set up to run this one, but you really need to clear your head up, you can't jump on every person if they made a small mistake or you don't agree with them.

yeah he just needs to remove destroy last created sound and thats that.
He can make a separate trigger to destroy the sound when he wishes to and does not need the sound anymore!
 
can you behave?
whats your problem?
if i make a mistake somewhere because i wasn't paying that much attention is no big deal, you on the other hand really have some issues. Clear them out before you talk to me!

My bad about the wait, i saw it said checking conditions so i assumed he had another trigger set up to run this one, but you really need to clear your head up, you can't jump on every person if they made a small mistake or you don't agree with them.
It's not because you made ONE SMALL mistake, it's because you've made several LARGE mistakes over most of your posts in the Triggers and Scripts forum, and I'm getting annoyed with you posting crap everywhere.

The trigger is fine again, coz now that the wait is cleared up that means the sound is recreated every time the trigger is run, so destroying it will not cause problems. Essentially he is creating a new sound every time and destroying it.
WRONG. The sound is created and destroyed each time, it's created ONCE at map initialization, and just PLAYED every time the trigger runs.
 
Status
Not open for further replies.
Top