I use the 3D sound for bar I made, the music comes inside the room and when you get closer you hear it more
the teleport its for another thing in the map, there is no connection between them, but if I use the zone of the teleport its disable the loop sound effect when I visit the bar again. here the sound script.
"-- reconditioned script (based on the HockeyKid script).
-- Script 3D surround sound to GameGuru. Object interaction AlgoStep Company (DevCore35, Adrien, Gaetan)
-- This script can be used in commercial games
function soundbinau_init(e)
nlevel=0
maxvolume = 100
minvolume = 1
noise = 0
end
function soundbinau_main(e)
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX;
PlayerDY = g_Entity[e]['y'] - g_PlayerPosY;
PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
nvolume = maxvolume - ( PlayerDist / 35.0 )
if nvolume < minvolume then
StopSound(e,0)
noise=0
else
if noise == 0 then
LoopSound(e,0)
noise = 1
end
SetSoundVolume(nvolume)
end
end"