So I've made a few nextbot's now. But I never really went into coroutines. Now I want to make a nextbot that is able to play animations and stuff. I don't really know how to do that.
I've tried to use coroutines but I keep getting errors. I would like to get some help with that. So what I am making is the fast zombie from hl2.
I put this in the ChaseEnemy function.
[code]
local ent = ents.FindInSphere( self:GetPos(), 60)
for k, v in pairs( ent ) do
if v:IsPlayer() && ( v:Health() > 0 ) then
timer.Simple( 0.5,
function() v:TakeDamage( 5 )
coroutine.wait( 0.5 )
end)
[/code]
I've tried to make my npc deal damage to the player. The timer is working. But the coroutine didn't worked at all. I've never used coroutines so I don't know what I did wrong?
How would I make the nextbot playing a animation while dealing damage?
I just want it to attack players. Should be simple but I don't know how to do that.
Sorry, you need to Log In to post a reply to this thread.