• Invincible SNPCs...not what I asked for
    3 replies, posted
I've been scripting an SNPC for a while now, and so far, it's been fine I guess. But, I've tried directly copying and pasting from the wiki, and my snpc is still invincible, even though I set it's health to 25. Help, please! Oh, and here's the init.lua: [php] AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) include('shared.lua') ENT.OurHealth = 25; function ENT:Initialize() self:SetModel( "models/Humans/airborne/male_01.mdl" ) self:SetHullType( HULL_HUMAN ); self:SetHullSizeNormal(); self:SetSolid( SOLID_BBOX ) self:SetMoveType( MOVETYPE_STEP ) self:CapabilitiesAdd( CAP_MOVE_GROUND | CAP_OPEN_DOORS | CAP_ANIMATEDFACE | CAP_TURN_HEAD | CAP_USE_SHOT_REGULATOR | CAP_AIM_GUN ) self:SetMaxYawSpeed( 5000 ) //don't touch stuff above here self:Give( "npc_bar" ) //Can be given sweps. end function ENT:OnTakeDamage(dmg) self.Entity:TakePhysicsDamage(dmg); -- React physically when getting shot/blown if(self.Entity.OurHealth <= 0) then return; end -- If the health-variable is already zero or below it - do nothing self.Entity.OurHealth = self.Entity.OurHealth - dmg:GetDamage(); -- Reduce the amount of damage took from our health-variable if(self.Entity.OurHealth <= 0) then -- If our health-variable is zero or below it self.Entity:Remove(); -- Remove our entity self:SetSchedule( SCHED_FALL_TO_GROUND ) -- Because it's given a new schedule, the old one will end. end end /*--------------------------------------------------------- Name: SelectSchedule ---------------------------------------------------------*/ function ENT:SelectSchedule() self:SetSchedule( SCHED_IDLE_STAND ) //run the schedule we created earlier end [/php]
Are you drawing it in cl_init.lua
[QUOTE=yakahughes;21028700]Are you drawing it in cl_init.lua[/QUOTE] [quote][B]my snpc is still [U]invincible[/U] [/B][/quote] Bit late eh yaka?
its invincible not invisible [editline]01:02PM[/editline] oh, and im pretty sure i've got it actually, thanks
Sorry, you need to Log In to post a reply to this thread.