//==========================================================================================
//
//	canyon_depths_b4.gm
//
//	Who  	When		What
//------------------------------------------------------------------------------------------
//	^4Tardis	05 September 2014	Initial Script
//
//==========================================================================================
//

global Map =
{
	Debug = 1, // please set to zero before distributing your script
	ShowMovers = false,


	Laboratory_Safe_Door_Dyno = 0,
	North_MG_Shield_Dyno = 0,
	Pit_Bridge_Dyno = 0,
	Pit_Bridge_1_Dyno = 0,
	Pit_Bunker_Side_Gate_Dyno = 0,
	Pit_Tank_Barrier_Dyno = 0,
	River_Barrier_Dyno = 0,
	Road_Barrier_Dyno = 0,
	Road_Barrier_1_Dyno = 0,
	Sas_Control_Room_Barricade_Dyno = 0,
	Train_System_Controls_Dyno = 0,
	assault_ladder_Dyno = 0,
	storage_room_door_Dyno = 0,
	Axis_Command_Post_Dyno = 0,
	Allied_Command_Post_Dyno = 0,
	Talk = true, //set Talk to false if you don't want the bots to cheer after winning game:
	
	Movers =
	{
		"MOVER_tank_01",
		"MOVER_tank_02",
		"MOVER_tank_03",
		"MOVER_mobile_bridge_mover",
		"MOVER_bunker_monte_charge",
		"MOVER_convoyeur_1",
	},

	Switches =
	{
		ladder =
		{
			Enabled = false,
			WaypointName = "ladder",
			LimitTeam = 0, // disabled initially.
			LimitClass = (1<<CLASS.COVERTOPS) | (1<<CLASS.FIELDOPS) | (1<<CLASS.SOLDIER),
			LimitBots = 1,
			Priority = 0, // leave for paththrough
		},
	
		garagedoor =
		{
			Enabled = false,
			WaypointName = "garagedoor",
			LimitTeam = 0, // disabled initially.
			LimitClass = (1<<CLASS.COVERTOPS) | (1<<CLASS.FIELDOPS) | (1<<CLASS.SOLDIER),
			LimitBots = 1,
			Priority = 0, // leave for paththrough
		},

		lockA =
		{
			Enabled = false,
			WaypointName = "lockA",
			LimitTeam = 0, // disabled initially.
			LimitClass = (1<<CLASS.COVERTOPS) | (1<<CLASS.FIELDOPS) | (1<<CLASS.SOLDIER),
			LimitBots = 1,
			Priority = 0, // leave for paththrough
		},
		
		lockB =
		{
			Enabled = false,
			WaypointName = "lockB",
			LimitTeam = 0, // disabled initially.
			LimitClass = (1<<CLASS.COVERTOPS) | (1<<CLASS.FIELDOPS) | (1<<CLASS.SOLDIER),
			LimitBots = 1,
			Priority = 0, // leave for paththrough
		},
		
		DoorA =
		{
			WaypointName = "DoorA",
			LimitTeam = 0, // disabled initially.
			LimitClass = (1<<CLASS.COVERTOPS) | (1<<CLASS.FIELDOPS) | (1<<CLASS.SOLDIER),
			LimitBots = 1,
			Priority = 0, // leave for paththrough
		},
		
		DoorB =
		{
			Enabled = false,
			WaypointName = "DoorB",
			LimitTeam = 0, // disabled initially.
			LimitClass = (1<<CLASS.COVERTOPS) | (1<<CLASS.FIELDOPS) | (1<<CLASS.SOLDIER),
			LimitBots = 1,
			Priority = 0, // leave for paththrough
		},
		
		lock1 =
		{
			Enabled = false,
			WaypointName = "lock1",
			LimitTeam = 0, // disabled initially.
			LimitClass = (1<<CLASS.COVERTOPS) | (1<<CLASS.FIELDOPS) | (1<<CLASS.SOLDIER),
			LimitBots = 1,
			Priority = 0, // leave for paththrough
		},
		
		lock2 =
		{
			Enabled = false,
			WaypointName = "lock2",
			LimitTeam = 0, // disabled initially.
			LimitClass = (1<<CLASS.COVERTOPS) | (1<<CLASS.FIELDOPS) | (1<<CLASS.SOLDIER),
			LimitBots = 1,
			Priority = 0, // leave for paththrough
		},
		
		lock2 =
		{
			Enabled = false,
			WaypointName = "lock2",
			LimitTeam = 0, // disabled initially.
			LimitClass = (1<<CLASS.COVERTOPS) | (1<<CLASS.FIELDOPS) | (1<<CLASS.SOLDIER),
			LimitBots = 1,
			Priority = 0, // leave for paththrough
		},
		
		backdoor =
		{
			Enabled = false,
			WaypointName = "backdoor",
			LimitTeam = 0, // disabled initially.
			LimitClass = (1<<CLASS.COVERTOPS) | (1<<CLASS.FIELDOPS) | (1<<CLASS.SOLDIER),
			LimitBots = 1,
			Priority = 0, // leave for paththrough
		},
		
		//lift
		liftup =
		{
			Enabled = true,
			WaypointName = "liftup",
			PressOnce = true,
			Timeout = 1500,
			LimitTeam = 0, // disabled initially.
			LimitBots = 1,
			Priority = 0, // leave for paththrough
			AimPosition = Vec3(12159.938, 1491.875, -5869.089),
			// /bot waypoint_setproperty paththrough UseSwitch_PT:liftup
			Wait = function()
			{
				if ( Map.liftPos == "top")
				{
					sleep(6);
					return true;
				}
				else if ( Map.liftPos == "bottom")
				{
					sleep(6);
					return true;
				}
				else if ( Map.liftPos == "moving" )
				{
					sleep(6);
					return true;
				}
				return false;
			},
		},
	},
	
	Axis_Command_Post_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Command_Post" );

		Util.MapDebugPrint( "Axis_Command_Post_Built" );
	},

	Axis_Command_Post_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Axis_Command_Post_Dyno += 1;
		Util.MapDebugPrint( "Axis_Command_Post_Planted" );
	},

	Axis_Command_Post_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Axis_Command_Post_Dyno -= 1;
		Util.MapDebugPrint( "Axis_Command_Post_Defused" );
	},

	Axis_Command_Post_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Axis_Command_Post_Destroyed" );
	},
	
	Allied_Command_Post_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Command_Post" );

		Util.MapDebugPrint( "Allied_Command_Post_Built" );
	},

	Allied_Command_Post_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Allied_Command_Post_Dyno += 1;
		Util.MapDebugPrint( "Allied_Command_Post_Planted" );
	},

	Allied_Command_Post_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Allied_Command_Post_Dyno -= 1;
		Util.MapDebugPrint( "Allied_Command_Post_Defused" );
	},

	Allied_Command_Post_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Allied_Command_Post_Destroyed" );
	},

	North_MG_Shield_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "North_MG_Shield_Built" );
	},

	Pit_Bridge_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }
		SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_ladder" );
		Util.MapDebugPrint( "Pit_Bridge_Built" );
	},

	Pit_Bridge_1_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Pit_Bridge_1_Built" );
	},

	Pit_Tank_Barrier_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Pit_Tank_Barrier_Built" );
	},

	River_Barrier_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "River_Barrier_Built" );
	},

	Road_Barrier_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Road_Barrier_Built" );
	},

	Sas_Control_Room_Barricade_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Sas_Control_Room_Barricade_Built" );
	},

	Tank_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Tank_Built" );
	},

	Tank_1_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Tank_1_Built" );
	},

	Tank_2_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Tank_2_Built" );
	},

	Train_System_Controls_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "Train_System_Controls_Built" );
	},

	assault_ladder_Built = function( trigger )
	{
		if ( TestMap )
			{ return; }
		
		SetAvailableMapGoals( TEAM.AXIS, true, "CHECKPOINT.*" );
		Util.EnableGoal( "FLAG_obj_fuel.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Pit_Bridge" );
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_storage_room_door" );
		
		Util.MapDebugPrint( "assault_ladder_Built" );
	},

	Laboratory_Safe_Door_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Laboratory_Safe_Door_Dyno += 1;
		Util.MapDebugPrint( "Laboratory_Safe_Door_Planted" );
	},

	North_MG_Shield_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.North_MG_Shield_Dyno += 1;
		Util.MapDebugPrint( "North_MG_Shield_Planted" );
	},

	Pit_Bridge_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Pit_Bridge_Dyno += 1;
		Util.MapDebugPrint( "Pit_Bridge_Planted" );
	},

	Pit_Bridge_1_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Pit_Bridge_1_Dyno += 1;
		Util.MapDebugPrint( "Pit_Bridge_1_Planted" );
	},

	Pit_Bunker_Side_Gate_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Pit_Bunker_Side_Gate_Dyno += 1;
		Util.MapDebugPrint( "Pit_Bunker_Side_Gate_Planted" );
	},

	Pit_Tank_Barrier_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Pit_Tank_Barrier_Dyno += 1;
		Util.MapDebugPrint( "Pit_Tank_Barrier_Planted" );
	},

	River_Barrier_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.River_Barrier_Dyno += 1;
		Util.MapDebugPrint( "River_Barrier_Planted" );
	},

	Road_Barrier_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Road_Barrier_Dyno += 1;
		Util.MapDebugPrint( "Road_Barrier_Planted" );
	},

	Road_Barrier_1_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Road_Barrier_1_Dyno += 1;
		Util.MapDebugPrint( "Road_Barrier_1_Planted" );
	},

	Sas_Control_Room_Barricade_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Sas_Control_Room_Barricade_Dyno += 1;
		Util.MapDebugPrint( "Sas_Control_Room_Barricade_Planted" );
	},

	Train_System_Controls_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Train_System_Controls_Dyno += 1;
		Util.MapDebugPrint( "Train_System_Controls_Planted" );
	},

	assault_ladder_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.assault_ladder_Dyno += 1;
		Util.MapDebugPrint( "assault_ladder_Planted" );
	},

	storage_room_door_Planted = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.storage_room_door_Dyno += 1;
		Util.MapDebugPrint( "storage_room_door_Planted" );
	},

	Laboratory_Safe_Door_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Laboratory_Safe_Door_Dyno -= 1;
		Util.MapDebugPrint( "Laboratory_Safe_Door_Defused" );
	},

	North_MG_Shield_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.North_MG_Shield_Dyno -= 1;
		Util.MapDebugPrint( "North_MG_Shield_Defused" );
	},

	Pit_Bridge_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Pit_Bridge_Dyno -= 1;
		Util.MapDebugPrint( "Pit_Bridge_Defused" );
	},

	Pit_Bridge_1_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Pit_Bridge_1_Dyno -= 1;
		Util.MapDebugPrint( "Pit_Bridge_1_Defused" );
	},

	Pit_Bunker_Side_Gate_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Pit_Bunker_Side_Gate_Dyno -= 1;
		Util.MapDebugPrint( "Pit_Bunker_Side_Gate_Defused" );
	},

	Pit_Tank_Barrier_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Pit_Tank_Barrier_Dyno -= 1;
		Util.MapDebugPrint( "Pit_Tank_Barrier_Defused" );
	},

	River_Barrier_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.River_Barrier_Dyno -= 1;
		Util.MapDebugPrint( "River_Barrier_Defused" );
	},

	Road_Barrier_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Road_Barrier_Dyno -= 1;
		Util.MapDebugPrint( "Road_Barrier_Defused" );
	},

	Road_Barrier_1_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Road_Barrier_1_Dyno -= 1;
		Util.MapDebugPrint( "Road_Barrier_1_Defused" );
	},

	Sas_Control_Room_Barricade_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Sas_Control_Room_Barricade_Dyno -= 1;
		Util.MapDebugPrint( "Sas_Control_Room_Barricade_Defused" );
	},

	Train_System_Controls_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Train_System_Controls_Dyno -= 1;
		Util.MapDebugPrint( "Train_System_Controls_Defused" );
	},

	assault_ladder_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.assault_ladder_Dyno -= 1;
		Util.MapDebugPrint( "assault_ladder_Defused" );
	},

	storage_room_door_Defused = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.storage_room_door_Dyno -= 1;
		Util.MapDebugPrint( "storage_room_door_Defused" );
	},
	
	Laboratory_Safe_Door_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Laboratory_Safe_Door_Dyno = 0;
		
		SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_lock1" );
		
		Util.MapDebugPrint( "Laboratory_Safe_Door_Destroyed" );
	},

	North_MG_Shield_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.North_MG_Shield_Dyno = 0;

		Util.MapDebugPrint( "North_MG_Shield_Destroyed" );
	},

	Pit_Bridge_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Pit_Bridge_Dyno = 0;

		Util.MapDebugPrint( "Pit_Bridge_Destroyed" );
	},

	Pit_Bridge_1_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Pit_Bridge_1_Dyno = 0;

		Util.MapDebugPrint( "Pit_Bridge_1_Destroyed" );
	},

	Pit_Bunker_Side_Gate_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Pit_Bunker_Side_Gate_Dyno = 0;

		Util.MapDebugPrint( "Pit_Bunker_Side_Gate_Destroyed" );
	},

	Pit_Tank_Barrier_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Pit_Tank_Barrier_Dyno = 0;

		Util.MapDebugPrint( "Pit_Tank_Barrier_Destroyed" );
	},

	River_Barrier_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.River_Barrier_Dyno = 0;
		
		Util.MapDebugPrint( "River_Barrier_Destroyed" );
	},

	Road_Barrier_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Road_Barrier_Dyno = 0;

		Util.MapDebugPrint( "Road_Barrier_Destroyed" );
	},

	Road_Barrier_1_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Road_Barrier_1_Dyno = 0;
		
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_storage_room_door" );
		SetAvailableMapGoals( TEAM.AXIS, true, "CHECKPOINT.*" );
		Util.EnableGoal( "FLAG_obj_fuel.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Pit_Bridge" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Command_Post" );
		
		Util.MapDebugPrint( "Road_Barrier_1_Destroyed" );
	},

	Sas_Control_Room_Barricade_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Sas_Control_Room_Barricade_Dyno = 0;

		Util.MapDebugPrint( "Sas_Control_Room_Barricade_Destroyed" );
	},

	Tank_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }
			
		//tank 3 <>^3 Axis repaired the tank 3 !
		//mover_tank_03	
		
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Tank_1" );

		Util.MapDebugPrint( "Tank_Destroyed" );
	},

	Tank_1_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }
			
		//tank 1 <>^3 Axis repaired the tank 1 !
		//mover_tank_01
		
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Tank_2" );
		Util.MapDebugPrint( "Tank_1_Destroyed" );
	},

	Tank_2_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }
		//tank 2 <>^3 Axis repaired the tank 2 !
		//mover_tank_02  
		
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Tank_1" );
		
		Util.MapDebugPrint( "Tank_2_Destroyed" );
	},

	Train_System_Controls_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.Train_System_Controls_Dyno = 0;
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Train_System_Controls" );
		Util.MapDebugPrint( "Train_System_Controls_Destroyed" );
	},

	assault_ladder_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.assault_ladder_Dyno = 0;
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_assault_ladder" );
		
		if ( Map.Road_Barrier_1_Dyno == 1 ) //false
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT.*" );
			Util.DisableGoal("FLAG_obj_fuel.*");
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Pit_Bridge" );
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Command_Post" );
		}
		else if ( Map.Road_Barrier_1_Dyno == 0 ) //true
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "CHECKPOINT.*" );
			Util.EnableGoal("FLAG_obj_fuel.*");
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Pit_Bridge" );
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );
		}
		Util.MapDebugPrint( "assault_ladder_Destroyed" );
	},

	storage_room_door_Destroyed = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Map.storage_room_door_Dyno = 0;

		Util.MapDebugPrint( "storage_room_door_Destroyed" );
	},

	obj_ammo_01_Taken = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_ammo_01_Taken" );
	},

	obj_ammo_02_Taken = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_ammo_02_Taken" );
	},

	obj_fuel_can1_Taken = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_fuel_can1_Taken" );
	},

	obj_pit_key_01_Taken = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_pit_key_01_Taken" );
	},

	obj_refuel_can_01_Taken = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_refuel_can_01_Taken" );
	},

	obj_refuel_can_02_Taken = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_refuel_can_02_Taken" );
	},

	obj_refuel_can_03_Taken = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_refuel_can_03_Taken" );
	},

	obj_refuel_can_04_Taken = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_refuel_can_04_Taken" );
	},

	obj_refuel_can_05_Taken = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_refuel_can_05_Taken" );
	},

	obj_ammo_01_Returned = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_ammo_01_Returned" );
	},

	obj_ammo_02_Returned = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_ammo_02_Returned" );
	},

	obj_fuel_can1_Returned = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_fuel_can1_Returned" );
	},

	obj_pit_key_01_Returned = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_pit_key_01_Returned" );
	},

	obj_refuel_can_01_Returned = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_refuel_can_01_Returned" );
	},

	obj_refuel_can_02_Returned = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_refuel_can_02_Returned" );
	},

	obj_refuel_can_03_Returned = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_refuel_can_03_Returned" );
	},

	obj_refuel_can_04_Returned = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_refuel_can_04_Returned" );
	},

	obj_refuel_can_05_Returned = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_refuel_can_05_Returned" );
	},

	obj_ammo_01_Secured = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_ammo_01_Secured" );
	},

	obj_ammo_02_Secured = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_ammo_02_Secured" );
	},

	obj_fuel_can1_Secured = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_fuel_can1_Secured" );
	},

	obj_pit_key_01_Secured = function( trigger )
	{
		if ( TestMap )
			{ return; }
		
		Util.DisableGoal ("CAPPOINT_password");
		
		Util.MapDebugPrint( "obj_pit_key_01_Secured" );
	},

	obj_refuel_can_01_Secured = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_refuel_can_01_Secured" );
	},

	obj_refuel_can_02_Secured = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_refuel_can_02_Secured" );
	},

	obj_refuel_can_03_Secured = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_refuel_can_03_Secured" );
	},

	obj_refuel_can_04_Secured = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_refuel_can_04_Secured" );
	},

	obj_refuel_can_05_Secured = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "obj_refuel_can_05_Secured" );
	},

	spawn_castle_flag_Axis_Captured = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "spawn_castle_flag_Axis_Captured" );
	},

	spawn_castle_flag_Allies_Captured = function( trigger )
	{
		if ( TestMap )
			{ return; }

		Util.MapDebugPrint( "spawn_castle_flag_Allies_Captured" );
	},
//=========//	
//Stage 1
	ladder = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_ladder" );
		Util.MapDebugPrint( "Axis placed the mountain path ladder" );
	},

	Axis_Castle = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_GasDrop" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD.Pit_Bridge" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_North_MG_Shield" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_North_MG_Shield" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_assault_ladder" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_assault_ladder" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Command_Post" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );
		SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "CHECKPOINT.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_ladder" );
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Road_Barrier" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Road_Barrier" );
		SetGoalPriority( "PLANT_Road_Barrier", 0.82, TEAM.AXIS, CLASS.ENGINEER, true);
		SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_garagedoor" );
		Util.MapDebugPrint( "Axis secured the Castle" );
	},
//Stage 2
	Supply = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "CHECKPOINT.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_GasDrop" );
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_AmmoFuleDrop" );
		Util.EnableGoal( "FLAG_obj_refuel_can.*" );
		Util.EnableGoal( "FLAG_obj_ammo.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Pit_Bridge" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Pit_Bridge" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Command_Post" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Command_Post" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_River_Barrier" );
		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Castle_Side_Door" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Castle_Side_Door" );
		SetAvailableMapGoals( TEAM.AXIS, true, "GRENADE_fulegate" );
		Util.MapDebugPrint( "supply depot" );
	},
//Stage 2.5
	resupply = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_AmmoFuleDrop" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_River_Barrier" );
		SetAvailableMapGoals( TEAM.AXIS, false, "GRENADE_fulegate" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_garagedoor" );
		SetAvailableMapGoals( TEAM.AXIS, true, "MOVER_mobile_bridge_mover", true );
		SetAvailableMapGoals( TEAM.AXIS, true, "RIDE_Mobile" );

		if( Map.Garage_closed == true ) //true closed
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "RIDE_Mobile" );
			SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_garagedoor" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_garagedoor" );
		}
		else if( Map.Garage_open == true ) //true open
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "RIDE_Mobile" );
			SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_garagedoor" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_garagedoor" );
		}
		
		Util.MapDebugPrint( "Resupplyed the Tank" );
	},
//Stage 3
	Mobilebridge = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, true, "MOVER_mobile_bridge_mover", true );
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_AmmoFuleDrop" );
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_River_Barrier" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_River_Barrier" );
		SetAvailableMapGoals( TEAM.AXIS, true, "RIDE_Mobile" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_garagedoor" );
		SetAvailableMapGoals( TEAM.AXIS, true, "GRENADE_wall" );

		if( Map.Garage_closed == true ) //true closed
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "RIDE_Mobile" );
			SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_garagedoor" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_garagedoor" );
		}
		else if( Map.Garage_open == true ) //true open
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "RIDE_Mobile" );
			SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_garagedoor" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_garagedoor" );
		}
		Util.MapDebugPrint( "Mobile Bride" );
	},

	Garage_open  = function( trigger )
	{
		if ( TestMap )
		{ return; }
		
		Map.Garage_open = true;
		Map.Garage_closed = false;
		
		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_garagedoor" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_garagedoor" );
		SetAvailableMapGoals( TEAM.AXIS, true, "MOVER_mobile_bridge_mover", true );
		SetAvailableMapGoals( TEAM.AXIS, true, "RIDE_Mobile" );
		Util.MapDebugPrint( "Garage is open" );
	},

	Garage_closed  = function( trigger )
	{
		if ( TestMap )
		{ return; }
		
		Map.Garage_open = false;
		Map.Garage_closed = true;
		
		SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_garagedoor" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_garagedoor" );
		SetAvailableMapGoals( TEAM.AXIS, false, "RIDE_Mobile" );
		SetAvailableMapGoals( TEAM.AXIS, false, "MOVER_mobile_bridge_mover", false );
		Util.MapDebugPrint( "Garage is closed" );
	},

	Garage_dead  = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_garagedoor" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_garagedoor" );
		Util.MapDebugPrint( "secured the Garage" );
	},

	moblilebridgeout =
	{
		TriggerOnEntity = GetGoal("MOVER_mobile_bridge_mover").GetEntity(),

		OnEnter = function(ent)
		{
			Map.mobileout = false;
			Util.MapDebugPrint( "the mobile bridge is moving" );
		},
		OnExit = function(ent)
		{
			Map.mobileout = true;

			SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_garagedoor" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_garagedoor" );
			Util.MapDebugPrint( "the mobile bridge is out of the garage" );
		},
	},
//Stage 4
	River = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_River_Barrier" );
		SetAvailableMapGoals( TEAM.ALLIES, false,"BUILD_River_Barrier" );
		SetAvailableMapGoals( TEAM.AXIS, false, "RIDE_Mobile" );
		SetAvailableMapGoals( TEAM.AXIS, false, "MOVER_mobile_bridge_mover", false );
		Uitl.DisableGoal("SWITCH_garagedoor");
		
		// long way but build pit bridge - see pitbridge
		Util.MapDebugPrint( "Axis secured the River Barracks" );
	},

	Mobile_system = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "RIDE_Mobile" );
		Util.MapDebugPrint( "Mobile Bridge hydrolics systems pressurising" );
	},

	Mobile_ready = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, true, "RIDE_Mobile" );
		Util.MapDebugPrint( "Mobile Bridge Ready!" );
	},

	Mobile_dead = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "RIDE_Mobile" );
		Util.DisableGoal( "SWITCH_garagedoor" );
		
		Util.MapDebugPrint( "Mobile Bridge is deploying" );
	},
//Stage 5
	pit_dead = function( trigger )
	{
		if ( TestMap )
		{ return; }

		// self kill bots 
		Util.MapDebugPrint( "pit out post" );
	},
	
	pitbridge  = function( trigger )
	{
		if ( TestMap )
		{ return; }
		// build pit bridge
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Pit_Bridge_1" );
		Util.MapDebugPrint( "build pit bridge" );
	},
//STAGE 6
	pitmidspawn = function( trigger )
	{
		if ( TestMap )
		{ return; }
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Pit_Bridge_1" );
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Pit_Tank_Barrier" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Pit_Tank_Barrier" );
		Util.MapDebugPrint( "pitmidspawn" );
	},
//STAGE 7
//lift
	lift = function(trigger)
	{
		Map.liftPos = "moving";
		Map.Switches.liftup.Disabled = true;
		Util.MapDebugPrint("lift moving");

		sleep(6);
		vel = ToVector(trigger.Action);

		if (vel.z < 0)
		{
			Map.liftPos = "bottom";
			Map.Switches.liftup.Enabled = true;

			Util.MapDebugPrint("lift at bottom");
		}
		else if (vel.z > 0)
		{
			Map.lift1Pos = "top";
			Map.Switches.liftup.Disabled = true;

			Util.MapDebugPrint("lift at top");
		}
	},

	pitspawn = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Pit_Tank_Barrier" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Pit_Tank_Barrier" );
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Pit_Bunker_Side_Gate" );
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Sas_Control_Room_Barricade" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Sas_Control_Room_Barricade" );
		SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_password" );
		SetAvailableMapGoals( TEAM.AXIS, true, "FLAG_obj_pit_key_01" );
		Util.MapDebugPrint( "pitspawn" );
	},
