Navigation

 No Self Damage Feature Type: Coding Tutorials     Added: 21/01  
  Author: Corven 

Stops the player taking damage from hitting himself.

Can't hurt me

Code to be Added or Changed

g_combat.c

Look for G_Damage this is a pretty big chunk of code and an important one, it handles all the damage done in the game. What we're interested in is the lines:

// always give half damage if hurting self
// calculated after knockback, so rocket jumping works
if ( targ == attacker) {
damage *= 0.5;
}

That tells the game to only give the player half the damage if they are hurting themselves, but we want to now stop that totally, so we receive no damage. So we change it to this:

// always give half damage if hurting self
// calculated after knockback, so rocket jumping works
if ( targ == attacker) {
damage = 0;
}

Comments »



  Page 1

  Comments ( 0 )


  Features Index

  Home

Copyright 2001 MGON International AB - Privacy statement