This script seems to work great except the stopsound(e) is not stopping the entity sound.
Just edited Lee's script and it now seems to work better on my PC.
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
soundtest_flag = 0
function realsound_init(e)
end
function realsound_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist<400 then
if soundtest_flag==0 then
LoopSound(e,1)
ActivateIfUsed(e)
soundtest_flag = 1
SetSoundVolume(100-(PlayerDist/15))
end
end
if PlayerDist>=400 then
StopSound(e)
soundtest_flag = 0
end
end
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, AMD HD7870 gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit.