Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if not SanicSpeedBoost then
- _G.SanicSpeedBoost = {}
- SanicSpeedBoost.volume_fp = 1 -- first person audio volume multiplier
- SanicSpeedBoost.volume_tp = 2 -- third person audio volume multiplier
- blt.xaudio.setup()
- -- changed buffer to contain multiple sounds here
- SanicSpeedBoost.buffer = {}
- SanicSpeedBoost.buffer[1] = XAudio.Buffer:new(ModPath .. "sound1.ogg")
- SanicSpeedBoost.buffer[2] = XAudio.Buffer:new(ModPath .. "sound2.ogg")
- SanicSpeedBoost.buffer[3] = XAudio.Buffer:new(ModPath .. "sound3.ogg")
- SanicSpeedBoost.buffer[4] = XAudio.Buffer:new(ModPath .. "sound4.ogg")
- -- till here
- function SanicSpeedBoost:play_sound(unit, third_person)
- if not alive(unit) then
- return
- end
- local u_base = unit:base()
- if not u_base._sanic_last_t or u_base._sanic_last_t < Application:time() + 8 then
- u_base._sanic_last_t = Application:time()
- -- changed following line to randomly play one of the sounds
- local src = third_person and XAudio.UnitSource:new(unit, SanicSpeedBoost.buffer[math.random(4)]) or XAudio.Source:new(SanicSpeedBoost.buffer[math.random(4)])
- if not third_person then
- src:set_relative(true)
- end
- src._gain = third_person and SanicSpeedBoost.volume_tp or SanicSpeedBoost.volume_fp
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement