• lua NPC spawning
    5 replies, posted
So I can spawn a turret that can shoot. [lua] local ent = ents.Create("npc_turret_floor") -- This creates our npc entity ent:SetPos(tr.HitPos) -- This positions the npc at the place our trace hit. ent:SetCurrentWeaponProficiency( WEAPON_PROFICIENCY_VERY_GOOD ) ent:Spawn() -- This method spawns the npc into the world [/lua] but I cant spawn a Combine that can shoot. [lua] local ent = ents.Create("npc_combine_s") -- This creates our npc entity ent:SetPos(tr.HitPos) -- This positions the npc at the place our trace hit. ent:SetCurrentWeaponProficiency( WEAPON_PROFICIENCY_VERY_GOOD ) ent:Spawn() -- This method spawns the npc into the world ent:Give("weapon_smg1") -- This method gives the npc a pistol [/lua] Is it that he doesn't have ammo?
[lua]ent:Give( "ai_weapon_smg1" )[/lua]
I'm getting a server crash after a bit ED_Alloc: no free edicts how do i remove NPC's properly? [lua] v:Remove() [/lua] is not cutting it
If you want to remove all NPC's ( Which to me it does look like it ) [lua] for k, v in pairs( ents.FindByClass( "npc_*" ) ) do v:Remove() end [/lua]
[QUOTE=McDunkable;39110564]If you want to remove all NPC's ( Which to me it does look like it ) [lua] for k, v in pairs( ents.FindByClass( "npc_*" ) ) do v:Remove() end [/lua][/QUOTE] this is what i wanted to do. [lua] for k, v in pairs( ents.FindByClass( "npc_bullseye" ) ) do v:Remove() end [/lua] when i remove turrets though there sound is still heard, why?
How do you set a npc_combine_s health? Also there aim is Honorable how do i increase there accuracy?
Sorry, you need to Log In to post a reply to this thread.