Flank Angle Mod

Field of Glory II is a turn-based tactical game set during the Rise of Rome from 280 BC to 25 BC.
Schweetness101
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 928
Joined: Tue Nov 29, 2016 6:12 am

Flank Angle Mod

Post by Schweetness101 »

as per a discussion with stockwellpete, and kind of coming out of the medium foot discussion, I have made a mod that alters infantry flanks:

https://www.dropbox.com/sh/wz91htektdhe ... 9Oloa?dl=0

basically it downgrades 90 degree infantry flanks to just having the +50 on an occupied unit and being a normal attack on a non occupied unit. 'Rear' attacks have full +200 poa and auto drop affect on occupied units and +50 on unoccupied, as normal, and also the angle for what counts as rear is wider now so that non rear flanks are basically just the exactly 90 degree (starting and finishing position, not just finishing position) attacks.

Sorry, that explanation is a bit hard to follow, here's a picture:

Image

the yellow highlighted units get the auto drop attack on an occupied unit
the blue circled units do not get an auto drop but do get a +50 for flank attack on an occupied unit (Message: "Infantry flank but not rear attack no auto drop")
the non highlighted non circled units in the front get a normal attack

I'm not sure how this is affecting light infantry and infantry vs elephant flanks but I think it is, I just haven't had time to test that yet but maybe someone else can or I'll do it later.

I thought I'd just post the mod here in case anyone else wanted to try this out.

I guess this would basically make infantry flanking less viable because it takes an extra turn or two to get into full flanking position, thereby harming the effectiveness of infantry but especially of medium infantry I think perhaps, and maybe providing a greater relative importance to cavalry (and elephants and chariots etc...) by being the only units left that can get full flank effect from a 90 degree flank. That may or may not be good, I have not thought about all of the implications yet.

if you just want to get rid of 90 degree flanks for infantry altogether then:

CombatTools.bsf > line 1696 and changing ret = 1; to ret = 0;

EDIT:
v1.1 that removes the +50 for 90 degree flanks from infantry on occupied, so there is now only normal attacks at or less than 90 degrees, and rear attacks behind with auto drop, for infantry (just does the above change):
https://www.dropbox.com/sh/4zg6jzb7vbso ... xxFTa?dl=0

v1.2 that removes flanks from cavalry as well (vs infantry or cavalry):
https://www.dropbox.com/sh/bfh0r2xwlhfy ... ZAXCa?dl=0

v1.2b is like 1.2 but retains cav flanks vs other cav
https://www.dropbox.com/sh/kfheaeews0mh ... 7V2Ga?dl=0

**also note that this mod is not making a medium foot/heavy foot distinction for flanks, that is another mod, but perhaps those could be combined later

EDIT:
Here's a mod that combines the cav mod and the flank angle mod:

https://www.dropbox.com/sh/iloqrhs8j2ak ... q6U_a?dl=0

the cav mod section is the 33% higher casualties and -1 CT modifier to non light cav vs non light cav, and the ZoC/AP changes (not the vs medium foot changes)

the flank angle section does ('vs' meaning 'flanks'):
cav vs cav; inf vs cav; ele vs ele; ele vs cav: same as vanilla
cav vs inf or inf vs inf or ele vs inf: 90 degree flank attacks are +50 vs unoccupied and +100 with no autodrop vs occupied, the rear attacks are same as vanilla (+50 and +200 and autodrop respectively)

Update: here's a cav mod and flank angle mod combined v1.1:
https://www.dropbox.com/sh/8dg48wpb8q4c ... hvCVa?dl=0
it adds:
1) set the number of turns being pursued while routing before you disperse to 2, from 4 (plus the initial routing turn, so really to 3 from 5)
2) altered continue pursuit chances for cavalry (not to initial pursuit, but for follow up pursuit turns after first turn of pursuit)
stop chances for cavalry now base 60 (up from base 50) *where stop chance is percent chance to stop this turn
raised to 70 against other mounted if both same type of mounted
if pursuer is light and fleer is non light then stop chance is only 50
if pursuer is non-light and fleer is light then stop chance is all the way up at 90

