function ToWin()
if ((GetIGlobalVar("ukol.0", 1) * GetIGlobalVar("ukol.1", 1) * GetIGlobalVar("ukol.2", 1)) == 1) then
Win(0);
Suicide();
end;
end;

function ToLoose1()
if ( GetNUnitsInParty (0) <= 0) then
Loose(0);
DisplayTrace ("Unbelievable! The enemy has beaten you.");
Suicide();
end;
end;

function ToLoose2()
if (( GetNUnitsInArea (1, "west") > 0) or ( GetNUnitsInArea (1, "north") > 0)) then
Loose(0);
DisplayTrace ("The US forces broke through from the beachhead.");
Suicide();
end;
end;

function Start()
SetIGlobalVar("ukol.0", 0);
SetIGlobalVar("ukol.1", 0);
SetIGlobalVar("ukol.2", 0);
Suicide();
end;

function RevealObjective0()
if ( GetIGlobalVar("ukol.0", 0) == 0) then
        ObjectiveChanged(0, 0);
        Suicide();
	else Suicide();
	end;
end;

function protiutok1()
LandReinforcement (101);
Suicide();
end;

function protiutok2()
LandReinforcement (102);
LandReinforcement (103);
RunScript( "ustup" , 5000);
Suicide();
end;

function ustup()
if ( GetNUnitsInScriptGroup(103, 1) <= 0) then
GiveCommand (0, 102, 11462, 1658);
RunScript( "Objective0" , 10000);
Suicide();
end;
end;

function Objective0()
if ( GetNUnitsInScriptGroup(103, 1) <= 0) then
SetIGlobalVar("ukol.0", 1);
ObjectiveChanged(0, 1);
RunScript( "RevealObjective1" , 3000);
RunScript( "RevealObjective2" , 6000);
RunScript( "posily1" , 15000);
Suicide();
end;
end;

function posily1()
LandReinforcement (1);
Suicide();
end;

function RevealObjective1()
if ( GetIGlobalVar("ukol.1", 0) == 0) then
        ObjectiveChanged(1, 0);
        Suicide();
	else Suicide();
	end;
end;

function Objective1()
if ( GetNUnitsInArea (1, "cisterno") <= 0) then
SetIGlobalVar("ukol.1", 1);
ObjectiveChanged(1, 1);
Suicide();
end;
end;

function RevealObjective2()
if ( GetIGlobalVar("ukol.2", 0) == 0) then
        ObjectiveChanged(2, 0);
        Suicide();
	else Suicide();
	end;
end;

function Objective2()
if ( GetNUnitsInArea (1, "airfield") <= 0) then
SetIGlobalVar("ukol.2", 1);
ObjectiveChanged(2, 1);
DisableAviation (1, -1);
Suicide();
end;
end;

function Init()
RunScript( "Start" , 1000);
RunScript( "ToWin" , 5000);
RunScript( "ToLoose1" , 5000);
RunScript( "ToLoose2" , 5000);
RunScript( "RevealObjective0" , 3000);
RunScript( "protiutok1" , 120000);
RunScript( "protiutok2" , 300000);
RunScript( "Objective1" , 5000);
RunScript( "Objective2" , 5000);
end;