Victory object
Posted: Sun Oct 01, 2023 9:33 am
Hi,
I am looking for some help.
I am working on a small campaign and I am at my second mission.
I have placed three objective (called A-B-C) that are in player hand (wolf army).
I need to write on the editor a script that if the enemy (player one - ork) get the objective B they get the victory.
If they get A and/or C the game goes on.
Any help?.
Thanks
The script is similar to that of the mission Hollow Hills in stormclaw: a Rhino get on the objective tile x, y and win, but I need the opposite; whatever enemy units get on the objective tile x, y win the game.
FUNCTION Tick(side)
{
int i;
int DeadCount;
int RetreatCount;
int id;
int winterfang;
int object;
if (GetGlobal("RhinoCount") < 3)
{
for(i=0; i<GetUnitCount(0); i++)
{
//63,54
StartWorkString();
GetUnitTypeString(GetUnitTypeIndex(i));
if (StringCompare(GetWorkString(), "Rhino") == 1)
{
if (IsUnitValid(i) == 1)
{
if (GetUnitX(i) == 63 && GetUnitY(i) == 54)
{
AddVizFunctionCall("EndBattle", 0);
}
}
}
}
}
}
I have tried this but does not work:
FUNCTION StartTurn(side)
{
if (side == 1)
{
VictoryConditions() ;
}
}
FUNCTION VictoryConditions()
{
int i;
int id ;
for(i=1; i<GetUnitCount(1); i++)
{
id = GetUnitID(1, i) ;
if (IsUnitValid(i) == 0)
{
if (GetUnitX(i) == 47 && GetUnitY(i) == 35)
{
AddVizFunctionCall("EndBattle", 1);
}
}
}
}
I am looking for some help.
I am working on a small campaign and I am at my second mission.
I have placed three objective (called A-B-C) that are in player hand (wolf army).
I need to write on the editor a script that if the enemy (player one - ork) get the objective B they get the victory.
If they get A and/or C the game goes on.
Any help?.
Thanks
The script is similar to that of the mission Hollow Hills in stormclaw: a Rhino get on the objective tile x, y and win, but I need the opposite; whatever enemy units get on the objective tile x, y win the game.
FUNCTION Tick(side)
{
int i;
int DeadCount;
int RetreatCount;
int id;
int winterfang;
int object;
if (GetGlobal("RhinoCount") < 3)
{
for(i=0; i<GetUnitCount(0); i++)
{
//63,54
StartWorkString();
GetUnitTypeString(GetUnitTypeIndex(i));
if (StringCompare(GetWorkString(), "Rhino") == 1)
{
if (IsUnitValid(i) == 1)
{
if (GetUnitX(i) == 63 && GetUnitY(i) == 54)
{
AddVizFunctionCall("EndBattle", 0);
}
}
}
}
}
}
I have tried this but does not work:
FUNCTION StartTurn(side)
{
if (side == 1)
{
VictoryConditions() ;
}
}
FUNCTION VictoryConditions()
{
int i;
int id ;
for(i=1; i<GetUnitCount(1); i++)
{
id = GetUnitID(1, i) ;
if (IsUnitValid(i) == 0)
{
if (GetUnitX(i) == 47 && GetUnitY(i) == 35)
{
AddVizFunctionCall("EndBattle", 1);
}
}
}
}