Jump to content

[Script] Repeat 3DSound


overlocus

Recommended Posts

function createBackFire(theVeh, scx, scy, scz)
	local fireChords={}
	local dist = 0.04
	for i = 1, 6 do
		local x, y, z = getPositionFromElementOffset(theVeh,scx,scy-dist,scz)
		fireChords[i]= {pX = x, pY = y, pZ = z}
		dist = dist + 0.2
	end
	local x,y,z = getPositionFromElementOffset(theVeh,scx,scy,scz)
	local x2,y2,z2 = getPositionFromElementOffset(theVeh,scx,0,scz)
	local v1, v2, v3 = getVectors(x,y,z, x2,y2,z2)
	for i, val in ipairs(fireChords) do
		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2,v3, true)
		fxAddGunshot(val.pX,val.pY,val.pZ, v1+1.5,v2,v3, true)
		fxAddGunshot(val.pX,val.pY,val.pZ, v1-1.5,v2,v3, true)
		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2,v3+0.8, true)
		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2,v3-0.8, true)
		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2+1,v3+0.8, true)
		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2+2,v3+0.8, true)
		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2+10,v3+0.8, true)
		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2-10,v3+0.8, true)
		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2-2,v3+0.8, true)
		fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2-1,v3+0.8, true)
	end
	local s = playSound3D("sound/backfire2.wav", x,y,z, false)
	setSoundMaxDistance( s, 80 )	
	setSoundVolume(s, 0.5)	

I want the code to repeat itself randomly

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...