• 🏆 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!

Destroying sounds

Status
Not open for further replies.
Level 14
Joined
Aug 30, 2004
Messages
909
I apologize for my noobish question.

  • Sound - Play Lever <gen> at 100.00% volume, attached to (Triggering unit)
I play the "Lever" sound every time a Ywing pilot hops in his turret. If I destroy the sound immediately afterward I don't hear it in game. Do I need to destroy the sound? I was thinking of getting a push-down stack somewhere and destroying sounds two-seconds after they play, and so on... but I'm not sure sounds need to be destroyed.

If I leave the trigger as is, without destroying the sound, and it plays 50-100 times or something like that...does that eat up memory or is the computer just storing 1 sound?
 
Level 16
Joined
May 1, 2008
Messages
1,605
  • Sound - Destroy (Last played sound)
use this after playing the sound and set untick the looping part in sound sound editer in WE(if ticked). destroying it strait after it playing will stop it from leaking.

Moin moin o_O

Well you tested it? Take the ThunderClapCast sound, untick 3D sound, play it with a trigger, destroy it immediately after playing and see what happen!

Greetings and Peace
Dr Boom
 
When you add sound instances in the sound editor, the world editor creates a global variable for it that obtains a sound handle at map initialization, which is what you reference in GUI. This means that playing it several times doesn't mean that the sound is created over and over again, and you shouldn't destroy it either once it is done (if you do, you will not be able to play the sound again).

I don't even know why blizzard bothered to implement the DestroySound function into GUI since you cannot create new sounds in it, perhaps it is there incase you want to disable a sound in mid-game without using booleans/conditions or something.

Another thing you should know is that the function will allow the sound to finish before it removes it, so don't worry about the sound being cut off (the jass native is actually called KillSoundWhenDone).
 
Level 14
Joined
Aug 30, 2004
Messages
909
LaWl I just read the tooltip on the trigger =D and thought that making a new sound will create leek whiles using destroy last played sound will fix it. meh just trying to help :p.

That's okay, thank you. I know what you mean. I always feel bad that the usuals here handle all the questions. They help me out all the time so I like to come back here and try to help others, but since they know more than me it's hard to step up and try, you know?

Anyway, I appreciate the effort.

+rep to you all
 
Status
Not open for further replies.
Top