Making the player play sequences?

I tried making the player do custom sequences like waving but couldn’t get it to work, then I found some function that it was possible to do with but I had to override all the default animations and set the crouching, walking, jumping, driving and all of those separately for the player not to do a T-pose. Is there any way to just set something like the salute sequence when still using the default walking?

So far the closest I have got to making it work is restarting it every tick while at the same time setting it’s start time in the animations to a little more. This is very unoptimized and with lower ticks will look extremely glitchy.

Take a look at

Entity:AddGesture,

Entity:AddGestureSequence and

Entity:AddLayeredSequence.

Apparently a player is a BaseAnimatingOverlay entity, so I think one of those should work.

None of those work. They dont do anything at all.

[editline]6th August 2017[/editline]

I was able to create some more immersive and realistic movement using this code atleast:



hook.Add("PlayerButtonDown", "<- That does that ->", function( ply, key )

	if key == KEY_P then
		ply:ChatPrint("Act")
		ply:DoCustomAnimEvent( PLAYERANIMEVENT_CUSTOM , 88 )
	end

end)

hook.Add( "DoAnimationEvent" , "AnimEventTest" , function( ply , event , data )
if data == 88 then
	ply:AnimRestartGesture( GESTURE_SLOT_CUSTOM, ACT_RUN, true )
end
end )



I have no clue why that thing doesn’t seem to work. All I can say is that players have a gesture called



ply:LookupSequence( "gesture_wave" )


And there’s also an enum for it:



ACT_GMOD_GESTURE_WAVE


I just can’t get anything to work.

Oh damn I just figured out that the code I just posted works for every single sequence.

Totally gonna use the leaning back sequence when aiming with weapon in car :wink: