Inside3D!
     

Backpack Kills

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
redrum



Joined: 28 Mar 2007
Posts: 367
Location: Long Island, New York

PostPosted: Fri Oct 26, 2007 9:36 pm    Post subject: Backpack Kills Reply with quote

In void() BackpackTouch =
I added code so that if a backpack contains a certain amount of ammo it will explode.
I want the owner of the backpack to get a frag if a player dies in this manner.
I tried adding:
item.classname = "backpack"; in
void() DropBackpack = and adding:
if (targ.deathtype == "backpack")
{
attacker.frags = attacker.frags + 1;
return;
}

in
void() ClientObituary =
but it didn't work?
_________________
Welcome to the Overlook Hotel 69.113.123.178:27500
Back to top
View user's profile Send private message Send e-mail
Dr. Shadowborg
Inside3D Staff


Joined: 16 Oct 2004
Posts: 726

PostPosted: Sat Oct 27, 2007 4:20 am    Post subject: Reply with quote

Assuming you're having the backpack do the damage right, all you should need to do is put something like this:

Code:
item.owner = self;


In void() DropBackpack.
_________________
"Roboto suggests Plasma Bazooka."
Back to top
View user's profile Send private message
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Sat Oct 27, 2007 5:06 am    Post subject: Reply with quote

that will also make the person who dropped the backpack unable to pick it up
Back to top
View user's profile Send private message Send e-mail
redrum



Joined: 28 Mar 2007
Posts: 367
Location: Long Island, New York

PostPosted: Sat Oct 27, 2007 5:11 am    Post subject: Reply with quote

So how do I accomplish this?
_________________
Welcome to the Overlook Hotel 69.113.123.178:27500
Back to top
View user's profile Send private message Send e-mail
Dr. Shadowborg
Inside3D Staff


Joined: 16 Oct 2004
Posts: 726

PostPosted: Sat Oct 27, 2007 10:34 pm    Post subject: Reply with quote

Whoops, sorry about that.

Do this instead then:

Code:
item.enemy = self;


In DropBackpack()

Then in when you call T_Damage or T_RadiusDamage in your touch function, just set the attacker variable to self.enemy. For example:

Code:
T_Damage(other, self, self.enemy, damage);


Or in the case of T_RadiusDamage

Code:
T_RadiusDamage(self, self.enemy, damage, world);


Also, don't forget to put in some kind of delay before it can be picked up if you intend to make it so that the player can drop these while still alive and solid, because if you don't, YOU could blow up instead.
_________________
"Roboto suggests Plasma Bazooka."
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group