- Joined
- Feb 3, 2013
- Messages
- 277
In my arena map, I switch sounds in the game - when in arena battle music and when in shop different music; I get rid of the map music at map init - but what the f, it comes back later when I never called it to play. The issue is that sound is SO buggy, sometimes it'll not play - sometimes it'll overlap with the music... Does anyone know the foundations of how sound works in wc3?
And don't ask me to try setting the files as music files, it just makes the game lag hard - using files as sound makes it much more versatile in game.
And don't ask me to try setting the files as music files, it just makes the game lag hard - using files as sound makes it much more versatile in game.
EDIT: After a very long time..... with experimenting with music/sound files, I have found a consistent method to controlling in game music/sound files for those who want to be able to play different multiple sounds/musics and stop them whenever you want. THis is jass btw.
1st. At map init
call ClearMapMusic()
- TheDefaultMapMusic is very glitchy/buggy in my past experiences - it'll play without being told to whenever a sound is finished - Throw it away.2nd. In the sound editor, for every music/sound you want to use in your map - USE AS SOUND FILE
3rd. If the sound/music file you want to play is like background and should be playing consistently - check the 'Looping' box in the sound variable's properties - else just leave all the boxes blank, it will play one shot and be done.
4th. When playing sound/music, use the
PlaySoundBJ(gg_snd_'YourSoundVariableName')
function and when stopping it use theStopSound(gg_snd_'YourSoundVariableName', false, true)
The second parameter boolean -
KillSoundWhenDone
- is set as false. You dont want to kill the sound because that will prevent you from being able to play it after the stopping it the first time. That's itYou can use music files, but for something huge like the wc3 ingame music - pausing the previous one and playing a new one periodically causes bursts of lag and its not something I like seeing in my game and I don't recommend it to others. I hope this helps anyone making maps.
Last edited: