companion wrote: ↑Sun Dec 11, 2022 9:51 pm
I've added following ("//modded" part)to the CheckBreakOff function in CloseCombatLogic.bsf
It didn't crash the game but also did not seem to change anything during playtest.
Code: Select all
if (flanked == 0) // Can't break off if fighting to front and flank/rear
{
if ((IsFoot(me) == 1) && (all_foot == 1) && (LostCloseCombatBadly(me) == 1) && (foot_shock == 0))
{
try_break_off = 1;
}
//modded
if ((IsFoot(me) == 1) && (GetAttrib (me, "Pike") > 0) && (GetAttrib(me,"MoraleState") < 1) && (IsInCloseCombat (me) == 1))
{
if ((IsMounted (id) == 1) && (GetAttrib (id, "Impact_Mounted") > 0))
{
if (IsCombatInOpen(me,id) == 1)
{
try_break_off = 1;
}
}
if ((IsMounted (id) == 1) && (GetAttrib (id, "Impact_Pistol") > 0))
{
if (IsCombatInOpen(me,id) == 1)
{
try_break_off = 1;
}
}
}
Which part makes it nonfunctional?
My intention was to make a Steady, open terrain P&S unit that is currently in melee with something to automatically fallback when then charged by a battle cavalry
I think the logic of this function requires more complex scripting for your purpose.
The
'id' operator does not work properly beyond the previous script cycle. You should use '
all_foot' and other operators how it is used in the next condition
if (IsMounted(me) == 1) {}
something like this
Code: Select all
if (flanked == 0) // Can't break off if fighting to front and flank/rear
{
//modded
if (IsFoot(me) == 1)
{
if (all_foot == 1)
{
if ((LostCloseCombatBadly(me) == 1) && (foot_shock == 0))
{
try_break_off = 1;
}
}
else
{
if ((GetAttrib (me, "Pike") > 0) && (GetAttrib(me,"MoraleState") == 0) && (IsInCloseCombat (me) == 1))
{
if (((mounted_shock == 1) && (combat_in_open == 1)) || ((impact_pistol == 1) && (combat_in_open == 1)))
{
try_break_off = 1;
}
}
}
}//modded
....
}
And the previous cycle should be added with
Code: Select all
if (IsMounted(id) == 1)
{
all_foot = 0;
if (IsShockTroops(id) == 1)
{
mounted_shock = 1;
}
if (GetAttrib (id, "Impact_Pistol") > 0)
{
impact_pistol = 1;
}
}
...
if (IsCombatInOpen(me, id) == 1)
{
combat_in_open = 1;
}
Of course, you must write
int impact_pistol; int combat_in_open; in the function header and give them zero values.