• Running Animation
    0 replies, posted
I'm trying to make a running animation for Trouble in Terrorist Town using a running animation from half life 2. This code is standalone and doesn't require anything else to function so far. I'm attempting to stop the animation when you fire your weapon and revert to the default running animation in the period that you hold left-click but it doesn't want to work. Am I looking in the wrong area? Is it not supposed to be coded into this lua file at all? [CODE] local IsValid = IsValid local os = os local util = util hook.Add( "CalcMainActivity", "BaseAnimations", function( Player, Velocity ) if not Player.LastOnGround and not Player:OnGround() then Player.LastOnGround = true end if Player:IsOnGround() and Player.LastOnGround then Player:AddVCDSequenceToGestureSlot( GESTURE_SLOT_FLINCH, Player:LookupSequence("jump_land"), 0, true ) Player.LastOnGround = false end Player.m_FistAttackIndex = Player.m_FistAttackIndex or Player:GetNW2Int("$fist_attack_index") if Player.m_FistAttackIndex ~= Player:GetNW2Int("$fist_attack_index") then Player.m_FistAttackIndex = Player:GetNW2Int("$fist_attack_index") Player:AddVCDSequenceToGestureSlot( 5, Player:LookupSequence("zombie_attack_0" .. ( ( Player.m_FistAttackIndex )% 7 + 1 )), 0.5, true ) end if Player:IsOnGround() and Velocity:Length() < Player:GetRunSpeed() - 20 then return ACT_HL2MP_RUN_FAST, -1 end end) hook.Add("KeyPress", "TTT_KeyPress", function(ply, key) if IsValid(ply) and key == IN_ATTACK then local plyWep = ply:GetActiveWeapon() if !IsValid(plyWep) then return end if plyWep.Base != "weapon_tttbasegrenade" then if !plyWep:CanPrimaryAttack() or (CurTime() < plyWep:GetNextPrimaryFire()) then return end else if (CurTime() < plyWep:GetNextPrimaryFire()) then return end end return ACT_HL2MP_RUN_FAST, -1 end end) local function RenderHook( Object ) if not Object:IsPlayer() then return end if not Object.RenderOverride then Object.RenderOverride = function( self ) if hook.Call("PlayerRender", nil, self ) == nil then self:DrawModel() end end end end hook.Add("NetworkEntityCreated", "HookOntoPlayerRender", RenderHook ) hook.Add("NetworkEntityCreated", "HookOntoPlayerRender", OnEntityCreated ) [/CODE]
Sorry, you need to Log In to post a reply to this thread.