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

[Trigger] Can you remove this sound leak?

Status
Not open for further replies.
Level 8
Joined
Jan 16, 2008
Messages
156
I'm having some issues with sound leaks. First I simply did:

  • Gatling Engine Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Gatling Engine
    • Actions
      • Sound - Play GyrocopterImpactHit1 <gen> at 100.00% volume, attached to (Attacking unit)
But then I read that sounds leak. And since this sound is used a lot, I figured it leaked a lot. So I tried this:

  • Gatling Engine Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Gatling Engine
    • Actions
      • Set TempSound = GyrocopterImpactHit1 <gen>
      • Sound - Play TempSound at 100.00% volume, attached to (Attacking unit)
      • Sound - Destroy TempSound
And no luck, it plays the sound once, then never again. How do I destroy a sound I want to use again? I take it my TempSound isn't the correct temporary variable, but I can't find any information anywhere about what the correct temporary variable would be for sounds.

Thanks for any and all help.
 
Level 8
Joined
Jan 16, 2008
Messages
156
Wow Ghostwolf. It might be ok.

I actually tried what they said already, but I'll try it again right now and see if it works.

EDIT: This did not work, the sound plays once then never again any other ideas? I didn't see a "Last created sound" either.

  • Gatling Engine Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Gatling Engine
    • Actions
      • Sound - Play GyrocopterImpactHit1 <gen> at 100.00% volume, attached to (Attacking unit)
      • Sound - Destroy (Last played sound)
 
ok I think I got it:
Set a Sound variable like this:
Set SOUND = GyrocopterImpactHit1 <gen>

then do your thing...
Sound - Play GyrocopterImpactHit1 <gen> at 100.00% volume, attached to (Attacking unit)

Then wait until sound is played
Wait until (sound is 0.00 seconds from finishing) (Its something like this)

then do
Sound - Destroy (last created Sound)
 
Level 12
Joined
Mar 23, 2008
Messages
942
ok I think I got it:
Set a Sound variable like this:
Set SOUND = GyrocopterImpactHit1 <gen>

then do your thing...
Sound - Play GyrocopterImpactHit1 <gen> at 100.00% volume, attached to (Attacking unit)

Then wait until sound is played
Wait until (sound is 0.00 seconds from finishing) (Its something like this)

then do
Sound - Destroy (last created Sound)

It will do the same, you are pointing to the sound and them you destroy it, it will never play again.
Global Sounds don't leak, you just reuse them.
 
Level 8
Joined
Jan 16, 2008
Messages
156
Well Ghostwolf, it seems that sounds are variables. So I'd like to create a temporary variable and set it equal to the sound variable, then play the temporary sound variable, then destroy the temporary sound variable. Then rinse and repeat.

Unforunately I don't know the temporary sound trigger code (I assumed it was TempSound). If this entire idea isn't possible (ie no one has done this before) that is fine, I'll just leave it as is.

Also unforunately I don't know how to do Sound - Destroy (Last created sound). In the GUI menu, Sound - Destroy (Last played sound) is my only option unless I want to point it to a specific sound variable.

So more guidance on this issue would be great.

Anachron, this didn't work:

  • Gatling Engine Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Gatling Engine
    • Actions
      • Set Sound = GyrocopterImpactHit1 <gen>
      • Sound - Play GyrocopterImpactHit1 <gen> at 100.00% volume, attached to (Attacking unit)
      • Wait for (Last played sound) to be 0.00 seconds from finished playing
      • Sound - Destroy (Last played sound)
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
But why are you trying to destroy it anyway? The GyrocopterImpactHit1 sound will remain the SAME sound for the whole game, so if you initialize it once, you can re-use it any time in the game and never need to destroy it...

You only need to destroy variables that you will no longer use.
 
Status
Not open for further replies.
Top