function ProjectileData::damage(%this,%obj,%col,%fade,%pos,%normal)
{
if(%col.getClassName() == "WheeledVehicle")//it's a vehicle
//TODO Make this apply to units with armor too
{
%vehicleArmor = %col.getDatablock().armorValue;
%weaponPiercing = %obj.sourceObject.getDatablock().armorPiercing;
messageClient(%obj.sourceObject.client,' ',"Hit a vehicle.");
if(%vehicleArmor > 0)//if it is armored
{
messageClient(%obj.sourceObject.client,' ',"Hit an armored vehicle.");
if(%weaponPiercing >= %vehicleArmor)//can penetrate, continue normally.
{
%damApply = %this.directDamage;
}
else
{
%damApply = (%this.directDamage) * 0.5;
}
}
else
{
%damApply = %this.directDamage;//no armor, apply normally
}
}
s%points = %damApply;
//Check if that would be more than the target's health, and if so, set points to max health.
if((%col.getDamageLevel() + %damApply) > %col.getDatablock().maxDamage)
{
%points = %col.getDatablock().maxDamage - %col.getDamageLevel();
}
messageClient(%obj.sourceObject.client,' ',"Points Earned:" @ %points);
Parent::damage(%this,%obj,%col,%fade,%pos,%normal);
}
When I shoot a jeep with the gun, I get no "hit a vehicle" message.