//==========================================================================================
//	tankbuster.gm
//
//	Who      	When		What
//------------------------------------------------------------------------------------------
//	Qiki		26 June 2012	Initial Script
//	Native12	13.11.2012	Ready to test
//	Native12	15.11.2012	Added plantmine goals behind workshop door
//	Native12	20.11.2012	Added routes, moved some goals.....
//	Native12	24.11.2012	Added priority for grenade (thx Palota), change in goal MOBILEMG42_Axis_FrontDefend_1
//					Added navigate
//	Native12	25.11.2012	Forgotten facing in "MOUNT_Rand"
//	Native12	02.01.2013	fix logic errors
//
//	Associated files:	tankbuster.way		24.11.2012	138 kB (141 630 b)
//				tankbuster_goals.gm	25.11.2012	91,6 kB (93 816 b)
//
//==========================================================================================
//

global Map =
{
	Debug = 0,

	Allied_Command_Post_Dyno = 0,
	Assault_Ramp_Dyno = 0,
	Axis_Command_Post_Dyno = 0,
	Axis_Depot_MG42_Dyno = 0,
	Hut_MG42_Dyno = 0,
	Lorry_Wreck_Dyno = 0,
	Workshop_Door_Dyno = 0,

	SignalTransmitted = false,
	AxisCommandPostBuilt = false,
	AlliedCommandPostBuilt = false,
	the88mmdestroyed = false,
	Allies_OnTheRoad = 0,
	Allies_InMinefield = 0,
	Allies_OnHilltop = 0,
	cannon_is_pointed_at_the_road = false,
	cannon_is_pointed_at_the_hilltop = true,
	cannon_is_pointed_at_the_minefield = false,
	gun_rotates = false,
	switch_is_up = true,
	TruckIsOnTheRoad = false,
	Fire_switch_enabled = true,
	LorryWreckDestroyed = false,
	BombTruckBuilt = false,
	Truck_OnTheBridge = false,
	BombTruckOverBridge = false,
	BombTruckAtDepotGates = false,
	Allies_NearTanks = 0,
	StationFlagAllies = false,
	KartoffelDestroyed = false,
	KuhhirtDestroyed = false,
	RandDestroyed = false,
	AbgrundDestroyed = false,
	KohlmannDestroyed = false,
	SchnepferDestroyed = false,
	KrummDestroyed = false,
	FelsenDestroyed = false,
	fbWindow_exploded = false,

	Movers =
	{
		"MOVER_fan_electrics",
		"MOVER_tank6",
	},

	Navigation =
	{
		//  	/bot waypoint_setproperty paththrough Navigation_PT:jump
		jump =
		{
			navigate = function(_this)
			{
				wpTable = {};
				Wp.GetWaypointByName("Jump", wpTable);
				if ( _this.Goto(wpTable.position) == EVENT.PATH_SUCCESS )
				{
					_this.AddAimRequest(Priority.VeryHigh, "facing", wpTable.facing);
					sleep(0.1);
					_this.Bot.HoldButton(BTN.JUMP, 0.55);
					_this.Bot.HoldButton(BTN.FORWARD, 0.55);
					sleep(0.55);
				}
			},
		},

		//  	/bot waypoint_setproperty paththrough Navigation_PT:ammo
		ammo =
		{
			navigate = function(_this)
			{
				wpTable = {};
				Wp.GetWaypointByName("Ammo", wpTable);
				if ( _this.Goto(wpTable.position) == EVENT.PATH_SUCCESS )
				{
					_this.AddAimRequest(Priority.VeryHigh, "facing", wpTable.facing);
					sleep(1.9);
					_this.Bot.HoldButton(BTN.FORWARD, 0.25);
					sleep(0.25);
				}
			},
		},

		//  	/bot waypoint_setproperty paththrough Navigation_PT:fbwindow
		fbwindow =
		{
			EvalFunc = function() // if this function returns false, navigation will not run
			{
				return !Map.fbWindow_exploded;
			},

			navigate = function(_this)
			{
				if ( Map.fbWindow_exploded )
				{
					yield();
					return;
				}

				_this.AddWeaponRequest(Priority.High, WEAPON.KNIFE);
				_this.AddAimRequest(Priority.High, "facing", Vector3(-0.179001, -0.982332, 0.054621));

				while( !Map.fbWindow_exploded ) {
					_this.Bot.HoldButton(BTN.ATTACK1, 1);
					yield();
				}

				_this.ReleaseAimRequest();
				_this.ReleaseWeaponRequest();
			},
		},
	},

	Roles =
	{
		AXIS =
		{
			AllBots = true, // each bot is considered for a role
			DEFENDER =	//DEFEND Minefield
			{
				numbots = 4,
				crucialClass = CLASS.SOLDIER,
			},
			DEFENDER1 =	//DEFEND Hilltop & switches
			{
				numbots = 3,
				crucialClass = CLASS.FIELDOPS,
			},
			DEFENDER2 =	//DEFEND Road
			{
				numbots = 4,
				crucialClass = CLASS.ENGINEER,
			},
		},

		ALLIES =
		{
			AllBots = true, // each bot is considered for a role
			ATTACKER =
			{
				numbots = 4,
				crucialClass = CLASS.ENGINEER,
			},
			ATTACKER1 =
			{
				numbots = 3,
				crucialClass = CLASS.FIELDOPS,
			},
			ATTACKER2 =
			{
				numbots = 4,
				crucialClass = CLASS.ENGINEER,
			},
		},
	},

	Allied_Command_Post_Built = function( trigger )
	{

		Map.AlliedCommandPostBuilt = true;

		if ( !Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Allied_Command_Post" );

			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Allied_Command_Post" );
		}

		Util.MapDebugPrint( "^3Allied_Command_Post_Built" );
	},

	Allied_Command_Post_Planted = function( trigger )
	{

		Map.Allied_Command_Post_Dyno += 1;

		if ( Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Allied_Command_Post_.*" );
		}

		Util.MapDebugPrint( "^3Allied_Command_Post_Planted" );
	},

	Allied_Command_Post_Defused = function( trigger )
	{

		Map.Allied_Command_Post_Dyno -= 1;

		Util.MapDebugPrint( "^3Allied_Command_Post_Defused" );
	},

	Allied_Command_Post_Destroyed = function( trigger )
	{

		Map.AlliedCommandPostBuilt = false;

		if ( Map.Allied_Command_Post_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Allied_Command_Post_.*" );
		}

		if ( !Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Allied_Command_Post" );

			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Allied_Command_Post" );
		}

		Map.Allied_Command_Post_Dyno = 0;

		Util.MapDebugPrint( "^3Allied_Command_Post_Destroyed" );
	},

	Axis_Command_Post_Built = function( trigger )
	{

		Map.AxisCommandPostBuilt = true;

		if ( !Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Axis_Command_Post" );

			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Axis_Command_Post" );

			if ( !Map.the88mmdestroyed )
			{
				if ( Map.BombTruckAtDepotGates and !Map.AlliedCommandPostBuilt )
				{
					if ( !Map.cannon_is_pointed_at_the_minefield )
					{
						SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_Axis_Fire" );

						SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Minefield" );
					}
				}
				else if ( Map.TruckIsOnTheRoad )
				{
					if ( !Map.cannon_is_pointed_at_the_road )
					{
						SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_Axis_Fire" );

						SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Road" );
					}
				}
				else
				{
					if ( Map.cannon_is_pointed_at_the_road )
					{
						if ( Map.Allies_OnHilltop > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Hilltop" );
						}
						if ( Map.Allies_InMinefield > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Minefield" );
						}
					}

					if ( Map.cannon_is_pointed_at_the_hilltop )
					{
						if ( Map.Allies_InMinefield > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Minefield" );
						}
						if ( Map.Allies_OnTheRoad > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Road" );
						}
					}

					if ( Map.cannon_is_pointed_at_the_minefield )
					{
						if ( Map.Allies_OnHilltop > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Hilltop" );
						}
						if ( Map.Allies_OnTheRoad > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Road" );
						}
					}
				}
			}
		}

		Util.MapDebugPrint( "^3Axis_Command_Post_Built" );
	},

	Axis_Command_Post_Planted = function( trigger )
	{

		Map.Axis_Command_Post_Dyno += 1;

		if ( Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Axis_Command_Post_.*" );
		}

		Util.MapDebugPrint( "^3Axis_Command_Post_Planted" );
	},

	Axis_Command_Post_Defused = function( trigger )
	{

		Map.Axis_Command_Post_Dyno -= 1;

		Util.MapDebugPrint( "^3Axis_Command_Post_Defused" );
	},

	Axis_Command_Post_Destroyed = function( trigger )
	{

		Map.AxisCommandPostBuilt = false;

		if ( Map.Axis_Command_Post_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Axis_Command_Post_.*" );
		}

		if ( !Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Axis_Command_Post" );

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

			if ( !Map.the88mmdestroyed )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, {
					"SWITCH_Axis_Hilltop",
					"SWITCH_Axis_Minefield",
					"SWITCH_Axis_Road",
				});
			}
		}

		Map.Axis_Command_Post_Dyno = 0;

		Util.MapDebugPrint( "^3Axis_Command_Post_Destroyed" );
	},

	Assault_Ramp_Built = function( trigger )
	{

		if ( !Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Assault_Ramp" );

			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Assault_Ramp" );
		}

		Util.MapDebugPrint( "^3Assault_Ramp_Built" );
	},

	Assault_Ramp_Planted = function( trigger )
	{

		Map.Assault_Ramp_Dyno += 1;

		if ( Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Assault_Ramp_.*" );
		}

		Util.MapDebugPrint( "^3Assault_Ramp_Planted" );
	},

	Assault_Ramp_Defused = function( trigger )
	{

		Map.Assault_Ramp_Dyno -= 1;

		Util.MapDebugPrint( "^3Assault_Ramp_Defused" );
	},

	Assault_Ramp_Destroyed = function( trigger )
	{

		if ( Map.Assault_Ramp_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Assault_Ramp_.*" );
		}

		if ( !Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Assault_Ramp" );

			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Assault_Ramp" );
		}

		Map.Assault_Ramp_Dyno = 0;

		Util.MapDebugPrint( "^3Assault_Ramp_Destroyed" );
	},

	Axis_Depot_MG42_Built = function( trigger )
	{

		if ( !Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Axis_Depot_MG42" );

			SetAvailableMapGoals( TEAM.AXIS, true, {
				"MOUNTMG42_Axis_Depot_MG42",
				"REPAIRMG42_Axis_Depot_MG42",
			});
		}

		Util.MapDebugPrint( "^3Axis_Depot_MG42_Built" );
	},

	Axis_Depot_MG42_Planted = function( trigger )
	{

		Map.Axis_Depot_MG42_Dyno += 1;

		if ( Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Axis_Depot_MG42_.*" );
		}

		Util.MapDebugPrint( "^3Axis_Depot_MG42_Planted" );
	},

	Axis_Depot_MG42_Defused = function( trigger )
	{

		Map.Axis_Depot_MG42_Dyno -= 1;

		Util.MapDebugPrint( "^3Axis_Depot_MG42_Defused" );
	},

	Axis_Depot_MG42_Destroyed = function( trigger )
	{

		Map.Axis_Depot_MG42_Dyno = 0;

		if ( !Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"MOUNTMG42_Axis_Depot_MG42",
				"REPAIRMG42_Axis_Depot_MG42",
			});

			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Axis_Depot_MG42" );
		}

		Util.MapDebugPrint( "^3Axis_Depot_MG42_Destroyed" );
	},

	Bomb_Truck_Built = function( trigger )
	{

		Map.BombTruckBuilt = true;

		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Bomb_Truck" );

		if ( !Map.BombTruckAtDepotGates )
		{
			if ( !Map.BombTruckAtBarrier )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_Bomb_Truck" );
			}
			else
			{
				if ( Map.LorryWreckDestroyed )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_Bomb_Truck" );
				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_Bomb_Truck" );
				}
			}
		}

		if ( Map.Truck_OnTheBridge )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "GRENADE_Axis_TruckOnTheBridge_.*" );
		}

		if ( Map.BombTruckOverBridge )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "GRENADE_Axis_TruckOverBridge_.*" );
		}

		Util.MapDebugPrint( "^3Bomb_Truck_Built" );
	},

	Bomb_Truck_Destroyed = function( trigger )
	{

		Map.BombTruckBuilt = false;

		SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_Bomb_Truck" );

		if ( !Map.BombTruckAtDepotGates )
		{
			if ( Map.BombTruckAtBarrier and !Map.LorryWreckDestroyed )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Bomb_Truck" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Bomb_Truck" );
			}
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Bomb_Truck" );
		}

		if ( Map.Truck_OnTheBridge )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "GRENADE_Axis_TruckOnTheBridge_.*" );
		}

		if ( Map.BombTruckOverBridge )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "GRENADE_Axis_TruckOverBridge_.*" );
		}

		Util.MapDebugPrint( "^3Bomb_Truck_Destroyed" );
	},

	Hut_MG42_Built = function( trigger )
	{

		if ( !Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Hut_MG42" );

			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"REPAIRMG42_Hut_MG42",
				"MOUNTMG42_Hut_MG42",
			});

			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Hut_MG42" );
		}

		Util.MapDebugPrint( "^3Hut_MG42_Built" );
	},

	Hut_MG42_Planted = function( trigger )
	{

		Map.Hut_MG42_Dyno += 1;

		if ( Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Hut_MG42_.*" );
		}

		Util.MapDebugPrint( "^3Hut_MG42_Planted" );
	},

	Hut_MG42_Defused = function( trigger )
	{

		Map.Hut_MG42_Dyno -= 1;

		Util.MapDebugPrint( "^3Hut_MG42_Defused" );
	},

	Hut_MG42_Destroyed = function( trigger )
	{

		if ( Map.Hut_MG42_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "DEFUSE_Hut_MG42_.*" );
		}

		if ( !Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Hut_MG42" );

			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"REPAIRMG42_Hut_MG42",
				"MOUNTMG42_Hut_MG42",
			});

			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Hut_MG42" );
		}

		Map.Hut_MG42_Dyno = 0;

		Util.MapDebugPrint( "^3Hut_MG42_Destroyed" );
	},

	Lorry_Wreck_Planted = function( trigger )
	{

		Map.Lorry_Wreck_Dyno += 1;

		Util.MapDebugPrint( "^3Lorry_Wreck_Planted" );
	},

	Lorry_Wreck_Defused = function( trigger )
	{

		Map.Lorry_Wreck_Dyno -= 1;

		Util.MapDebugPrint( "^3Lorry_Wreck_Defused" );
	},

	Lorry_Wreck_Destroyed = function( trigger )
	{

		Map.LorryWreckDestroyed = true;

		Wp.SetWaypointFlag( "Lorry_Wreck", "closed", true );

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ATTACK_Allies_Start_Truck_.*",
			"PLANT_Lorry_Wreck",
		});

		if ( Map.Lorry_Wreck_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Lorry_Wreck_.*" );
		}

		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allies_Road_.*" );

		Map.Lorry_Wreck_Dyno = 0;

		if ( Map.BombTruckAtBarrier )
		{
			if ( Map.BombTruckBuilt )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "ESCORT_Bomb_Truck" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Bomb_Truck" );
			}
		}

		Util.MapDebugPrint( "^3Lorry_Wreck_Destroyed" );
	},

	Bomb_Truck_At_Barrier =
 	{
 		Name="Bomb_Truck_At_Barrier",
		TriggerOnEntity = GetGoal("MOVER_truck").GetEntity(),
 		OnEnter = function(ent)
 		{
			Map.BombTruckAtBarrier = true;

			if ( !Map.LorryWreckDestroyed )
			{
				SetGoalPriority( "PLANT_Lorry_Wreck", 0.92, TEAM.ALLIES, CLASS.ENGINEER );

				SetAvailableMapGoals( TEAM.ALLIES, false, "ESCORT_Bomb_Truck" );
			}

			Util.MapDebugPrint( "^3Bomb_Truck_At_Barrier" );
 		},
 		OnExit = function(ent)
 		{
			SetGoalPriority( "AIRSTRIKE_Axis_Start_Hilltop_4", 0.79, TEAM.AXIS, CLASS.FIELDOPS );
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"MOUNTMG42_Allied_Spawn",
				"REPAIRMG42_Allied_Spawn",
			});

			Util.MapDebugPrint( "^3Bomb_Truck_At_Barrier exit" );
 		},
	},

	Bomb_Truck_Past_Barrier =
 	{
 		Name="Bomb_Truck_Past_Barrier",
		TriggerOnEntity = GetGoal("MOVER_truck").GetEntity(),
 		OnEnter = function(ent)
 		{
			Map.BombTruckAtBarrier = false;

			Util.MapDebugPrint( "^3Bomb_Truck_Past_Barrier" );
 		},
	},

	the_88mm_destroyed = function( trigger )
	{

		Map.the88mmdestroyed = true;
		Map.Fire_switch_enabled = false;

		if ( !Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_Axis_.*" );

			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_the_88mm_spares" );
		}

		Util.MapDebugPrint( "^3the_88mm_destroyed" );
	},

	the_88mm_repaired = function( trigger )
	{

		Map.the88mmdestroyed = false;
		Map.Fire_switch_enabled = true;

		if ( !Map.SignalTransmitted )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_the_88mm_spares" );

			if ( Map.AxisCommandPostBuilt )
			{
				if ( Map.BombTruckAtDepotGates and !Map.AlliedCommandPostBuilt )
				{
					if ( !Map.cannon_is_pointed_at_the_minefield )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Minefield" );
					}
					else
					{
						if ( !Map.gun_rotates )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
						}
					}
				}
				else if ( Map.TruckIsOnTheRoad )
				{
					if ( !Map.cannon_is_pointed_at_the_road )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Road" );
					}
					else
					{
						if ( !Map.gun_rotates )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
						}
					}
				}
				else
				{
					if ( !Map.gun_rotates )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
					}

					sleep(1);

					if ( Map.cannon_is_pointed_at_the_road )
					{
						if ( Map.Allies_OnHilltop > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Hilltop" );
						}
						if ( Map.Allies_InMinefield > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Minefield" );
						}
					}

					if ( Map.cannon_is_pointed_at_the_hilltop )
					{
						if ( Map.Allies_InMinefield > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Minefield" );
						}
						if ( Map.Allies_OnTheRoad > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Road" );
						}
					}

					if ( Map.cannon_is_pointed_at_the_minefield )
					{
						if ( Map.Allies_OnHilltop > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Hilltop" );
						}
						if ( Map.Allies_OnTheRoad > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Road" );
						}
					}
				}
			}
			else
			{
				if ( !Map.gun_rotates )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
				}
			}
		}

		Util.MapDebugPrint( "^3the_88mm_repaired" );
	},

	Fire_switch = function( trigger )
	{

		if ( !Map.SignalTransmitted )
		{
			vel = ToVector(trigger.Action);

			if ( vel[ 2 ] < 0 )
			{
				if ( !Map.SignalTransmitted )
				{
					Map.Fire_switch_enabled = false;
					Map.switch_is_up = false;

					SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_Axis_Fire" );

					Util.MapDebugPrint( "^3Fire_switch disabled" );

					sleep(1);

					if ( !Map.the88mmdestroyed )
					{
						if ( !Map.BombTruckAtDepotGates )
						{
							if ( Map.AxisCommandPostBuilt and !Map.TruckIsOnTheRoad )
							{
								if ( Map.cannon_is_pointed_at_the_road )
								{
									if ( Map.Allies_OnHilltop > 0 )
									{
										SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Hilltop" );
									}
									if ( Map.Allies_InMinefield > 0 )
									{
										SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Minefield" );
									}
								}

								if ( Map.cannon_is_pointed_at_the_hilltop )
								{
									if ( Map.Allies_InMinefield > 0 )
									{
										SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Minefield" );
									}
									if ( Map.Allies_OnTheRoad > 0 )
									{
										SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Road" );
									}
								}

								if ( Map.cannon_is_pointed_at_the_minefield )
								{
									if ( Map.Allies_OnHilltop > 0 )
									{
										SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Hilltop" );
									}
									if ( Map.Allies_OnTheRoad > 0 )
									{
										SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Road" );
									}
								}
							}
						}
					}
				}
			}
			else if ( vel[ 2 ] > 0 )
			{
				if ( !Map.SignalTransmitted )
				{
					if ( !Map.the88mmdestroyed )
					{
						Map.switch_is_up = true;

						sleep(0.5);

						if ( !Map.gun_rotates )
						{
							if ( Map.BombTruckAtDepotGates and !Map.AlliedCommandPostBuilt )
							{
								if ( Map.cannon_is_pointed_at_the_minefield )
								{
									Map.Fire_switch_enabled = true;

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

									Util.MapDebugPrint( "^3Fire_switch enabled" );
								}
								else
								{
									if ( Map.AxisCommandPostBuilt )
									{
										SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Minefield" );
									}
									else
									{
										Map.Fire_switch_enabled = true;

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

										Util.MapDebugPrint( "^3Fire_switch enabled" );
									}
								}
							}
							else if ( Map.TruckIsOnTheRoad )
							{
								if ( Map.cannon_is_pointed_at_the_road )
								{
									Map.Fire_switch_enabled = true;

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

									Util.MapDebugPrint( "^3Fire_switch enabled" );
								}
								else
								{
									if ( Map.AxisCommandPostBuilt )
									{
										SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Road" );
									}
									else
									{
										Map.Fire_switch_enabled = true;

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

										Util.MapDebugPrint( "^3Fire_switch enabled" );
									}
								}
							}
							else
							{
								Map.Fire_switch_enabled = true;

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

								Util.MapDebugPrint( "^3Fire_switch enabled" );
							}
						}
					}
				}
			}
		}
	},

	gun_moving_toward_the_road = function( trigger )
	{

		if ( !Map.SignalTransmitted )
		{
			vel = ToVector(trigger.Action);

			if ( vel[ 2 ] == -16.00 )
			{
				Map.cannon_is_pointed_at_the_road = true;
				Map.cannon_is_pointed_at_the_hilltop = false;
				Map.cannon_is_pointed_at_the_minefield = false;

				Map.gun_rotates = true;

				SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_.*" );

				Util.MapDebugPrint( "^3cannon rotates in the direction of the road" );

				sleep(5);

				Map.gun_rotates = false;

				if ( !Map.Fire_switch_enabled and Map.switch_is_up )
				{
					Map.Fire_switch_enabled = true;

					Util.MapDebugPrint( "^3Fire_switch enabled after rotation" );
				}

				if ( !Map.the88mmdestroyed )
				{
					if ( Map.BombTruckAtDepotGates and !Map.AlliedCommandPostBuilt )
					{
						if ( Map.AxisCommandPostBuilt )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Minefield" );
						}
						else
						{
							if ( Map.Fire_switch_enabled )
							{
								SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
							}
						}
					}
					else if ( Map.TruckIsOnTheRoad )
					{
						if ( Map.Fire_switch_enabled )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
						}
					}
					else
					{
						if ( Map.Fire_switch_enabled )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
						}
					}
				}
			}
		}
	},

	gun_moving_toward_the_hill = function( trigger )
	{

		if ( !Map.SignalTransmitted )
		{
			vel = ToVector(trigger.Action);

			if ( vel[ 2 ] == -16.00 )
			{
				Map.cannon_is_pointed_at_the_hilltop = true;
				Map.cannon_is_pointed_at_the_road = false;
				Map.cannon_is_pointed_at_the_minefield = false;

				Map.gun_rotates = true;

				SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_.*" );

				Util.MapDebugPrint( "^3cannon rotates in the direction of top of the hill" );

				sleep(5);

				Map.gun_rotates = false;

				if ( !Map.Fire_switch_enabled and Map.switch_is_up )
				{
					Map.Fire_switch_enabled = true;

					Util.MapDebugPrint( "^3Fire_switch enabled after rotation" );
				}

				if ( !Map.the88mmdestroyed )
				{
					if ( Map.BombTruckAtDepotGates and !Map.AlliedCommandPostBuilt )
					{
						if ( Map.AxisCommandPostBuilt )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Minefield" );
						}
						else
						{
							if ( Map.Fire_switch_enabled )
							{
								SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
							}
						}
					}
					else if ( Map.TruckIsOnTheRoad )
					{
						if ( Map.AxisCommandPostBuilt )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Road" );
						}
						else
						{
							if ( Map.Fire_switch_enabled )
							{
								SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
							}
						}
					}
					else
					{
						if ( Map.Fire_switch_enabled )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
						}
					}
				}
			}
		}
	},

	gun_moving_toward_the_minefield = function( trigger )
	{

		if ( !Map.SignalTransmitted )
		{
			vel = ToVector(trigger.Action);

			if ( vel[ 2 ] == -16.00 )
			{
				Map.cannon_is_pointed_at_the_minefield = true;
				Map.cannon_is_pointed_at_the_hilltop = false;
				Map.cannon_is_pointed_at_the_road = false;

				Map.gun_rotates = true;

				SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_.*" );

				Util.MapDebugPrint( "^3cannon rotates in the direction of minefield" );

				sleep(5);

				Map.gun_rotates = false;

				if ( !Map.Fire_switch_enabled and Map.switch_is_up )
				{
					Map.Fire_switch_enabled = true;

					Util.MapDebugPrint( "^3Fire_switch enabled after rotation" );
				}

				if ( !Map.the88mmdestroyed )
				{
					if ( Map.BombTruckAtDepotGates and !Map.AlliedCommandPostBuilt )
					{
						if ( Map.Fire_switch_enabled )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
						}
					}
					else if ( Map.TruckIsOnTheRoad )
					{
						if ( Map.AxisCommandPostBuilt )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Road" );
						}
						else
						{
							if ( Map.Fire_switch_enabled )
							{
								SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
							}
						}
					}
					else
					{
						if ( Map.Fire_switch_enabled )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
						}
					}
				}
			}
		}
	},

	AlliesOnTheRoad =
	{
		Name = "AlliesOnTheRoad",
		TriggerOnClass = CLASS.ANYPLAYER,

		OnEnter = function(ent)
		{
			if ( !Map.SignalTransmitted )
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.Allies_OnTheRoad += 1;

					if ( Map.Allies_OnTheRoad == 1 )
					{
						if ( !Map.BombTruckAtDepotGates )
						{
							if ( !Map.TruckIsOnTheRoad )
							{
								if ( !Map.the88mmdestroyed )
								{
									if ( Map.cannon_is_pointed_at_the_road )
									{
										if ( Map.Fire_switch_enabled )
										{
											SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
										}
									}
									else
									{
										if ( Map.AxisCommandPostBuilt )
										{
											SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Road" );
										}
									}
								}
							}
						}
					}

					Util.MapDebugPrint( "^5Allies entered into trigger AlliesOnTheRoad" );
				}
			}
		},
		OnExit = function(ent)
		{
			if ( !Map.SignalTransmitted )
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.Allies_OnTheRoad -= 1;

					if ( Map.Allies_OnTheRoad == 0 )
					{
						if ( !Map.TruckIsOnTheRoad )
						{
							SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_Axis_Road" );
						}

						Util.MapDebugPrint( "^5Allies left trigger AlliesOnTheRoad" );
					}
				}
			}
		},
	},

	AlliesInMinefield =
	{
		Name = "AlliesInMinefield",
		TriggerOnClass = CLASS.ANYPLAYER,

		OnEnter = function(ent)
		{
			if ( !Map.SignalTransmitted )
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.Allies_InMinefield += 1;

					if ( Map.Allies_InMinefield == 1 )
					{
						if ( !Map.BombTruckAtDepotGates )
						{
							if ( !Map.TruckIsOnTheRoad )
							{
								if ( !Map.the88mmdestroyed )
								{
									if ( Map.cannon_is_pointed_at_the_minefield )
									{
										if ( Map.Fire_switch_enabled )
										{
											SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
										}
									}
									else
									{
										if ( Map.AxisCommandPostBuilt )
										{
											SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Minefield" );
										}
									}
								}
							}
						}
					}

					Util.MapDebugPrint( "^5Allies entered into trigger AlliesInMinefield" );
				}
			}
		},
		OnExit = function(ent)
		{
			if ( !Map.SignalTransmitted )
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.Allies_InMinefield -= 1;

					if ( Map.Allies_InMinefield == 0 )
					{
						SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_Axis_Minefield" );

						Util.MapDebugPrint( "^5Allies left trigger AlliesInMinefield" );
					}
				}
			}
		},
	},

	AlliesOnHilltop =
	{
		Name = "AlliesOnHilltop",
		TriggerOnClass = CLASS.ANYPLAYER,

		OnEnter = function(ent)
		{
			if ( !Map.SignalTransmitted )
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.Allies_OnHilltop += 1;

					if ( Map.Allies_OnHilltop == 1 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Axis_Hilltop_.*" );

						if ( !Map.BombTruckAtDepotGates )
						{
							if ( !Map.TruckIsOnTheRoad )
							{
								if ( !Map.the88mmdestroyed )
								{
									if ( Map.cannon_is_pointed_at_the_hilltop )
									{
										if ( Map.Fire_switch_enabled )
										{
											SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
										}
									}
									else
									{
										if ( Map.AxisCommandPostBuilt )
										{
											SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Hilltop" );
										}
									}
								}
							}
						}

						Util.MapDebugPrint( "^5Allies entered into trigger AlliesOnHilltop" );
					}
				}
			}
		},
		OnExit = function(ent)
		{
			if ( !Map.SignalTransmitted )
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.Allies_OnHilltop -= 1;

					if ( Map.Allies_OnHilltop == 0 )
					{
						SetAvailableMapGoals( TEAM.AXIS, false, {
							"SWITCH_Axis_Hilltop",
							"DEFEND_Axis_Hilltop_.*",
						});

						Util.MapDebugPrint( "^5Allies left trigger AlliesOnHilltop" );
					}
				}
			}
		},
	},

	TruckOnTheRoad =
 	{
 		Name="TruckOnTheRoad",
		TriggerOnEntity = GetGoal("MOVER_truck").GetEntity(),
 		OnEnter = function(ent)
 		{
			if ( !Map.SignalTransmitted )
			{
				Map.TruckIsOnTheRoad = true;

				SetGoalPriority( "SWITCH_Axis_Road", 0.71, TEAM.AXIS, 0 );
				SetGoalPriority( "MOBILEMG42_Axis_Start_Road_5", 0.75, TEAM.AXIS, CLASS.SOLDIER );

				SetGoalPriority( "MOUNTMG42_Allied_Spawn", 0.49, TEAM.ALLIES, 0 );
				SetGoalPriority( "REPAIRMG42_Allied_Spawn", 0.6, TEAM.ALLIES, CLASS.ENGINEER );

				SetAvailableMapGoals( TEAM.AXIS, false, {
					"SWITCH_Axis_Hilltop",
					"SWITCH_Axis_Minefield",
					"MOBILEMG42_Axis_Start_Road_5",
				});

				SetAvailableMapGoals( TEAM.AXIS, true, {
					".*_Axis_Road_.*",
					"CALLARTILLERY_Axis_Hilltop_.*",
					"ARTILLERY_S_Axis_Hilltop_.*",
				});

				if ( !Map.the88mmdestroyed )
				{
					if ( Map.cannon_is_pointed_at_the_road )
					{
						if ( Map.Fire_switch_enabled )
						{
							SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_Axis_Road" );

							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
						}
					}
					else
					{
						if ( Map.AxisCommandPostBuilt )
						{
							SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_Axis_Fire" );

							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Road" );
						}
					}
				}
				sleep(0.5);
				SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_Start_Road_5" );
			}

			Util.MapDebugPrint( "^3TruckOnTheRoad" );
 		},
 		OnExit = function(ent)
 		{
			if ( !Map.SignalTransmitted )
			{
				Map.TruckIsOnTheRoad = false;

				SetGoalPriority( "SWITCH_Axis_Road", 0.70, TEAM.AXIS, 0 );

				SetAvailableMapGoals( TEAM.AXIS, false, "AIRSTRIKE_Axis_Start_Hilltop_.*" );

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

				if ( !Map.the88mmdestroyed and Map.AxisCommandPostBuilt )
				{
					if ( Map.cannon_is_pointed_at_the_road )
					{
						if ( Map.Allies_OnHilltop > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Hilltop" );
						}
						if ( Map.Allies_InMinefield > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Minefield" );
						}
					}

					if ( Map.cannon_is_pointed_at_the_hilltop )
					{
						if ( Map.Allies_InMinefield > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Minefield" );
						}
						if ( Map.Allies_OnTheRoad > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Road" );
						}
					}

					if ( Map.cannon_is_pointed_at_the_minefield )
					{
						if ( Map.Allies_OnHilltop > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Hilltop" );
						}
						if ( Map.Allies_OnTheRoad > 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Road" );
						}
					}
				}
			}
			Util.MapDebugPrint( "^3Truck is near Bridge" );
 		},
	},

	TruckOnTheBridge =
 	{
 		Name="TruckOnTheBridge",
		TriggerOnEntity = GetGoal("MOVER_truck").GetEntity(),
 		OnEnter = function(ent)
 		{
			Map.Truck_OnTheBridge = true;

			SetAvailableMapGoals( TEAM.AXIS, true, "GRENADE_Axis_TruckOnTheBridge_.*" );

			Util.MapDebugPrint( "^3TruckOnTheBridge" );
 		},
	},

	TruckOnTheBridgeExit =
 	{
 		Name="TruckOnTheBridgeExit",
		TriggerOnEntity = GetGoal("MOVER_truck").GetEntity(),
 		OnEnter = function(ent)
 		{
			Map.Truck_OnTheBridge = false;
			Map.BombTruckOverBridge = true;

			SetAvailableMapGoals( TEAM.AXIS, false, {
				"GRENADE_Axis_TruckOnTheBridge_.*",
				".*_Axis_Start_Road_.*",
				"DEFEND_Axis_Road_.*",
				".*_Axis_Start_Hilltop_.*",
				"DEFEND_Axis_Minefield_5",
				"DEFEND_Axis_Start_Minefield_12",
			});

			SetAvailableMapGoals( TEAM.AXIS, true, ".*_Axis_TruckOverBridge_.*" );

			Util.MapDebugPrint( "^3TruckOnTheBridge exit" );
 		},
	},

	Bomb_Truck_Over_Bridge = function( trigger )
	{

		SetGoalPriority( "BUILD_Assault_Ramp", 0.88, TEAM.ALLIES, CLASS.ENGINEER );

		SetGoalPriority( "PLANT_Allied_Command_Post", 0.85, TEAM.AXIS, CLASS.ENGINEER );

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"SWITCH_Axis_Hilltop",
			".*_Axis_Hilltop_.*",
			".*_Axis_Start_Hilltop_.*",
			"SWITCH_Axis_Road",
			"CALLARTILLERY_Axis_Road_5",
			"ARTILLERY_S_Axis_Road_6",
			".*_Axis_Start_Road_.*",
			"DEFEND_Axis_Road_.*",
			"AIRSTRIKE_Axis_TruckNearBridge_1",
			"SMOKEBOMB_Axis_Start_Minefield_1",
			"MOBILEMG42_Axis_Minefield_1",
		});

		SetGoalPriority( "DEFEND_Axis_AtAxis_CP_.*", 0.61, TEAM.AXIS, 0 );
		SetGoalPriority( "DEFEND_Axis_Minefield_4", 0.6, TEAM.AXIS, 0 );
		SetGoalPriority( "DEFEND_Axis_Minefield_2", 0.59, TEAM.AXIS, 0 );
		SetGoalPriority( "DEFEND_Axis_TruckOverBridge_5", 0.58, TEAM.AXIS, 0 );

		SetAvailableMapGoals( TEAM.AXIS, true, {
			"SMOKEBOMB_Axis_TruckAtDepotGates_1",
			"MOBILEMG42_Axis_TruckAtDepotGates_2",
			"DEFEND_Axis_AtAxis_CP_.*",
		});

		Util.MapDebugPrint( "^3Bomb_Truck_Over_Bridge" );
	},

	Bomb_Truck_At_Depot_Gates = function( trigger )
	{

		Map.BombTruckOverBridge = false;
		Map.BombTruckAtDepotGates = true;

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ESCORT_Bomb_Truck",
			"BUILD_Bomb_Truck",
		});

		SetAvailableMapGoals( TEAM.AXIS, false, "GRENADE_Axis_TruckOverBridge_.*" );

		foreach ( id and bot in BotTable )
		{
			if ( bot.GetTeam() == TEAM.AXIS )
			{
				Util.IgnoreTargetGoal( bot, "MOVER_truck" );
			}
		}

		if ( !Map.SignalTransmitted )
		{
			if ( !Map.AlliedCommandPostBuilt )
			{
				if ( !Map.the88mmdestroyed )
				{
					if ( Map.cannon_is_pointed_at_the_minefield )
					{
						if ( Map.Fire_switch_enabled )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Fire" );
						}
					}
					else
					{
						if ( Map.AxisCommandPostBuilt )
						{
							SetAvailableMapGoals( TEAM.AXIS, false, "SWITCH_Axis_Fire" );

							SetAvailableMapGoals( TEAM.AXIS, true, "SWITCH_Axis_Minefield" );
						}
					}
				}
			}
		}

		Util.MapDebugPrint( "^3Bomb_Truck_At_Depot_Gates" );
	},

	Signal_Transmitted = function( trigger )
	{

		Util.MapDebugPrint( "^3Signal_Transmitted" );

		Util.ClearRoleForGoals( ".*", ROLE.DEFENDER );
		Util.ClearRoleForGoals( ".*", ROLE.DEFENDER1 );
		Util.ClearRoleForGoals( ".*", ROLE.DEFENDER2 );

		Util.ClearRoleForGoals( ".*", ROLE.ATTACKER );
		Util.ClearRoleForGoals( ".*", ROLE.ATTACKER1 );
		Util.ClearRoleForGoals( ".*", ROLE.ATTACKER2 );

		foreach ( id and bot in BotTable )
		{
			bot.TargetBreakableDist = 300.0;
		}

		sleep(9);

		Map.SignalTransmitted = true;

		SetAvailableMapGoals( TEAM.AXIS, false, ".*" );

		SetAvailableMapGoals( TEAM.ALLIES, false, ".*" );

		SetAvailableMapGoals( 0, true, "ROUTE_.*" );

		WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, WEAPON.FLAMETHROWER, false );
		WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, WEAPON.STG44, false );

		WeaponTable.SetWeaponTeamAvailability ( TEAM.ALLIES, CLASS.SOLDIER, WEAPON.PANZERFAUST, true );

		if ( ETUtil.CountClass( TEAM.AXIS, CLASS.SOLDIER ) < 3 )
		{
			WeaponTable.SetWeaponTeamAvailability ( TEAM.AXIS, CLASS.SOLDIER, WEAPON.PANZERFAUST, false );
		}
		else
		{
			WeaponTable.SetWeaponTeamAvailability ( TEAM.AXIS, CLASS.SOLDIER, WEAPON.PANZERFAUST, true );
		}

		ETUtil.SetAimModeForMount("MOUNT_Rand", { Vec3(8665.719, 9339.153, 93.845), Vec3(10063.875, 7112.133, 14.889), Vec3(8192.125, 10181.709, 54.310) });

		sleep(1);

		SetAvailableMapGoals( 0, true, {
			"AMMOCAB_.*",
			"HEALTHCAB_.*",
		});

		SetAvailableMapGoals( TEAM.AXIS, true, {
			".*_Axis_Flag_.*",
			"BUILD_Workshop_Door",
			"PLANTMINE_Axis_WorkshopDoor_.*",
		});

		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"CHECKPOINT_station_flag",
			"SWITCH_Allies_Steam",
			"GRENADE_Abgrund_.*",
			"GRENADE_Felsen_.*",
			"GRENADE_Kartoffel_.*",
			"GRENADE_Kohlmann_.*",
			"GRENADE_Krumm_.*",
			"GRENADE_Kuhhirt_.*",
			"GRENADE_Rand_.*",
			"GRENADE_Schnepfer_.*",
			"GRENADE_RailsPower_.*",
		});
	},

	Window_exploded = function( trigger )
	{

		Map.fbWindow_exploded = true;

		Util.MapDebugPrint( "^3Window_exploded" );
	},

	station_flag_Allies_Captured = function( trigger )
	{

		Map.StationFlagAllies = true;

		if ( ETUtil.CountClass( TEAM.AXIS, CLASS.COVERTOPS ) > 0 )
		{
			Util.LimitToClass("CHECKPOINT_station_flag", TEAM.AXIS, CLASS.COVERTOPS );
		}
		else
		{
			Util.LimitToClass("CHECKPOINT_station_flag", TEAM.AXIS, CLASS.FIELDOPS, CLASS.MEDIC, CLASS.SOLDIER );
		}

		SetAvailableMapGoals( TEAM.ALLIES, false, "CHECKPOINT_station_flag" );

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

		if ( Map.Allies_NearTanks > 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, ".*_Axis_Flag_.*" );
		}

		Util.MapDebugPrint( "^3station_flag_Allies_Captured" );
	},

	station_flag_Axis_Captured = function( trigger )
	{

		Map.StationFlagAllies = false;

		SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT_station_flag" );

		SetAvailableMapGoals( TEAM.ALLIES, true, "CHECKPOINT_station_flag" );

		if ( Map.Allies_NearTanks == 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, ".*_Axis_Flag_.*" );
		}

		Util.MapDebugPrint( "^3station_flag_Axis_Captured" );
	},

	Workshop_Door_Built = function( trigger )
	{

		GetGoal("DEFEND_Axis_FrontDefend_2").AimVectors =
		{ Vec3(-0.990, -0.129, -0.056) };
		GetGoal("DEFEND_Axis_FrontDefend_3").AimVectors =
		{ Vec3(-0.999, -0.037, -0.013) };
		GetGoal("DEFEND_Axis_FrontDefend_4").AimVectors =
		{ Vec3(-0.999, -0.051, -0.015), Vec3(-0.406, -0.914, -0.023) };
		GetGoal("DEFEND_Axis_FrontDefend_6").AimVectors =
		{ Vec3(-0.973, -0.219, -0.075) };
		GetGoal("DEFEND_Axis_FrontDefend_7").AimVectors =
		{ Vec3(-0.927, -0.360, -0.103) };
		GetGoal("DEFEND_Axis_FrontDefend_9").AimVectors =
		{ Vec3(-0.993, -0.090, -0.077), Vec3(-0.667, -0.732, -0.142) };

		ETUtil.SetAimModeForMount("MOUNT_Rand", { Vec3(8665.719, 9339.153, 93.845), Vec3(10063.875, 7112.133, 14.889) });

		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Workshop_Door" );

		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Workshop_Door" );

		SetAvailableMapGoals( TEAM.ALLIES, false, "ROUTE_Workshop_Door" );

		Util.MapDebugPrint( "^3Workshop_Door_Built" );
	},

	Workshop_Door_Planted = function( trigger )
	{

		Map.Workshop_Door_Dyno += 1;

		SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Workshop_Door_.*" );

		Util.MapDebugPrint( "^3Workshop_Door_Planted" );
	},

	Workshop_Door_Defused = function( trigger )
	{

		Map.Workshop_Door_Dyno -= 1;

		Util.MapDebugPrint( "^3Workshop_Door_Defused" );
	},

	Workshop_Door_Destroyed = function( trigger )
	{

		GetGoal("DEFEND_Axis_FrontDefend_2").AimVectors =
		{ Vec3(-0.990, -0.129, -0.056), Vec3(-0.835, 0.545, -0.075) };
		GetGoal("DEFEND_Axis_FrontDefend_3").AimVectors =
		{ Vec3(-0.999, -0.037, -0.013), Vec3(-0.791, 0.612, 0.008) };
		GetGoal("DEFEND_Axis_FrontDefend_4").AimVectors =
		{ Vec3(-0.999, -0.051, -0.015), Vec3(-0.406, -0.914, -0.023), Vec3(-0.819, 0.574, 0.010) };
		GetGoal("DEFEND_Axis_FrontDefend_6").AimVectors =
		{ Vec3(-0.973, -0.219, -0.075), Vec3(-0.920, 0.383, -0.086) };
		GetGoal("DEFEND_Axis_FrontDefend_7").AimVectors =
		{ Vec3(-0.927, -0.360, -0.103), Vec3(-0.955, 0.283, -0.088) };
		GetGoal("DEFEND_Axis_FrontDefend_9").AimVectors =
		{ Vec3(-0.993, -0.090, -0.077), Vec3(-0.667, -0.732, -0.142), Vec3(-0.824, 0.562, -0.070) };

		if ( Map.Workshop_Door_Dyno > 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Workshop_Door_.*" );
		}

		Map.Workshop_Door_Dyno = 0;

		ETUtil.SetAimModeForMount("MOUNT_Rand", { Vec3(8665.719, 9339.153, 93.845), Vec3(10063.875, 7112.133, 14.889), Vec3(8192.125, 10181.709, 54.310) });

		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Workshop_Door" );

		SetAvailableMapGoals( TEAM.ALLIES, true, "ROUTE_Workshop_Door" );

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

		Util.MapDebugPrint( "^3Workshop_Door_Destroyed" );
	},

	Rails_Safe = function( trigger )
	{

		SetAvailableMapGoals( TEAM.ALLIES, false, "GRENADE_RailsPower_.*" );

		Util.MapDebugPrint( "^3Rails_Safe" );
	},

	AlliesNearTanks =
	{
		Name = "AlliesNearTanks",
		TriggerOnClass = CLASS.ANYPLAYER,

		OnEnter = function(ent)
		{
			if( GetEntTeam(ent) == TEAM.ALLIES )
			{
				Map.Allies_NearTanks += 1;

				if ( Map.Allies_NearTanks == 1 )
				{
					Util.BotChat( TEAM.AXIS, "sayteam", "^1Allies are near tanks! Defend tanks!", 2 );

					SetAvailableMapGoals( TEAM.AXIS, false, ".*_Axis_Flag_.*" );

					SetAvailableMapGoals( TEAM.AXIS, true, {
						"DEFEND_Axis_FrontDefend_.*",
						".*_Axis_LeftDefend_.*",
					});

					if ( !Map.RandDestroyed )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "MOUNT_Rand" );
					}

					Util.MapDebugPrint( "^5Allies entered into trigger AlliesNearTanks" );

					sleep(0.5);
				}

				if ( ETUtil.CountClass( TEAM.AXIS, CLASS.SOLDIER ) > 1 )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_FrontDefend_1" );
				}

				if ( !Map.StationFlagAllies )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, ".*_Axis_Flag_.*" );
				}
			}
		},
		OnExit = function(ent)
		{
			if( GetEntTeam(ent) == TEAM.ALLIES )
			{
				Map.Allies_NearTanks -= 1;

				if ( Map.Allies_NearTanks == 0 )
				{
					Util.BotChat( TEAM.AXIS, "sayteam", "^2Tanks are safe!", 2 );

					if ( !Map.StationFlagAllies )
					{
						SetAvailableMapGoals( TEAM.AXIS, false, {
							".*_Axis_FrontDefend_.*",
							".*_Axis_LeftDefend_.*",
						});

						if ( !Map.RandDestroyed )
						{
							SetAvailableMapGoals( TEAM.AXIS, false, "MOUNT_Rand" );
						}

						SetAvailableMapGoals( TEAM.AXIS, true, ".*_Axis_Flag_.*" );
					}

					Util.MapDebugPrint( "^5Allies left trigger AlliesNearTanks" );
				}

				if ( ETUtil.CountClass( TEAM.AXIS, CLASS.SOLDIER ) < 2 )
				{
					SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMG42_Axis_FrontDefend_1" );
				}
			}
		},
	},

	SwitchAlliesSteam =
	{
		Name = "SwitchAlliesSteam",
		TriggerOnClass = CLASS.ANYPLAYER,

		OnEnter = function(ent)
		{
			Util.MapDebugPrint( "^5Someone entered into trigger SwitchAlliesSteam" );
			sleep(1);
			SetAvailableMapGoals( TEAM.ALLIES, false, "SWITCH_Allies_Steam" );
			sleep(49);
			SetAvailableMapGoals( TEAM.ALLIES, true, "SWITCH_Allies_Steam" );
		},
	},

	//Tanks

	Felsen_Destroyed = function( trigger )
	{

		Map.FelsenDestroyed = true;

		SetAvailableMapGoals( TEAM.ALLIES, false, "GRENADE_Felsen_.*" );

		Util.MapDebugPrint( "^3Felsen_Destroyed" );

		if ( Map.KartoffelDestroyed and Map.KuhhirtDestroyed and Map.RandDestroyed and Map.AbgrundDestroyed and Map.KohlmannDestroyed and Map.SchnepferDestroyed and Map.KrummDestroyed )
		{
			sleep(1);
			ETUtil.WinningChat( TEAM.ALLIES );
			sleep(1.5);
			ETUtil.LosingChat( TEAM.AXIS );

			Util.MapDebugPrint( "^5Allies_Win" );
		}
	},

	Krumm_Destroyed = function( trigger )
	{

		Map.KrummDestroyed = true;

		SetAvailableMapGoals( TEAM.ALLIES, false, "GRENADE_Krumm_.*" );

		Util.MapDebugPrint( "^3Krumm_Destroyed" );

		if ( Map.KartoffelDestroyed and Map.KuhhirtDestroyed and Map.RandDestroyed and Map.AbgrundDestroyed and Map.KohlmannDestroyed and Map.SchnepferDestroyed and Map.FelsenDestroyed )
		{
			sleep(1);
			ETUtil.WinningChat( TEAM.ALLIES );
			sleep(1.5);
			ETUtil.LosingChat( TEAM.AXIS );

			Util.MapDebugPrint( "^5Allies_Win" );
		}
	},

	Schnepfer_Destroyed = function( trigger )
	{

		Map.SchnepferDestroyed = true;

		SetAvailableMapGoals( TEAM.ALLIES, false, "GRENADE_Schnepfer_.*" );

		Util.MapDebugPrint( "^3Schnepfer_Destroyed" );

		if ( Map.KartoffelDestroyed and Map.KuhhirtDestroyed and Map.RandDestroyed and Map.AbgrundDestroyed and Map.KohlmannDestroyed and Map.KrummDestroyed and Map.FelsenDestroyed )
		{
			sleep(1);
			ETUtil.WinningChat( TEAM.ALLIES );
			sleep(1.5);
			ETUtil.LosingChat( TEAM.AXIS );

			Util.MapDebugPrint( "^5Allies_Win" );
		}
	},

	Kohlmann_Destroyed = function( trigger )
	{

		Map.KohlmannDestroyed = true;

		SetAvailableMapGoals( TEAM.ALLIES, false, "GRENADE_Kohlmann_.*" );

		Util.MapDebugPrint( "^3Kohlmann_Destroyed" );

		if ( Map.KartoffelDestroyed and Map.KuhhirtDestroyed and Map.RandDestroyed and Map.AbgrundDestroyed and Map.SchnepferDestroyed and Map.KrummDestroyed and Map.FelsenDestroyed )
		{
			sleep(1);
			ETUtil.WinningChat( TEAM.ALLIES );
			sleep(1.5);
			ETUtil.LosingChat( TEAM.AXIS );

			Util.MapDebugPrint( "^5Allies_Win" );
		}
	},

	Abgrund_Destroyed = function( trigger )
	{

		Map.AbgrundDestroyed = true;

		SetAvailableMapGoals( TEAM.ALLIES, false, "GRENADE_Abgrund_.*" );

		Util.MapDebugPrint( "^3Abgrund_Destroyed" );

		if ( Map.KartoffelDestroyed and Map.KuhhirtDestroyed and Map.RandDestroyed and Map.KohlmannDestroyed and Map.SchnepferDestroyed and Map.KrummDestroyed and Map.FelsenDestroyed )
		{
			sleep(1);
			ETUtil.WinningChat( TEAM.ALLIES );
			sleep(1.5);
			ETUtil.LosingChat( TEAM.AXIS );

			Util.MapDebugPrint( "^5Allies_Win" );
		}
	},

	Rand_Destroyed = function( trigger )
	{

		Map.RandDestroyed = true;

		SetAvailableMapGoals( TEAM.AXIS, false, "MOUNT_Rand" );

		SetAvailableMapGoals( TEAM.ALLIES, false, "GRENADE_Rand_.*" );

		Util.MapDebugPrint( "^3Rand_Destroyed" );

		if ( Map.KartoffelDestroyed and Map.KuhhirtDestroyed and Map.AbgrundDestroyed and Map.KohlmannDestroyed and Map.SchnepferDestroyed and Map.KrummDestroyed and Map.FelsenDestroyed )
		{
			sleep(1);
			ETUtil.WinningChat( TEAM.ALLIES );
			sleep(1.5);
			ETUtil.LosingChat( TEAM.AXIS );

			Util.MapDebugPrint( "^5Allies_Win" );
		}
	},

	Kuhhirt_Destroyed = function( trigger )
	{

		Map.KuhhirtDestroyed = true;

		SetAvailableMapGoals( TEAM.ALLIES, false, "GRENADE_Kuhhirt_.*" );

		Util.MapDebugPrint( "^3Kuhhirt_Destroyed" );

		if ( Map.KartoffelDestroyed and Map.RandDestroyed and Map.AbgrundDestroyed and Map.KohlmannDestroyed and Map.SchnepferDestroyed and Map.KrummDestroyed and Map.FelsenDestroyed )
		{
			sleep(1);
			ETUtil.WinningChat( TEAM.ALLIES );
			sleep(1.5);
			ETUtil.LosingChat( TEAM.AXIS );

			Util.MapDebugPrint( "^5Allies_Win" );
		}
	},

	Kartoffel_Destroyed = function( trigger )
	{

		Map.KartoffelDestroyed = true;

		SetAvailableMapGoals( TEAM.ALLIES, false, "GRENADE_Kartoffel_.*" );

		Util.MapDebugPrint( "^3Kartoffel_Destroyed" );

		if ( Map.KuhhirtDestroyed and Map.RandDestroyed and Map.AbgrundDestroyed and Map.KohlmannDestroyed and Map.SchnepferDestroyed and Map.KrummDestroyed and Map.FelsenDestroyed )
		{
			sleep(1);
			ETUtil.WinningChat( TEAM.ALLIES );
			sleep(1.5);
			ETUtil.LosingChat( TEAM.AXIS );

			Util.MapDebugPrint( "^5Allies_Win" );
		}
	},

	Thirty_second = function( trigger )
	{

		Util.MapDebugPrint( "^5Thirty_second" );

		sleep(30);

		if ( !Map.KartoffelDestroyed or !Map.KuhhirtDestroyed or !Map.RandDestroyed or !Map.AbgrundDestroyed or !Map.KohlmannDestroyed or !Map.SchnepferDestroyed or !Map.KrummDestroyed or !Map.FelsenDestroyed )
		{
			Util.MapDebugPrint( "^5Axis_Win" );

			sleep(1);
			ETUtil.WinningChat( TEAM.AXIS );
			sleep(1.5);
			ETUtil.LosingChat( TEAM.ALLIES );
		}
	},

};

global OnMapLoad = function()
{

	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built );
	OnTrigger( "Allies have built the Assault Ramp!", Map.Assault_Ramp_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Axis_Command_Post_Built );
	OnTrigger( "Axis have built the Depot MG42!", Map.Axis_Depot_MG42_Built );
	OnTrigger( "The Bomb Truck has been repaired!", Map.Bomb_Truck_Built );
	OnTrigger( "Allies have built the Hut MG42!", Map.Hut_MG42_Built );
	OnTrigger( "Axis have built the secure workshop door!!", Map.Workshop_Door_Built );
	OnTrigger( "Planted at the Allied Command Post.", Map.Allied_Command_Post_Planted );
	OnTrigger( "Planted at the Assault Ramp.", Map.Assault_Ramp_Planted );
	OnTrigger( "Planted at the Axis Command Post.", Map.Axis_Command_Post_Planted );
	OnTrigger( "Planted at the Axis Depot MG42.", Map.Axis_Depot_MG42_Planted );
	OnTrigger( "Planted at the Hut MG42.", Map.Hut_MG42_Planted );
	OnTrigger( "Planted at the Lorry Wreck.", Map.Lorry_Wreck_Planted );
	OnTrigger( "Planted at the Workshop Door.", Map.Workshop_Door_Planted );
	OnTrigger( "Defused at the Allied Command Post.", Map.Allied_Command_Post_Defused );
	OnTrigger( "Defused at the Assault Ramp.", Map.Assault_Ramp_Defused );
	OnTrigger( "Defused at the Axis Command Post.", Map.Axis_Command_Post_Defused );
	OnTrigger( "Defused at the Axis Depot MG42.", Map.Axis_Depot_MG42_Defused );
	OnTrigger( "Defused at the Hut MG42.", Map.Hut_MG42_Defused );
	OnTrigger( "Defused at the Lorry Wreck.", Map.Lorry_Wreck_Defused );
	OnTrigger( "Defused at the Workshop Door.", Map.Workshop_Door_Defused );
	OnTrigger( "Axis have destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "Axis have destroyed the Assault Ramp!", Map.Assault_Ramp_Destroyed );
	OnTrigger( "Allies have destroyed the Axis Command Post!", Map.Axis_Command_Post_Destroyed );
	OnTrigger( "Allies have destroyed the Depot MG42!", Map.Axis_Depot_MG42_Destroyed );
	OnTrigger( "The Bomb Truck has been damaged!", Map.Bomb_Truck_Destroyed );
	OnTrigger( "Axis have destroyed the Hut MG42!!", Map.Hut_MG42_Destroyed );
	OnTrigger( "the Lorry Wreck Destroyed.", Map.Lorry_Wreck_Destroyed );
	OnTrigger( "Allies have destroyed the secure workshop door!!", Map.Workshop_Door_Destroyed );
	OnTrigger( "^3Axis have reclaimed the Station!", Map.station_flag_Axis_Captured );
	OnTrigger( "^3Allies have captured the Station!", Map.station_flag_Allies_Captured );
	OnTrigger( "^3Power to live rails interrupted - rails now safe!", Map.Rails_Safe );
	OnTrigger( "^3The Bomb Truck is over the bridge!", Map.Bomb_Truck_Over_Bridge );
	OnTrigger( "^3The Bomb Truck is at the depot gates!!", Map.Bomb_Truck_At_Depot_Gates );
	OnTrigger( "^3Truck detonation signal transmitted - detonation in 10 seconds!", Map.Signal_Transmitted );
	OnTrigger( "^3Allies have destroyed the 88mm!", Map.the_88mm_destroyed );
	OnTrigger( "^3Axis have repaired the 88mm!", Map.the_88mm_repaired );
	OnTrigger( "lever_fire_goto", Map.Fire_switch );
	OnTrigger( "lever_aim1_goto", Map.gun_moving_toward_the_road );
	OnTrigger( "lever_aim2_goto", Map.gun_moving_toward_the_hill );
	OnTrigger( "lever_aim3_goto", Map.gun_moving_toward_the_minefield );
	OnTrigger( "thirty second warning.", Map.Thirty_second );
	OnTrigger( "GRENADE_window Exploded.", Map.Window_exploded );
	//Tanks
	OnTrigger( "^3Jagdpanther Felsen has been destroyed!", Map.Felsen_Destroyed );
	OnTrigger( "^3Jagdpanther Krumm has been destroyed!", Map.Krumm_Destroyed );
	OnTrigger( "^3Jagdpanther Schnepfer has been destroyed!", Map.Schnepfer_Destroyed );
	OnTrigger( "^3Jagdpanther Kohlmann has been destroyed!", Map.Kohlmann_Destroyed );
	OnTrigger( "^3Jagdpanther Abgrund has been destroyed!", Map.Abgrund_Destroyed );
	OnTrigger( "^3Jagdpanther Rand has been destroyed!", Map.Rand_Destroyed );
	OnTrigger( "^3Jagdpanther Kuhhirt has been destroyed!", Map.Kuhhirt_Destroyed );
	OnTrigger( "^3Jagdpanther Kartoffel has been destroyed!", Map.Kartoffel_Destroyed );

	Util.DisableGoal( ".*", true );

	SetGoalPriority( "BUILD_Axis_Command_Post", 0.91, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "DEFEND_Axis_Start_Hilltop_.*", 0.49, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_Start_Road_.*", 0.49, TEAM.AXIS, 0 );
	SetGoalPriority( "MOBILEMG42_Axis_Start_Road_5", 0.89, TEAM.AXIS, CLASS.SOLDIER );
	SetGoalPriority( "PLANT_.*", 0.72, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Allied_Command_Post", 0.78, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Allied_Command_Post", 0.85, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "PLANT_Hut_MG42", 0.52, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Hut_MG42", 0.7, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "SMOKEBOMB_Axis_Start_Minefield_1", 0.82, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "DEFEND_Axis_Flag_3", 0.51, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_Flag_5", 0.51, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_Flag_6", 0.52, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_Flag_10", 0.52, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_FrontDefend_.*", 0.55, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_FrontDefend_9", 0.57, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_FrontDefend_4", 0.57, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_LeftDefend_.*", 0.55, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_LeftDefend_2", 0.57, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_LeftDefend_3", 0.56, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_LeftDefend_5", 0.56, TEAM.AXIS, 0 );
	SetGoalPriority( "MOBILEMG42_Axis_Flag_2", 0.9, TEAM.AXIS, CLASS.SOLDIER );
	SetGoalPriority( "MOBILEMG42_Axis_Flag_1", 0.91, TEAM.AXIS, CLASS.SOLDIER );

	SetGoalPriority( "MOBILEMG42_Axis_LeftDefend_1", 1.01, TEAM.AXIS, CLASS.SOLDIER );

	SetGoalPriority( "MOUNTMG42_Hut_MG42", 0.51, TEAM.ALLIES, 0 );
	SetGoalPriority( "REPAIRMG42_Hut_MG42", 0.6, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Lorry_Wreck", 0.92, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Allied_Command_Post", 0.89, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Bomb_Truck", 0.91, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "CHECKPOINT_station_flag", 0.82, TEAM.ALLIES, 0 );
	SetGoalPriority( "SWITCH_Allies_Steam", 0.81, TEAM.ALLIES, 0 );

	Wp.SetWaypointFlag( "Lorry_Wreck", "closed", false );

	WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, WEAPON.FLAMETHROWER, false );
	WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, WEAPON.STG44, false );

	WeaponTable.SetWeaponTeamAvailability ( TEAM.ALLIES, CLASS.SOLDIER, WEAPON.PANZERFAUST, true );

	if ( ETUtil.CountClass( TEAM.AXIS, CLASS.SOLDIER ) < 3 )
	{
		WeaponTable.SetWeaponTeamAvailability ( TEAM.AXIS, CLASS.SOLDIER, WEAPON.PANZERFAUST, false );
	}
	else
	{
		WeaponTable.SetWeaponTeamAvailability ( TEAM.AXIS, CLASS.SOLDIER, WEAPON.PANZERFAUST, true );
	}

	SetAvailableMapGoals( TEAM.AXIS, true, {
		"BUILD_Axis_Command_Post",
		"BUILD_Axis_Depot_MG42",
		"AIRSTRIKE_Axis_Start_Hilltop_.*",
		".*_Axis_Start_Road_.*",
		".*_Axis_Start_Minefield_.*",
		"SWITCH_Axis_Fire",
		".*_Axis_Minefield_.*",
	});

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"BUILD_Allied_Command_Post",
		"BUILD_Assault_Ramp",
		"BUILD_Hut_MG42",
		"PLANT_Lorry_Wreck",
		"BUILD_Bomb_Truck",
		"MOUNTMG42_Allied_Spawn",
		"REPAIRMG42_Allied_Spawn",
		"ATTACK_Allies_Minefield_.*",
		"ATTACK_Allies_Start_Hilltop_.*",
		"ATTACK_Allies_Start_Truck_.*",
	});

	Util.AddUseWp( "PLANT_Allied_Command_Post", "Plant_Allied_CP" );
	Util.AddUseWp( "PLANT_Assault_Ramp", "Assault_Ramp_Plant_WP" );
	Util.AddUseWp( "PLANT_Workshop_Door", "Workshop_Door_Plant_WP_1" );
	Util.AddUseWp( "PLANT_Workshop_Door", "Workshop_Door_Plant_WP_2" );

	Util.SetGoalPosition(3215.472656, 1225.874878, 123.125, "PLANT_Lorry_Wreck");

	Util.LimitToClass("PLANT_Assault_Ramp", TEAM.AXIS, CLASS.COVERTOPS);
	Util.LimitToClass("PLANT_Hut_MG42", TEAM.AXIS, CLASS.COVERTOPS);
	ETUtil.SetCabinets();

	Util.SetRoleForGoals( ".*_Axis_Minefield_.*", ROLE.DEFENDER );
	Util.SetRoleForGoals( "SWITCH_.*", ROLE.DEFENDER1 );
	Util.SetRoleForGoals( "DEFEND_Axis_Start_Hilltop_.*", ROLE.DEFENDER1 );
	Util.SetRoleForGoals( ".*_Axis_Hilltop_.*", ROLE.DEFENDER1 );
	Util.SetRoleForGoals( "MOUNTMG42_Axis_Depot_MG42", ROLE.DEFENDER1 );
	Util.SetRoleForGoals( "MOUNTMG42_Axis_Depot_MG42", ROLE.DEFENDER2 );
	Util.SetRoleForGoals( ".*_Axis_Start_Road_.*", ROLE.DEFENDER2 );
	Util.SetRoleForGoals( "DEFEND_Axis_Road_.*", ROLE.DEFENDER2 );

	Util.SetRoleForGoals( "ATTACK_Allies_Start_Truck_.*", ROLE.ATTACKER );
	Util.SetRoleForGoals( "ESCORT_Bomb_Truck", ROLE.ATTACKER );
	Util.SetRoleForGoals( "ATTACK_Allies_Road_.*", ROLE.ATTACKER );
	Util.SetRoleForGoals( "ATTACK_Allies_Start_Hilltop_.*", ROLE.ATTACKER1 );
	Util.SetRoleForGoals( "ATTACK_Allies_Minefield_.*", ROLE.ATTACKER2 );

	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "SWITCH_.*" );
	Util.SetMaxUsers( 1, "CHECKPOINT_station_flag" );
	Util.SetMaxUsers( 1, "PLANT_Lorry_Wreck" );
	Util.SetMaxUsers( 1, "MOUNT_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );

	NP1 = OnTriggerRegion(AABB(501.189,2233.307,1.125,1147.288,3121.302,191.383), RegionTrigger.DisableBotPush);		//mine-field
	DCM1 = OnTriggerRegion(AABB(501.189,2233.307,1.125,1147.288,3121.302,191.383), RegionTrigger.DisableCombatMovement);	//mine-field
	DCM2 = OnTriggerRegion(AABB(1846.353,3366.040,12.722,2578.127,3585.952,294.331), RegionTrigger.DisableCombatMovement);	//the edge of the water near the wooden boat
	DCM3 = OnTriggerRegion(AABB(1779.452,3028.847,121.125,2677.524,3339.991,283.125), RegionTrigger.DisableCombatMovement);	//around bridge
	NP4 = OnTriggerRegion(AABB(1715.079,3420.623,449.125,2098.535,3587.998,567.389), RegionTrigger.DisableBotPush);		//around switches
	DCM4 = OnTriggerRegion(AABB(1715.079,3420.623,449.125,2098.535,3587.998,567.389), RegionTrigger.DisableCombatMovement);	//around switches
	NP5 = OnTriggerRegion(AABB(2479.899,3781.696,641.125,2578.737,3924.875,738.131), RegionTrigger.DisableBotPush);		//around goal "Defend_Axis_Road_4"
	DCM5 = OnTriggerRegion(AABB(2479.899,3781.696,641.125,2578.737,3924.875,738.131), RegionTrigger.DisableCombatMovement);	//around goal "Defend_Axis_Road_4"
	NP6 = OnTriggerRegion(AABB(1387.396,3749.426,641.125,1505.983,3924.875,759.727), RegionTrigger.DisableBotPush);		//around goal "Defend_Axis_Minefield_5"
	DCM6 = OnTriggerRegion(AABB(1387.396,3749.426,641.125,1505.983,3924.875,759.727), RegionTrigger.DisableCombatMovement);	//around goal "Defend_Axis_Minefield_5"
	NP7 = OnTriggerRegion(AABB(1128.593,3036.706,118.294,1384.421,3392.154,311.642), RegionTrigger.DisableBotPush);		//around goals "Defend_Axis_Minefield_2 & 3"
	NP8 = OnTriggerRegion(AABB(2154.405,1774.911,587.433,2428.708,2144.801,701.567), RegionTrigger.DisableBotPush);		//around goal "Defend_Axis_Start_Hilltop_.*"
	DCM8 = OnTriggerRegion(AABB(2154.405,1774.911,587.433,2428.708,2144.801,701.567), RegionTrigger.DisableCombatMovement);	//around goal "Defend_Axis_Start_Hilltop_.*"
	NP9 = OnTriggerRegion(AABB(2584.432,1789.840,448.583,2722.807,1898.433,584.233), RegionTrigger.DisableBotPush);		//around goal "DEFEND_Axis_Start_Road_6"
	DCM9 = OnTriggerRegion(AABB(2584.432,1789.840,448.583,2722.807,1898.433,584.233), RegionTrigger.DisableCombatMovement);	//around goal "DEFEND_Axis_Start_Road_6"
	NP10 = OnTriggerRegion(AABB(1383.774,3539.127,641.125,1494.507,3668.422,744.160), RegionTrigger.DisableBotPush);		//around goal "DEFEND_Axis_Start_Minefield_12"
	DCM10 = OnTriggerRegion(AABB(1383.774,3539.127,641.125,1494.507,3668.422,744.160), RegionTrigger.DisableCombatMovement);	//around goal "DEFEND_Axis_Start_Minefield_12"
	NP11 = OnTriggerRegion(AABB(1479.126,3353.254,441.125,2195.909,3422.868,563.125), RegionTrigger.DisableBotPush);		//platform near switches
	DCM11 = OnTriggerRegion(AABB(1479.126,3353.254,441.125,2195.909,3422.868,563.125), RegionTrigger.DisableCombatMovement);	//platform near switches
	NP12 = OnTriggerRegion(AABB(9707.125,9091.587,145.125,9856.875,9344.874,268.257), RegionTrigger.DisableBotPush);		//platform & stairs near axis second spawn
	DCM12 = OnTriggerRegion(AABB(9707.125,9091.587,145.125,9856.875,9344.874,268.257), RegionTrigger.DisableCombatMovement);	//platform & stairs near axis second spawn
	NP13 = OnTriggerRegion(AABB(10074.875,8928.448,9.125,10160.875,9111.145,136.337), RegionTrigger.DisableBotPush);		//around goal "MOBILEMG42_Axis_FrontDefend_1"
	DCM13 = OnTriggerRegion(AABB(10074.875,8928.448,9.125,10160.875,9111.145,136.337), RegionTrigger.DisableCombatMovement);	//around goal "MOBILEMG42_Axis_FrontDefend_1"
	NP14 = OnTriggerRegion(AABB(4250.535,7060.085,-59.686,4496.551,7501.099,165.437), RegionTrigger.DisableBotPush);		//around goal "MOBILEMG42_Axis_Flag_2"
	DCM14 = OnTriggerRegion(AABB(4250.535,7060.085,-59.686,4496.551,7501.099,165.437), RegionTrigger.DisableCombatMovement);	//around goal "MOBILEMG42_Axis_Flag_2"

	T1 = OnTriggerRegion(AABB(3078.460,1049.667,100.125,3116.460,1087.667,174.125), Map.Bomb_Truck_At_Barrier );
	T2 = OnTriggerRegion(AABB(3207.531,1415.879,100.125,3247.031,1474.177,213.025), Map.Bomb_Truck_Past_Barrier );
	T3 = OnTriggerRegion(AABB(2805.708,1572.979,79.552,3978.279,2475.011,579.317), Map.AlliesOnTheRoad );	//trigger: firing range of the cannon on the road
	T4 = OnTriggerRegion(AABB(3035.564,1600.319,100.125,3409.018,2102.013,227.813), Map.TruckOnTheRoad );	//trigger: firing range of the cannon on the road
	T5 = OnTriggerRegion(AABB(501.619,1993.297,1.125,1162.886,3267.377,172.531), Map.AlliesInMinefield );	//trigger around minefield
	T6 = OnTriggerRegion(AABB(1683.165,1988.133,597.036,2289.206,2576.321,905.910), Map.AlliesOnHilltop );	//trigger around hilltop
	T7 = OnTriggerRegion(AABB(2443.243,3087.125,137.125,2526.982,3248.875,253.505), Map.TruckOnTheBridge );	//trigger on the bridge
	T8 = OnTriggerRegion(AABB(2082.043,3087.125,137.125,2133.290,3248.874,253.158), Map.TruckOnTheBridgeExit );	//trigger on the bridge
	T9 = OnTriggerRegion(AABB(6780.891,5126.457,-62.870,10688.859,10529.378,502.555), Map.AlliesNearTanks );	//trigger around tanks
	T10 = OnTriggerRegion(AABB(6850.875,8938.503,73.125,6888.875,8976.503,147.125), Map.SwitchAlliesSteam );	//trigger goal "SWITCH_Allies_Steam"

	Trigger_WindowFirstAxisSpawn = OnTriggerRegion(AABB(1898.385,3539.125,193.125,2255.823,3870.788,415.868), RegionTrigger.BreakableDistance);	//window in first axis spawn
	Trigger_WoodenBoat = OnTriggerRegion(AABB(2118.597,3309.232,6.808,2429.108,3520.311,211.329), RegionTrigger.BreakableDistance);	//wooden boat under first axis spawn
	Trigger_WoodenBarrier = OnTriggerRegion(AABB(1742.437,2327.808,630.982,1952.902,2465.375,816.209), RegionTrigger.BreakableDistance);	//wooden barrier on top of the hill
	Trigger_Window_1_StationSpawn = OnTriggerRegion(AABB(2541.558,4922.791,1.125,2977.894,5278.417,210.734), RegionTrigger.BreakableDistance);	//window near Station spawn
	Trigger_Window_2_StationSpawn = OnTriggerRegion(AABB(3302.668,5175.125,1.125,3614.012,5666.239,183.702), RegionTrigger.BreakableDistance);	//window near Station spawn
	Trigger_UpperWindow_SecondAxisSpawn = OnTriggerRegion(AABB(9785.617,8880.192,161.125,10153.520,9364.504,272.862), RegionTrigger.BreakableDistance);	//window in second axis spawn
	Trigger_LowerWindow_SecondAxisSpawn = OnTriggerRegion(AABB(9723.771,8858.310,1.125,9959.734,9283.442,141.819), RegionTrigger.BreakableDistance);	//window under second axis spawn

	MapRoutes =
	{
		CHECKPOINT_station_flag =
		{
			ROUTE_Depot =
			{
				ROUTE_Depot_Tunnel =
				{
					Weight = 3,
				},
				ROUTE_Depot_Tunnel =
				{
					ROUTE_Depot_Upper_Tunnel =
					{

					},
				},
			},

			ROUTE_AxisSecondSpawn =
			{
				ROUTE_Storage =
				{
					Weight = 3,
					ROUTE_Front_Tunnel =
					{

					},
				},
				ROUTE_Steam_Right =
				{
					ROUTE_Left_Tunnel =
					{

					},
				},
				ROUTE_Workshop_Door =
				{
					ROUTE_Left_Tunnel =
					{

					},
				},
			},
		},
	};

	MapRoutes["GRENADE_.*"] =
	{
		ROUTE_Depot =
		{
			ROUTE_Depot_Tunnel =
			{
				ROUTE_Left_Tunnel =
				{
					ROUTE_Steam_Right =
					{

					},
					ROUTE_Steam_Left =
					{

					},
					ROUTE_Workshop_Door =
					{

					},
				},
				ROUTE_Front_Tunnel =
				{
					ROUTE_Storage =
					{

					},
				},
			},
		},

		ROUTE_Station_Spawn =
		{
			ROUTE_Left_Tunnel =
			{
				ROUTE_Steam_Right =
				{

				},
				ROUTE_Steam_Left =
				{

				},
				ROUTE_Workshop_Door =
				{

				},
			},
			ROUTE_Front_Tunnel =
			{
				ROUTE_Storage =
				{

				},
			},
		},
	};

	MapRoutes[".*_Axis_Flag_.*"] =
	{
		ROUTE_AxisSecondSpawn =
		{
			ROUTE_Storage =
			{
				ROUTE_Front_Tunnel =
				{

				},
			},
			ROUTE_Steam_Right =
			{
				ROUTE_Left_Tunnel =
				{

				},
			},
			ROUTE_Workshop_Door =
			{
				ROUTE_Left_Tunnel =
				{

				},
			},
		},
	};

	Util.Routes(MapRoutes);

	Util.FixMoverPos("truck", Vec3(1025.000, 1142.500, 72.500), Vec3(1024.000, 1288.000, 4.000));

	print( "^3Omni-bot map script by ^1Q^2i^3k^4i^1 and ^1n^2a^4t^8i^3v^5e12 ^3for " + GetMapName() + " executed." );
};

global OnBotJoin = function( bot )
{
	Util.IgnoreTargetGoal( bot, "MOVER_fan_electrics" );

	Server.MinClassCount[TEAM.AXIS][CLASS.SOLDIER] = 1;
	Server.MinClassCount[TEAM.AXIS][CLASS.ENGINEER] = 2;
	Server.MinClassCount[TEAM.AXIS][CLASS.FIELDOPS] = 1;

	wpn = bot.GetWeapon(WEAPON.ALLY_GRENADE);
	if(wpn)
	{
		wpn.PrimaryFire.LowAmmoPriority = 0.8;
	}
};
