• I need help with my new SNPC
    2 replies, posted
Hello, I have been working on a German Shepherd (Name of a dog kind) SNPC and I came across a bug were I can't fix the problem, I don't know what is problem. If you think you can help me, please do so! Thank you. - Error - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// [ERROR] lua/includes/modules/ai_task.lua:117: bad argument #1 to 'RunEngineTask' (number expected, got nil) 1. RunEngineTask - [C]:-1 2. Run - lua/includes/modules/ai_task.lua:117 3. RunTask - gamemodes/base/entities/entities/base_ai/schedules.lua:148 4. DoSchedule - gamemodes/base/entities/entities/base_ai/schedules.lua:71 5. unknown - gamemodes/base/entities/entities/base_ai/schedules.lua:22 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - init.lua - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) include('shared.lua') ENT.Damage = 20 local schdChase = ai_schedule.New( "AIFighter Chase" ) schdChase:AddTask( "FindEnemy", { Class = "player", Radius = 200000 } ) schdChase:EngTask( "TASK_GET_PATH_TO_ENEMY", 0 ) schdChase:EngTask( "TASK_RUN_PATH", 0 ) schdChase:EngTask( "TASK_WAIT_FOR_MOVEMENT", 0 ) function ENT:SpawnFunction( ply, tr ) if ( !tr.Hit ) then return end local SpawnPos = tr.HitPos + tr.HitNormal * 20 local ent = ents.Create( "npc_germanshepherd" ) ent:SetPos( SpawnPos ) ent:Spawn() ent:Activate() return ent end function ENT:Think() local entstoattack = ents.FindInSphere(self:GetPos() + self:GetForward()*75,47) if entstoattack != nil then for _,v in pairs(entstoattack) do if ( (v:IsNPC() && (v != self) && (v:GetClass() != self:GetClass()) || (v:GetClass() == "prop_physics")) )then local sequence = self.Entity:LookupSequence("attack_leftmidbite") self.Entity:SetSequence(sequence) v:TakeDamage( self.Damage, self ) if v:GetClass() == "prop_physics" then local phys = v:GetPhysicsObject() if phys != nil && phys != NULL then phys:ApplyForceOffset(self:GetForward()*500,Vector(math.random(-1,1),math.random(-1,1),math.random(-1,1))) end end end end end end function ENT:Initialize() self:SetModel( "models/dogmeat.mdl" ) self:SetHullType( HULL_LARGE ); self:SetHullSizeNormal(); self:SetSolid( SOLID_BBOX ) self:SetMoveType( MOVETYPE_STEP ) self:CapabilitiesAdd( CAP_MOVE_GROUND,CAP_ANIMATEDFACE,CAP_TURN_HEAD,CAP_AIM_GUN,CAP_OPEN_DOORS ) self:SetMaxYawSpeed( 5000 ) self:SetHealth ( 1000 ) end function ENT:OnTakeDamage(dmg) self:SetHealth(self:Health() - dmg:GetDamage()) if self:Health() <= 0 then self:Remove() end end function ENT:SelectSchedule() self:StartSchedule( schdChase ) end /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// If you find the problem please help me!
As far as I am aware, SNPCs are currently broken in GM13
Kind of...[QUOTE=Lerpaderp;39103096]As far as I am aware, SNPCs are currently broken in GM13[/QUOTE]
Sorry, you need to Log In to post a reply to this thread.