--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 = 151 --entity number where thunder sound is set number provided by me local light_number = 149 -- added by me jan 12 2016 entity number of light being used local lightswitch = {} local flashtime = 100 -- this revised by me needs to be at least 2 seconds 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) --Hide(sound_entity) removed by me --CollisionOff(sound_entity) --SetPosition(sound_entity,g_PlayerPosX,g_PlayerPosY,g_PlayerPosZ)removed by me if lightswitch[e] == -1 then HideLight(light_number) 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 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) 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) > 2500 then lightswitch[e] = 0 end else Destroy(e)-- not sure what this does end --lightswitch[e] = -1 end --Prompt(GetPlayerDistance(e)) if GetPlayerDistance(e) > trigger_boundry then lightswitch[e] = -1 end end