those are tentative values like everything else, but from testing a bit they seem to do a nice job of letting cavalry return to the fight to get something done in terms of flanking or coming back to finish the cav fight on the wings. They can still run off a bit, they are just not nearly as likely anymore to spend almost the whole game pursuing

I am also interested in decreasing or even eliminating chance to rally from broken, if anyone is interested in that.
Last edited by Schweetness101 on Wed May 13, 2020 3:39 pm, edited 6 times in total.
My Mods:
Ancient Greek https://www.slitherine.com/forum/viewtopic.php?p=977908#p977908
Dark Ages Britain https://www.slitherine.com/forum/viewtopic.php?t=106417
Anarchy (Medieval) https://www.slitherine.com/forum/viewtopic.php?p=987488#p987488
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Flank Angle Mod

Post by stockwellpete »

The rationale for this is that "flank" and "rear" attacks are not really separate things given that most armies of the ancient and medieval period fought in extended lines. So any attack from a flank on a unit already occupied to its front would inevitably wrap around its rear. There are a few of us who have been wanting to try this out since the early days of FOG2 so thanks to Schweetness101 for giving us the chance to look at it.
pompeytheflatulent
Sergeant First Class - Elite Panzer IIIL
Sergeant First Class - Elite Panzer IIIL
Posts: 432
Joined: Thu Nov 07, 2019 3:37 pm

Re: Flank Angle Mod

Post by pompeytheflatulent »

How would infantry charging lancers at 90 degrees work? Do they still get their impact cancelled or is it just a flat +50 POA?
76mm
Lieutenant Colonel - Panther D
Lieutenant Colonel - Panther D
Posts: 1289
Joined: Tue Feb 09, 2010 12:08 pm

Re: Flank Angle Mod

Post by 76mm »

stockwellpete wrote: Thu May 07, 2020 10:20 pm So any attack from a flank on a unit already occupied to its front would inevitably wrap around its rear.
Don't understand this explanation, which would seem to better explain the current mechanics?

I'm not really seeing the logic for neutering flank attacks, even on unoccupied units...units weren't marching around in square, so were facing in one direction or another, and if you hit them from another direction it seems like it should sting?
Schweetness101
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 928
Joined: Tue Nov 29, 2016 6:12 am

Re: Flank Angle Mod

Post by Schweetness101 »

pompeytheflatulent wrote: Thu May 07, 2020 11:17 pm How would infantry charging lancers at 90 degrees work? Do they still get their impact cancelled or is it just a flat +50 POA?
I don't think they have their +50 cancelled in vanilla when charging the flank or rear of an occupied or unoccupied lancer

it's the same in the mod.
My Mods:
Ancient Greek https://www.slitherine.com/forum/viewtopic.php?p=977908#p977908
Dark Ages Britain https://www.slitherine.com/forum/viewtopic.php?t=106417
Anarchy (Medieval) https://www.slitherine.com/forum/viewtopic.php?p=987488#p987488
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Flank Angle Mod

Post by stockwellpete »

76mm wrote: Fri May 08, 2020 2:43 am
stockwellpete wrote: Thu May 07, 2020 10:20 pm So any attack from a flank on a unit already occupied to its front would inevitably wrap around its rear.
Don't understand this explanation, which would seem to better explain the current mechanics?

I'm not really seeing the logic for neutering flank attacks, even on unoccupied units...units weren't marching around in square, so were facing in one direction or another, and if you hit them from another direction it seems like it should sting?
The main logic is that flank and rear attacks are not really separate things where most units are deployed in extended lines. Also, at the moment you also get so-called flank attacks happening right in the middle of big melees in most games, maybe because a unit has been turned to 45 degrees by one attacker and then hit in the so-called flank by another. In reality there would be no exposed flank there that warranted an automatic cohesion drop (basically because the centre of melees would be jammed full of bodies). Instead players will need to focus on getting 2v1's or 3v1's in the melee itself to wear down the enemy. Given that this should lock units into melees for longer it then puts a premium on making progress with cavalry out on one of the flanks so that they can attack the enemy from the rear.

There will be all sorts of issues with it - not least whether there should still be a +50POA for a unit being hit in the side (I think there probably shouldn't be), or whether the bonus for getting a 2v1 or 3v1 should be a bit higher - because this will change the melee dynamics considerably. I cannot find the discussion from not too long ago where I think some players were saying that cavalry melees take too long so flank attacks should be retained for them, so as to relatively speed up those melees in relation to infantry melees, so that there was more time for developments on the flank to materialise (I think this is a very good point).

I think one of the issues more generally is that our armies are made up of "units" for the purposes of playing the game. How else could you represent armies? But actually, in "real life", soldiers tended to fight as contingents or "battles" (in the medieval period), not as separate units. So this is a way of mitigating that particular anomaly, if that is the right word. Once an army's "units" are engaged in melee, they actually behave more like "contingents" with this idea.

As I say, there are a few of us who were around at the start of FOG2 who want to potter around with this idea and see what we can make of it. It may come to nothing, of course. :wink:
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28411
Joined: Sun Dec 04, 2005 6:25 pm

Re: Flank Angle Mod

Post by rbodleyscott »

This isn't ever going to happen in the vanilla game. Some new players have a hard enough time coping with the idea that an attack at 45 degrees, or that does not start behind the flank, does not count as a flank attack - and make rude remarks about it in their STEAM reviews. They also don't like that flank attacks on unengaged units aren't devastating.

They would throw a fit at this rule.

So even if we wanted to do it (which we don't) we would not do it - for public relations reasons.
Richard Bodley Scott

Image
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Flank Angle Mod

Post by stockwellpete »

rbodleyscott wrote: Fri May 08, 2020 6:24 am They would throw a fit at this rule.
Next year, April Fool's Day, announce it as a rule change and watch the reaction! :lol:
Athos1660
Major-General - Jagdtiger
Major-General - Jagdtiger
Posts: 2761
Joined: Wed May 29, 2019 3:23 pm

Re: Flank Angle Mod

Post by Athos1660 »

Comparing Pike&Shot with FoG2, flank/rear attacks have already been tremendously downgraded. In P&S, flank/rear attack by non-light troop on an unoccupied non-light unit lead to a cohesion drop (overall POA : +200). And lights charging non-lights = PoA +50. I may be wrong, but I guess this change was a decision of game design, not a matter of timeframe.

A good one, I guess, as I had liked the dramatic effects of P&S flank/rear attacks before getting used to the more reassuring/softer/more hushed FoG2 ones and finally preferring the latter ones.

Ppl often like dramatic effects in games anyway.
And I am not sure that over-downgrading each 'effect' in the game (the effect of terrains, the effects of MF on HF, the effects of LF, the effects of Infantry on non-light cavalry, the effect of rear/flank charges etc.) would be a great move for the Vanilla game. But it is a matter of taste and it would certainly make a great mod.

Just my 2 cent :-)
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28411
Joined: Sun Dec 04, 2005 6:25 pm

Re: Flank Angle Mod

Post by rbodleyscott »

Athos1660 wrote: Fri May 08, 2020 7:58 amAnd I am not sure that over-downgrading each 'effect' in the game (the effect of terrains, the effects of MF on HF, the effects of LF, the effects of Infantry on non-light cavalry, the effect of rear/flank charges etc.) would be a great move for the Vanilla game.
I am glad someone has had the courage to come out and say this. It just about sums up my own views.

Essentially it all boils down to homogenization, which is a route that sadly many games have gone down in the quest for "balance". It is much easier to achieve "balance" by reducing the differences between things, rather than by maintaining the differences and making other adjustments to balance the game.

Always assuming that true balance is even a desirable goal other than for tournaments without mirror matches.

Much as we all appreciate Pete's hard work in organizing and running the FOG2 Digital League, it would be a bit "tail wagging the dog" for game development to be driven by the priorities of a decade-old tournament format left over from a different game (FOG1), that does not take advantage of FOG2 game features such as mirror matches, which automatically create tournament balance.

The Ancient period is the single most varied era of warfare, that is one of its main attractions for wargamers. I would prefer to celebrate that rather than gradually erode it.
Richard Bodley Scott

Image
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Flank Angle Mod

Post by stockwellpete »

rbodleyscott wrote: Fri May 08, 2020 9:19 am
Much as we all appreciate Pete's hard work in organizing and running the FOG2 Digital League, it would be a bit "tail wagging the dog" for game development to be driven by a decade-old tournament format left over from a different game (FOG1), that does not take advantage of FOG2 game features such as mirror matches, which automatically create tournament balance.

The Ancient period is the single most varied era of warfare, that is one of its main attractions for wargamers. I would prefer to celebrate that rather than gradually erode it.
Well, I accept that my ideas are partly driven by what I think might be good for the FOG2DL, but they are much more influenced by what I think I will need for my medieval scenarios (e.g. War of the Roses, HYW). The FOG2DL does actually use mirror matches in the Themed Event, but it is the least popular section of the tournament of the moment (maybe because you are only guaranteed 4 matches instead of 9). Mirror matches between unbalanced armies, or between players of different skill levels, are not necessarily very entertaining in and of themselves - and I do think, on balance, that the 9 match league format does offer greater variety and it is still very popular.

In terms of Athos's list (the effect of terrains, the effects of MF on HF, the effects of LF, the effects of Infantry on non-light cavalry, the effect of rear/flank charges etc), I am only in favour of some of those ideas i.e. reducing the severity of the rough ground terrain type (or making it affect MF a bit as well, not sure yet) and removing flank attacks (possibly only for infantry, not sure yet). On the other hand I would re-introduce anarchy charges at the drop of a hat and I would make command and control much more rigorous as an option (using a tick box menu at the start) for those who are interested. Plenty of variety and dynamism there still, I feel. :wink:
Last edited by stockwellpete on Fri May 08, 2020 10:08 am, edited 1 time in total.
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Flank Angle Mod

Post by stockwellpete »

I have played my first battle against the AI using this mod and it went very well. I think I need to take out the +50POA for attacking the side of a unit next so there is no flank element at all. The biggest difference straight away (and I like this effect very much) is that because you get your bonuses from achieving 2v1's or 3v1's, units now need only move directly into contact with an enemy at the nearest point to get the optimum bonus possible, rather than trying to work their way up the side to try and get a "killer" flank attack. Immediately the battle lines become much more coherent and it was only in the later stages that gaps started to appear for cavalry to exploit (there were woods on both flanks of the map I was given so cavalry couldn't really prosper there earlier in the battle).
Athos1660
Major-General - Jagdtiger
Major-General - Jagdtiger
Posts: 2761
Joined: Wed May 29, 2019 3:23 pm

Re: Flank Angle Mod

Post by Athos1660 »

rbodleyscott wrote: Fri May 08, 2020 9:19 am The Ancient period is the single most varied era of warfare (...) I would prefer to celebrate that rather than gradually erode it.
+1. This is great news for Fog2!
stockwellpete wrote: Fri May 08, 2020 9:55 am In terms of Athos's list (the effect of terrains, the effects of MF on HF, the effects of LF, the effects of Infantry on non-light cavalry, the effect of rear/flank charges, etc.)
I do know how to make friends :lol:
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Flank Angle Mod

Post by stockwellpete »

Schweetness101 wrote: Thu May 07, 2020 8:48 pm
if you just want to get rid of 90 degree flanks for infantry altogether then:

CombatTools.bsf > line 1696 and changing ret = 1; to ret = 0;

at least I think so I haven't tested that so yuknow...
Could you check this again please. Line 1696 is completely empty of data and that area seems to be about built up areas. Thanks.
SnuggleBunnies
Major-General - Jagdtiger
Major-General - Jagdtiger
Posts: 2892
Joined: Tue Apr 07, 2015 2:09 am

Re: Flank Angle Mod

Post by SnuggleBunnies »

Really I could not be more opposed to this change, but mod away! Maybe I'll even test it out in MP so I can point out everything wrong with it ;).
MP Replays:
https://www.youtube.com/channel/UCjUQy6dEqR53NwoGgjxixLg

Pike and Shot-Sengoku Jidai Crossover Mod:
https://www.slitherine.com/forum/viewtopic.php?t=116259

Middle Earth mod:
https://www.slitherine.com/forum/viewtopic.php?p=1029243#p1029243
Schweetness101
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 928
Joined: Tue Nov 29, 2016 6:12 am

Re: Flank Angle Mod

Post by Schweetness101 »

stockwellpete wrote: Fri May 08, 2020 10:27 am
Schweetness101 wrote: Thu May 07, 2020 8:48 pm
if you just want to get rid of 90 degree flanks for infantry altogether then:

CombatTools.bsf > line 1696 and changing ret = 1; to ret = 0;

at least I think so I haven't tested that so yuknow...
Could you check this again please. Line 1696 is completely empty of data and that area seems to be about built up areas. Thanks.
yes, it is this function, IsFlankRearAttack(), and I removed all comments except the one next to the relevant line that says //CHANGE THIS TO ZERO:

Code: Select all

FUNCTION IsFlankRearAttack(me, enemy)
{
	int ret;
	int startX;
	int startY;

	ret = 0;

	startX = GetAttrib(me, "StartingPosX");
	startY = GetAttrib(me, "StartingPosY");

	if ((IsUnitSquadType(enemy, "Battle_Wagons") == 1) || (GetAttrib(enemy, "InSquare") == 1))
	{
		ret = 0;
	}
	else
	{
		if (IsMounted(me))
		{
			if (GetAngleFrom(me, enemy) >= 85)
			{
				if (GetAngleFromTile(startX, startY, enemy) >= 85) 
				{
					if (IsKeil(enemy) == 0)
					{
						ret = 1;
					}
				}
			}

			if (GetAngleFrom(me, enemy) > 138)
			{
				if (GetAngleFromTile(startX, startY, enemy) > 138) 
				{
					ret = 2;
				}
			}
		}
		else
		{
			if (GetAngleFrom(me, enemy) >= 85)
			{
				if (GetAngleFromTile(startX, startY, enemy) >= 85) 
				{
					if (IsKeil(enemy) == 0)
					{
						ret = 1;//CHANGE THIS TO ZERO
					}
				}
			}

			if (GetAngleFrom(me, enemy) >= 85) 
			{
				if (GetAngleFromTile(startX, startY, enemy) > 100) 
				{
					ret = 2;
				}
			}
		}

		if (ret > 0)
		{
			if (IsFoot(enemy) == 1)
			{
				if ((IsTileEdgeDefendibleObstacle(GetUnitX(enemy), GetUnitY(enemy), GetUnitX(me), GetUnitY(me)) >= 0) || (GetTerrainCoverValue(GetUnitX(enemy), GetUnitY(enemy), 6) == 1))
				{
					ret = 0;
				}
			}
		}
	}

	return ret;
}
My Mods:
Ancient Greek https://www.slitherine.com/forum/viewtopic.php?p=977908#p977908
Dark Ages Britain https://www.slitherine.com/forum/viewtopic.php?t=106417
Anarchy (Medieval) https://www.slitherine.com/forum/viewtopic.php?p=987488#p987488
Morbio
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2164
Joined: Fri Jan 01, 2010 4:40 pm
Location: Wokingham, UK

Re: Flank Angle Mod

Post by Morbio »

rbodleyscott wrote: Fri May 08, 2020 9:19 am
Athos1660 wrote: Fri May 08, 2020 7:58 amAnd I am not sure that over-downgrading each 'effect' in the game (the effect of terrains, the effects of MF on HF, the effects of LF, the effects of Infantry on non-light cavalry, the effect of rear/flank charges etc.) would be a great move for the Vanilla game.
I am glad someone has had the courage to come out and say this. It just about sums up my own views.

Essentially it all boils down to homogenization, which is a route that sadly many games have gone down in the quest for "balance". It is much easier to achieve "balance" by reducing the differences between things, rather than by maintaining the differences and making other adjustments to balance the game.

Always assuming that true balance is even a desirable goal other than for tournaments without mirror matches.

Much as we all appreciate Pete's hard work in organizing and running the FOG2 Digital League, it would be a bit "tail wagging the dog" for game development to be driven by the priorities of a decade-old tournament format left over from a different game (FOG1), that does not take advantage of FOG2 game features such as mirror matches, which automatically create tournament balance.

The Ancient period is the single most varied era of warfare, that is one of its main attractions for wargamers. I would prefer to celebrate that rather than gradually erode it.
I agree with Richard. I'd certainly like to see more events with Mirror matches... the DL is great and I enjoy it, and would probably prefer slightly smaller leagues with mirror matches. I don't tend to play in the themed events mostly because of the theme or because they use modded armies.
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Flank Angle Mod

Post by stockwellpete »

Sorry, originally you said change ret = 1 to ret = 0. I have copied the section that you seem to be pointing to FUNCTION IsFlankRearAttack(me, enemy) which is on line 1643 on my edit by Notepad++ programme. The only ret = 1 that I can see is about 30 lines further down, so presumably I need to change that one? Does it mean that the ret = 2 that is a further lines down needs to change, or does it stay as it is?


FUNCTION IsFlankRearAttack(me, enemy)
{
int ret;
int startX;
int startY;

ret = 0;

startX = GetAttrib(me,"StartingPosX");
startY = GetAttrib(me,"StartingPosY");

// Battle Wagons and Troops in Square formation immune to effects of flank and rear attacks
// if ((IsUnitSquadType(enemy, "Battle_Wagons") == 1) || (GetAttrib(enemy, "InSquare") == 1))
// if (GetAttrib(enemy, "InSquare") == 1)
if ((IsUnitSquadType(enemy, "Battle_Wagons") == 1) || (GetAttrib(enemy, "InSquare") == 1)) // v1.3.0 change
{
ret = 0;
}
else
{
if (GetAngleFrom(me, enemy) >= 85) // Charger behind flank
{
if (GetAngleFromTile(startX, startY, enemy) >= 85) // Charger started turn behind flank
{
// Keils immune to ill effects of flank attack
if (IsKeil(enemy) == 0)
{
ret = 1;
}
}
}

if (GetAngleFrom(me, enemy) > 138) // Charger behind rear
// Unit directly diagonally behind flank (135 degrees approx) should NOT count as behind rear
{
if (GetAngleFromTile(startX, startY, enemy) > 138) // Charger started turn behind rear.
{
ret = 2;
}
}

if (ret > 0)
{
// defensible obstacles and built-up-areas/buildings prevent flank/rear attack on foot. (No need to exclude Battle Wagons as they can't be flank/rear attacked anyway).
if (IsFoot(enemy) == 1)
{
if ((IsTileEdgeDefendibleObstacle(GetUnitX(enemy), GetUnitY(enemy), GetUnitX(me), GetUnitY(me)) >= 0) || (GetTerrainCoverValue(GetUnitX(enemy), GetUnitY(enemy), 6) == 1))
{
ret = 0;
}
}
}
}
Schweetness101
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 928
Joined: Tue Nov 29, 2016 6:12 am

Re: Flank Angle Mod

Post by Schweetness101 »

stockwellpete wrote: Fri May 08, 2020 2:49 pm Sorry, originally you said change ret = 1 to ret = 0. I have copied the section that you seem to be pointing to FUNCTION IsFlankRearAttack(me, enemy) which is on line 1643 on my edit by Notepad++ programme. The only ret = 1 that I can see is about 30 lines further down, so presumably I need to change that one? Does it mean that the ret = 2 that is a further lines down needs to change, or does it stay as it is?


FUNCTION IsFlankRearAttack(me, enemy)
{
int ret;
int startX;
int startY;

ret = 0;

startX = GetAttrib(me,"StartingPosX");
startY = GetAttrib(me,"StartingPosY");

// Battle Wagons and Troops in Square formation immune to effects of flank and rear attacks
// if ((IsUnitSquadType(enemy, "Battle_Wagons") == 1) || (GetAttrib(enemy, "InSquare") == 1))
// if (GetAttrib(enemy, "InSquare") == 1)
if ((IsUnitSquadType(enemy, "Battle_Wagons") == 1) || (GetAttrib(enemy, "InSquare") == 1)) // v1.3.0 change
{
ret = 0;
}
else
{
if (GetAngleFrom(me, enemy) >= 85) // Charger behind flank
{
if (GetAngleFromTile(startX, startY, enemy) >= 85) // Charger started turn behind flank
{
// Keils immune to ill effects of flank attack
if (IsKeil(enemy) == 0)
{
ret = 1;
}
}
}

if (GetAngleFrom(me, enemy) > 138) // Charger behind rear
// Unit directly diagonally behind flank (135 degrees approx) should NOT count as behind rear
{
if (GetAngleFromTile(startX, startY, enemy) > 138) // Charger started turn behind rear.
{
ret = 2;
}
}

if (ret > 0)
{
// defensible obstacles and built-up-areas/buildings prevent flank/rear attack on foot. (No need to exclude Battle Wagons as they can't be flank/rear attacked anyway).
if (IsFoot(enemy) == 1)
{
if ((IsTileEdgeDefendibleObstacle(GetUnitX(enemy), GetUnitY(enemy), GetUnitX(me), GetUnitY(me)) >= 0) || (GetTerrainCoverValue(GetUnitX(enemy), GetUnitY(enemy), 6) == 1))
{
ret = 0;
}
}
}
}
this looks like you are editing the original CombatTools.bsf file in:

...\SteamLibrary\steamapps\common\Field of Glory II\Data\scripts

DON'T edit anything in there, that is the vanilla game. Instead you

instead go to

C:\Users\YOURNAME\Documents\My Games\FieldOfGlory2\CAMPAIGNS\Medium Foot Flank Mod\Data\scripts

and edit the mod's CombatTools.BSF > IsFlankRearAttack() function. You will see that function now had two separate sections for the flank angles, one for IsMounted(me) and one for else. The more specific relevant section looks like this:

Code: Select all

			if (GetAngleFrom(me, enemy) >= 85) // Charger behind flank
				{
					if (GetAngleFromTile(startX, startY, enemy) >= 85) // Charger started turn behind flank
						{
							// Keils immune to ill effects of flank attack
							if (IsKeil(enemy) == 0)
								{
								ret = 1;// 1;//added for flank mod, so this removes all auto drop for (side) flanks AND i have redefined side flanks (by below angle change in rear flanks) to only mean sides and rear to include a greater angle 
								//eg behind diagonal type angle
//NOT QUITE right because above means they don't even get the flank attack in, so that they don't get the +50 even when flanking an occupied enemy, would be better
//if they still got that +50, so perhaps instead I should alter the angle here, but keep the 1, and isntead elsewhere decrease the effectiveness of a returning 1
//I'll do that now I guess, so above is back to returning 1, and then where do I edit what is doine with this so that 1 is insufficuent for infantry to get the autodrop?
								}
						}
				}
that is what it should look like exactly. In the above code I pasted I removed my comments because I thought they would be confusing, but here it is exactly as it appears in the mod file, comments and all. That re=1 you see there should be ret=0 if you want to remove flanks for infantry altogether.
My Mods:
Ancient Greek https://www.slitherine.com/forum/viewtopic.php?p=977908#p977908
Dark Ages Britain https://www.slitherine.com/forum/viewtopic.php?t=106417
Anarchy (Medieval) https://www.slitherine.com/forum/viewtopic.php?p=987488#p987488
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Flank Angle Mod

Post by stockwellpete »

Ok thanks. I think I have got it changed OK. I will give it a try now. Sorry, modding is way out of my comfort zone.
Post Reply

Return to “Field of Glory II”