I made a nextbot that is supposed to stand there (until activated) however, when I brought my friend into a server and spawned it, he said that it was doing a sitting animation. But standing when he spawned it. I will post a picture of what he saw below.
https://cdn.discordapp.com/attachments/411709223655833603/413147773320560660/Screenshot_19.png
Now for me he does an idle pose, I will post his RunBehavior function below.
function ENT:RunBehaviour()
-- This function is called when the entity is first spawned, it acts as a giant loop that will run as long as the NPC exists
while ( true ) do
-- Lets use the above mentioned functions to see if we have/can find a enemy
while ( self:HaveEnemy() ) and (!self.Recruited) or (self.NoRecruiter) and (self:GetEnemy():IsValid()) do
coroutine.yield()
-- Now that we have a enemy, the code in this block will run
for p, ply in pairs( player.GetAll() ) do
if ( self:GetEnemy():EyePos():Distance( self:EyePos() ) <= 200 ) then
self:SetEyeTarget( self:GetEnemy():EyePos() )
break
end
end
if (!self:HaveTarget()) then
self.loco:FaceTowards(self:GetEnemy():GetPos()) -- Face our enemy
end
self.loco:SetDesiredSpeed(0)
self:StartActivity(ACT_IDLE_RPG)
if (self:HaveTarget()) and self.Target:GetPos():Distance(self:GetPos())<=3000 and self.Target:Health() > 0 then
self:StartActivity(ACT_RANGE_ATTACK_AR2)
self.loco:FaceTowards(self.Target:GetPos())
self.loco:SetDesiredSpeed(0)
if (!self.Shooting) and self.Target:Health() > 0 then
local angle = self.Target:GetPos() - self:GetPos() + Vector(0,0,-10)
self.Shooting = true
self:MuzzleFlash()
if self.Target:Health() <= 0 then self.Target = nil
end
local bullet = {}
bullet.Num = 1
bullet.Src = self:WorldSpaceCenter() + Vector(0,-1.4,1.5)
bullet.Dir = angle:GetNormalized()
bullet.Spread = Vector( .1 , .1 , 1)
bullet.Force = 5
bullet.Damage = 8
bullet.AmmoType = "AR2"
bullet.Tracer = 1
bullet.Callback = function( attacker, tr, dmginfo )
dmginfo:SetDamageType( DMG_BULLET )
end
self:EmitSound( Sound( "weapons/ar2/fire1.wav" ), 75, 100, .5, CHAN_AUTO )
timer.Simple(.1, function()
self.Shooting = false
end)
self:FireBullets( bullet )
if self.Target:Health() <= 0 then self.Target = nil
end
end
end
end
while ( !self:HaveEnemy() ) do
self:StartActivity( ACT_IDLE_RPG )
coroutine.yield()
end
if ( self.loco:IsStuck() ) then
self:HandleStuck();
return "stuck"
end
That is the part of it that impacts this, as the next part does not. Anyway, if you know why he is sitting in that picture please help me out. Many thanks in advance.
Sorry, you need to Log In to post a reply to this thread.