Author Topic: TF2-esque Critical and Mini-Crit hits  (Read 1095 times)

The idea is to package the damage script, quote:
Quote from: Badspot
Code: [Select]
function ProjectileData::damage(%this,%obj,%col,%fade,%pos,%normal)
{
   if(%this.directDamage <= 0)
      return;

   %damageType = $DamageType::Direct;
   if(%this.DirectDamageType)
      %damageType = %this.DirectDamageType;

   %scale = getWord(%obj.getScale(), 2);
   %directDamage = mClampF(%this.directDamage, -100, 100) * %scale;

   if(%col.getType() & $TypeMasks::PlayerObjectType)
   {
      %col.damage(%obj, %pos, %directDamage, %damageType);
   }
   else
   {
      %col.damage(%obj, %pos, %directDamage, %damageType);
   }
}

Code: [Select]
function ProjectileData::radiusDamage(%this, %obj, %col, %distanceFactor, %pos, %damageAmt)
{
   //validate distance factor
   if(%distanceFactor <= 0)
      return;
   else if(%distanceFactor > 1)
      %distanceFactor = 1;

   %damageAmt *= %distanceFactor;

   if(%damageAmt)
   {
      //use default damage type if no damage type is given
      %damageType = $DamageType::Radius;
      if(%this.RadiusDamageType)
         %damageType = %this.RadiusDamageType;

      %col.damage(%obj, %pos, %damageAmt, %damageType);

      //burn the player?
      if(%this.explosion.playerBurnTime > 0)
      {
         if(%col.getType() & ($TypeMasks::PlayerObjectType | $TypeMasks::CorpseObjectType))
         {
            //check for vehicle protection from burning
            %doBurn = true;
            if(%col.isMounted())
            {
               %mountData = %col.getObjectMount().getDataBlock();
               if(%mountData.protectPassengersBurn)
                  %doBurn = false;
            }

            if(%doBurn)
               %col.burn(%this.explosion.playerBurnTime * %distanceFactor);
         }  
      }
   }
}
Shouldn't it be possible to multiply this damage by 1.35 (mini crit) and 3 (crit) respectively given that a certain variable exists to do so?
If I am not mistaken the script already has an example of damage multiplication in the form of multiplying damage by the size of the player. Can't we multiply damage given a certain variable exists?
But another question is whether to give that variable to the attacker, the projectile, or the victim. Perhaps all, but it should be given thought that critical hits do not stack in TF2, and Valve implemented that for a reason.
Also, what about the random crits that weapons seem to have? Is it possible to give weapons a random attribute that gives their projectiles a critical variable? To show it has this variable, is it possible to locate a projectile and cause it to produce an emitter?
« Last Edit: August 29, 2010, 06:28:41 PM by The Titanium »

Cmon, anyone?
Also, sorry for bumping, but honestly, is this idea really worth ignoring completely?

Didn't space guy made a critical Emote that make's the damage a 1hit kill?

No, it's just an emote that occurs if you execute it I believe.
And that's far from the point.
To make actual 1.35x and 3x damage multiplications using datablocks included in weapons would be terrible. So why not package the original damage script?

Imagine a Kritzkrieg, or random criticals. Or an event that could change you to critical mode for a specified time.
« Last Edit: August 30, 2010, 02:24:18 PM by The Titanium »