[Ranged Damages Reworked] My Analysis was Wrong so [CLOSED]

There is no peace among the stars: the Imperium of Man is beset on all sides by all kinds of threats. Among them is the Orks, a barbaric and warlike xeno race. One of their fiercest leaders, Grukk Face-Rippa, leads his Red Waaagh! in the Sanctus Reach system...
Post Reply
Exaercase
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 37
Joined: Tue May 16, 2017 2:13 pm

[Ranged Damages Reworked] My Analysis was Wrong so [CLOSED]

Post by Exaercase » Fri May 19, 2017 4:17 pm

I'm terribly sorry about this post. All i've said is false and with the pip help i'll found all info i need.
I currently do a steam guide on damages calculation (the real this time :P) 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 ?

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;
	}	
}
Last edited by Exaercase on Wed Jan 03, 2018 8:04 pm, edited 3 times in total.

GordonStraylight
Straylight
Straylight
Posts: 148
Joined: Tue Aug 16, 2016 12:47 pm

Re: Ranged Damages Calculation Totaly Reworked

Post by GordonStraylight » Thu May 25, 2017 12:15 am

Hi Exaercase,

The effectivness score functions are just for the tooltips to show the player the potential damage. Changes made here wont actually effect the combat model.

Cheers,

Gordon.

Exaercase
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 37
Joined: Tue May 16, 2017 2:13 pm

Re: Ranged Damages Calculation Totaly Reworked

Post by Exaercase » Thu May 25, 2017 1:47 pm

Hello,

Yes, After time to read different script i understand these, but thank for answer and confimartion :)

But i don't find in Fire.bsf where the hit result are calculated to put log en Dmg, Power Roll, Armor Roll, AP Roll and HeavyArmor Roll cause in the game i don't feel the feedback about this.

If you know Mordheim they have put a combat log and it s marvellous for peapole like me that play on boardgame and that like to understand why damage have this value or no domage etc ...

But else your game is great one of the better on Wharmmer for peapole that like the boardgame

Thank to you for this game

NB : If the damge are not hard coded could you say me the script i need to read to understand better the mechanic of this part of the game

Thanks again, see you
Best Reagrds, ExA

GordonStraylight
Straylight
Straylight
Posts: 148
Joined: Tue Aug 16, 2016 12:47 pm

Re: Ranged Damages Calculation Totaly Reworked

Post by GordonStraylight » Fri May 26, 2017 10:57 am

In CombatTools.bsf look for functions like DoFire and TriggerFire. You can find the Fire.bsf script in data/battle/scripts.

Cheers,

Gordon.

Exaercase
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 37
Joined: Tue May 16, 2017 2:13 pm

Re: Ranged Damages Calculation Totaly Reworked

Post by Exaercase » Fri May 26, 2017 11:29 am

Thanks a lot

Regards ExA

Exaercase
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 37
Joined: Tue May 16, 2017 2:13 pm

Re: Ranged Damages Calculation Totaly Reworked

Post by Exaercase » Fri May 26, 2017 2:53 pm

Hello Again,

For standard damage
I'll try to understand and that i see is that POWER check is do on POWER/2 for DAMAGE*2 else DAMAGE=DAMGE else if Power check Fail Damage=Damage/4

To be certain i put many "Log" function but no log file nowhere, i ve try also ti put command SetDebugUIObject ("BattleDebug"); but don't work

Could you help me ?

Thx in advance
Regards

pipfromslitherine
Site Admin
Site Admin
Posts: 8977
Joined: Wed Mar 23, 2005 10:35 pm

Re: Ranged Damages Calculation Totaly Reworked

Post by pipfromslitherine » Fri May 26, 2017 3:16 pm

When in battle F6 should bring up the debug log.

Cheers

Pip
follow me on Twitter here

Exaercase
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 37
Joined: Tue May 16, 2017 2:13 pm

Re: [Ranged Damages Calculation Reworked] I m Totaly Wrong

Post by Exaercase » Sat Jul 15, 2017 7:38 pm

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 ?

Thx in advance, ExA
Olivier Milliot

Post Reply

Return to “Warhammer 40,000: Sanctus Reach”