Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

Help redirecting damage?

| Inside3d Forums Forum Index -> QuakeC Programming

View previous topic :: View next topic
Author | Message
--- | ---
gnounc Joined: 06 Apr 2009 Posts: 120 |

Posted: Mon Aug 16, 2010 9:19 am Post subject: Help redirecting damage? |

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 |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Mon Aug 16, 2010 9:28 am Post subject: |

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 |

gnounc Joined: 06 Apr 2009 Posts: 120 |

Posted: Mon Aug 16, 2010 9:37 am Post subject: |

Apparently yes, yes I can. Done and done, thank you.

Back to top |

Display posts from previous:

| 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