Increase range of cohesion test when CinC die

Post Reply
matlegob
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 181
Joined: Fri Jun 16, 2017 7:01 pm

Increase range of cohesion test when CinC die

Post by matlegob »

Hi,

how can I Increase the range of cohesion test when CinC die?

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

Re: Increase range of cohesion test when CinC die

Post by rbodleyscott »

Moved to modding forum.
Richard Bodley Scott

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

Re: Increase range of cohesion test when CinC die

Post by rbodleyscott »

You would need to mod the

SetProximityMoraleFlagsGeneralIncapacitated()

function in

GeneralTools.bsf

Code: Select all

// Sets cohesion test flags for friendly units close to incapacitated general.
FUNCTION SetProximityMoraleFlagsGeneralIncapacitated(generalUnit)
{
	int i;
	int total;
	int side;
	int id;
	int distance;

	side = GetUnitSide(generalUnit);
	total = GetUnitCount(side);

	distance = 1;
	if (GetAttrib(generalUnit, "GeneralType") > 0) // C-in-C or Ally general have greater radius of dismay
		{
			distance = 2; // may need tweaking
		}

	for (i=0; i<total; i++)
		{
			id = GetUnitID(side, i);

			if (id != generalUnit) // This unit has already been tested
				{
					if (GetDistanceBetween(generalUnit, id) <= distance) // Only units within range
						{
							if ((GetAttrib(generalUnit, "GeneralType") < 2) || (GetAttrib(generalUnit, "OriginalTeam") == GetAttrib(id, "OriginalTeam"))) // Ally generals only affect their own team.
								{
									SetAttrib(id, "MoraleTestDue", 1);
								}
							// Log("Setting proximity morale flag: unit due to test, unit triggering test", id, generalUnit);
						}
				}
		}

}
You need to change the value assigned to the distance variable in the line:

Code: Select all

distance = 2; // may need tweaking
I am sure you know this already, but for the benefit of anyone else reading this, I should give the usual warning: You should not mod files in your main build if you will ever ever play MP. It will break MP.

See:

https://archonwiki.slitherine.com/index.php/Modding

and various threads here

viewforum.php?f=492

for the approved method of modding. (That won't interfere with MP)
Richard Bodley Scott

Image
matlegob
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 181
Joined: Fri Jun 16, 2017 7:01 pm

Re: Increase range of cohesion test when CinC die

Post by matlegob »

Thanks for your fast answer
Post Reply

Return to “Field of Glory II: Modding”