I use the following adapted version of the function VictoryConditions
Code: Select all
FUNCTION VictoryConditions()
{
int total;
int i;
int id;
int ret;
int unitX;
int unitY;
total = GetUnitCount(1);
SetGlobal("victory", 0);
for (i = 0; i < total; i++)
{
id = GetUnitID(1,i);
if (id != -1)
{
if ((IsUnitValid(id) == 1) && (GetAttrib(id, "MoraleState") < 3))
{
unitX = GetUnitX(id);
unitY = GetUnitY(id);
if ((unitX >= 30) && (unitX <= 32) && (unitY == 47) && (IsUnitSquadType(id, "Train") == 1))
{
SetGlobal("victory", 1);
i = total;
PlayVictoryDefeatSounds(1);
if (GetShowSide() == 0)
{
ShowUIScreenY("BattlePop0", "Anim1", "IDS_SCN_MP_ADJUSTED_DEFEAT");
AddVizDelay(2);
}
gGameScoreData.decisive = 1;
gGameScoreData.winner =0;
EndBattle(0);
}
}
}
}
if (GetGlobal("victory") != 1 )
{
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.
}
However when after this the result is shown together with the difficulty used it states it was a victory for me, i.e. a defeat for the AI.
1) What am I doing wrong? How can I have it show also defeat in the screen stating the difficulty level?
2) How can I have a different text be shown than IDS_SCN_MP_ADJUSTED_DEFEAT by function ShowUIScreenY? I have tried to create my own IDS text in text1.txt of my scenario but that did not seem to work. I believe I had called it IDS_SCN_BAGGAGE.
3) How can I update the default instructions for victory to include also info that it will be a defeat when the baggage train of the AI reaches that specific point at the edge of the map?

