• ply:AnimRestartGesture not working?
    2 replies, posted
So, I'm currently fixing some things in Tiramisu 2, and I've come across one problem involving the animation system. When I fire my weapon and then stop firing, my character does not stop the shooting animation. Also, when I attempt to reload, I get this error in my console: [CODE] [ERROR] gamemodes/tiramisu/gamemode/sh_animations.lua:806: bad argument #2 to 'AnimRestartGesture' (number expected, got nil) 1. AnimRestartGesture - [C]:-1 2. unknown - gamemodes/tiramisu/gamemode/sh_animations.lua:806 [/CODE] This is my animation section: [CODE] function GM:DoAnimationEvent( ply, event, data ) -- This is for gestures. holdtype = "default" if( ValidEntity( ply:GetActiveWeapon() ) ) then holdtype = Anims.DetectHoldType( ply:GetActiveWeapon():GetHoldType() ) end if event == PLAYERANIMEVENT_ATTACK_PRIMARY then if Anims[ ply:GetGender() ][ holdtype ][ "fire" ] then ply:AnimRestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, Anims[ ply:GetGender() ][ holdtype ][ "fire" ] ) else ply:AnimRestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_GESTURE_RANGE_ATTACK_SMG1 ) end return ACT_VM_PRIMARYATTACK elseif event == PLAYERANIMEVENT_RELOAD then if Anims[ ply:GetGender() ][ holdtype ][ "reload" ] then ply:AnimRestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_GESTURE_RELOAD_SMG1 ) else ply:AnimRestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, Anims[ ply:GetGender() ][ holdtype ][ "reload" ] ) end return ACT_INVALID elseif event == PLAYERANIMEVENT_CANCEL_RELOAD then ply:AnimResetGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD ) return ACT_INVALID end if event == PLAYERANIMEVENT_JUMP then ply.Jumping = true ply.FirstJumpFrame = true ply.JumpStartTime = CurTime() ply:AnimRestartMainSequence() return ACT_INVALID end return nil end [/CODE]
The problem is you are passing a nil value for the second argument. Check that your ACT_ enums are still valid ( some have changed name, I've noticed ) and that your Anims table is also not nil for that index.
I've noticed that most animations work, it's just reloading that generates an error, and the shooting animations never stop.
Sorry, you need to Log In to post a reply to this thread.