//==========================================================================================
//
//	canyon_depths_b3.gm
//
//	Who  	When		What
//------------------------------------------------------------------------------------------
//	^4Tardis	31 August 2014	Initial Script
//
//==========================================================================================
//

global Map =
{
	Debug = 1, // please set to zero before distributing your script
	ShowMovers = false,
	Talk = true, //set Talk to false if you don't want the bots to cheer after winning game:

	Castle_Side_Door_Dyno = 0,
	Axis_Command_Post_Dyno = 0,
	Allied_Command_Post_Dyno = 0,
	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,
	Bunkerfrontclosed = true,
	Bunkerfrontopen = false,
	Bunkerbackclosed = true,
	Bunkerbackopen = false,
	mobileout = false,
	MainGate = false, //false
	Garage_open = true, //open at start
	Garage_closed = false, //is not open at start

	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
		},
		
		//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;
			},
		},
	},

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

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

	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" );
	},

	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" );
	},

	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_Bunker_Side_Gate_Built = function( trigger )
	{
		if ( TestMap )
		{ return; }

		Util.MapDebugPrint( "Pit_Bunker_Side_Gate_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, "SWITCH_ladder" );
		Util.MapDebugPrint( "assault_ladder_Built" );
	},

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

		Map.Castle_Side_Door_Dyno = 0;
		Util.EnableGoal( "FLAG_obj_fuel.*" );

		if ( Map.MainGate == false ) //false
		{
			Util.DisableGoal( "CHECKPOINT.*" );
			Util.DisableGoal( "FLAG_obj_fuel.*" );
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Command_Post" );
		}
		else if ( Map.MainGate == true ) //true
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "CHECKPOINT.*" );
			Util.EnableGoal( "FLAG_obj_fuel.*" );
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Pit_Bridge" );
			SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_ladder" );
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );
		}
		Util.MapDebugPrint( "Castle_Side_Door_Destroyed" );
	},

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

		Map.Command_Post_Dyno = 0;
		Util.MapDebugPrint( "Command_Post_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;
		Map.MainGate = 1;

		SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_ladder" );
		SetAvailableMapGoals( TEAM.AXIS, true, "CHECKPOINT.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );
		Util.EnableGoal( "FLAG_obj_fuel.*" );
		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; }
		
		Util.MapDebugPrint( "Tank_Destroyed" );
	},

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

		Util.MapDebugPrint( "Tank_1_Destroyed" );
	},

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

		Util.MapDebugPrint( "Tank_2_Destroyed" );
	},

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

		Map.Train_System_Controls_Dyno = 0;
		Util.MapDebugPrint( "Train_System_Controls_Destroyed" );
	},

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

		Map.assault_ladder_Dyno = 0;

		if ( Map.MainGate == false ) //false
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT.*" );
			Util.DisableGoal("FLAG_obj_fuel.*");
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Pit_Bridge" );
			SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_ladder" );
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Command_Post" );
		}
		else if ( Map.MainGate == true ) //true
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "CHECKPOINT.*" );
			Util.EnableGoal("FLAG_obj_fuel.*");
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Pit_Bridge" );
			SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_ladder" );
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );
		}
		Util.MapDebugPrint( "assault_ladder_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_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" );
		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.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 );
		// long way but build pit bridge
		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" );
		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_garagedoor" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_garagedoor" );
		Util.MapDebugPrint( "Mobile Bridge is deploying" );
	},

	//stage 5
	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, 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" );
		Util.MapDebugPrint( "obj_pit_key_01_Secured" );
	},

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

	tankinbunker=
	{
		TriggerOnEntity = GetGoal("MOVER_tank_03").GetEntity(),
		OnEnter = function(ent)
		{
			if(Map.Bunkerfrontclosed == false)
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_lockA" );
				SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_lockB" );
			}
			else 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" );
			}
			else if(Map.Bunkerbackclosed == false)
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_lockA" );
				SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_lockB" );
			}
			else if(Map.Bunkerbackopen == true)
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_lockA" );
			}
			Util.MapDebugPrint( "Tank Inside Bunker" );
		},
		OnExit = function(ent)
		{
		},
	},

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

		Map.Bunkerfrontclosed = true;
		Map.Bunkerfrontopen = false;
		Util.MapDebugPrint( "Bunker Door A Closed" );
	},

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

		Map.Bunkerfrontopen = true;
		Map.Bunkerfrontclosed = false;
		Util.MapDebugPrint( "Bunker Door A Open" );
	},

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

		Map.Bunkerbackclosed = true;
		Map.Bunkerbackopen = false;
		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; }

		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_lockA" );
		SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_lockB" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Sas_Control_Room_Barricade" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Sas_Control_Room_Barricade" );
		SetAvailableMapGoals( TEAM.AXIS, false, "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
	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.*" );
		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 Castle Sidedoor has been constructed.", Map.Castle_Side_Door_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( "The North Shield has been constructed.", Map.North_MG_Shield_Built );
	OnTrigger( "Train_System_Controls", Map.Pit_Bridge_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 !", Map.Tank_Built );
	OnTrigger( "<>^3 Axis repaired the tank !", Map.Tank_1_Built );
	OnTrigger( "<>^3 Axis repaired the tank !", 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( "Planted at the Castle Side Door", Map.Castle_Side_Door_Planted );
	//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 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( "Defused at the Castle Side Door", Map.Castle_Side_Door_Defused );
	//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 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( "<>^3 Axis opened the bunker side Gate !", Map.Castle_Side_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( "<>^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 Small Pit 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 !", Map.Tank_Destroyed );
	OnTrigger( "<>^3 Allies damaged the tank !", Map.Tank_1_Destroyed );
	OnTrigger( "<>^3 Allies damaged the tank !", 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 are stealing the Fuel Can !", Map.obj_fuel_can1_Taken );
	OnTrigger( "<> ^3Allies returned the Fuel Can.", Map.obj_fuel_can1_Returned );
	OnTrigger( "<> ^3Axis temporarily refueled the Tank !", Map.obj_fuel_can1_Secured );
	OnTrigger( "<> ^3Axis are stealing the Bunker Door Codes !", Map.obj_pit_key_01_Taken );
	OnTrigger( "<> ^3Allies returned the Pit Bunker Door Codes.", Map.obj_pit_key_01_Returned );
	OnTrigger( "<> ^3Axis unlocked the Pit Bunker !", Map.obj_pit_key_01_Secured );
	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( "^3Allies returned the 1st Ammo Crate.", Map.obj_ammo_01_Returned );
	OnTrigger( "^3Allies returned the 2nd Ammo Crate.", Map.obj_ammo_02_Returned );
	OnTrigger( "<> ^3The tank has enough ammo now.", Map.obj_ammo_01_Secured );
	OnTrigger( "<> ^3The tank has enough ammo now.", Map.obj_ammo_02_Secured );
	OnTrigger( "<> ^3Axis are stealing the 2nd Fuel Can !", Map.obj_refuel_can_01_Taken );
	OnTrigger( "<> ^3Axis are stealing the 3rd Fuel Can !", Map.obj_refuel_can_02_Taken );
	OnTrigger( "<> ^3Axis are stealing the 4th Fuel Can !", Map.obj_refuel_can_03_Taken );
	OnTrigger( "<> ^3Axis are stealing the 5th Fuel Can !", Map.obj_refuel_can_04_Taken );
	OnTrigger( "<> ^3Axis are stealing the 6th Fuel Can !", Map.obj_refuel_can_05_Taken );
	OnTrigger( "<> ^3Allies returned the 2nd Fuel Can.", Map.obj_refuel_can_01_Returned );
	OnTrigger( "<> ^3Allies returned the 3rd Fuel Can.", Map.obj_refuel_can_02_Returned );
	OnTrigger( "<> ^3Allies returned the 4th Fuel Can.", Map.obj_refuel_can_03_Returned );
	OnTrigger( "<> ^3Allies returned the 5th Fuel Can.", Map.obj_refuel_can_04_Returned );
	OnTrigger( "<> ^3Allies returned the 6th Fuel Can.", Map.obj_refuel_can_05_Returned );
	OnTrigger( "<> ^3Axis Secured the 2nd Fuel Can !", Map.obj_refuel_can_01_Secured );
	OnTrigger( "<> ^3Axis Secured the 3rd Fuel Can !", Map.obj_refuel_can_02_Secured );
	OnTrigger( "<> ^3Axis Secured the 4th Fuel Can !", Map.obj_refuel_can_03_Secured );
	OnTrigger( "<> ^3Axis Secured the 5th Fuel Can !", Map.obj_refuel_can_04_Secured );
	OnTrigger( "<> ^3Axis Secured the 6th 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( "<> ^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 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(12896.360,503.767,-5988.475,13098.924,962.048,-5879.069), Map.tankoutbunker );
	inbunker = OnTriggerRegion(AABB(12904.686,1271.315,-5982.875,13145.820,1628.629,-5864.516), 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 ); //TO EDIT

	Util.DisableGoal( ".*", true ); // all but routes
	//~SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_.*" );
	//~SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_.*" );
	Util.DisableGoal( "AMMOCAB.*" ); //need to sort this stages
	Util.DisableGoal( "HEALTHCAB.*" ); //need to sort this stages
	Util.DisableGoal( "MOUNTMG42.*" ); //need to sort this stages
	//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_Pit_Bridge_1" );
	//Util.EnableGoal
	//~SetAvailableMapGoals
	//stage 0
	Util.EnableGoal( "BUILD.*" ); //need to limit this
	SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Pit_Bridge_1" );
	SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Train_System_Controls" );
	SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Sas_Control_Room_Barricade" );
	SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Command_Post" );
	Util.EnableGoal( "PLANT.*" ); //need to limit this
	SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Pit_Bunker_Side_Gate" );
	SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Laboratory_Safe_Door" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Train_System_Controls" );
	SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Sas_Control_Room_Barricade" );
	SetAvailableMapGoals( TEAM.AXIS, true, "CAPPOINT_GasDrop" );
	//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 );
	//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_Castle_Side_Door", "SIDEDOOR" );
	// 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( 3, "CHECKPOINT.*" );
	Util.SetMaxUsers( 1, "CAMP_.*" );
	Util.SetMaxUsers( 1, "PLANTMINE_.*" );
	// Camp times
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=15, MaxCampTime=90} );
	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=10, MaxCampTime=60} );
	
	Util.UpdateSwitchData();
	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 =
		{
		},
		BUILD_Road_Barrier =
		{
		},
		PLANT_Road_Barrier =
		{
		},
		PLANT_Road_Barrier_1 =
		{
		},
		BUILD_Castle_Side_Door =
		{
		},
		PLANT_Castle_Side_Door =
		{
		},
		BUILD_North_MG_Shield =
		{
		},
		PLANT_North_MG_Shield =
		{
		},
		BUILD_Pit_Bridge =
		{
		},
		PLANT_Pit_Bridge =
		{
		},
		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_Tank_2 =
		{
		},
		BUILD_Train_System_Controls =
		{
		},
		PLANT_Train_System_Controls =
		{
		},
		PLANT_Laboratory_Safe_Door =
		{
		},
		PLANT_Pit_Bunker_Side_Gate =
		{
		},
	};
	Util.Routes(MapRoutes);
};
