- Joined
- Mar 6, 2006
- Messages
- 282
Before anyone just tells me to use SoundTools, let me explain something real quick.
People say you can't play a sound right after you create it. Like this:
What I've found is, if you preload the sound just by playing it, then you CAN play sounds right after creating them, like the above code.
Notes on preloading:
- Set the sound volume to zero, so they can't hear it.
- Only works if the player's game-sound is enabled at the time of preloading
- If it's a 3D sound, then you need to FORCE the player to hear it by
playing it in an area that you KNOW that player is already looking at.
(that would be easy at the start of the game, where most preloading is done)
So here's the question:
What's the problem with this? I mean, I can't be the only person to do this, and there must be a reason that SoundTools was created, because whenever I search for sound threads, it's just people saying to use SoundTools.
People say you can't play a sound right after you create it. Like this:
JASS:
local sound s = CreateSound( "Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveCaster1.wav", false, true, true, 10, 10, "" )
call SetSoundDuration( s, GetSoundFileDuration("Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveCaster1.wav") )
call SetSoundChannel( s, 0 )
call SetSoundVolume( s, 127 )
call SetSoundPitch( s, 1.0 )
call SetSoundPosition(s, GetUnitX(me), GetUnitY(me), 0)
call StartSound(s)
call KillSoundWhenDone(s)
set s = null
What I've found is, if you preload the sound just by playing it, then you CAN play sounds right after creating them, like the above code.
Notes on preloading:
- Set the sound volume to zero, so they can't hear it.
- Only works if the player's game-sound is enabled at the time of preloading
- If it's a 3D sound, then you need to FORCE the player to hear it by
playing it in an area that you KNOW that player is already looking at.
(that would be easy at the start of the game, where most preloading is done)
So here's the question:
What's the problem with this? I mean, I can't be the only person to do this, and there must be a reason that SoundTools was created, because whenever I search for sound threads, it's just people saying to use SoundTools.