function Objective0()
  if ( GetIGlobalVar("temp.revel.objective.0", 0) == 0) then     
	ObjectiveChanged(0, 0);
	Suicide();
  	end;	
end;
---------------------------------------------------------------------------------
function Objective1()
  if ( GetIGlobalVar("temp.revel.objective.1", 0) == 0) then     
	ObjectiveChanged(1, 0);
	Suicide();
  	end;	
end;
---------------------------------------------------------------------------------
function Objective2()
  if ( GetIGlobalVar("temp.revel.objective.2", 0) == 0) then     
	ObjectiveChanged(2, 0);
	Suicide();
  	end;	
end;
---------------------------------------------------------------------------------
function Objective3()
  if ( GetIGlobalVar("temp.revel.objective.3", 0) == 0) then     
	ObjectiveChanged(3, 0);
	Suicide();
  	end;	
end;
---------------------------------------------------------------------------------
function z_0()
	
	if (GetNUnitsInScriptGroup(1, 1) <= 1) then
	SetIGlobalVar("temp.revel.objective.0", 1);
	ObjectiveChanged(0, 1);
	RunScript("Objective1", 2000);
	LandReinforcement(10);
	Suicide();
	end;
end;

---------------------------------------------------------------------------------
function z_1()
	
	if (GetNUnitsInScriptGroup(100, 1) <= 1) then 
	SetIGlobalVar("temp.revel.objective.1", 1);
	ObjectiveChanged(1, 1);
	RunScript("Objective2", 2000);
	RunScript("Land100", 60000);
	LandReinforcement(20);
	Suicide();
	end;
end;
---------------------------------------------------------------------------------
function z_2()
	
	if (GetNUnitsInScriptGroup(3, 1) < 1) then
	SetIGlobalVar("temp.revel.objective.2", 1);
	ObjectiveChanged(2, 1);
	RunScript("Objective3", 2000);
	Suicide();
	end;
end;
---------------------------------------------------------------------------------
function z_3()
	
	if (GetNUnitsInArea(1, "d2") == 0) then
	SetIGlobalVar("temp.revel.objective.3", 1);
	ObjectiveChanged(3, 1);
	Suicide();
	end;
end;
---------------------------------------------------------------------------------
function at1()


	GiveCommand(3,1,x100,y100);
	x100, y100 = GetScriptAreaParams ("d1");	
end;

---------------------------------------------------------------------------------
function Land100()



		GiveCommand(3,3,x400,y400);
		GiveCommand(3,4,x400,y400);


			if (GetNUnitsInArea(0, "at28") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at28");
			
			end;

			if (GetNUnitsInArea(0, "at27") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at27");
			
			end;

			if (GetNUnitsInArea(0, "at26") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at26");

			end;

			if (GetNUnitsInArea(0, "at25") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at25");

			end;
			
			if ( GetNUnitsInArea(0, "at24") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at24");

			end;

			if ( GetNUnitsInArea(0, "at23") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at23");

			end;

			if ( GetNUnitsInArea(0, "at22") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at22");

			end;

			if ( GetNUnitsInArea(0, "at21") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at21");

			end;

			if ( GetNUnitsInArea(0, "at20") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at20");

			end;

			if ( GetNUnitsInArea(0, "at19") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at19");

			end;
			
			if ( GetNUnitsInArea(0, "at18") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at18");

			end;

			if ( GetNUnitsInArea(0, "at17") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at17");

			end;

			if ( GetNUnitsInArea(0, "at16") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at16");

			end;

			if ( GetNUnitsInArea(0, "at15") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at15");

			end;

			if ( GetNUnitsInArea(0, "at14") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at14");

			end;

			if ( GetNUnitsInArea(0, "at13") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at13");

			end;

			if ( GetNUnitsInArea(0, "at12") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at12");

			end;

			if ( GetNUnitsInArea(0, "at11") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at11");

			end;

			if ( GetNUnitsInArea(0, "at10") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at10");

			end;

			if ( GetNUnitsInArea(0, "at9") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at9");

			end;

			if ( GetNUnitsInArea(0, "at8") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at8");

			end;

			if ( GetNUnitsInArea(0, "at7") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at7");

			end;

			if ( GetNUnitsInArea(0, "at6") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at6");

			end;
			
			if ( GetNUnitsInArea(0, "at5") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at5");

			end;

			if ( GetNUnitsInArea(0, "at4") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at4");

			end;

			if ( GetNUnitsInArea(0, "at3") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at3");

			end;

			if ( GetNUnitsInArea(0, "at2") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at2");

			end;

			if ( GetNUnitsInArea(0, "at1") > 0) then
                                              x400, y400 = GetScriptAreaParams ("at1");

			end;
end;
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
function ToWin()

	--DisplayTrace ("x= %g y= %g", x400, y400);

	if ((GetIGlobalVar("temp.revel.objective.0", 0) 
	* GetIGlobalVar("temp.revel.objective.1", 0) 
	* GetIGlobalVar("temp.revel.objective.2", 0) 
	* GetIGlobalVar("temp.revel.objective.3", 0)) == 1) then
		Win(0);
		Suicide();
	end;
end;
---------------------------------------------------------------------------------
function gamover_Loose1()
	if ( GetNUnitsInParty (0) < 1) then
	RunScript("gamover_Loose0", 5000);
	Suicide();
	end;
end;
---------------------------------------------------------------------------------
function gamover_Loose0()
        Loose();
        Suicide();
end;
---------------------------------------------------------------------------------
function Init()
	RunScript("Objective0", 2000);
	RunScript("z_0", 2000);
	RunScript("z_1", 2000);
	RunScript("z_2", 2000);
	RunScript("z_3", 2000);
	RunScript("at1", 30000);
	RunScript("ToWin", 2000);
	RunScript("gamover_Loose1", 2000);
end;