Is is possible to give a unit infinite cohesion?
-
- Private First Class - Wehrmacht Inf
- Posts: 8
- Joined: Thu Mar 25, 2021 10:21 am
Is is possible to give a unit infinite cohesion?
By infinite morale I mean, is it possible to make a unit fight until the bitter end in a scenario, until it disperses or autobreaks? I'm also wondering how strong is it possible to make an individual unit by modding the squad file.
-
- Field of Glory 2
- Posts: 28085
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Is is possible to give a unit infinite cohesion?
The short answer is yes.
Either
a) by modded game scripts as in Jomni's zombie mod
or, easier,
b) by using a
CustomCohesionTestModifier(me, enemy, reason, combatLog)
function in your scenario script to give the unroutable unit a massive positive CT modifier.
This function is automatically looked for in the scenario script by the Cohesion Test code, and will be called if it exists.
I cannot show you an example, because it was not used in any of the FOG2 or FOG2M scenarios.
However, if you tell me exactly what you are trying to achieve, with what units, I would be happy to write one for you.
(Note that it wouldn't stop them from autobreaking, nor from autodropping when flanked)
Either
a) by modded game scripts as in Jomni's zombie mod
or, easier,
b) by using a
CustomCohesionTestModifier(me, enemy, reason, combatLog)
function in your scenario script to give the unroutable unit a massive positive CT modifier.
This function is automatically looked for in the scenario script by the Cohesion Test code, and will be called if it exists.
I cannot show you an example, because it was not used in any of the FOG2 or FOG2M scenarios.
However, if you tell me exactly what you are trying to achieve, with what units, I would be happy to write one for you.
(Note that it wouldn't stop them from autobreaking, nor from autodropping when flanked)
Richard Bodley Scott
-
- Private First Class - Wehrmacht Inf
- Posts: 8
- Joined: Thu Mar 25, 2021 10:21 am
Re: Is is possible to give a unit infinite cohesion?
Thank you,
I am using FoG II Medieval to simulate battles for a fictional setting I am working on, and while I mostly need regular units, for one scenario I need to have a unit of cavalry (specifically Armoured Lancers) suffer no cohesion losses and be fully armored + be heavy lancers. Is this possible to achieve with a scenario script or would I need to mod the squad file to achieve this?
I am using FoG II Medieval to simulate battles for a fictional setting I am working on, and while I mostly need regular units, for one scenario I need to have a unit of cavalry (specifically Armoured Lancers) suffer no cohesion losses and be fully armored + be heavy lancers. Is this possible to achieve with a scenario script or would I need to mod the squad file to achieve this?
-
- Field of Glory 2
- Posts: 28085
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Is is possible to give a unit infinite cohesion?
Will there be other units classified the same but without immunity to fear?Markush100 wrote: ↑Mon Jan 09, 2023 4:35 pm Thank you,
I am using FoG II Medieval to simulate battles for a fictional setting I am working on, and while I mostly need regular units, for one scenario I need to have a unit of cavalry (specifically Armoured Lancers) suffer no cohesion losses and be fully armored + be heavy lancers. Is this possible to achieve with a scenario script or would I need to mod the squad file to achieve this?
Richard Bodley Scott
-
- Private First Class - Wehrmacht Inf
- Posts: 8
- Joined: Thu Mar 25, 2021 10:21 am
Re: Is is possible to give a unit infinite cohesion?
No, there will be one unit of Armoured Lancers in the battle.rbodleyscott wrote: ↑Mon Jan 09, 2023 4:39 pmWill there be other units classified the same but without immunity to fear?Markush100 wrote: ↑Mon Jan 09, 2023 4:35 pm Thank you,
I am using FoG II Medieval to simulate battles for a fictional setting I am working on, and while I mostly need regular units, for one scenario I need to have a unit of cavalry (specifically Armoured Lancers) suffer no cohesion losses and be fully armored + be heavy lancers. Is this possible to achieve with a scenario script or would I need to mod the squad file to achieve this?
-
- Field of Glory 2
- Posts: 28085
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Is is possible to give a unit infinite cohesion?
Then it should not be too much of problem to script in the scenario script. The extra armour could be scripted too.Markush100 wrote: ↑Mon Jan 09, 2023 4:52 pmNo, there will be one unit of Armoured Lancers in the battle.rbodleyscott wrote: ↑Mon Jan 09, 2023 4:39 pmWill there be other units classified the same but without immunity to fear?Markush100 wrote: ↑Mon Jan 09, 2023 4:35 pm Thank you,
I am using FoG II Medieval to simulate battles for a fictional setting I am working on, and while I mostly need regular units, for one scenario I need to have a unit of cavalry (specifically Armoured Lancers) suffer no cohesion losses and be fully armored + be heavy lancers. Is this possible to achieve with a scenario script or would I need to mod the squad file to achieve this?
I assume that it is Arthur and the knights of the round table?
Richard Bodley Scott
-
- Private First Class - Wehrmacht Inf
- Posts: 8
- Joined: Thu Mar 25, 2021 10:21 am
Re: Is is possible to give a unit infinite cohesion?
Which commands can I use for the script? And no, I am using it for a fantasy world I am working on.rbodleyscott wrote: ↑Mon Jan 09, 2023 5:27 pmThen it should not be too much of problem to script in the scenario script. The extra armour could be scripted too.Markush100 wrote: ↑Mon Jan 09, 2023 4:52 pmNo, there will be one unit of Armoured Lancers in the battle.rbodleyscott wrote: ↑Mon Jan 09, 2023 4:39 pm
Will there be other units classified the same but without immunity to fear?
I assume that it is Arthur and the knights of the round table?
-
- Field of Glory 2
- Posts: 28085
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Is is possible to give a unit infinite cohesion?
It will be simpler to write the function for you.Markush100 wrote: ↑Tue Jan 10, 2023 11:09 pmWhich commands can I use for the script? And no, I am using it for a fantasy world I am working on.rbodleyscott wrote: ↑Mon Jan 09, 2023 5:27 pmThen it should not be too much of problem to script in the scenario script. The extra armour could be scripted too.Markush100 wrote: ↑Mon Jan 09, 2023 4:52 pm
No, there will be one unit of Armoured Lancers in the battle.
I assume that it is Arthur and the knights of the round table?
What name will the special unit have in column A in the squads file? I need to know that for the script to be able to identify it.
Richard Bodley Scott
-
- Field of Glory 2
- Posts: 28085
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Is is possible to give a unit infinite cohesion?
I assume that if you are doing a fantasy world, you will need a modded squads file anyway.
The method of making them unroutable that I suggested above will only work in Editor-created scenarios with a scenario script. If you also want it to work in Custom Battles and/or Campaigns, then it will be necessary to use a modded MoraleTools.BSF game script in your campaign folder.
In that case, you could make the modding less "hacky" by adding an "Unroutable" column to the squads file, and then the modded moraletools.bsf script could simply not allow a morale drop in the cohesion test for units with 1 in that column.
It would also be possible to prevent them from autodropping when flanked, although that would require another modded script.
They would still autobreak from losses, if that is what you want. Otherwise that could be modded too.
The method of making them unroutable that I suggested above will only work in Editor-created scenarios with a scenario script. If you also want it to work in Custom Battles and/or Campaigns, then it will be necessary to use a modded MoraleTools.BSF game script in your campaign folder.
In that case, you could make the modding less "hacky" by adding an "Unroutable" column to the squads file, and then the modded moraletools.bsf script could simply not allow a morale drop in the cohesion test for units with 1 in that column.
It would also be possible to prevent them from autodropping when flanked, although that would require another modded script.
They would still autobreak from losses, if that is what you want. Otherwise that could be modded too.
Richard Bodley Scott
-
- Private First Class - Wehrmacht Inf
- Posts: 8
- Joined: Thu Mar 25, 2021 10:21 am
Re: Is is possible to give a unit infinite cohesion?
The unit I want to modify is ARM_LITH_CAV.rbodleyscott wrote: ↑Tue Jan 10, 2023 11:25 pmIt will be simpler to write the function for you.Markush100 wrote: ↑Tue Jan 10, 2023 11:09 pmWhich commands can I use for the script? And no, I am using it for a fantasy world I am working on.rbodleyscott wrote: ↑Mon Jan 09, 2023 5:27 pm
Then it should not be too much of problem to script in the scenario script. The extra armour could be scripted too.
I assume that it is Arthur and the knights of the round table?
What name will the special unit have in column A in the squads file? I need to know that for the script to be able to identify it.
-
- Field of Glory 2
- Posts: 28085
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Is is possible to give a unit infinite cohesion?
And do you only need to modify it for an Editor-created scenario, or also for Custom battles and/or campaigns?
Richard Bodley Scott
-
- Private First Class - Wehrmacht Inf
- Posts: 8
- Joined: Thu Mar 25, 2021 10:21 am
Re: Is is possible to give a unit infinite cohesion?
Only for an editor scenario.rbodleyscott wrote: ↑Thu Jan 12, 2023 7:56 am And do you only need to modify it for an Editor-created scenario, or also for Custom battles and/or campaigns?
-
- Field of Glory 2
- Posts: 28085
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Is is possible to give a unit infinite cohesion?
In which case, here is a scenario script you can use. You just need to put it in the same folder as your .BAM file (in the SCENARIO folder in your custom folder, in /Documents/My Games/FieldOfGloryMedieval/CAMPAIGNS) and change the filename to match that of the .BAM folder.
The code added to CustomiseUnits() changes ARM_LITH_CAV to Fully Armoured, makes them heavy lancers and removes their light spear and bow. To be honest it would have been much easier to do all this with a modded Squads file.
The CustomCohesionTestModifier() function gives them an extra +10 modifier on their cohesion tests, which should mean they never fail one.
I have not tested this script at all, so if it does not work as described, please let me know.
The code added to CustomiseUnits() changes ARM_LITH_CAV to Fully Armoured, makes them heavy lancers and removes their light spear and bow. To be honest it would have been much easier to do all this with a modded Squads file.
The CustomCohesionTestModifier() function gives them an extra +10 modifier on their cohesion tests, which should mean they never fail one.
I have not tested this script at all, so if it does not work as described, please let me know.
Richard Bodley Scott
-
- Private First Class - Wehrmacht Inf
- Posts: 8
- Joined: Thu Mar 25, 2021 10:21 am
Re: Is is possible to give a unit infinite cohesion?
Thank you very much, I will try the script out.rbodleyscott wrote: ↑Thu Jan 12, 2023 5:22 pm In which case, here is a scenario script you can use. You just need to put it in the same folder as your .BAM file (in the SCENARIO folder in your custom folder, in /Documents/My Games/FieldOfGloryMedieval/CAMPAIGNS) and change the filename to match that of the .BAM folder.
YourScenarioScript.zip
The code added to CustomiseUnits() changes ARM_LITH_CAV to Fully Armoured, makes them heavy lancers and removes their light spear and bow. To be honest it would have been much easier to do all this with a modded Squads file.
The CustomCohesionTestModifier() function gives them an extra +10 modifier on their cohesion tests, which should mean they never fail one.
I have not tested this script at all, so if it does not work as described, please let me know.