Is there a way to artificially increase casualties count?

Moderator: rbodleyscott

Post Reply
fogman
Sr. Colonel - Wirbelwind
Sr. Colonel - Wirbelwind
Posts: 1796
Joined: Wed Jun 20, 2012 1:29 pm

Is there a way to artificially increase casualties count?

Post by fogman »

Suppose army A is trying to destroy army B within a limited amount of turns. Since B is basically unable to inflict damage on A to the extent needed to win, it can only win by delaying its destruction for as long as possible. One way to make that a possibility is to have A artificially lose a certain percentage every turn. Now there's a way to do that in Fog1; is there some sort of scripting that could achieve that in Fog 2?
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28108
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is there a way to artificially increase casualties count?

Post by rbodleyscott »

The short answer is yes. I will give it some thought after the holidays.
Richard Bodley Scott

Image
fogman
Sr. Colonel - Wirbelwind
Sr. Colonel - Wirbelwind
Posts: 1796
Joined: Wed Jun 20, 2012 1:29 pm

Re: Is there a way to artificially increase casualties count?

Post by fogman »

OK thanks. It's a mechanism that I use extensively, and not only to model lopsided battles.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28108
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is there a way to artificially increase casualties count?

Post by rbodleyscott »

I am sure that what you propose would be doable, but before I write code for it, are you sure it would achieve the effect you want?

Unless you have modded the victory condition code, battles are decided by rout %, not casualties. Simply removing casualties each turn would not affect the rout % until units autobreak.

Why not use the Victory Conditions code to adjust the rout % required for each side to break? Wouldn't giving the two sides different break points solve the issue you are trying to solve?

Code: Select all

// This function applies standard victory conditions. The actual StandardVictoryConditions() function code can be found in MoreScenarioTools.BSF.
// The parameters are (breakpoint0a, breakpoint0b, breakpoint1a, breakpoint1b, drawdecider, MPgame)
// breakpoint0a is Side 0 first breakpoint (in % troops UNrouted), breakpoint0b is Side 0 second breakpoint.
// breakpoint1a is Side 1 first breakpoint (in % troops UNrouted), breakpoint1b is Side 1 second breakpoint.
// An army is defeated if it reaches its second breakpoint, or if it reaches its first breakpoint (or anywhere between that and its second breakpoint)
// and the enemy has at least 25% more troops UNrouted.
// drawdecider indicates which side wins if the game is drawn ("ScenarioDeadline" turn limit reached or both sides are "defeated" on same turn).
// drawdecider == 0 means that Side 0 wins draws. drawdecider == 1 means that Side 1 wins draws. drawdecider == 2 means that whichever side is ahead wins draws.
// MPgame = 1 means that the game is an MP game. In non-random MP games, the victory conditions can automatically be adjusted to take account of initial disparity in forces,
// so that the losing army will win the scenario if the enemy victory was too Pyrrhic. To implement this, the StartTurnPost() function needs to include SetMPForceRatio();
// If this is likely to happen, the ScenarioUI text in the top left of the screen will report that the losing side is “ahead on points”.
// Special victory conditions can be applied using SpecialScenarioVictoryConditions() - see Lostwithiel.BSF for an example of this. If present in the scenario .bsf file,
// this function is run by StandardVictoryConditions() if neither army is broken.
FUNCTION VictoryConditions()
{
	StandardVictoryConditions(60, 40, 60, 40, 2, IsMultiplayer());
	
	return 1; // VictoryConditions() must return a non-zero value so that the main program knows it exists and therefore not to use the default version.
}
If you choose to go down this route, I can also explain how to change the victory conditions displayed on the screen.

Paul has probably already explained it somewhere, but I can't immediately find where.
Richard Bodley Scott

Image
fogman
Sr. Colonel - Wirbelwind
Sr. Colonel - Wirbelwind
Posts: 1796
Joined: Wed Jun 20, 2012 1:29 pm

Re: Is there a way to artificially increase casualties count?

Post by fogman »

What I meant was to increase the rout % automatically regardless of field casualties; but if that value is a direct function of the field casualties, then I suspect that could be an unsurmountable problem. The issue with adjusting the rout % for each side in the victory condition is that the superior side can hold back, thus removing the 'race against time' aspect of the scenario.

Now, I can simply implement the coarse 'analog' method used in fog1 whereby I have a line of 'marker' units being destroyed one at a time at one end of the field.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28108
Joined: Sun Dec 04, 2005 6:25 pm

Re: Is there a way to artificially increase casualties count?

Post by rbodleyscott »

fogman wrote: Tue Jan 02, 2024 4:48 pm What I meant was to increase the rout % automatically regardless of field casualties;
Ah, that was not clear to me.
but if that value is a direct function of the field casualties
It isn't. It is a direct function of the % routed [NOT casualties]. There is no way to modify that in a scenario script without actually routing extra units.

But there is a much easier built-in way of dealing with the situation, which requires no modding at all, just changes to the parameters in the call to StandardVictoryConditions() in the scenario script - see below.
The issue with adjusting the rout % for each side in the victory condition is that the superior side can hold back, thus removing the 'race against time' aspect of the scenario.
Actually no.

You can set one side to automatically win if the turn limit is reached without either side breaking. So the stronger side can be forced to attack or forfeit the game by default.

Just change the 5th (drawdecider) parameter in the StandardVictoryConditions() call in the scenario script (see previous post) to 0 if you want side 0 (side A) to win if the turn limit is reached without a clear victor, or 1 if you want side 1 (side B) to win if the turn limit is reached without a clear victor. (It is currently set at 2, which means that whichever side is ahead wins draws)

(See the comments in the code segment in my previous post)
Now, I can simply implement the coarse 'analog' method used in fog1 whereby I have a line of 'marker' units being destroyed one at a time at one end of the field.
Really not necessary.

You should be able to achieve what you want by a combination of adjusting the breakpoint parameters and the drawdecider parameter.

Note that the breakpoint parameters represent the % unrouted, not the % routed. So if you want the breakpoint to be 30% routed, you need to pass 70 in the relevant parameter.
Richard Bodley Scott

Image
fogman
Sr. Colonel - Wirbelwind
Sr. Colonel - Wirbelwind
Posts: 1796
Joined: Wed Jun 20, 2012 1:29 pm

Re: Is there a way to artificially increase casualties count?

Post by fogman »

That should work. I'll give it a try. Thanks.
Post Reply

Return to “Field of Glory II: Medieval - Scenario Design”