• Nextbot BehaveUpdate
    1 replies, posted
i'm trying out the Behave Update Function for a Nexbot i'm trying to code, where it updates every time it's target comes into Melee range. I use the following: [CODE]function ENT:BehaveUpdate( fInterval ) if ( !self.BehaveThread ) then return end local range = self:GetRangeTo(self:GetEnemy()) print(range) if(range < 75) then self:ResetSequenceInfo() self:SetCycle(0) self:SetPlaybackRate(0) self.loco:SetDesiredSpeed(0) self.Enemy:TakeDamage(10,self) self:PlaySequenceAndWait(hit) end local ok, message = coroutine.resume( self.BehaveThread ) if ( ok == false ) then self.BehaveThread = nil Msg( self, "error: ", message, "\n" ); end end[/CODE] but the print returns constantly as nil and the console spams this error: [CODE][ERROR] addons/nextbot/lua/entities/cp_nextbot.lua:178: attempt to compare nil with number 1. unknown - addons/nextbot/lua/entities/cp_nextbot.lua:178 [/CODE] (line 178 is the "if < 75" statement) however, if i take out the code, and simply leave in the variable definition, and the print, the variable works just fine, and spams my console with the range from it's target. anything i'm missing?
nothing? alright then :C
Sorry, you need to Log In to post a reply to this thread.