| 04-22-2006, 06:53 PM | #1 |
It seems that if you use KillSoundWhenDone(sound) just after playing it, it usually kills it immediately, and therefore thats the "jass sound bug". If you're using sounds in jass and you want that sound to be played like it should, instead of KillSoundWhenDone(sound), I made this function to do it AFTER the sound is actually played: Lets say your sound duration is 1933 1933 is 1 second .933, almost 2 seconds So make sure you add the duration too in the function JASS:function KillSound_Child takes nothing returns nothing local timer t = GetExpiredTimer() local string s = GetAttachmentTable(t) local sound snd = GetTableSound(s, "snd") call KillSoundWhenDone(snd) call ClearTable(s) call DestroyTimer(t) set t = null set snd = null endfunction function KillSound takes sound snd, real dur returns nothing local timer t = CreateTimer() local string s = GetAttachmentTable(t) call SetTableObject(s, "snd", snd) call TimerStart(t, dur*.001, false, function KillSound_Child) set t = null endfunction Instead of killsoundwhendone, use this: call KillSound(sound, duration) where the duration is the sound duration in milliseconds. it uses tables, you can get the tables and attachable vars from vexorian's caster system. You can use handle vars as well, but it requires one of the both, if you're gonna use handles make sure to customize it properly. Hope this helps anyone. |
