Big problem with NPC 3rd person weapon code..
Moderator: InsideQC Admins
3 posts
• Page 1 of 1
Big problem with NPC 3rd person weapon code..
I added a code to spawn a 3rd person gun to a singleplayer enemy, it works but sometiems the weapon gets
also attached to my grenades and shell ejection (???)...
Anybody can help me??
Heres the code..
also attached to my grenades and shell ejection (???)...
Anybody can help me??
Heres the code..
- Code: Select all
void() npc_mp40update =
{
if(self.owner.classname == "npc_soldier")
setmodel (self, "progs/visual/vis_mp40.mdl");
self.angles = self.owner.angles;
self.origin = self.owner.origin;
self.think = npc_mp40update;
self.nextthink = time + 0.01;
self.frame = self.owner.frame;
};
void() SpawnNPCWeapon =
{
local entity gun;
gun = spawn ();
gun.owner = self;
gun.movetype = MOVETYPE_NONE;
gun.solid = SOLID_NOT;
gun.classname = "Third Person Weapon";
setorigin (gun, self.origin);
gun.angles = self.angles;
gun.frame = self.owner.frame;
self.gunnumber = self.gunnumber + 1;
if(self.gunnumber > 1) //Do we already have one?
gun.think = SUB_Remove; //Then go away
else
gun.think = npc_mp40update;
gun.nextthink = time+ 0.01;
};
-

drm_wayne - Posts: 232
- Joined: Sat Feb 11, 2012 5:47 pm
Re: Big problem with NPC 3rd person weapon code..
do you remove the 3rd-person weapon when its owner dies? or does it linger on other things like projectiles that simply use the same entity slot as its owner?
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Re: Big problem with NPC 3rd person weapon code..
Spike wrote:do you remove the 3rd-person weapon when its owner dies? or does it linger on other things like projectiles that simply use the same entity slot as its owner?
Currently the dead body and the gun gets removed (they sink in the ground)....
But it seems to happen after i walk over the dead bodies... lol xD
-

drm_wayne - Posts: 232
- Joined: Sat Feb 11, 2012 5:47 pm
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest