Is is possible to give a unit infinite cohesion?

Post Reply
Markush100
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 8
Joined: Thu Mar 25, 2021 10:21 am

Is is possible to give a unit infinite cohesion?

Post by Markush100 »

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.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28085
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is is possible to give a unit infinite cohesion?

Post by rbodleyscott »

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)
Richard Bodley Scott

Image
Markush100
Private First Class - Wehrmacht Inf
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?

Post by Markush100 »

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?
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28085
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is is possible to give a unit infinite cohesion?

Post by rbodleyscott »

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?
Will there be other units classified the same but without immunity to fear?
Richard Bodley Scott

Image
Markush100
Private First Class - Wehrmacht Inf
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?

Post by Markush100 »

rbodleyscott wrote: Mon Jan 09, 2023 4:39 pm
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?
Will there be other units classified the same but without immunity to fear?
No, there will be one unit of Armoured Lancers in the battle.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28085
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is is possible to give a unit infinite cohesion?

Post by rbodleyscott »

Markush100 wrote: Mon Jan 09, 2023 4:52 pm
rbodleyscott wrote: Mon Jan 09, 2023 4:39 pm
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?
Will there be other units classified the same but without immunity to fear?
No, there will be one unit of Armoured Lancers in the battle.
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?
Richard Bodley Scott

Image
Markush100
Private First Class - Wehrmacht Inf
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?

Post by Markush100 »

rbodleyscott wrote: Mon Jan 09, 2023 5:27 pm
Markush100 wrote: Mon Jan 09, 2023 4:52 pm
rbodleyscott wrote: Mon Jan 09, 2023 4:39 pm

Will there be other units classified the same but without immunity to fear?
No, there will be one unit of Armoured Lancers in the battle.
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?
Which commands can I use for the script? And no, I am using it for a fantasy world I am working on.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28085
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is is possible to give a unit infinite cohesion?

Post by rbodleyscott »

Markush100 wrote: Tue Jan 10, 2023 11:09 pm
rbodleyscott wrote: Mon Jan 09, 2023 5:27 pm
Markush100 wrote: Mon Jan 09, 2023 4:52 pm

No, there will be one unit of Armoured Lancers in the battle.
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?
Which commands can I use for the script? And no, I am using it for a fantasy world I am working on.
It will be simpler to write the function for you.

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

Image
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28085
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is is possible to give a unit infinite cohesion?

Post by rbodleyscott »

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.
Richard Bodley Scott

Image
Markush100
Private First Class - Wehrmacht Inf
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?

Post by Markush100 »

rbodleyscott wrote: Tue Jan 10, 2023 11:25 pm
Markush100 wrote: Tue Jan 10, 2023 11:09 pm
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?
Which commands can I use for the script? And no, I am using it for a fantasy world I am working on.
It will be simpler to write the function for you.

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.
The unit I want to modify is ARM_LITH_CAV.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28085
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is is possible to give a unit infinite cohesion?

Post by rbodleyscott »

And do you only need to modify it for an Editor-created scenario, or also for Custom battles and/or campaigns?
Richard Bodley Scott

Image
Markush100
Private First Class - Wehrmacht Inf
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?

Post by Markush100 »

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?
Only for an editor scenario.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28085
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is is possible to give a unit infinite cohesion?

Post by rbodleyscott »

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
(3.42 KiB) Downloaded 24 times

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

Image
Markush100
Private First Class - Wehrmacht Inf
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?

Post by Markush100 »

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.
Thank you very much, I will try the script out.
Post Reply

Return to “Field of Glory II: Scenario Design”