The idea is to package the damage script, quote:
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);
}
}
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?