the latterAthos1660 wrote: ↑Sat May 09, 2020 7:16 pmSorry I was not clear.Schweetness101 wrote: ↑Sat May 09, 2020 5:45 pmreason 3 is 'other reason', which includes another 0-9 'fullReasons', where 8 is charged while fragmented. I added a 10th reason that is cohesion check from non light cav vs non light cavAthos1660 wrote: ↑Sat May 09, 2020 5:46 am
To make cohesion loss because of charge rarer, I added this bit of script in MoraleTools.bsf after line 508, ie after the Close combat test :
Is it correct ?Code: Select all
// Charge of Non-light cav test if ((IsMounted(me)) && (IsMounted(enemy)) && (IsLightTroops(me) == 0) && (isLightTroops(enemy) == 0) && (reason == 3 )) { modifiers += 1; PrintStringLiteralX(UIString, 0, "\n"); PrintStringLiteralX(UIString, 0, "Charge of Non-light cav: +1"); Log("Charge of Non-light cav", me); } //end
If so, my question is : has reason 3 already been used in the scripts for another situation in game, so that my code will unintentionally give this modifier to this situation, or is it written in a way that prevents it to happen (with : if ((IsMounted(me)) && (IsMounted(enemy)) && (IsLightTroops(me) == 0) && (isLightTroops(enemy) == 0)) ?
I added to the explanation comment like this:
// fullReason: 0 = Shooting, 1 = Impact Close Combat, 2 = Melee Close combat, 4 = Bolster/Rally, 5 = automatic morale drop, 6 = Seeing rout, 7 = Seeing general fall, 8 = Charged while Fragmented, 9 = Fall back
//10 = auto CT from non light cav charging non light cav
at the top of moraletools.bsf
if reason is 3 in MoraleUpdate(), then it calls CohesionTest() which has a bunch of checks for the full reasons at the bottom, where I added an extra one like
//added for cav mod
if (fullReason == 10)
{
PrintStringLiteralX(UIString, 0, " ");
PrintStringLiteralX(UIString, 0, "Non-Light Cavalry Charged Non-Light Cavalry, auto CT");
//I have no idea where the above actually prints out though
}
//added for cav mod
not sure if it is fully working but if it is you call it like this from Assault.bsf:
morale_state = MoraleUpdate(unit, me, 3, -1, 0, 0, GetCurrentSide(), 10);
morale_state = MoraleUpdate(me, unit, 3, -1, 0, 0, GetCurrentSide(), 10);
notice the bold 10, not 8, because that last parameter is for the fullReason
not sure if every other parameter is correct or if you want this cohesion check to happen on routing or pursuing units
it also seems like it might not be happening on units that are already in combat.
If I added this...... It was not meant to provide a title to the automatic charge cohesion tests before the impact. It was meant to add a modifier +1 to those very charge cohesion tests which it actually does :Code: Select all
// Charge of Non-light cav test if ((IsMounted(me)) && (IsMounted(enemy)) && (IsLightTroops(me) == 0) && (isLightTroops(enemy) == 0) && (reason == 3 )) { modifiers += 1; PrintStringLiteralX(UIString, 0, "\n"); PrintStringLiteralX(UIString, 0, "Charge of Non-light cav: +1"); Log("Charge of Non-light cav", me); } //end
My question was actually :
If I write...
... will this +1 modifier apply :Code: Select all
if ((IsMounted(me)) && (IsMounted(enemy)) && (IsLightTroops(me) == 0) && (isLightTroops(enemy) == 0) && (reason == 3 ))
- when and only when a Non-Light Cavalry charges a Non-Light Cavalry ?
- or to any "other reason" including the 0-9 'fullReasons' (fall back, rally, charged when fragmented...) whenever 1 or 2 (?) non-light cav are involved ?
I fear the latter. If so, is there a way to solve the issue ?
without looking at it i can't be sure, but if I had to guess you could resolve it i think by changing reason == 3 to fullReason == 10




