Increase range of cohesion test when CinC die
Posted: Sat Jan 15, 2022 9:26 am
Hi,
how can I Increase the range of cohesion test when CinC die?
Thx
how can I Increase the range of cohesion test when CinC die?
Thx
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);
}
}
}
}Code: Select all
distance = 2; // may need tweaking