| 08-04-2006, 08:03 PM | #1 |
Here is the trigger. Lightning works fine, but the sound won't work. Maybe I am referencing to the file wrong? The file is in Sounds/Ambient/Doodad Effects/RollingThunder1.wav JASS:function Lightning_Zap_Actions takes nothing returns nothing local effect e local location tempLoc = GetRandomLocInRect(gg_rct_Recipe) local sound s=CreateSoundFromLabel("AmbientDoodadEffectsRollingThunder1",false,true,true,10,10) call PauseTimer(udg_LightningTimer) set e = AddSpecialEffectLoc("Doodads\\Cinematic\\Lightningbolt\\Lightningbolt.mdx",tempLoc) if GetRandomReal(0,1)>=.60 then call SetSoundVolume(s,GetRandomInt(80,100)) call SetSoundPosition(s,GetLocationX(tempLoc),GetLocationY(tempLoc),0) call SetSoundDistanceCutoff(s,3500) call StartSound(s) call KillSoundWhenDone(s) endif call TriggerSleepAction(GetRandomReal(1,2.25)) call DestroyEffect(e) call RemoveLocation( tempLoc ) set tempLoc=null set e=null set s=null call TimerStart( udg_LightningTimer, GetRandomReal(0.5,5), false, null ) endfunction function InitTrig_Lightning_Zap takes nothing returns nothing set gg_trg_Lightning_Zap = CreateTrigger( ) call TriggerRegisterTimerExpireEvent( gg_trg_Lightning_Zap, udg_LightningTimer ) call TriggerAddAction( gg_trg_Lightning_Zap, function Lightning_Zap_Actions ) endfunction |
| 08-04-2006, 08:14 PM | #2 |
Dosent "AmbientDoodadEffectsRollingThunder1" have to be "Sounds/Ambient/Doodad Effects/RollingThunder1.wav"? Iv never really used sounds, but that could be it. |
| 08-04-2006, 08:18 PM | #3 |
Still wouldn't work that way either. I've used sounds, but only after importing them to be used as a global. I wanted to try this method for a change, but it's not completely necessary. |
| 08-04-2006, 08:48 PM | #4 |
Should be: "Sounds//Ambient//Doodad Effects//RollingThunder1.wav" Additionally, sounds should be preloaded in JASS before they are played, or for the first few times they are likely not to play, but get killed instantly by KillSoundWhenDone. |
| 08-05-2006, 04:38 AM | #5 |
Could you please explain. How do I load them first? |
| 08-05-2006, 04:59 AM | #6 |
Most likely: JASS:call Preload("soundpath") |
| 08-05-2006, 02:36 PM | #7 |
OK, so do you think it would be better to just import the sound as a global "gg_snd_RollingThunder1". The trigger to play the sound as you can see will be going off quite often. I want to make sure it's not gonna slow down the game in any way. |
| 08-05-2006, 03:24 PM | #8 |
Global sounds cannot overlap with themselves. If you try and play it when it is still playing, it will ignore you. You only have to preload it ONCE, just do it at start up. |
| 08-06-2006, 01:58 AM | #9 |
Ok, I have the sound now, but I want it only to play for someone with the camera over a certain position. It seems to be playing the sound everywhere. Here is what I have again. JASS:function Lightning_Zap_Actions takes nothing returns nothing local effect e local location tempLoc = GetRandomLocInRect(gg_rct_Recipe) local sound s=CreateSoundFromLabel("Doodads\\Cinematic\\Lightningbolt\\LightningBolt1.wav",false,true,true,5,5) call PauseTimer(udg_LightningTimer) set e = AddSpecialEffectLoc("Doodads\\Cinematic\\Lightningbolt\\Lightningbolt.mdx",tempLoc) if GetRandomReal(0,1)>=.60 then call SetSoundVolume(s,GetRandomInt(80,100)) call SetSoundPosition(s,GetLocationX(tempLoc),GetLocationY(tempLoc),0) call SetSoundDistanceCutoff(s,3500) call StartSound(s) call KillSoundWhenDone(s) endif call TriggerSleepAction(GetRandomReal(1,2.25)) call DestroyEffect(e) call RemoveLocation( tempLoc ) set tempLoc=null set e=null set s=null call TimerStart( udg_LightningTimer, GetRandomReal(0.5,5), false, null ) endfunction function InitTrig_Lightning_Zap takes nothing returns nothing set gg_trg_Lightning_Zap = CreateTrigger( ) call TriggerRegisterTimerExpireEvent( gg_trg_Lightning_Zap, udg_LightningTimer ) call TriggerAddAction( gg_trg_Lightning_Zap, function Lightning_Zap_Actions ) endfunction |
| 08-06-2006, 02:39 AM | #10 |
Weird, I see that you've used it as 3D. But if you let me carp... dunno if that "3500" in SetSoundDistanceCutoff is too long. |
| 08-06-2006, 02:59 AM | #11 |
I'm assuming that the 3500 is referring the the map points x and y which would only be a corner of the map if that is correct. |
