I have a problem with an NPC spawning script.
The combine spawned via the the below code receives a pistol with which he should normally shoot the player, as you know, combines don’t like players much.
At least it works that way in sandbox.
Well, the combine spawns, I stand in front of me. He turns to me, getting ready to attack - BUT: **He repeats the animation where he pulls out the pistol I gave him over and over again, not attacking me.
What am I doing wrong?**
The code is below:
(Deriving from base gamemode)
I checked the variables spawn.pos, spawn.angle and npc.health (all set by me) but they have no errors.
The same problem occurs with other weapons and npcs, however some just stand still with their weapon.
Zombies who don’t have any weapons attack as usual.
local ent = ents.Create( "npc_metropolice" ) ent:SetPos( spawn.pos ) ent:Spawn() ent:SetAngles( spawn.angle ) ent:SetHealth( npc.health ) ent:Give("weapon_pistol")