First sorry for my english i m not and native english speaker
Second i hope not do mistake in my analyse. If it's the case sorry for the disturbing.
---------
With the help of PIP i've be able to understand more about sript and modify it to do for my usage (i like understand what happen in combat) a Battle Log Interface.
So i've be able to see some strange thing happen in the CombatTools.BSF. Some Aera Weapon/Melee/Ability would have damage that (sorry im french and it s a matematic expression so i try to say in english) go forward zero. The reason is realtively simple and it's correct for exemple for Frag grenade.
When you do "for ()" loop (or multi imbricated "for ()" loop for multi-tiles impact) you don't reinitialize the variable damage and APDamge. So for the next men in unit or men in unit in the blast area we use the previous result. and this previous result could be less that initial and so on so time after time the total damge go forward zero.
Here an exemple of correct code : FUNCTION FragGrenade
Code: Select all
for(r=tilex-radius; r<=tilex+radius; r++)
{
for(t=tiley-radius; t<=tiley+radius; t++)
{
men = 1;
target = GetUnitOnTile(r,t);
if (IsUnitValid(target) == 1 && target != me)
{
for (i=0; i<GetUnitMen(target); i++)
{
if (GetUnitManDead(target, i) == 0)
{
man = men;
//ExA note : It' here we reinit for the next men damage and APDamge variable
damage = 20;
APDamage = 0;
WeaponPowerRoll = Rand(1, 100);
WeaponApRoll = Rand(1, 100);
BallisticProtectionRoll = Rand(1, 100);
HeavyArmourRoll = Rand(1, 100);
.
.
.
}
}
}
}
}
Code: Select all
FUNCTION DoFire(me, x, y, weapon, KFF)
{
[i]var declaration[/i]
UseVizQueue(1);
miss = 1;
if (weapon == 1)
{
damage = GetAttrib(me, "1ST_Damage");
APDamage = GetAttrib(me, "1ST_Damage");
}
if (weapon == 2)
{
damage = GetAttrib(me, "2ND_Damage");
APDamage = GetAttrib(me, "2ND_Damage");
}
if (weapon == 3)
{
damage = GetAttrib(me, "3RD_Damage");
APDamage = GetAttrib(me, "3RD_Damage");
}
if (HasDabestAmmo(me) == 1)
{
damage += 15;
APDamage += 15;
}
if (HasBlessingofMork(unit) == 1 && GetAttribArray(unit, "AbilityCooldown2", 6) == 5)
{
damage = 0;
APDamage = 0;
}
//ExA note : First Part of the function it it for blast damge so problem
//ExA note : Second part for unique man damage so no problem
if (IsBlastWeapon(me, weapon) > 0)
{
PlayImpactSound(me, -1, weapon, x, y, 0);
AddVizSpotAnim(x, y, GetHitEffect(me, weapon), GetHitEffectIndex(me, weapon), 25, -1, 0, GetProjCoverHeight(me, x/100, y/100));
// do area damage
r = 0;
if (IsBlastWeapon(me, weapon) > 1)
{
r = 1;
}
for (j = (x/100) - r; j <= (x/100) + r; j++)
{
for (k = (y/100) - r; k <= (y/100) + r; k++)
{
unit = GetUnitOnTile(j, k);
//ExA note : I cut the tile damge
if (IsUnitValid(unit) == 1)
{
miss = 0;
for (i=0; i<GetUnitMen(unit); i++)
{
if (GetUnitManDead(unit, i) == 0)
{
//ExA note : NO Reinit of damage and APDamage
miss = 0;
// do attack roll
WeaponPowerRoll = Rand(1, 100);
WeaponApRoll = Rand(1, 100);
BallisticProtectionRoll = Rand(1, 100);
HeavyArmourRoll = Rand(1, 100);
//ExA note : begin of final damage calculation and armor reduction and effect
//ExA note : So the next man inherit of the final damge and APDamge of the previous
//ExA note : and so time after time the damge and APDamge go forward zero
.
.
.
}
}
}
}
}
}
else
{
//ExA note : non blast weapon = no pb i think with the if (GetPositionDistance(x,y,GetManX(unit, i),GetManY(unit, i)) < 5) that select one man
}
}
i put the initial damage and APDamge in a variable and use it for the reinit.
For the other case is more simple to correct it
Other Function with the same pb (i think) :
FUNCTION TriggerAreaMelee
FUNCTION TriggerPowerBurst (i m not totaly sure)
FUNCTION DoBonusRokkit (Seem's work like Function DoFire one part on blastweapon with the problem and one part non blast that is ok (use of "if (GetPositionDistance(x,y,GetManX(unit, i),GetManY(unit, i)) < 2)" ))
No pb in (i think)
FUNCTION DoKillbolt is ok i thnk is as the dofire non blast part the "if (GetPositionDistance(x,y,GetManX(unit, i),GetManY(unit, i)) < 2)" select only one man
---------------------------------------------------
Totaly another thing i think in (Here i do an error yesterday is not frag but krak function but code it s ok) FUNCTION KarkGreande you have forget to put in commentary a line (in all other damage function this line is in commentary moreover if no you could do more damage if you loss your damage roll that if you do a roll > as 50% of power (Init Damage = 60 : Roll < 50% Power Damage = 120, Roll >50% Power Damage = 20 !!!!!, Roll MISS Damage = 30 !!!!)
Code: Select all
//ExA Note : Part of Krak (damge calculation part) (NB : Power = 70)
damage = 60;
APDamage = 0;
WeaponPowerRoll = Rand(1, 100);
WeaponApRoll = Rand(1, 100);
BallisticProtectionRoll = Rand(1, 100);
HeavyArmourRoll = Rand(1, 100);
if (WeaponPowerRoll < (35))
{
// ExA Note : Damage = 120
damage += damage;
}
else if (WeaponPowerRoll < 70)
{
// ExA Note : Here i think miss the "//"
// ExA Note : Damage = 20 < of the miss roll below = 30
damage = 20;
}
else
{
// ExA Note : Damage = 30
damage = damage/2;
}
NB : Corrected with the steam update for Legacy of Weirdboy DLC
A Last thnig but i think no pb about that else we take a compilation error :
Code: Select all
FUNCTION GetAttribFromWeapon(me, weapon, char attrib[32])
{
StartWorkString(11) ;
if (weapon == 1)
{
PrintWorkStringLiteral("1ST", 11)
}
if (weapon == 2)
{
PrintWorkStringLiteral("2ND", 11)
}
if (weapon == 3)
{
PrintWorkStringLiteral("3RD", 11)
}
StartWorkString(12);
PrintWorkStringLiteral(GetWorkString(11), 12);
PrintWorkStringLiteral(attrib, 12);
// ExA Note : miss a ")" a the end
return GetAttrib(me, GetWorkString(12) ;
}
and some error in debug mode about unit that don t exist "painboy" and "Big_Redd" that it call in one function (AITool) for the first and many for the second.
---------------------------------------------------------------------------
Thx if you would had the courage to read untill here
hope no mistake for me
and hope i ve could help you
Bye
Regards ExA