• SNPC Help, If Possible.
    0 replies, posted
  • Avatar of Skydive
  • So, Ive Been Having Trouble With An SNPC So My Friend Gave Me The Amazing Idea Of Asking On The Forums. Anyway Moving Back Onto My Subject My NPC Inst Really Moving Or Attacking. Its Just Supposed to Attack Like A Normal Combine NPC, So What Exactly Would I Do? My Method Was Setting Entity Relationships But It Doesn't Work And I Do Not Get Any Errors In The Console. On Top Of All Of This The NPC Does Not Move Or Take Damage. [CODE]function ENT:Initialize() if self:GetActiveWeapon() == nil then self:Give("weapon_smg1") end self:SetModel("models/humans/group01/male_02.mdl") self:SetHullType( HULL_HUMAN ) self:SetHullSizeNormal(); self:SetSolid( SOLID_BBOX ) self:SetMoveType( MOVETYPE_STEP ) self:CapabilitiesAdd( CAP_MOVE_GROUND | CAP_OPEN_DOORS | CAP_SQUAD | CAP_ANIMATEDFACE | CAP_USE_WEAPONS | CAP_SQUAD | CAP_DUCK | CAP_MOVE_SHOOT | CAP_TURN_HEAD | CAP_USE_SHOT_REGULATOR | CAP_AIM_GUN ) self:SetMaxYawSpeed( 5000 ) self:SetHealth(100) self:SetEnemy(NULL) end function ENT:OnTakeDamage(dmg) self:SetHealth(self:Health() - dmg:GetDamage()) if self:Health() <= 0 then self.Remove() self.CreateRagdoll() end end function ENT:Think() local function FindEnemy() local entstoattack = ents.FindInSphere( self:GetPos(), 120) if entstoattack ~= nil then for k,v in pairs(entstoattack) do if v:IsPlayer() && v:Alive() then self:AddEntityRelationship( v, D_HT, 10 ) self:SetSchedule( SCHED_RANGE_ATTACK1 ) end end else self:SetSchedule( SCHED_NONE ) end end end[/CODE] Happily, I Am Not A Noob Lua Coder and I Wouldn't Necessarily Mind If You Post Me A Tutorial Link Since I Havent Found Even ONE Yet. Yes I Have Checked On The Wiki and LuaSearch But Have Not Had Any Success. Thanks In Advance For The Worthwhile Support I Might Recieve. [highlight](User was banned for this post ("Wrong Section" - Gran PC))[/highlight]