Uncle
Warcraft Moderator
- Joined
- Aug 10, 2018
- Messages
- 7,866
Hello, I know there's a lot of threads on this subject but they're all very dated and lacked the answer I was looking for.
Basically, I'm trying to play a sound whenever the user presses a custom frame button.
I've got this function for playing the sound but the issue is it requires x/y coordinates and only works if the user's camera is near those coordinates:
Is there any solution to get around the limiting nature of Warcraft 3's sounds? I simply want a sound that always plays regardless of location and does not interrupt/get interrupted by other sounds.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
EDIT:
This function seem to be working fine now. Not sure why it didn't work properly in my tests before.
Basically, I'm trying to play a sound whenever the user presses a custom frame button.
I've got this function for playing the sound but the issue is it requires x/y coordinates and only works if the user's camera is near those coordinates:
Lua:
function PlaySoundForPlayer(sndPath, player, sndX, sndY, vol)
if GetLocalPlayer() ~= player then
sndPath = ""
end
local snd = CreateSound(sndPath, false, true, true, 10, 10, "DefaultEAXON")
local point = Location(sndX, sndY)
SetSoundChannel(snd, 0)
SetSoundDistances(snd, 600, 500000)
SetSoundDistanceCutoff(snd, 500000)
SetSoundDuration(snd, GetSoundFileDuration(sndPath))
SetSoundVolume(snd, 127)
SetSoundConeAngles(snd, 0, 0, 127)
SetSoundConeOrientation(snd, 0, 0, 0)
SetSoundPitch(snd, 1.0)
PlaySoundAtPointBJ(snd, vol, point, 0)
KillSoundWhenDone(snd)
end
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
EDIT:
This function seem to be working fine now. Not sure why it didn't work properly in my tests before.
Last edited: