(mod) Opportunity fire in FoG2 ?

Post Reply
Athos1660
Major-General - Elite Tiger I
Major-General - Elite Tiger I
Posts: 2563
Joined: Wed May 29, 2019 3:23 pm

(mod) Opportunity fire in FoG2 ?

Post by Athos1660 »

Here is an idea for a mod. I’m not good at modding, so I won’t be able to make it. But it might interest a modder who’d read this thread.

In Pike and Shot, « opportunity fire » was implemented : in the enemy turn, a friendly unit can automatically shoot at an enemy who comes into range.

On the Steam forums of P&S, Zarkarion explained it very well, why it hadn’t been implemented in FoG 2 :
"Unfortunately Undo and opportunity fire are not really mutually compatible. This is because you could use the Undo command to draw the opportunity fire of enemy units that are not at a good angle or range by repeatedly moving and unmoving a unit until they fail the test to wait for a better target.
This would mean that all moves that go within shooting range of an enemy unit would have to be disallowed from being Undone, which would pretty much negate the value of the undo command.
This is one of the reasons that FOG2 does not have opportunity fire, to make the Undo command viable.
If Pike and Shot underwent a complete makeover, we would have to decide which was more worthwhile, Undo or opportunity fire. »
Still I am a huge fan of opportunity fire in P&S and, playing SP in FoG2, I can force myself not to undo when fired at, while being sure the AI knows it can trust me :-)

So I was wondering if opportunity fire (for 5 turns) would be easily moddable in FoG2 (even without undo being prevented after opportunity fire).

_______

A side note about Undo vs. opportunity fire :

In Fog2, I mostly use undo during the early approach phase before the armies meet (ie before any potential opportunity fire), especially when 'Move whole command’ gives results I haven’t expected (shame on me) and wouldn't wish because of variations in terrain, such as say :

Image

Image

So I guess I for one wouldn’t be against such a rule as : "all moves that go within shooting range of an enemy unit (…) have to be disallowed from being Undone ».

btw, neither am I against the thrill of ’Be careful, play wise! There’s no undo in this game’ you can experience in P&S.

However, I don’t know the other great reasons that led to opportunity fire not being implemented in FoG2.
Neither do I know whether or not opportunity fire would be historically accurate in FoG2.
It might also unfairly favour armies relying heavily on bowmen.

So it was just my 2 cent :-)

(And opportunity fire is certainly not vital to have fun in game.)
Last edited by Athos1660 on Sat Mar 07, 2020 2:21 pm, edited 2 times in total.
Athos1660
Major-General - Elite Tiger I
Major-General - Elite Tiger I
Posts: 2563
Joined: Wed May 29, 2019 3:23 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by Athos1660 »

(my mistake)
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28052
Joined: Sun Dec 04, 2005 6:25 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by rbodleyscott »

If you added in opportunity fire, you would also need to mod the normal shooting. This is because when units shoot in FOG2 they actually fire two volleys, and these are added together, (and only one animation shown) so that the total amount of shooting is the same as if units shot in both turns (including opportunity fire). Also there is separate tracking of cohesion tests for first and second volleys.

If you added opportunity fire back in without changing the normal shooting, shooty units would be far too effective.

So this would be a difficult mod to do as the mechanism for shooting and consequent cohesion tests are far more convoluted than is apparent on the surface..
Richard Bodley Scott

Image
Athos1660
Major-General - Elite Tiger I
Major-General - Elite Tiger I
Posts: 2563
Joined: Wed May 29, 2019 3:23 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by Athos1660 »

...which means that this awfully difficult mod to do would also be a purely cosmetic one (whose sole limited interest would be to show the animation of opportunity fire), while coming into conflict with Undo...

Thank you very much for this exhaustive answer.
Cronos09
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 304
Joined: Thu Feb 22, 2018 4:28 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by Cronos09 »

Athos1660 wrote: Sat Mar 07, 2020 8:26 pm ... be a purely cosmetic one (whose sole limited interest would be to show the animation of opportunity fire), while coming into conflict with Undo...
To make this change:
1) copy any module for testing to ...\Documents\My Games\FieldOfGlory2\CAMPAIGNS\;
2) copy $DEFAULT.BSF and Shooting.BSF from ...\Field of Glory II\Data\Battle\Scripts\ to ...\Documents\My Games\FieldOfGlory2\CAMPAIGNS\(Campaign name)\Data\Battle\Scripts\;
3) copy FUNCTION REACT_Unit_Shoot(me, unit) from P&S Shooting.BSF to the Shooting.BSF that you copied to your testing module.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28052
Joined: Sun Dec 04, 2005 6:25 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by rbodleyscott »

Cronos09 wrote: Fri Mar 27, 2020 8:53 am
Athos1660 wrote: Sat Mar 07, 2020 8:26 pm ... be a purely cosmetic one (whose sole limited interest would be to show the animation of opportunity fire), while coming into conflict with Undo...
To make this change:
1) copy any module for testing to ...\Documents\My Games\FieldOfGlory2\CAMPAIGNS\;
2) copy $DEFAULT.BSF and Shooting.BSF from ...\Field of Glory II\Data\Battle\Scripts\ to ...\Documents\My Games\FieldOfGlory2\CAMPAIGNS\(Campaign name)\Data\Battle\Scripts\;
3) copy FUNCTION REACT_Unit_Shoot(me, unit) from P&S Shooting.BSF to the Shooting.BSF that you copied to your testing module.
You would need to make a lot of other changes to rebalance shooting, otherwise troops with shooting capability would be severely overpowered.
Richard Bodley Scott

Image
Athos1660
Major-General - Elite Tiger I
Major-General - Elite Tiger I
Posts: 2563
Joined: Wed May 29, 2019 3:23 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by Athos1660 »

Cronos09 wrote: Fri Mar 27, 2020 8:53 am
Athos1660 wrote: Sat Mar 07, 2020 8:26 pm ... be a purely cosmetic one (whose sole limited interest would be to show the animation of opportunity fire), while coming into conflict with Undo...
To make this change:
1) copy any module for testing to ...\Documents\My Games\FieldOfGlory2\CAMPAIGNS\;
2) copy $DEFAULT.BSF and Shooting.BSF from ...\Field of Glory II\Data\Battle\Scripts\ to ...\Documents\My Games\FieldOfGlory2\CAMPAIGNS\(Campaign name)\Data\Battle\Scripts\;
3) copy FUNCTION REACT_Unit_Shoot(me, unit) from P&S Shooting.BSF to the Shooting.BSF that you copied to your testing module.
Interesting ! Thank you so much for having thought about it and having made this mod :-)
rbodleyscott wrote: Fri Mar 27, 2020 9:25 am You would need to make a lot of other changes to rebalance shooting, otherwise troops with shooting capability would be severely overpowered.
If I am not mistaken, as is in this mod, opportunity fire works if and only if the unit has not fired during its previous own turn.

So I think (but I may be mistaken) that, with this mod, you have the choice between :
- 'normal' fire using 100% of shooting capability then opportunity fire using 0%
- or 'normal' fire using 0% of shooting capability then opportunity that using 100%

So no overpowered unit but a binary situation.
So, indeed, there would be a need of rebalance, ie a distribution of this 100% between normal fire and opportunity one.

(edit)
I've just re-read your reply above, especially about cohesion tests...
Cronos09 wrote: Fri Mar 27, 2020 8:53 am 3) copy FUNCTION REACT_Unit_Shoot(me, unit) from P&S Shooting.BSF to the Shooting.BSF that you copied to your testing module.
btw for players interested in this mod but not knowing the ins and out of modding, maybe the following sentence would be easier to understand :
3) replace the FUNCTION REACT_Unit_Shoot(me, unit) of the Shooting.BSF that you copied to your testing FoG module with that of P&S Shooting.BSF, as if you keep both FUNCTION REACTs in your FoG file, the game will crash. I did that mistake :-)
Last edited by Athos1660 on Fri Mar 27, 2020 10:47 am, edited 1 time in total.
Cronos09
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 304
Joined: Thu Feb 22, 2018 4:28 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by Cronos09 »

rbodleyscott wrote: Fri Mar 27, 2020 9:25 am You would need to make a lot of other changes to rebalance shooting, otherwise troops with shooting capability would be severely overpowered.
I see it from your post above. This is only a "cosmetic" change. If Athos1660 wish to see some reactive fire in FoG2 he can do and test it.
Athos1660
Major-General - Elite Tiger I
Major-General - Elite Tiger I
Posts: 2563
Joined: Wed May 29, 2019 3:23 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by Athos1660 »

Cronos09 wrote: Fri Mar 27, 2020 10:30 am I see it from your post above. This is only a "cosmetic" change.
It also makes units that did not fired during their turns (because the player forgot it or because of the shooting range) shoot.
Cronos09
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 304
Joined: Thu Feb 22, 2018 4:28 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by Cronos09 »

Athos1660 wrote: Fri Mar 27, 2020 10:19 am btw for players interested in this mod but not knowing the ins and out of modding, maybe the following sentence would be easier to understand :
3) replace the FUNCTION REACT_Unit_Shoot(me, unit) of the Shooting.BSF that you copied to your testing FoG module with that of P&S Shooting.BSF, as if you keep both FUNCTION REACTs in your FoG file, the game will crash. I did that mistake :-)

You are right. Replace instead of copy.
Athos1660 wrote: Fri Mar 27, 2020 10:33 am It also makes units that did not fired during their turns (because the player forgot it or because of the shooting range) shoot.
I have not noticed that during some testing. And an unit can shoot one time during its turn and an opponent's turn as before.
Athos1660
Major-General - Elite Tiger I
Major-General - Elite Tiger I
Posts: 2563
Joined: Wed May 29, 2019 3:23 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by Athos1660 »

Cronos09 wrote: Fri Mar 27, 2020 10:44 am
Athos1660 wrote: Fri Mar 27, 2020 10:33 am It also makes units that did not fired during their turns (because the player forgot it or because of the shooting range) shoot.
I have not noticed that during some testing. And an unit can shoot one time during its turn and an opponent's turn as before.

This is just a consequence of the fact that in this mod, opportunity fire SEEMS TO work if and only if the unit has not fired during its previous own turn.

My set up :

Image

Test 1 : during my turn, I make them all but the slingers (who are out of range) shoot. During the enemy turn, only the slingers shoot (as the enemy came closer).

Test 2 : during my turn, I don't make any of them shoot. During the enemy turn, they all shoot.

I did those tests three times each.
_______________

btw, I must admit I really get confused about when a unit is meant to opportunely shoot in P&S (as I haven't played the game for some time) and the way it is handled by FoG2.
Cronos09
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 304
Joined: Thu Feb 22, 2018 4:28 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by Cronos09 »

In P&S there is Residual Shooting Phase. FoG2 has such phase only for AI turn.
This is scripted in StartTurnPreTools.BSF (P&S)

Code: Select all

	if (GetTurn() > 0)
		{
			if (GetTurn() == 1)
				{
					first_time = 1;
				}

			AddVizFunctionCall("StartString",1);
			PrintStringX(1, 0, "IDS_PHASE_HOUSEKEEPING_SHOOTING0");
			AddVizFunctionCall("ShowUIStringPopupTimed", "Residual_Shooting_Icon.dds", 1);
			AddVizDelay(2);

			if ((UseTutorialMode() == 1) && (first_time == 1))
				{
					PrintStringLiteralX(1, 0, ":\n");
					PrintStringX(1, 0, "IDS_PHASE_HOUSEKEEPING_SHOOTING1");
					AddVizFunctionCall("ShowUIStringPopup",1);
				}
			AddVizDelay(2);

			// Do any shooting that was not done last turn
			CompleteLastTurnShooting(side);
The residual type of fire is definited in function CompleteLastTurnShooting(side) (FOG2 also has it). You can find it below in the file. In P&S it consists of two blocks, in FoG2 - of one that only works during AI turn.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28052
Joined: Sun Dec 04, 2005 6:25 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by rbodleyscott »

Cronos09 wrote: Fri Mar 27, 2020 12:35 pm In P&S there is Residual Shooting Phase. FoG2 has such phase only for AI turn.
This is scripted in StartTurnPreTools.BSF (P&S)

Code: Select all

	if (GetTurn() > 0)
		{
			if (GetTurn() == 1)
				{
					first_time = 1;
				}

			AddVizFunctionCall("StartString",1);
			PrintStringX(1, 0, "IDS_PHASE_HOUSEKEEPING_SHOOTING0");
			AddVizFunctionCall("ShowUIStringPopupTimed", "Residual_Shooting_Icon.dds", 1);
			AddVizDelay(2);

			if ((UseTutorialMode() == 1) && (first_time == 1))
				{
					PrintStringLiteralX(1, 0, ":\n");
					PrintStringX(1, 0, "IDS_PHASE_HOUSEKEEPING_SHOOTING1");
					AddVizFunctionCall("ShowUIStringPopup",1);
				}
			AddVizDelay(2);

			// Do any shooting that was not done last turn
			CompleteLastTurnShooting(side);
The residual type of fire is definited in function CompleteLastTurnShooting(side) (FOG2 also has it). You can find it below in the file. In P&S it consists of two blocks, in FoG2 - of one that only works during AI turn.
It was the easiest way to ensure that the AI did not forget to shoot with any of its units. The player has to remember for himself, and obviously has the option to hold his fire to save ammunition.
Richard Bodley Scott

Image
Athos1660
Major-General - Elite Tiger I
Major-General - Elite Tiger I
Posts: 2563
Joined: Wed May 29, 2019 3:23 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by Athos1660 »

Thank you, Gentlemen !
Athos1660
Major-General - Elite Tiger I
Major-General - Elite Tiger I
Posts: 2563
Joined: Wed May 29, 2019 3:23 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by Athos1660 »

What I do like in P&S opportunity fire is :
  • interruption of moves
  • and casualties during one's turn because of one's unit coming into range of enemy shooting, before being able to shoot or charge.
IMHO it adds a feeling of life and unpredictability.
CharlesdeBatz
Corporal - Strongpoint
Corporal - Strongpoint
Posts: 53
Joined: Sun Jul 11, 2021 5:41 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by CharlesdeBatz »

I've tested this out by copying the P&S React_Unit_Shoot function over to the Shooting.bsf file in FoG. What I've noticed is that units did not consistently fire when an enemy unit moved into range; or, at least, the behavior I would expect from P&S experience is no longer the case.

That is, the enemy units return fire when fired upon (at least when my unit is directly in front of them, and not off to the side), but do not fire when the unit moves into range.
Cronos09
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 304
Joined: Thu Feb 22, 2018 4:28 pm

Re: (mod) Opportunity fire in FoG2 ?

Post by Cronos09 »

CharlesdeBatz wrote: Thu Dec 02, 2021 9:24 am I've tested this out by copying the P&S React_Unit_Shoot function over to the Shooting.bsf file in FoG. What I've noticed is that units did not consistently fire when an enemy unit moved into range; or, at least, the behavior I would expect from P&S experience is no longer the case.

That is, the enemy units return fire when fired upon (at least when my unit is directly in front of them, and not off to the side), but do not fire when the unit moves into range.
These had only been my first changes (which were followed by many others) to get P&S reactive fire in FoG2. I have carefully worked this point in this mod: https://www.slitherine.com/forum/viewto ... 60#p937704.
I made a quick adaptation it for the original to have P&S reactive fire and residual shooting phase as a global mod: https://disk.yandex.by/d/Se2lHQwXMv-0uA
Unzip and install it as a global mod for FoG2.
Post Reply

Return to “Field of Glory II: Modding”