Going to move this thread to scripts thread, so all can benefit from it.
For your script, I got it this way.
waitForAllEntities = 1
function ai_animgp4_init(e)
rotate[e] = 11
frame = 0
testdirectionS = ""
CharacterControlLimbo(e)
SetAnimationFrames(4610,4635)
LoopAnimation(e)
ModulateSpeed(e,0.1)
SetAnimationSpeed(e,1.0)
StartTimer(e)
-- 11 test for reverse animation on Combat Solier
end
function ai_animgp4_main(e)
if waitForAllEntities == 1 then
waitForAllEntities = 0
StartTimer(e)
return
end
-- test for reverse animation on Combat Soldier, raises arm, but doesn't bring it back down!
if rotate[e] == 11 and g_Entity[e]['animating'] == 0 then
-- raise arm
testdirectionS = 'forward'
--SetAnimationSpeed(e,0.1)
--SetAnimationFrames(4610,4635) -- works fine in this direction 4610,4635
-- PlayAnimation(e)
g_Entity[e]['animating'] = 1
end
if rotate[e] == 11 and GetTimer(e) > 5000 and g_Entity[e]['animating'] == 1 then
rotate[e] = rotate[e] + 1
g_Entity[e]['animating'] = 2
-- return
end
if rotate[e] == 12 and g_Entity[e]['animating'] == 2 then
-- reverse brings arm down
testdirectionS = 'reverse'
--SetAnimationSpeed(e,-1)
-- SetAnimationFrames(4000,4635) -- goes straight from frame 4635 to frame 4610 without showing any frames in between
-- LoopAnimation(e)
SetAnimationSpeed(e,-2)
g_Entity[e]['animating'] = 0
--rotate[e] = rotate[e] - 1 -- sets to repeat animation!
end
frame = g_Entity[e]['frame']
Prompt ("Frame = " .. frame .. " Direction Play = " .. testdirectionS .. " RotateState = " .. rotate[e] )
end
Map file attached below.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit