Forum

Modifying the radius of an explosion

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Modifying the radius of an explosion

Postby asdqwe » Sun Apr 05, 2009 1:43 pm

I only want to increase the radius of an Ogre's grenade, not its damage. In Ogre.qc I modified a T_RadiusDamage parameter to 940 instead of 40. However this seems to increase BOTH radius and damage.
So, where do I find the radius proper?

Thanks.
________
BMW Sauber F1.09
Last edited by asdqwe on Tue Feb 01, 2011 9:40 pm, edited 1 time in total.
asdqwe
 
Posts: 24
Joined: Sun Apr 05, 2009 1:38 pm

Postby Lardarse » Sun Apr 05, 2009 2:45 pm

You would need to re-write T_RadiusDamage to take an extra parameter, and then sensibly alter all of the function calls to it.

You would also need to adjust the forumla that works out how much damage to be dealt, as it currently has a fixed falloff of 0.5 damage per unit.
User avatar
Lardarse
 
Posts: 266
Joined: Sat Nov 05, 2005 1:58 pm
Location: Bristol, UK

this function works ok

Postby hondobondo » Fri Apr 10, 2009 9:51 pm

Code: Select all
/*

this is an attempt at making a constant radial damage function. i.e., a function that does identical _damage_ to everyone
in _radius_, instead of damage always based on the distance from the center. this can be used to inflict a small damage
over a large radius, or vice versa

*/

float inside_radius2;

void (entity inflictor, entity attacker, float damage, float radius, entity ignore) T_RadiusDamage2 = {

   //local float points;
   local entity head;
   local vector org,dir;   //dir added by bondo

   if (inside_radius2)
   {
      remove (world);
      print_self ("T_RadiusDamage2:", "recursive");
      return;
   }

   inside_radius2 = TRUE;

   //pofp increases the damage/radius
   //if (attacker.invincible_finished > time) damage = (damage * 1.3);
   head = findradius (inflictor.origin,(radius + 40.000));

   while ( head ) {

      if (head != ignore)
      {

         if ( head.takedamage )
         {
            //bondo's attempt to make creatures fly when attacked by radius damage
            dir = head.origin - inflictor.origin;
            dir = normalize(dir);
            //end of attempt
            if ( CanDamage (head,inflictor) )
            {
               if (head == attacker) damage = damage * 0.5;

               T_Damage (head,inflictor,attacker,damage);

               //bondo attempting again
               //this only causes grenades to bounce you around
               if ((head != attacker))
               {
                  if (head.flags & FL_ONGROUND)
                     head.flags = head.flags - FL_ONGROUND;
                  head.velocity = dir * damage * 3.5;
                  head.velocity_z = head.velocity_z + damage * 4.5;
               //end again
               }
             }

         }
      }
      head = head.chain;
   }
   inside_radius2 = FALSE;
};


it also adds this error check by aguirre, and some fun physics effects by me[/code]
hondobondo
 
Posts: 207
Joined: Tue Sep 26, 2006 2:48 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest