Page 1 of 1

Increase range of cohesion test when CinC die

Posted: Sat Jan 15, 2022 9:26 am
by matlegob
Hi,

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

Thx

Re: Increase range of cohesion test when CinC die

Posted: Sat Jan 15, 2022 10:09 am
by rbodleyscott
Moved to modding forum.

Re: Increase range of cohesion test when CinC die

Posted: Sat Jan 15, 2022 10:17 am
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)

Re: Increase range of cohesion test when CinC die

Posted: Sat Jan 15, 2022 5:12 pm
by matlegob
Thanks for your fast answer