--Function requires the same name as the file local vol = 90 -- thunder volume local trigger_boundry = 100 -- activate distance was 600 revised by me local sound_entity = 74 --entity number where thunder sound is set number provided by me local light_number = 154 -- added by me jan 12 2016 entity number of light being used local light_number2 = 149 local lightswitch = {} local flashtime = 1000 --length of flash 1/2 second local endtime = 1000 -- revised by me local repeating = 1 --set to 1 to allow for flash to happen again if player has moved away and back function m2thunder_b_init(e) lightswitch[e] = -1 end function m2thunder_b_main(e) if lightswitch[e] == -1 then HideLight(light_number) HideLight(light_number2) lightswitch[e] = 0 elseif lightswitch[e] == 0 then if GetPlayerDistance(e) < trigger_boundry then StartTimer(e) -- Start timer added by Pirate Myke --FreezePlayer() -- freeze the player at trigger zone boundery ShowLight(light_number)-- turn on the light marker for 5 seconds ShowLight(light_number2)-- turn on the light marker for 5 seconds lightswitch[e] = 1 -- set a flag that the light is on PlaySound(sound_entity, 0) --play thunder wav file SetSoundVolume(vol) --adjust the thunder volume (note; soundvol must come after the sound) end elseif lightswitch[e] == 1 then -- added for test by Pirate Myke if GetTimer(e) > flashtime then StartTimer(e) HideLight(light_number) HideLight(light_number2) lightswitch[e] = 2 --UnFreezePlayer() end -- end my addition Pirate Myke elseif lightswitch[e] == 2 then --TextCenterOnX(50,50,4,"WOW! That was close") if GetTimer(e) > endtime then lightswitch[e] = 3 end elseif lightswitch[e] == 3 then if repeating == 1 then if GetPlayerDistance(e) > trigger_boundry * 2 then lightswitch[e] = 0 end else Destroy(e) end end --Prompt(GetPlayerDistance(e)) --if GetPlayerDistance(e) > trigger_boundry then --lightswitch[e] = -1 --end end