need help plz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

need help plz

newbie77
i´m trying to make a simple lua script for something called monsterengine.
script looks like this.
worldID = System.WorldManager.CreateWorld()

ambID = World.CreateEntity(worldID,"sounds/amb.xml", 0, 0, 0)
sale2ID = World.CreateEntity(worldID,"sounds/sale2.xml", 0, 0, 5)
player1ID = World.CreateEntity(worldID,"sounds/player1.xml", 0, 0, 0)
rightID = World.CreateEntity(worldID, "sounds/right.xml", 0,0,0)
leftID = World.CreateEntity(worldID, "sounds/left.xml", 0,0,0)

World.AudioModule.CreateSound(worldID, "amb", "../../ljud/amb.ogg", "preload")
World.AudioModule.CreateSound(worldID, "sale2", "../../ljud/sale2.ogg", "preload")
World.AudioModule.CreateSound(worldID, "right","../../ljud/right.ogg", "preload")
World.AudioModule.Createsound(worldID, "left","../../ljud/left.ogg", "preload")

Entity.AudioObject.PlaySound(worldID, ambID, "amb", "amb")
Entity.AudioObject.PlaySound(worldID, sale2ID, "ljud", "sale2")
Entity.AudioObject.PlaySound(worldID, rightID "ljud", "right")
Entity.AudioObject.PlaySound(worldID, leftID "ljud", "left")


Entity.AudioObject.SetSourceAttribute(worldID, ambID, "ljud", "loop", 1)
Entity.AudioObject.SetSourceAttribute(worldID, sale2ID, "ljud", "loop", 1)

Entity.FollowCameraObject.FetchCamera(worldID, player1ID)

World.InputInterface.RegisterLuaFunction(worldID, "w", "MoveForward")
World.InputInterface.RegisterLuaFunction(worldID, "s", "MoveBack")
World.InputInterface.RegisterLuaFunction(worldID, "a", "TurnLeft")
World.InputInterface.RegisterLuaFunction(worldID, "d", "TurnRight")

function ppos (posx, posy, posz)
        Entity.TransformObject.SetPosition(worldID, player1ID, posx, posy, posz)
end

function MoveForward()
        x, y, z = Entity.TransformObject.GetPosition(worldID, player1ID)
        Print(z)
        ppos(x,y,z+0.5)
end

function MoveBack()
        x, y, z = Entity.TransformObject.GetPosition(worldID, player1ID)
        Print(z)
        ppos(x,y,z-0.5)
end

--function MoveLeft()
        --x, y, z = Entity.TransformObject.GetPosition(worldID, player1ID)
        --Print(x)
        --ppos(x-0.3,y,z)
--end

--function MoveRight()
        --x, y, z = Entity.TransformObject.GetPosition(worldID, player1ID)
        --Print(x)
        --ppos(x+0.3,y,z)
--end


function prot (rotx, roty, rotz)
        Entity.TransformObject.SetRotation(worldID, player1ID, string "PlayerNode", rotX, rotY, rotZ)
end

function TurnLeft()
        rx, ry, rz = Entity.TransformObject.AddRotation(worldID, player1ID, string "PlayerNode", axisX, axisY, axisZ, degree)
end

function TurnRight()
        rx, ry, rz = Entity.TransformObject.AddRotation(worldID, player1ID, string "PlayerNode", axisX, axisY, axisZ, degree)
end

what i need help with is to put sound fade down on the sale2 sound. i want it to fade down the far away i get from that sound.
and i also need to have the sound right.ogg to be played at the same volume after certain position.

any1 wanna give me some exaple code to play with plz ;)
Cheers
//Chris