The "proper" way to animate NPCS?

I’m currently making a botch job of using:

[lua]
function ENT:Think()
–is attacking?
if self.Entity.attacktime > CurTime() then
–animation
self.Entity:SetSequence( self.Entity:LookupSequence( “throw1” ) )
–is moving?
elseif self.Entity:GetPos() != self.Entity.pos then
–animation
self.Entity:SetSequence( self.Entity:LookupSequence( “sprint_all” ) )
self.Entity.pos = self.Entity:GetPos()
end
end
[/lua]

Which is a bit stupid. Is there any way I can force animations my own way, while using shedules? (I hate shedules, but it seems it’s the only way to move NPCS for now, thanks to no Nav Mesh support!).

Also, the throw1 sequence fucks up, and judders after one run through, and no, it’s not because it’s “resetting”, SetSequence doesn’t reset it if it’s the current sequence. Basically, I need a sequence override.

Second, not so important question:
What’s the best way to create clientside ragdolls? I know you can SetNPCState dead and so on, but it doesn’t work with Citizen based models (missing ACT_DIESAMPLE?).

No one?

It’s only been 5 hours Fizz :stuck_out_tongue:

I solved it, kinda. Still using the hack for sprinting while moving, as for attacking, I’m using a custom task.

Instead of checking positions check velocity.

That doesn’t work. If a NPC moves by using an animation, it doesn’t have a velocity.

Are you talking about vanilla NPCs or SNPCs?

Also, to change a (S)NPC/s movement sequence (which you are appearantly trying to do at the part where you’re checking the NPC’s position?), use NPC.SetMovementActivity(ACT_*)/NPC.SetMovementSequence(seq)

NPCS and thanks :smiley: