Getting a NextBot to use player running animations correctly


--In ENT:RunBehavior()
self:StartActivity( ACT_HL2MP_RUN )


Whenever I use this code in ENT:RunBehavior(), it just stands their and the legs of the model don’t move. Just so you know, I’m using a model that actually has these animations(hence the fact that it wasn’t T-posing). Anyone know how to make it’s legs move when using player animations?

I’m not sure, but this might help

Entity:SetIK. Emphesis on the not sure.

Use ACT_RUN instead

i’ve found the following to work.


function ENT:Think()
self:BodyMoveXY()
self:BodyUpdate()


end

Put your StartActivity wherever you put it, and have these two functions run in Think when you need them, and it should work.

I’ve been a little iffy with think hooks, I’ve been kinda OCD-ish about it causing lag because it is called so often. I put self:BodyUpdate() and what not in Think, and it works. Thanks! Well, is it okay to call those randomly in Think? Will it cause lag? I’ll probably get boxes for asking that, but I feel a little worried about lag. :stuck_out_tongue:


function ENT:Think()
self:BodyMoveXY()
self:BodyUpdate()
	if self.lastthink < CurTime() then 
	
if ( self:GetEnemy() and IsValid( self:GetEnemy() ) ) then 
			if (self:GetRangeTo(self:GetEnemy()) < 30) then
			self:SetMaterial("")
				if self:GetEnemy():IsPlayer() then
				    self:GetEnemy():TakeDamage( 10 )
					self:GetEnemy():ViewPunch(Angle( 10, 0, 0 )) 
				end
end
end
		self.lastthink = CurTime() + 1 -- Where 1 is the delay
end
end


Never mind. No lag, it works all fine. I shouldn’t have thought it wouldn’t work or would cause lag XD