drop item when hit

Discuss programming in the QuakeC language.
Post Reply
ajay
Posts: 559
Joined: Fri Oct 29, 2004 6:44 am
Location: Swindon, UK

drop item when hit

Post by ajay »

I'd like to get an npc to drop something (like dropbackpack, I've got a routine to do that, called dropit() ) once each time it's been hit by a player's attack?

Any ideas?

cheers

ajay
Wazat
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Post by Wazat »

Yes. In the NPC's th_pain function just call the function to drop the item. Put that function call at the very top and it'll drop items every time it's attacked.
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Post by r00k »

TRue wazat but remmember that with nailgun or lg the pain frames are refreshed ever 0.2 seconds, he should actually put a delay in there so that its not like droping too many entities!
ajay
Posts: 559
Joined: Fri Oct 29, 2004 6:44 am
Location: Swindon, UK

Post by ajay »

Wazat wrote:Yes. In the NPC's th_pain function just call the function to drop the item. Put that function call at the very top and it'll drop items every time it's attacked.
Thanks, works perfectly.
Cheers,
ajay
Post Reply