//STAGE 8 TANK LOCKS
	obj_pit_key_01_Secured = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_lockA" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_lockA" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Sas_Control_Room_Barricade" );
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Sas_Control_Room_Barricade" );
		SetAvailableMapGoals( TEAM.AXIS, true, "GRENADE_control" );
		SetAvailableMapGoals( TEAM.AXIS, false, "CAPPOINT_password" );
		SetAvailableMapGoals( TEAM.AXIS, false, "FLAG_obj_pit_key_01" );
		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Pit_Bunker_Side_Gate" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Sas_Control_Room_Barricade" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Sas_Control_Room_Barricade" );
		
		Util.MapDebugPrint( "obj_pit_key_01_Secured" );
	},

	tankoutbunker=
	{
		TriggerOnEntity = GetGoal("MOVER_tank_03").GetEntity(),
		OnEnter = function(ent)
		{
			if ( Map.Bunkerfrontclosed == true )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_lockA" );
			}
			else if( Map.Bunkerfrontclosed == false )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_lockA" );
			}
			Util.MapDebugPrint( "Tank Outside Bunker" );
		},
		OnExit = function(ent)
		{
		},
	},

	tankinbunker=
	{
		TriggerOnEntity = GetGoal("MOVER_tank_03").GetEntity(),
		OnEnter = function(ent)
		{
		
			if( Map.Bunkerfrontclosed == true )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_lockA" );
				SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_lockB" );
			}
			else if( Map.Bunkerfrontopen == true )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_lockA" );
				SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_lockB" );
			}
			Util.MapDebugPrint( "Tank Inside Bunker" );
		},
		OnExit = function(ent)
		{
		},
	},

	Bunkerfrontclosed = function( trigger )
	{
		if ( TestMap )
		{ return; }
		
		Map.Bunkerfrontopen = false;
		Map.Bunkerfrontclosed = true;
		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_lockA" );
		SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_lockB" );
			
		Util.MapDebugPrint( "Bunker Door A Closed" );
	},

	Bunkerfrontopen = function( trigger )
	{
		if ( TestMap )
		{ return; }

		Map.Bunkerfrontopen = true;
		Map.Bunkerfrontclosed = false;
		SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_lockA" );
		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_lockB" );
		
		Util.MapDebugPrint( "Bunker Door A Open" );
	},

	Bunkerbackclosed = function( trigger )
	{
		if ( TestMap )
		{ return; }

		Map.Bunkerbackopen = false;
		Map.Bunkerbackclosed = true;
		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_lockA" );
		SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_lockB" );
		
		Util.MapDebugPrint( "Bunker Door B Closed" );
	},

	Bunkerbackopen = function( trigger )
	{
		if ( TestMap )
		{ return; }

		Map.Bunkerbackopen = true;
		Map.Bunkerbackclosed = false;
		
		Util.MapDebugPrint( "Bunker Door B Open" );
	},
//STAGE 9 DOOR1 //STAGE 10 DOOR2
	bunkerlock = function( trigger )
	{
		if ( TestMap )
		{ return; }

		Util.DisableGoal( "SWITCH_lockA" );
		Util.DisableGoal( "SWITCH_lockB" );
		Util.DisableGoal( "BUILD_Sas_Control_Room_Barricade" );
		Util.DisableGoal( "PLANT_Sas_Control_Room_Barricade" );
		Util.DisableGoal( "GRENADE_control" );
		Util.EnableGoal( "SWITCH_DoorA" );
		Util.EnableGoal( "SWITCH_DoorB" );
		
		Util.MapDebugPrint( "Tank Is Pass The Control Room" );
	},

	Lab_door1_open = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_DoorA" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_DoorA" );
		
		Util.MapDebugPrint( "opening Laboratory Door #1" );
	},

	Lab_door1_closed = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_DoorA" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_DoorA" );
		
		Util.MapDebugPrint( "closing Laboratory Door #1 " );
	},

	Lab_door1_dead = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_DoorA" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_DoorA" );
		
		Util.MapDebugPrint( "The tank has passed Laboratory Door #1" );
	},

	Lab_door2_open = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_DoorB" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_DoorB" );
		
		Util.MapDebugPrint( "opening Laboratory Door #2" );
	},

	Lab_door2_closed = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_DoorB" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_DoorB" );
		
		Util.MapDebugPrint( "closing Laboratory Door #2" );
	},

	Lab_door2_dead = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_DoorB" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_DoorB" );
		
		Util.MapDebugPrint( "The tank has passed Laboratory Door #2" );
	},
//STAGE 11 TRAM CONTROL / LAST DOOR /TANK
	
	deadtank =
	{
		TriggerOnEntity = GetGoal("MOVER_tank_03").GetEntity(),

		OnEnter = function(ent)
		{
			Util.DisableGoal( "BUILD_Tank" );
			Util.DisableGoal( "BUILD_Tank_1" );
			Util.DisableGoal( "BUILD_Tank_2" );
			Util.DisableGoal( "MOVER_Tank_01" );
			Util.DisableGoal( "MOVER_Tank_02" );
			Util.DisableGoal( "MOVER_Tank_03" );
		
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Laboratory_Safe_Door" );
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Train_System_Controls" );
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Train_System_Controls" );
			
			Util.MapDebugPrint( "the tank is in final resting position ENTER" );
		},
		OnExit = function(ent)
		{
			Util.MapDebugPrint( "the tank is in final resting position EXIT" );
		},
	},
	
	finaltank = function( trigger )
	{
		if ( TestMap )
		{ return; }

		Util.MapDebugPrint( "Tank is in final resting place !#1" );
	},
	
	Laboratory = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Train_System_Controls" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Train_System_Controls" );
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Laboratory_Safe_Door" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Tank.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, "MOVER_Tank.*" );
		
		Util.MapDebugPrint( "Laboratory Now in Axis Hands" );
	},

	Tram =
	{
		TriggerOnEntity = GetGoal("MOVER_convoyeur_1").GetEntity(),
		OnEnter = function(ent)
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "RIDE_Tram" );

			Util.MapDebugPrint( "Tram_Entered_Dissmount_Zone" );
		},
		OnExit = function(ent)
		{
			Util.MapDebugPrint( "Tram_Exited_Dissmount_Zone" );
		},
	},
//STAGE 12 MAIN LOCKS
	Laboratory_Safe_Door_Destroyed = function( trigger )
	{
		if ( TestMap )
		{ return; }

		Map.Laboratory_Safe_Door_Dyno = 0;
		
		SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_lock.*" );
		
		Util.MapDebugPrint( "Laboratory_Safe_Door_Destroyed" );
	},

	lockunlock = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_lock.*" );
		Util.MapDebugPrint( "Lock levers can be switched again" );
	},

	locked = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_lock.*" );
		Util.MapDebugPrint( "Wait 25 seconds before switching any other lock" );
	},
	
	Lock1_dead = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_lock1" );
		Util.MapDebugPrint( "disabled Lock #1" );
	},

	Lock2_dead = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_lock2" );
		Util.MapDebugPrint( "disabled Lock #2" );
	},

	Lock3_dead = function( trigger )
	{
		if ( TestMap )
		{ return; }

		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_lock3" );
		Util.MapDebugPrint( "disabled Lock #3" );
	},
	
	

	Axis_Win = function( trigger )
	{
		if ( TestMap )
		{ return; }

//Game Over
		if ( Map.Talk && MAP_TALK )
		{
			ETUtil.WinningChat( TEAM.AXIS );
			ETUtil.LosingChat( TEAM.ALLIES );
		}
		Util.MapDebugPrint( "Axis_Win" );
	},

};

global OnMapLoad = function()
{
	if ( TestMapOn )
		{ Util.AutoTestMap(); }

// Register callback functions
	OnTrigger( "The North Shield has been constructed.", Map.North_MG_Shield_Built );
	OnTrigger( "<> ^3Axis have built the Pit Bridge !", Map.Pit_Bridge_Built );
	OnTrigger( "<> ^3Axis built the bridge !", Map.Pit_Bridge_1_Built );
	OnTrigger( "<> ^3Allies constructed the Pit Tank Barrier !", Map.Pit_Tank_Barrier_Built );
	OnTrigger( "The River Barrier has been constructed.", Map.River_Barrier_Built );
	OnTrigger( "The Road Barrier has been constructed.", Map.Road_Barrier_Built );
	OnTrigger( "The Control Room Barrier has been constructed.", Map.Sas_Control_Room_Barricade_Built );
	OnTrigger( "<>^3 Axis repaired the tank 1 !", Map.Tank_Built );
	OnTrigger( "<>^3 Axis repaired the tank 2 !", Map.Tank_1_Built );
	OnTrigger( "<>^3 Axis repaired the tank 3 !", Map.Tank_2_Built );
	OnTrigger( "<>^3 Axis have built the conveyor controls !", Map.Train_System_Controls_Built );
	OnTrigger( "The Castle Ladder has been constructed.", Map.assault_ladder_Built );
	OnTrigger( "<> ^3Allies Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built );
	OnTrigger( "<> ^3Axis Command Post constructed. Charge speed increased!", Map.Axis_Command_Post_Built );
	OnTrigger( "Planted at the Laboratory Safe Door", Map.Laboratory_Safe_Door_Planted );
	OnTrigger( "Planted at the North MG Shield", Map.North_MG_Shield_Planted );
	OnTrigger( "Planted at the Pit Bridge", Map.Pit_Bridge_Planted );
	OnTrigger( "Planted at the Pit Bridge 1", Map.Pit_Bridge_1_Planted );
	OnTrigger( "Planted at the Pit Bunker Side Gate", Map.Pit_Bunker_Side_Gate_Planted );
	OnTrigger( "Planted at the Pit Tank Barrier", Map.Pit_Tank_Barrier_Planted );
	OnTrigger( "Planted at the River Barrier", Map.River_Barrier_Planted );
	OnTrigger( "Planted at the Road Barrier", Map.Road_Barrier_Planted );
	OnTrigger( "Planted at the Road Barrier 1", Map.Road_Barrier_1_Planted );
	OnTrigger( "Planted at the Sas Control Room Barricade", Map.Sas_Control_Room_Barricade_Planted );
	OnTrigger( "Planted at the Train System Controls", Map.Train_System_Controls_Planted );
	OnTrigger( "Planted at the assault ladder", Map.assault_ladder_Planted );
	OnTrigger( "Planted at the storage room door", Map.storage_room_door_Planted );
	OnTrigger( "Defused at the Laboratory Safe Door", Map.Laboratory_Safe_Door_Defused );
	OnTrigger( "Defused at the North MG Shield", Map.North_MG_Shield_Defused );
	OnTrigger( "Defused at the Pit Bridge", Map.Pit_Bridge_Defused );
	OnTrigger( "Defused at the Pit Bridge 1", Map.Pit_Bridge_1_Defused );
	OnTrigger( "Defused at the Pit Bunker Side Gate", Map.Pit_Bunker_Side_Gate_Defused );
	OnTrigger( "Defused at the Pit Tank Barrier", Map.Pit_Tank_Barrier_Defused );
	OnTrigger( "Defused at the River Barrier", Map.River_Barrier_Defused );
	OnTrigger( "Defused at the Road Barrier", Map.Road_Barrier_Defused );
	OnTrigger( "Defused at the Road Barrier 1", Map.Road_Barrier_1_Defused );
	OnTrigger( "Defused at the Sas Control Room Barricade", Map.Sas_Control_Room_Barricade_Defused );
	OnTrigger( "Defused at the Train System Controls", Map.Train_System_Controls_Defused );
	OnTrigger( "Defused at the assault ladder", Map.assault_ladder_Defused );
	OnTrigger( "Defused at the storage room door", Map.storage_room_door_Defused );
	OnTrigger( "<>^3 Axis destroyed the laboratory door !", Map.Laboratory_Safe_Door_Destroyed );
	OnTrigger( "The North Shield has been destroyed.", Map.North_MG_Shield_Destroyed );
	OnTrigger( "The Desert Bridge has been destroyed.", Map.Pit_Bridge_Destroyed );
	OnTrigger( "<>^3 Axis opened the bunker side Gate !", Map.Pit_Bunker_Side_Gate_Destroyed );
	OnTrigger( "<> ^3Axis destroyed the Pit Tank Barrier !", Map.Pit_Tank_Barrier_Destroyed );
	OnTrigger( "The River Barrier has been destroyed.", Map.River_Barrier_Destroyed );
	OnTrigger( "The Road Barrier has been destroyed.", Map.Road_Barrier_Destroyed );
	OnTrigger( "<> ^3Axis destroyed the Castle Gate !", Map.Road_Barrier_1_Destroyed );
	OnTrigger( "The Control Room Barrier has been destroyed.", Map.Sas_Control_Room_Barricade_Destroyed );
	OnTrigger( "<>^3 Allies damaged the tank 01!", Map.Tank_Destroyed );
	OnTrigger( "<>^3 Allies damaged the tank 02!", Map.Tank_1_Destroyed );
	OnTrigger( "<>^3 Allies damaged the tank 03!", Map.Tank_2_Destroyed );
	OnTrigger( "<>^3 Allies destroyed the conveyor controls !", Map.Train_System_Controls_Destroyed );
	OnTrigger( "The Castle Ladder has been destroyed", Map.assault_ladder_Destroyed );
	OnTrigger( "<> ^3Axis breached the Storage Room !", Map.storage_room_door_Destroyed );
	OnTrigger( "<> ^3Allies team has destroyed the Axis Command Post!", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "<> ^3Allies team has destroyed the Axis Command Post!", Map.Axis_Command_Post_Destroyed );
	OnTrigger( "<> ^3Axis are stealing the 1st Ammo Crate !", Map.obj_ammo_01_Taken );
	OnTrigger( "<> ^3Axis are stealing the 2nd Ammo Crate !", Map.obj_ammo_02_Taken );
	OnTrigger( "<> ^3Axis are stealing the Re-Fuel Can !", Map.obj_fuel_can1_Taken );
	OnTrigger( "<> ^3Axis are stealing the Bunker Door Codes !", Map.obj_pit_key_01_Taken );
	OnTrigger( "<> ^3Axis are stealing the 1st Fuel Can !", Map.obj_refuel_can_01_Taken );
	OnTrigger( "<> ^3Axis are stealing the 2nd Fuel Can !", Map.obj_refuel_can_02_Taken );
	OnTrigger( "<> ^3Axis are stealing the 3rd Fuel Can !", Map.obj_refuel_can_03_Taken );
	OnTrigger( "<> ^3Axis are stealing the 4th Fuel Can !", Map.obj_refuel_can_04_Taken );
	OnTrigger( "<> ^3Axis are stealing the 5th Fuel Can !", Map.obj_refuel_can_05_Taken );
	OnTrigger( "<> ^3Allies returned the 1st Ammo Crate.", Map.obj_ammo_01_Returned );
	OnTrigger( "<> ^3Allies returned the 2nd Ammo Crate.", Map.obj_ammo_02_Returned );
	OnTrigger( "<> ^3Allies returned the Re-Fuel Can", Map.obj_fuel_can1_Returned );
	OnTrigger( "<> ^3Allies returned the Pit Bunker Door Codes.", Map.obj_pit_key_01_Returned );
	OnTrigger( "<> ^3Allies returned the 1st Fuel Can.", Map.obj_refuel_can_01_Returned );
	OnTrigger( "<> ^3Allies returned the 2nd Fuel Can.", Map.obj_refuel_can_02_Returned );
	OnTrigger( "<> ^3Allies returned the 3rd Fuel Can.", Map.obj_refuel_can_03_Returned );
	OnTrigger( "<> ^3Allies returned the 4th Fuel Can.", Map.obj_refuel_can_04_Returned );
	OnTrigger( "<> ^3Allies returned the 5th Fuel Can.", Map.obj_refuel_can_05_Returned );
	OnTrigger( "<> ^3Axis Secured the 1st Ammo Crate.", Map.obj_ammo_01_Secured );
	OnTrigger( "<> ^3Axis Secured the 2nd Ammo Crate.", Map.obj_ammo_02_Secured );
	OnTrigger( "<> ^3Axis temporarily refueled the Tank !", Map.obj_fuel_can1_Secured );
	OnTrigger( "<> ^3Axis unlocked the Pit Bunker !", Map.obj_pit_key_01_Secured );
	OnTrigger( "<> ^3Axis Secured the 1st Fuel Can.", Map.obj_refuel_can_01_Secured );
	OnTrigger( "<> ^3Axis Secured the 2nd Fuel Can.", Map.obj_refuel_can_02_Secured );
	OnTrigger( "<> ^3Axis Secured the 3rd Fuel Can.", Map.obj_refuel_can_03_Secured );
	OnTrigger( "<> ^3Axis Secured the 4th Fuel Can.", Map.obj_refuel_can_04_Secured );
	OnTrigger( "<> ^3Axis Secured the 4th Fuel Can.", Map.obj_refuel_can_05_Secured );
	OnTrigger( "<> ^3Axis captured the Castle!", Map.spawn_castle_flag_Axis_Captured );
	OnTrigger( "<> ^3Allies reclaim the Castle!", Map.spawn_castle_flag_Allies_Captured );
//====//	
	OnTrigger( "<> ^3Axis placed the mountain path ladder", Map.ladder );
	OnTrigger( "<> ^3Axis secured the Castle", Map.Axis_Castle );
	OnTrigger( "<> ^3Mobile Bridge hydrolics systems pressurising ...", Map.Mobile_system );
	OnTrigger( "<> ^3Mobile Bridge Ready to deploy ! Enter the cabin to activate it !", Map.Mobile_ready );
	OnTrigger( "<> ^3Mobile Bridge is deploying !", Map.Mobile_dead );
	OnTrigger( "<> ^3Axis have breached the Pit Wall !", Map.pit_dead );
	OnTrigger( "<> ^3AXIS are opening Laboratory Door #1 !", Map.Lab_door1_open );
	OnTrigger( "<> ^3ALLIES are closing Laboratory Door #1 !", Map.Lab_door1_closed );
	OnTrigger( "<> ^3The tank has passed Laboratory Door #1 !", Map.Lab_door1_dead );
	OnTrigger( "<> ^3AXIS are opening Laboratory Door #2 !", Map.Lab_door2_open );
	OnTrigger( "<> ^3ALLIES are closing Laboratory Door #2 !", Map.Lab_door2_closed );
	OnTrigger( "<> ^3The tank has passed Laboratory Door #2 !", Map.Lab_door2_dead );
	OnTrigger( "<> ^3Axis have disabled Lock #1 !", Map.Lock1_dead );
	OnTrigger( "<> ^3Axis have disabled Lock #2 !", Map.Lock2_dead );
	OnTrigger( "<> ^3Axis have disabled Lock #3 !", Map.Lock3_dead );
	OnTrigger( "<> ^3Garage gate is open !", Map.Garage_open );
	OnTrigger( "<> ^3Garage door is closed !", Map.Garage_closed );
	OnTrigger( "<> ^3Axis secured the Depot Spawn", Map.Garage_dead );
	OnTrigger( "<> ^3The Tank is on the road again !", Map.resupply );
	OnTrigger( "bunker_monte_charge_goto", Map.lift );
	OnTrigger( "<> ^3Axis secured the Pit Bunker", Map.bunkerlock );
	OnTrigger( "<> ^7Security system : ^3Wait 25 seconds^7 before switching any other lock.", Map.locked );
	OnTrigger( "<> ^7Security system : Lock levers can be switched again.", Map.lockunlock );
	OnTrigger( "<> ^3Axis secured the River Barracks",Map.River );
	OnTrigger( "<> ^3Bunker front door is open.", Map.Bunkerfrontopen );
	OnTrigger( "<> ^3Bunker front door is closed.", Map.Bunkerfrontclosed );
	OnTrigger( "<> ^3Bunker back door is opened.", Map.Bunkerbackopen );
	OnTrigger( "<> ^3Bunker back door is closed.", Map.Bunkerbackclosed );
	OnTrigger( "<> ^3The Tank has reached the supply depot !", Map.Supply );
	OnTrigger( "<> ^3Find a way to enter the depot and get the mobile bridge !", Map.Mobilebridge );
	OnTrigger( "<> ^3Axis must construct the pit bridge.", Map.pitbridge );
	OnTrigger( "<> ^3Axis secured the Pit Mid Spawn", Map.pitmidspawn );
	OnTrigger( "<> ^3Axis secured the Pit Low Spawn", Map.pitspawn );
	OnTrigger( "<> ^3Axis have infiltrated the Laboratory !", Map.Laboratory );
	OnTrigger( "<> ^3Axis have unlocked safe !", Map.Axis_Win );
	
//Region Trigers
	outbunker = OnTriggerRegion(AABB(12842.050,672.961,-5990.107,13206.615,985.869,-5860.347), Map.tankoutbunker );
	inbunker = OnTriggerRegion(AABB(12799.125,1353.866,-5982.875,13303.337,1757.719,-5871.957), Map.tankinbunker );
	mobileout = OnTriggerRegion(AABB(5098.563,1105.779,-538.506,5450.802,1490.042,-400.200), Map.moblilebridgeout );
	controlroom = OnTriggerRegion(AABB(12282.874,1535.125,-5982.875,12560.137,1662.397,-5906.875), RegionTrigger.DisableCombatMovement );
	Train = OnTriggerRegion(AABB(11636.222,6279.126,-7358.875,11872.874,6489.652,-7276.875), Map.Tram ); 
	finaltank = OnTriggerRegion(AABB(12143.125,6747.502,-7230.875,12319.262,7143.156,-7022.647), Map.deadtank);
//Util.RemoveGoal	
	Util.RemoveGoal( "BUILD_Laboratory_Safe_Door" );
	Util.RemoveGoal( "BUILD_Road_Barrier_1" );
	Util.RemoveGoal( "BUILD_Laboratory_Safe_Door" );
	Util.RemoveGoal( "BUILD_Pit_Bunker_Side_Gate" );
	Util.RemoveGoal( "PLANT_Tank" );
	Util.RemoveGoal( "PLANT_Tank_1" );
	Util.RemoveGoal( "PLANT_Tank_2" );
	Util.RemoveGoal( "PLANT_Pit_Bridge_1" );
	Util.RemoveGoal( "BUILD_storage_room_door" );
//SetGoalPriority
	SetGoalPriority( "MOUNTMG42.*", 0.0, 0, CLASS.ENGINEER, true );
	SetGoalPriority( "MOUNTMG42.*", 0.0, 0, CLASS.MEDIC, true );
	SetGoalPriority( "PLANT_Road_Barrier_1", 0.91, TEAM.AXIS, CLASS.ENGINEER, true );
	SetGoalPriority( "BUILD_Tank", 1.00, TEAM.AXIS, CLASS.ENGINEER, true );
	SetGoalPriority( "BUILD_Tank_1", 1.00, TEAM.AXIS, CLASS.ENGINEER, true );
	SetGoalPriority( "BUILD_Tank_2", 1.00, TEAM.AXIS, CLASS.ENGINEER, true );
	SetGoalPriority( "BUILD_assault_ladder", 0.91, TEAM.AXIS, CLASS.ENGINEER, true );
//Stage 0	
	Util.DisableGoal( ".*", true ); // all but routes
	SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_North_MG_Shield" );
	SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_assault_ladder" );
	SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Road_Barrier_1" );
	SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_GasDrop" );
//~SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_.*" );	
	SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_North_MG_Shield" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_assault_ladder" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Road_Barrier" );
	SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Command_Post" );
// Max users per goal
	Util.SetMaxUsers( 1, "ATTACK_.*" );
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "SNIPE_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 1, "MOBILEMG42_.*" );
	Util.SetMaxUsers( 1, "MOBILEMORTAR_.*" );
	Util.SetMaxUsers( 1, "AIRSTRIKE_.*" );
	Util.SetMaxUsers( 1, "CALLARTILLERY_.*" );
	Util.SetMaxUsers( 2, "PLANT.*" );
	Util.SetMaxUsers( 2, "BUILD.*" );
	Util.SetMaxUsers( 3, "CHECKPOINT.*" );
	Util.SetMaxUsers( 1, "CAMP_.*" );
	Util.SetMaxUsers( 1, "PLANTMINE_.*" );
//Util.AddUseWp
	Util.AddUseWp( "PLANT_Road_Barrier_1", "gate1" );
	Util.AddUseWp( "PLANT_Road_Barrier_1", "gate2" );
	Util.AddUseWp( "PLANT_Road_Barrier_1", "gate3" );
	Util.AddUseWp( "PLANT_Road_Barrier_1", "gate4" );
	Util.AddUseWp( "PLANT_Road_Barrier_1", "gate5" );
	Util.AddUseWp( "PLANT_Road_Barrier", "road1" );
	Util.AddUseWp( "PLANT_Road_Barrier", "road2" );
	Util.AddUseWp( "PLANT_Road_Barrier", "road3" );
	Util.AddUseWp( "PLANT_Road_Barrier", "road4" );
	Util.AddUseWp( "PLANT_Road_Barrier", "road5" );
// Camp times
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=15, MaxCampTime=90} );
	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=10, MaxCampTime=60} );

	Util.MapDebugPrint( "Omni-bot map script for " + GetMapName() + " executed." );
};

global OnBotJoin = function( bot )
{
// Uncomment for shootable breakables
	bot.TargetBreakableDist = 90.0;
// Only set MaxViewDistance on maps with limited sight (e.g. fog)
	bot.MaxViewDistance = 2400;
};

global InitializeRoutes = function()
{
	MapRoutes =
	{
		BUILD_assault_ladder =
		{
		},
		PLANT_assault_ladder =
		{
		},
		FLAG_obj_fuel_can1 =
		{
		},
		PLANT_Road_Barrier_1 =
		{
		},
		BUILD_North_MG_Shield =
		{
		},
		PLANT_North_MG_Shield =
		{
		},
		PLANT_storage_room_door =
		{
		},
		BUILD_Pit_Bridge =
		{
		},
		PLANT_Pit_Bridge =
		{
		},
		PLANT_Road_Barrier =
		{
		},
		BUILD_Command_Post =
		{
		},
		PLANT_Command_Post =
		{
		},
		FLAG_obj_refuel_can_01 =
		{
		},
		FLAG_obj_refuel_can_02 =
		{
		},
		FLAG_obj_refuel_can_03 =
		{
		},
		FLAG_obj_refuel_can_04 =
		{
		},
		FLAG_obj_refuel_can_05 =
		{
		},
		FLAG_obj_ammo_02 =
		{
		},
		FLAG_obj_ammo_01 =
		{
		},
		CHECKPOINT_spawn_castle_flag =
		{
		},
		BUILD_Pit_Bridge_1 =
		{
		},
		BUILD_Pit_Tank_Barrier =
		{
		},
		PLANT_Pit_Tank_Barrier =
		{
		},
		BUILD_Sas_Control_Room_Barricade =
		{
		},
		PLANT_Sas_Control_Room_Barricade =
		{
		},
		BUILD_Tank =
		{
		},
		BUILD_River_Barrier =
		{
		},
		PLANT_River_Barrier =
		{
		},
		FLAG_obj_pit_key_01 =
		{
		},
		BUILD_Tank_1 =
		{
		},
		BUILD_Train_System_Controls =
		{
		},
		PLANT_Train_System_Controls =
		{
		},
		PLANT_Laboratory_Safe_Door =
		{
		},
		PLANT_Pit_Bunker_Side_Gate =
		{
		},
		BUILD_Tank_2 =
		{
		},
	};
	Util.Routes(MapRoutes);
};
