I've given up trying to add animations, but I have a robot character that I'd like to give servo sounds to. So far I've got it working for crawling leg movements, but for reasons unbeknownst to me, walking/running/strafing sounds do not work at all.
Here's my modified script so far:
;Header
desc = Player body
;Triggers
;set up entity as player body
:state=0:bindentitytocam=0,offsetentmovebeforerotate=1,offsetenty=-23,offsetentfore=-15,animate=1,dimvar=Calc,dimvar=Moving,dimvar=Anim,state=10
;animations
:ALWAYS:setvar=Moving 0
:keypressed=17 1,plrusingrun=0:addvar=Moving 1,loopsound=audiobank\walk.wav
:keypressed=17 1,plrusingrun=1:addvar=Moving 2,loopsound=audiobank\run.wav
:keypressed=31 1,plrusingrun=0:addvar=Moving -1,loopsound=audiobank\walk.wav
:keypressed=31 1,plrusingrun=1:addvar=Moving -2,loopsound=audiobank\run.wav
:keypressed=17 0:stopsound
:keypressed=31 0:stopsound
:ALWAYS:setvar=Calc 0
:keypressed=30 1:addvar=Calc -90,loopsound=audiobank\walk.wav
:keypressed=32 1:addvar=Calc 90,loopsound=audiobank\walk.wav
:vargreater=Moving 1:divvar=Calc 2
:varless=Moving -1:divvar=Calc -2
:ALWAYS:addvar=Calc 180
:keypressed=30 0:stopsound
:keypressed=32 0:stopsound
:varnotequal=Calc 90,varnotequal=Calc -90: offsetentyang=%Calc
:varequal=Moving 2:setanimspeed=100,setvar=Anim 5
:varequal=Moving 1:setanimspeed=100,setvar=Anim 2
:varequal=Moving 0:setanimspeed=100,setvar=Anim 1
:varequal=Moving 0,varnotequal=Calc 180,plrusingrun=0:setanimspeed=100,setvar=Anim 3
:varequal=Moving 0,varnotequal=Calc 180,plrusingrun=1:setanimspeed=100,setvar=Anim 3
:varequal=Moving -1:setanimspeed=-100,setvar=Anim 2
:varequal=Moving -2:setanimspeed=-100,setvar=Anim 5
;Crouching
:keypressed=46 1:loopsound=audiobank\walk.wav,addvar=Anim 30,offsetenty=8
:keypressed=46 0:offsetenty=-23
:keypressed=46 0:stopsound
:ALWAYS:animate=%Anim
Interestingly, I found out that if I press say W and S at the same time, the sound repeats itself (even when the player isn't moving) until you press either W or S again, and the same with A and D. Can anyone point out what I'm doing wrong because for the life of me I can't see it...
EDIT: And also having moved the 'loopsound' actions to the bit where the variables are calculated means that nothing happens at all. Shifting them around to a different place in the actions string does nothing either.
[center]