I currently do a steam guide on damages calculation (the real this time
 ) but that will take time cause i'm french and translate in english it's time consuming. I'll do my best but that could be a little long to do correctly i will try to explain the more simply possible and in the same time explained the C script code as Spoiler to not encumber the manual.
) but that will take time cause i'm french and translate in english it's time consuming. I'll do my best but that could be a little long to do correctly i will try to explain the more simply possible and in the same time explained the C script code as Spoiler to not encumber the manual.As now i now all i now (thx pip
 ) and as all i say in the topic is totaly wrong could be possible to delete it ?
 ) and as all i say in the topic is totaly wrong could be possible to delete it ?Thx in advance, ExA
Olivier Milliot
Hello,
I ve read carrefully info on forum and video tuto 2 that Say
Hit = Base Dmg = BD
Roll Power OK = BD * 2 = NormCrit
Roll Normal Armor OK = NormCrit * (Range between 0.5 - 0.18)
Roll Armor Piercing OK = NormCrit * 2 = HeavyCrit
Roll Heavy Armour OK = HeavyCrit * (Range between 0.5 - 0.18)
And Script in "CombatTools.BSF" Named "GetOldRangedEffectivnessScore"
Is ok (near with my comprehension of languague)
But it s not the scrit used !!!!!!!!!!!
and i not understand the new script
i put the two functions and hope help to undestand what is happen on screen.
Thx in advance
Code: Select all
FUNCTION GetRangedEffectivnessScore(me, unit, weapon)
{
int shots;
int men;
int multiplier;
int Power;
int Ballistic;
int AP;
int HeavyArmour;
int Chance;
int score;
int damage;
int i;
int high;
int low;
int standard;
int TotalDamage;
int BallisticReduction;
int APhigh;
int HeavyArmourReduction;
int lowDamage;
int StandardDamage;
int HighDamage;
int APDamage;
	shots = GetAttribFromWeapon(me, weapon,"_Shots")*GetCurrentMen(me) ;
	shots *= GetAttribFromWeapon(me, weapon,"_TwinLinked")+1 ;
shots *= 1000;
StartWorkString(12);
PrintWorkStringLiteral(GetWorkString(11), 12);
PrintWorkStringLiteral("_Damage", 12);
damage = GetAttrib(me, GetWorkString(12));
men = GetCurrentMen(unit);
Ballistic = Min(GetAttrib(unit, "BallisticProtection"), 99);
HeavyArmour = Min(HeavyArmourDamageReductionChance(me, unit, weapon), 99);
Power = Min(WeaponDamageChance(me, unit, weapon), 99);
AP = Min(WeaponAPDamageChance(me, unit, weapon), 99);
if (IsBlastWeapon(me, weapon) > 1)
{
	shots = men*shots;
}
high = 100 - (Power/2);
low = ((high*10)/100)*(100-Power);
low /= 10;
low = shots/(100-low); 
low = (damage/4)*low;
StandardDamage = damage;
standard = ((high*10)/100)*Power;
standard /= 10; 
standard = shots/(100-standard);  
standard = damage*standard;
HighDamage = damage*2;
high = Power/2; 
high = shots/(100-high); 
high = (damage*2)*high;
TotalDamage = low+standard+high;
APDamage = damage;
APhigh = shots/(100-AP);
APhigh = damage*APhigh;
TotalDamage += APhigh;
TotalDamage/=100;
if (GetWeaponSpread(me, weapon) == 0 && IsBlastWeapon(me, weapon) == 0)
{
	TotalDamage = Min(TotalDamage, GetBaseHitPoints(unit));
}
if (GetWeaponSpread(me, weapon) == 1)
{
	TotalDamage = Min(TotalDamage, GetBaseHitPoints(unit)*men);
}
BallisticReduction = ((TotalDamage/4)*100)/(100-Ballistic);
BallisticReduction = BallisticReduction/10;
HeavyArmourReduction = ((TotalDamage/2)*100)/(100-HeavyArmour);
HeavyArmourReduction=  HeavyArmourReduction/10;
TotalDamage -= HeavyArmourReduction + BallisticReduction;
if (HeavyArmourDamageReductionChance(me, unit, weapon) >= 40 && WeaponAPDamageChance(me, unit, weapon) <= 40)
{
	TotalDamage -= HeavyArmourReduction + BallisticReduction;
}
//TotalDamage -= ((TotalDamage/10)*((100-Chance)/10));
if (TotalDamage< 40)
{
return 1;
}
else if (TotalDamage< 55)
{
return 2;
}
else if (TotalDamage< 80)
{
return 3;
}
else if (TotalDamage< 100)
{
return 4;
}
else
{
return 5;
}
 
}
FUNCTION GetOldRangedEffectivnessScore(me, unit, weapon)
{
int shots;
int men;
int multiplier;
int Power;
int Ballistic;
int AP;
int HeavyArmour;
int Chance;
int score;
int damage;
int i;
int high;
int low;
int standard;
int TotalDamage;
int BallisticReduction;
int APhigh;
int HeavyArmourReduction;
int lowDamage;
int StandardDamage;
int HighDamage;
int APDamage;
int s;
int x;
int WeaponPowerRoll;
int WeaponApRoll;
int BallisticProtectionRoll;
int HeavyArmourRoll;
	
	
	if (GetUniversalVar("eff_target") == unit && GetUniversalVar("eff_me") == me)
	{
		return GetUniversalVar("eff_rating");
	}
	else
	{
		SetUniversalVar("eff_target", unit);
		SetUniversalVar("eff_me", me);
	}
	shots = GetAttribFromWeapon(me, weapon,"_Shots")*GetCurrentMen(me) ;
	shots *= Max(GetAttribFromWeapon(me, weapon,"_TwinLinked"), 1) ;
	men = GetCurrentMen(unit);
	Ballistic = Min(GetAttrib(unit, "BallisticProtection"), 99);
	HeavyArmour = Min(HeavyArmourDamageReductionChance(me, unit, weapon), 99);
	if (IsBlastWeapon(me, weapon) > 1)
	{
		shots = men*shots;
	}
	score = 0;
	for (x=0; x < 100; x++)
	{
		for (s=0; s < shots; s++)
		{
		
			StartWorkString(12);
			//PrintWorkStringLiteral(GetWorkString(11), 12);
			PrintWorkStringLiteral("1ST_Damage", 12);
			damage = GetAttrib(me, GetWorkString(12));
			APDamage = damage;
			
			WeaponPowerRoll = Rand(1, 100);
			WeaponApRoll = Rand(1, 100);
			
			if (WeaponPowerRoll < (WeaponDamageChance(me, unit, weapon)/2))
			{
				damage *= 2;
			}
			else if (WeaponPowerRoll > WeaponDamageChance(me, unit, weapon))
			{
				damage /= 4;
			}
			
			if (WeaponApRoll > WeaponAPDamageChance(me, unit, weapon))
			{
				APDamage = 0;
			}	
			BallisticProtectionRoll = Rand(1, 100);
			HeavyArmourRoll = Rand(1, 100);
			
			if (HasInfernoAmmo(me) == 0)
			{
				if (BallisticProtectionRoll < BallisticDamageReductionChance(me, unit, weapon))
				{
					damage = ReduceDamage(damage);
					if (HasHellfireAmmo(me) == 0)
					{
						if (BallisticProtectionRoll < (BallisticDamageReductionChance(me, unit, weapon)-20))
						{
							damage = ReduceDamage(damage);
							if (BallisticProtectionRoll < (BallisticDamageReductionChance(me, unit, weapon)-40))
							{
								damage = ReduceDamage(damage);
							}					
						}									
					}
				}							
			}			
			if (HasVengeanceAmmo(me) == 0)
			{
				if (HeavyArmourRoll < HeavyArmourDamageReductionChance(me, unit, weapon))
				{
					APDamage = ReduceDamage(APDamage);				
					damage = ReduceDamage(damage);
					if (HasKrakenAmmo(me) == 0)
					{
						if (HeavyArmourRoll < (HeavyArmourDamageReductionChance(me, unit, weapon)-20))
						{
							APDamage = ReduceDamage(APDamage);				
							damage = ReduceDamage(damage);
							if (HeavyArmourRoll < (HeavyArmourDamageReductionChance(me, unit, weapon)-40))
							{
								APDamage = ReduceDamage(APDamage);				
								damage = ReduceDamage(damage);													
							}										
						}										
					}
				}
				if (HeavyArmourDamageReductionChance(me, unit, weapon) >= 40 && WeaponAPDamageChance(me, unit, weapon) <= 40)
				{
					//Log("extraarmour");
					HeavyArmourRoll = Rand(1, 100);
					if (HeavyArmourRoll < (HeavyArmourDamageReductionChance(me, unit, weapon))-20)
					{
						APDamage = ReduceDamage(APDamage);				
						damage = ReduceDamage(damage);	
						if (HasKrakenAmmo(me) == 0)
						{
							if (HeavyArmourRoll < (HeavyArmourDamageReductionChance(me, unit, weapon)-30))
							{
								APDamage = ReduceDamage(APDamage);				
								damage = ReduceDamage(damage);
								if (HeavyArmourRoll < (HeavyArmourDamageReductionChance(me, unit, weapon)-40))
								{
									APDamage = ReduceDamage(APDamage);				
									damage = ReduceDamage(damage);						
								}													
							}											
						}												
					}												
				}							
			}
			if (HasWolfAmulet(unit) == 1)
			{
				if (Rand(1,100) < 30)
				{
					damage = 0;
					APDamage = 0;
				}
			}
			if (HasBeltOfRuss(unit) == 1)
			{
				if (Rand(1,100) < 50)
				{
					damage = 0;
					APDamage = 0;
				}
			}
			if (HasVoidShield(unit) == 1)
			{
				if (Rand(1,100) < 50)
				{
					damage = 0;
					APDamage = 0;
				}
			}
			if (HasIonShield(unit) == 1)
			{
				if (Rand(1,100) < 50)
				{
					damage = 0;
					APDamage = 0;
				}
			}
			damage += APDamage;
			
			if (GetWeaponSpread(me, weapon) == 0 && IsBlastWeapon(me, weapon) == 0)
			{
				damage = Min(damage, GetBaseHitPoints(unit));
			}
			if (GetWeaponSpread(me, weapon) == 1)
			{
				damage = Min(damage, GetBaseHitPoints(unit)*men);
			}
			
			score += damage;		
		}				
	}
	score /= 100;
	//score = GetPercent(score, GetBaseHitPoints(unit)*men);
		SetUniversalVar("eff_rating", score);
		return score;
	if (score< 20)
	{
		return 1;
	}
	else if (score < 40)
	{
		return 2;
	}
	else if (score < 60)
	{
		return 3;
	}
	else if (score < 80)
	{
		return 4;
	}
	else
	{
		return 5;
	}	
}
 
					 
					

