Inside3D!
     

Help redirecting damage?

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



Joined: 06 Apr 2009
Posts: 120

PostPosted: Mon Aug 16, 2010 9:19 am    Post subject: Help redirecting damage? Reply with quote

Code:


void() W_damageSwap =
{
   local vector dir;
   
   dir = aim (self, 100);
   traceline (self.origin, self.origin + dir*200, FALSE, self);

   if (trace_ent.takedamage)
   {
      self.flags = self.flags + FL_HOST;
      self.occupant = trace_ent;
   }
};

and basically stuck this in T_Damage

Code:


   if (targ.flags & FL_HOST)
   {
      targ.occupant.health = targ.occupant.health - take;
      // react to the damage
      oldself = self;
      self = targ;
   }



I'm trying to make a selected enemy take damage in my place.

[edited because I'm retarded and had the entities switched around]

almost working


Last edited by gnounc on Mon Aug 16, 2010 9:32 am; edited 1 time in total
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Mon Aug 16, 2010 9:28 am    Post subject: Reply with quote

can't you just change targ at the start of the function?

if (targ.occupant && targ.occupant.health > 0)
targ = targ.occupant;
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
gnounc



Joined: 06 Apr 2009
Posts: 120

PostPosted: Mon Aug 16, 2010 9:37 am    Post subject: Reply with quote

Apparently yes, yes I can.
Done and done, thank you.
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