Inside3D!
     

Modifying the radius of an explosion

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



Joined: 05 Apr 2009
Posts: 24

PostPosted: Sun Apr 05, 2009 1:43 pm    Post subject: Modifying the radius of an explosion Reply with quote

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.
Back to top
View user's profile Send private message
Lardarse



Joined: 05 Nov 2005
Posts: 243
Location: Bristol, UK

PostPosted: Sun Apr 05, 2009 2:45 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
hondobondo



Joined: 26 Sep 2006
Posts: 102

PostPosted: Fri Apr 10, 2009 9:51 pm    Post subject: this function works ok Reply with quote

Code:

/*

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]
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