global Map =
{
	Ammo_Cabinet_north_ammocabinet = "AMMOCAB_north_ammocabinet",
	Ammo_Cabinet_south_ammocabinet = "AMMOCAB_south_ammocabinet",
	Health_Cabinet_north_healthcabinet = "HEALTHCAB_north_healthcabinet",
	Health_Cabinet_south_healthcabinet = "HEALTHCAB_south_healthcabinet",
	Flag_gold_crate = "FLAG_gold_crate",
	Cappoint_Gold_Dropoff = "CAPPOINT_Gold_Dropoff",
	Build_Command_Post = "BUILD_Command_Post",
	Build_Tank = "BUILD_Tank",
	Build_Tank_Barrier_1 = "BUILD_Tank_Barrier_1",
	Build_Tank_Barrier_2 = "BUILD_Tank_Barrier_2",
	Build_Truck = "BUILD_Truck",
	Build_Truck_Barrier_1 = "BUILD_Truck_Barrier_1",
	Build_Truck_Barrier_2 = "BUILD_Truck_Barrier_2",
	Plant_Command_Post = "PLANT_Command_Post",
	Plant_Tank_Barrier_1 = "PLANT_Tank_Barrier_1",
	Plant_Tank_Barrier_2 = "PLANT_Tank_Barrier_2",
	Plant_Truck_Barrier_1 = "PLANT_Truck_Barrier_1",
	Plant_Truck_Barrier_2 = "PLANT_Truck_Barrier_2",
	Mount_mg42_allied = "MOUNTMG42_mg42_allied",
	Mount_mg42_bank = "MOUNTMG42_mg42_bank",
	Mount_mg42_bridge = "MOUNTMG42_mg42_bridge",
	Repair_mg42_allied = "REPAIRMG42_mg42_allied",
	Repair_mg42_bank = "REPAIRMG42_mg42_bank",
	Repair_mg42_bridge = "REPAIRMG42_mg42_bridge",
	Mover_tank = "MOVER_tank",
	Mover_truck = "MOVER_truck",
	Plant_Mine_393 = "PLANTMINE_393",
	Plant_Mine_823 = "PLANTMINE_823",
	Plant_Mine_824 = "PLANTMINE_824",
	Plant_Mine_849 = "PLANTMINE_849",
	Plant_Mine_928 = "PLANTMINE_928",
	Plant_Mine_96 = "PLANTMINE_96",
	Plant_Mine_Depot_6 = "PLANTMINE_Depot_6",
	Plant_Mine_Truck_Barrier1_3 = "PLANTMINE_Truck_Barrier1_3",
	Plant_Mine_depotgate2 = "PLANTMINE_depotgate2",

	start_of_map = true,
	Escorting = false,
	TruckLoaded = false,

	//set status' for conditionals
	barrierone = 0, //not constructed
	barriertwo = 0,
	barrierthree = 0,
	barrierfour = 0,

	// region triggers
	iw1 = 0,
	iw2 = 0,
	iw3 = 0,
	DefendingTeam = TEAM.AXIS,

	//vehicle positions
	near_defense_one = false,
	near_defense_two = false,
	near_defense_three = false,
	near_defense_four = false,

	//dyno counters
	bOneDyno = 0,
	bTwoDyno = 0,
	bThreeDyno = 0,
	bFourDyno = 0,

	DispenseAmmoTime = 15,

	spamnades = true,
	rnadehall_bots = 0,
	rnadedoor_bots = 0,
	Navigation =
	{
		rnadehall =
		{
			wpInfo = Util.WpNameInfo("rNadeHall"),
			navigate = function(_this)
			{
				if ( Map.spamnades && Map.rnadehall_bots < 1 && Map.start_of_map && _this.Bot.HasAmmo(WEAPON.AXIS_GRENADE) )
				{
					Map.rnadehall_bots += 1;

					_this.AddAimRequest(Priority.High, "facing", Map.Navigation.rnadehall.wpInfo.facing);
					_this.AddWeaponRequest(Priority.High, WEAPON.AXIS_GRENADE );

					if ( _this.Goto(Map.Navigation.rnadehall.wpInfo.position) == EVENT.PATH_SUCCESS )
					{
						_this.BlockForWeaponChange( WEAPON.AXIS_GRENADE );
						_this.Bot.HoldButton(BTN.ATTACK1, 0.5);
						sleep(1);
					}

					Map.rnadehall_bots -= 1;
					yield();
				}
				else
				{
					sleep(1);
				}

			},
		},

		quickjump =
		{
			navigate = function(_this)
			{
				_this.Bot.HoldButton(BTN.JUMP, 0.25);
				sleep(0.25);
			},
		},
	},

	// path through for allies throwing a/s to assist in stealing tank
	Airstrike =
	{
		tankassist =
		{
			Enabled = true,
			Team = (1<<TEAM.ALLIES),
			Facing = Vector3(-0.601,-0.392,0.696),
			NoPause = false,
			Waypoint = "bTankAS1",
		},
	},

	slopeNodes = function(close)
	{
		for( i = 1; i <= 3; i += 1 ) {
			s = "slope" + i;
			Wp.SetWaypointFlag( s, "closed", close );
		}
	},

	allies_steal_tank = function( trigger )
	{
		Map.spamnades = false;

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Depot_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Tank_Barrier1_.*" );
		Map.Airstrike.tankassist.Enabled = false;

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Depot_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Tank_Barrier1_.*",
			"TRIPMINE_Tank_Barrier1_.*",
			"CAMP_rTbarrier1_.*",
			"AIRSTRIKE_rTbarrier1_.*",
		});
		SetGoalPriority( Map.Build_Command_Post, 0.8, TEAM.AXIS);
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"AIRSTRIKE_rDepot.*",
			"PLANTMINE_rTank.*",
			"TRIPMINE_Depot.*",
		});

		// use build offsets instead of forced routing
		Util.ForceRouting( "BUILD_Tank", false );

		Util.MapDebugPrint( "allies_steal_tank" );
	},

	Command_Post_Built = function( trigger )
	{
		Util.MapDebugPrint( "Command_Post_Built" );
	},

	Command_Post_Destroyed = function( trigger )
	{
		Util.MapDebugPrint( "Command_Post_Destroyed" );
	},

	Tank_Built = function( trigger )
	{
		// Allied goals
		if ( Map.start_of_map )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Command_Post );
			Map.start_of_map = false;
		}

		Util.MapDebugPrint( "Tank_Built" );
	},

	Tank_Destroyed = function ( trigger )
	{
		Util.SetPositionGoal( Map.Build_Tank, Map.Mover_tank );

		Util.MapDebugPrint( "Tank_Destroyed" );
	},

	Truck_Built = function( trigger )
	{
		Util.MapDebugPrint( "Truck_Built" );
	},

	Truck_Destroyed = function ( trigger )
	{
		Util.SetPositionGoal( Map.Build_Truck, Map.Mover_truck );

		Util.MapDebugPrint( "Truck_Destroyed" );
	},

	tank_at_barrier1 = function()
	{
		Map.near_defense_one = true;

		//technically shouldn't need the 'else', but just to be sure
		if ( Map.barrierone > 0 && Map.bOneDyno < 1)
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Tank ); }
		else
			{ SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Tank ); }

		Util.MapDebugPrint("tank_at_barrier1");
	},

	tank_past_barrier1 = function( trigger )
	{
		// open these nodes for a more direct path
		Map.slopeNodes(false);

		Map.near_defense_one = false;

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_Tank_Barrier2_.*",
			"ATTACK_newbarrier2_.*",
			Map.Plant_Tank_Barrier_2,
			Map.Mount_mg42_bridge,
			Map.Repair_mg42_bridge,
			"AIRSTRIKE_bBarrier2.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Ammo_Cabinet_north_ammocabinet,
			"ATTACK_Tank_Barrier1_.*",
			Map.Plant_Tank_Barrier_1,
			Map.Health_Cabinet_north_healthcabinet,
		});

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, true, {
			Map.Ammo_Cabinet_south_ammocabinet,
			"DEFEND_Tank_Barrier2_.*",
			"TRIPMINE_Tank_Barrier2_.*",
			Map.Build_Tank_Barrier_2,
			Map.Health_Cabinet_south_healthcabinet,
			Map.Mount_mg42_bridge,
			Map.Repair_mg42_bridge,
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			Map.Build_Tank_Barrier_1,
			"DEFEND_Tank_Barrier1_.*",
			"TRIPMINE_Tank_Barrier1_.*",
			"CAMP_rTbarrier1_.*",
			"AIRSTRIKE_rTbarrier1_.*",
		});

		//make sure the tank repair goal is active
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Tank );

		Util.MapDebugPrint( "tank_past_barrier1" );
	},

	Tank_Barrier_1_Built = function( trigger )
	{
		Map.barrierone = 1;

		if ( Map.near_defense_one )
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Tank ); }

		Util.MapDebugPrint( "Tank_Barrier_1_Built" );
	},

	Tank_Barrier_1_Destroyed = function( trigger )
	{
		Map.barrierone = 0;

		//reset the dyno counter
		Map.bOneDyno = 0;

		Util.MapDebugPrint( "Tank_Barrier_1_Destroyed" );
	},

	planted_at_Tank_Barrier_1 = function ( trigger )
	{
		//got a dyno down, build the tank if needed
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Tank );

		Map.bOneDyno += 1;

		Util.MapDebugPrint("planted_at_Tank_Barrier_1");
	},

	defused_at_Tank_Barrier_1 = function ( trigger )
	{
		Map.bOneDyno -= 1;

		//focus back on planting dyno
		if ( Map.bOneDyno < 1 && Map.near_defense_one )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Tank );
		}

		Util.MapDebugPrint("defused_at_Tank_Barrier_1");
	},

	tank_at_bridge_mg = function()
	{
		Map.at_bridge_mg = true;

		SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_Tank_Barrier_2 );
		Util.MapDebugPrint("tank_at_bridge_mg");
	},

	tank_at_barrier2 = function()
	{
		Map.near_defense_two = true;

		SetGoalPriority( Map.Build_Command_Post, 0.83, TEAM.ALLIES);

		if ( Map.barriertwo > 0 && Map.bTwoDyno < 1 )
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Tank ); }
		else
			{ SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Tank ); }

		SetAvailableMapGoals( TEAM.AXIS, false, Map.Build_Command_Post );

		// enable the repair routes
		Util.EnableGoal("ROUTE_repair_route.*");
		Util.MapDebugPrint("tank_at_barrier2");
	},

	tank_past_barrier2 = function( trigger )
	{
		Map.near_defense_two = false;

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_Bank_.*",
			Map.Mount_mg42_bank,
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ATTACK_Tank_Barrier2_.*",
			"ATTACK_newbarrier2_.*",
			Map.Plant_Tank_Barrier_2,
			Map.Mount_mg42_bridge,
			Map.Repair_mg42_bridge,
			"AIRSTRIKE_bBarrier2.*",
		});

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, true, {
			Map.Mount_mg42_bank,
			"DEFEND_Bank_.*",
			Map.Repair_mg42_bank,
			Map.Build_Truck_Barrier_1,
			"PLANTMINE_rBank.*",
			"CALLARTILLERY_rBank.*",
			"ARTILLERY_S_rBank.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Tank_Barrier2_.*",
			"TRIPMINE_Tank_Barrier2_.*",
			"DEFEND_Bank_[89]",
			"DEFEND_Bank_Roam4",
			Map.Build_Tank_Barrier_2,
			Map.Mount_mg42_bridge,
			Map.Repair_mg42_bridge,
		});

		//make sure the tank repair goal is active
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Tank );

		// only use the back stairs for the repair
		Util.DisableGoal("ROUTE_repair_route_bridge.*");

		// routing isn't super reliable here, and we want allies avoiding south stairs
		Wp.SetWaypointFlag( "southstairs1", "axis", true );
		Wp.SetWaypointFlag( "southstairs3", "axis", true );

		Util.MapDebugPrint( "tank_past_barrier2" );
	},

	Tank_Barrier_2_Built = function( trigger )
	{
		Map.barriertwo = 1;

		if ( Map.near_defense_two )
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Tank ); }

		Util.MapDebugPrint( "Tank_Barrier_2_Built" );
	},

	Tank_Barrier_2_Destroyed = function( trigger )
	{
		Map.barriertwo = 0;

		//reset the dyno counter
		Map.bTwoDyno = 0;

		Util.MapDebugPrint( "Tank_Barrier_2_Destroyed" );
	},

	planted_at_Tank_Barrier_2 = function ( trigger )
	{
		Map.bTwoDyno += 1;

		if ( Map.near_defense_two )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Tank );
		}

		Util.MapDebugPrint("planted_at_Tank_Barrier_2");
	},

	defused_at_Tank_Barrier_2 = function ( trigger )
	{
		Map.bTwoDyno -= 1;

		if ( Map.bTwoDyno < 1 && Map.near_defense_two )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Tank );
		}

		Util.MapDebugPrint("defused_at_Tank_Barrier_2");
	},

	blow_doors = function( trigger )
	{
		sleep( 2 );

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Tank );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			Map.Build_Truck,
			Map.Flag_gold_crate,
			Map.Cappoint_Gold_Dropoff,
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "MOUNT_tank" );

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Build_Truck_Barrier_2 );
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Mount_mg42_bridge );
		SetAvailableMapGoals( TEAM.AXIS, true, Map.Mount_mg42_bank );
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Repair_mg42_bridge );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_Bank_[89]",
			"TRIPMINE_Bank.*",
			"DEFEND_Bank_Roam4",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, "MOUNT_tank_axis" );

		// let allies use south stairs again
		Wp.SetWaypointFlag( "southstairs1", "axis", false );
		Wp.SetWaypointFlag( "southstairs3", "axis", false );

		// intrusion warning region triggers
		Map.iw1 = OnTriggerRegion( AABB(1480.742,-2466.167,-403.870,1605.773,-2403.699,-235.466), RegionTrigger.IntrusionWarning );
		Map.iw2 = OnTriggerRegion( AABB(1470.405,-2041.986,-359.106,1696.767,-1951.906,-206.108), RegionTrigger.IntrusionWarning );
		Map.iw3 = OnTriggerRegion( AABB(1854.647,-2344.672,-406.225,1942.472,-2162.907,-187.716), RegionTrigger.IntrusionWarning );

		Util.MapDebugPrint( "blow_doors" );
	},

	allies_taking_gold = function( trigger )
	{
		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			Map.Repair_mg42_allied,
			"ESCORT_truck",
			Map.Mount_mg42_allied,
			"ATTACK_Truck_Barrier1_.*",
			Map.Plant_Truck_Barrier_1,
			Map.Plant_Truck_Barrier_2,
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ATTACK_Bank_.*",
			Map.Mount_mg42_bank,
		});
		SetGoalPriority( Map.Build_Truck, 0.9, TEAM.ALLIES );

		Map.TruckLoaded = true;

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, true, {
			Map.Repair_mg42_allied,
			Map.Mount_mg42_allied,
			"DEFEND_Truck_Barrier1_.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_Bank_.*",
			"TRIPMINE_Bank.*",
			Map.Mount_mg42_bank,
			Map.Repair_mg42_bank,
			"PLANTMINE_rBank.*",
			"CALLARTILLERY_rBank.*",
			"ARTILLERY_S_rBank.*",
		});

		DeleteTriggerRegion( Map.iw1 );
		DeleteTriggerRegion( Map.iw2 );
		DeleteTriggerRegion( Map.iw3 );

		Util.MapDebugPrint( "allies_taking_gold" );
	},

	truck_at_barrier1 = function()
	{
		Map.near_defense_three = true;

		SetAvailableMapGoals( TEAM.AXIS, false, Map.Plant_Command_Post );

		if ( Map.barrierthree > 0 && Map.bThreeDyno < 1 )
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Truck ); }
		else
			{ SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Truck ); }

		Util.MapDebugPrint("truck_at_barrier1");
	},

	truck_past_barrier1 = function( trigger )
	{
		Map.near_defense_three = false;
		Util.ChangeSpawn( TEAM.ALLIES, 3 );

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Truck_Barrier1_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Truck_Barrier2_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, Map.Plant_Truck_Barrier_1 );

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Truck_Barrier1_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Truck_Barrier2_.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, Map.Build_Truck_Barrier_1 );

		//make sure the truck repair goal is active
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Truck );

		Util.MapDebugPrint( "truck_past_barrier1" );
	},

	Truck_Barrier_1_Built = function( trigger )
	{
		Map.barrierthree = 1;

		if ( Map.near_defense_three )
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Truck ); }

		Util.MapDebugPrint( "Truck_Barrier_1_Built" );
	},

	Truck_Barrier_1_Destroyed = function( trigger )
	{
		Map.barrierthree = 0;

		//reset the dyno counter
		Map.bThreeDyno = 0;

		Util.MapDebugPrint( "Truck_Barrier_1_Destroyed" );
	},

	planted_at_Truck_Barrier_1 = function ( trigger )
	{
		Map.bThreeDyno += 1;

		if ( Map.near_defense_three )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Truck );
		}

		Util.MapDebugPrint("planted_at_Truck_Barrier_1");
	},

	defused_at_Truck_Barrier_1 = function ( trigger )
	{
		Map.bThreeDyno -= 1;

		if ( Map.bThreeDyno < 1 && Map.near_defense_three )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Truck );
		}

		Util.MapDebugPrint("defused_at_Truck_Barrier_1");
	},

	truck_at_barrier2 = function()
	{
		Map.near_defense_four = true;

		if ( Map.barrierfour > 0 && Map.bFourDyno < 1 )
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Truck ); }
		else
			{ SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Truck ); }

		Util.MapDebugPrint("truck_at_barrier2");
	},

	truck_past_barrier2 = function( trigger )
	{
		Map.near_defense_four = false;

		// Allied goals
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Truck_Barrier2_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Escape_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			Map.Mount_mg42_allied,
			Map.Repair_mg42_allied,
			Map.Plant_Truck_Barrier_2,
		});

		// Axis goals
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Truck_Barrier2_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Truck_Escape_.*" );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			Map.Mount_mg42_allied,
			Map.Repair_mg42_allied,
			Map.Build_Truck_Barrier_2,
		});

		//make sure the truck repair goal is active
		SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Truck );

		Util.MapDebugPrint( "truck_past_barrier2" );
	},

	Truck_Barrier_2_Built = function( trigger )
	{
		Map.barrierfour = 1;

		if ( Map.near_defense_four )
			{ SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Truck ); }

		Util.MapDebugPrint( "Truck_Barrier_2_Built" );
	},

	Truck_Barrier_2_Destroyed = function( trigger )
	{
		Map.barrierfour = 0;

		//reset the dyno counter
		Map.bFourDyno = 0;

		Util.MapDebugPrint( "Truck_Barrier_2_Destroyed" );
	},

	planted_at_Truck_Barrier_2 = function ( trigger )
	{
		Map.bFourDyno += 1;

		if ( Map.near_defense_four )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, Map.Build_Truck );
		}

		Util.MapDebugPrint("planted_at_Truck_Barrier_2");
	},

	defused_at_Truck_Barrier_2 = function ( trigger )
	{
		Map.bFourDyno -= 1;

		if ( Map.bFourDyno < 1 && Map.near_defense_four )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, Map.Build_Truck );
		}

		Util.MapDebugPrint("defused_at_Truck_Barrier_2");
	},

	gold_crate_Taken = function( trigger )
	{
		Util.MapDebugPrint( "gold_crate_Taken" );
	},

	Gold_Dropoff_Captured = function( trigger )
	{
		Util.MapDebugPrint( "Gold_Dropoff_Captured" );
	},

	vehicle_at_location = function( trigger )
	{
		switch(Map.VehicleLocation)
		{
			case 1: // tank
			{
				// unused atm
			}
			case 2:
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "MOUNT_tank_axis" );
				Map.tank_at_barrier1();
			}
			case 3: // bridge hill
			{
				// axis can't get a good aim from here
				SetAvailableMapGoals( TEAM.AXIS, false, "MOUNT_tank_axis" );
			}
			case 4:
			{
				Map.tank_at_bridge_mg();
				SetAvailableMapGoals( TEAM.AXIS, true, "MOUNT_tank_axis" );

				// allies can come from both sides
				ETUtil.SetAimModeForMount( "MOUNT_tank_axis", "random" );
			}
			case 5:
			{
				Map.tank_at_barrier2();
			}
			case 6: // truck
			{
				Map.truck_at_barrier1();
			}
			case 7:
			{
				Map.truck_at_barrier2();
			}
		}
		Util.MapDebugPrint("vehicle at location " + Map.VehicleLocation, true);
	},
};

global OnMapLoad = function()
{
	Util.SetGoalOffset( 0, 160, 0, Map.Plant_Tank_Barrier_1 );
	Util.SetGoalOffset( 0, 174, 0, Map.Plant_Tank_Barrier_2 );

	// Adjust tank goal for rebuild
	Util.SetPositionGoal( Map.Build_Tank, Map.Mover_tank );
	Util.SetPositionGoal( Map.Build_Truck, Map.Mover_truck ); //truck too

	// close these waypoints until tank is past barrier
	Map.slopeNodes(true);

	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Command_Post_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Command_Post_Built );
	OnTrigger( "The Tank has been repaired!", Map.Tank_Built );
	OnTrigger( "Tank Barrier #1 has been constructed.", Map.Tank_Barrier_1_Built );
	OnTrigger( "Tank Barrier #2 has been constructed.", Map.Tank_Barrier_2_Built );
	OnTrigger( "The Truck has been repaired!", Map.Truck_Built );
	OnTrigger( "Truck Barrier #1 has been constructed.", Map.Truck_Barrier_1_Built );
	OnTrigger( "Truck Barrier #2 has been constructed.", Map.Truck_Barrier_2_Built );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Command_Post_Destroyed );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Command_Post_Destroyed );
	OnTrigger( "The Tank has been damaged!", Map.Tank_Destroyed );
	OnTrigger( "Tank Barrier #1 has been destroyed.", Map.Tank_Barrier_1_Destroyed );
	OnTrigger( "Tank Barrier #2 has been destroyed.", Map.Tank_Barrier_2_Destroyed );
	OnTrigger( "The Truck has been damaged!", Map.Truck_Destroyed );
	OnTrigger( "Truck Barrier #1 has been destroyed.", Map.Truck_Barrier_1_Destroyed );
	OnTrigger( "Truck Barrier #2 has been destroyed.", Map.Truck_Barrier_2_Destroyed );
	OnTrigger( "goldrush_allies_gold1_taken", Map.gold_crate_Taken );
	OnTrigger( "goldrush_allies_gold2_taken", Map.gold_crate_Taken );
	OnTrigger( "Allied team has secured the first Gold Crate!", Map.Gold_Dropoff_Captured );
	OnTrigger( "Allied team has secured the second Gold Crate!", Map.Gold_Dropoff_Captured );
	OnTrigger( "Allied team has stolen the Tank!", Map.allies_steal_tank );
	OnTrigger( "Allied team is escaping with the Gold Crates!", Map.allies_taking_gold );
	OnTrigger( "goldrush_allies_tank_barrier1", Map.tank_past_barrier1 );
	OnTrigger( "goldrush_allies_tank_barrier2", Map.tank_past_barrier2 );
	OnTrigger( "goldrush_allies_truck_barrier1", Map.truck_past_barrier1 );
	OnTrigger( "goldrush_allies_truck_barrier2", Map.truck_past_barrier2 );
	OnTrigger( "Allied team has destroyed the Bank Doors!", Map.blow_doors );
	OnTrigger( "Planted at Tank Barrier #1.", Map.planted_at_Tank_Barrier_1 );
	OnTrigger( "Defused at Tank Barrier #1.", Map.defused_at_Tank_Barrier_1 );
	OnTrigger( "Planted at Tank Barrier #2.", Map.planted_at_Tank_Barrier_2 );
	OnTrigger( "Defused at Tank Barrier #2.", Map.defused_at_Tank_Barrier_2 );
	OnTrigger( "Planted at Truck Barrier #1.", Map.planted_at_Truck_Barrier_1 );
	OnTrigger( "Defused at Truck Barrier #1.", Map.defused_at_Truck_Barrier_1 );
	OnTrigger( "Planted at Truck Barrier #2.", Map.planted_at_Truck_Barrier_2 );
	OnTrigger( "Defused at Truck Barrier #2.", Map.defused_at_Truck_Barrier_2 );
	OnTrigger( "tank at location", Map.vehicle_at_location );
	OnTrigger( "truck at location", Map.vehicle_at_location );

	firstcorner = OnTriggerRegion(AABB(641.330,1526.699,184.529,952.875,1677.401,267.442), RegionTrigger.VehicleTrigger);
	barrier1 = OnTriggerRegion(AABB(660.253,828.462,59.548,960.874,1040.700,173.040), RegionTrigger.VehicleTrigger);
	bridgehill = OnTriggerRegion(AABB(2151.544,-64.875,-147.159,2313.876,184.875,-36.052), RegionTrigger.VehicleTrigger);
	bridgemg = OnTriggerRegion(AABB(2223.261,938.122,-416.814,2471.191,1218.338,-342.679), RegionTrigger.VehicleTrigger);
	barrier2 = OnTriggerRegion(AABB(1656.194,493.729,-416.801,2034.268,726.966,-337.425), RegionTrigger.VehicleTrigger);
	barrier3 = OnTriggerRegion(AABB(480.061,-720.472,-332.313,634.705,-478.740,-222.440), RegionTrigger.VehicleTrigger);
	barrier4 = OnTriggerRegion(AABB(-1818.902,-1406.621,-47.144,-1658.912,-1076.801,37.125), RegionTrigger.VehicleTrigger);

	// when tank is between barrier 2 and final spot, force allies anywhere but south stairs
	Wp.SetWaypointFlag( "southstairs1", "axis", false );
	Wp.SetWaypointFlag( "southstairs3", "axis", false );

	// set some preferred positions to start from for vehicle goals
	ETUtil.SetStartIndex("BUILD_Truck", 0);
	ETUtil.SetStartIndex("ESCORT_truck", 0);
	ETUtil.SetStartIndex("BUILD_Tank", 0);

	// Max users per goal
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsersInProgress( 2, "DEFEND_Bank_Roam.*" );
	Util.SetMaxUsersInProgress( 2, "DEFEND_Tank_Barrier2_Roam.*" );
	Util.SetMaxUsers( 1, "CAMP_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 1, "MOUNT_tank.*" );
	Util.SetMaxUsers( 1, ".*Command_Post" );

	SetMapGoalProperties( "ATTACK_.*", {MinCampTime=10, MaxCampTime=30});
	SetMapGoalProperties( "DEFEND_.*", {MinCampTime=15, MaxCampTime=20});
	SetMapGoalProperties( "DEFEND_Bank_Roam.*", {MinCampTime=1, MaxCampTime=2});
	SetMapGoalProperties( "DEFEND_Tank_Barrier2_Roam.*", {MinCampTime=1, MaxCampTime=2});
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=45, MaxCampTime=90});
	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=120, MaxCampTime=120});

	SetGoalPriority( "MOUNTMG42_.*", 0.0, 0, CLASS.MEDIC );
	SetGoalPriority( "MOUNTMG42_.*", 0.0, 0, CLASS.ENGINEER );
	SetGoalPriority( "DEFEND_Bank_Roam.*", 0.49 );
	SetGoalPriority( "DEFEND_Tank_Barrier2_Roam.*", 0.49 );

	ETUtil.SetCabinets();

	// Allied goals
	SetGoalPriority( Map.Build_Truck, 0.7, TEAM.ALLIES );
	SetGoalPriority( Map.Cappoint_Gold_Dropoff, 0.92, TEAM.ALLIES );
	SetGoalPriority( Map.Build_Tank, 0.91, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Command_Post, 0.0, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Tank_Barrier_1, 0.84, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Tank_Barrier_2, 0.83, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Truck_Barrier_1, 0.82, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Truck_Barrier_2, 0.81, TEAM.ALLIES, CLASS.ENGINEER );

	// Axis goals
	SetGoalPriority( "PLANTMINE_rTank2", 0.93, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( Map.Build_Tank_Barrier_1, 0.93, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( Map.Build_Command_Post, 0.92, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( Map.Build_Tank_Barrier_2, 0.92, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( Map.Build_Truck_Barrier_1, 0.91, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( Map.Plant_Command_Post, 0.0, TEAM.AXIS, CLASS.ENGINEER );

	Util.DisableGoal( ".*", true ); // all but routes

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"AMMOCAB_north_ammocabinet",
		"HEALTHCAB_north_healthcabinet",
		"BUILD_Tank",
		"PLANT_Tank_Barrier_1",
		"PLANT_Tank_Barrier_2",
		"MOUNT_tank",
		"PLANT_Command_Post",
		"ATTACK_Depot.*",
	});

	SetAvailableMapGoals( TEAM.AXIS, true, {
		"BUILD_Tank_Barrier_1",
		"BUILD_Command_Post",
		"PLANT_Command_Post",
		"DEFEND_Depot.*",
		"AIRSTRIKE_rDepot.*",
		"PLANTMINE_rTank.*",
		"TRIPMINE_Depot.*",
	});

	//routes for tank build at barrier 2
	Util.DisableGoal("ROUTE_repair_route.*");

	// force routing for the tank build
	Util.ForceRouting( "BUILD_Tank", true );

	//set up some routing
	MapRoutes =
	{
		BUILD_Tank =
		{
			ROUTE_AllySpawn =
			{
				ROUTE_depotgate =
				{
					ROUTE_depotgate2 = {},
					ROUTE_depotgatesplit = { ROUTE_as_rightsplit1 = {}, },
					ROUTE_cproute = {},
				},
				ROUTE_as_right =
				{
					ROUTE_as_rightsplit1 = {},
					ROUTE_as_rightsplit2 = { ROUTE_depotflank = {}, },
				},
			},
			ROUTE_AllySpawn2 =
			{
				ROUTE_depotgate =
				{
					ROUTE_depotgate2 = {},
					ROUTE_depotgatesplit = { ROUTE_as_rightsplit1 = {}, },
					ROUTE_cproute = {},
				},
				ROUTE_as_right =
				{
					ROUTE_as_rightsplit1 = {},
					ROUTE_as_rightsplit2 = { ROUTE_depotflank = {}, },
				},
			},

			ROUTE_TankYardSpawn =
			{
				ROUTE_repair_route_stairs = {},
				ROUTE_repair_route_bridge1 =
				{
					Weight = 2,
					ROUTE_repair_route_bridge2 =
					{
						ROUTE_repair_route_bridge3 = {},
					}
				},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_repair_route_stairs = {},
				ROUTE_repair_route_bridge1 =
				{
					Weight = 2,
					ROUTE_repair_route_bridge2 =
					{
						ROUTE_repair_route_bridge3 = {},
					}
				},
			},
		},
		PLANT_Tank_Barrier_1 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_depotflank = {},
				ROUTE_depotflank2 = {},
				ROUTE_as_rightsplit1 = {},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_depotflank = {},
				ROUTE_depotflank2 = {},
				ROUTE_as_rightsplit1 = {},
			},
		},
		PLANT_Tank_Barrier_2 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_bridgeroute =
				{
					Weight = 3,
					ROUTE_bridgeroute2 = {},
				},
				ROUTE_cp_stairs = { Weight = 2,},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_bridgeroute =
				{
					ROUTE_bridgeroute2 = {},
				},
				ROUTE_cp_stairs = { Weight = 2,},
			},
		},
		ATTACK_Tank_Barrier2_1 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_bridgeroute =
				{
					Weight = 3,
					ROUTE_bridgeroute2 = {},
				},
				ROUTE_trb1_stairs = { Weight = 2, ROUTE_b2flank = {}, },
				ROUTE_cp_stairs = {},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_bridgeroute =
				{
					Weight = 2,
					ROUTE_bridgeroute2 = {},
				},
				ROUTE_trb1_stairs = { Weight = 2, ROUTE_b2flank = {}, },
				ROUTE_cp_stairs = {},
			},
		},
		ATTACK_newbarrier2_1 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_trb1_stairs = { ROUTE_b2flank = {}, },
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_trb1_stairs = { ROUTE_b2flank = {}, },
			},
		},
		ATTACK_Bank_1 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_trb1_stairs = {},
				ROUTE_cp_stairs = { ROUTE_cp_stairs2 = {}, },
				//ROUTE_southstairs = {},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_trb1_stairs = {},
				ROUTE_cp_stairs = { ROUTE_cp_stairs2 = {}, },
				//ROUTE_southstairs = {},
			},
		},
		BUILD_Truck =
		{
			ROUTE_TankYardSpawn = { ROUTE_trb1_stairs = {}, },
			ROUTE_TankYardSpawn2 = { ROUTE_trb1_stairs = {}, },
		},
		FLAG_gold_crate =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_trb1_stairs =
				{
					Weight = 2,
					ROUTE_westbank =
					{
						ROUTE_bankfront = {},
						ROUTE_westbank2 = { ROUTE_bankback = {}, },
					},
				},
				ROUTE_cp_stairs = { ROUTE_cp_stairs2 = {}, },
				ROUTE_southstairs = {},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_trb1_stairs =
				{
					Weight = 2,
					ROUTE_westbank =
					{
						ROUTE_bankfront = {},
						ROUTE_westbank2 = { ROUTE_bankback = {}, },
					},
				},
				ROUTE_cp_stairs = { ROUTE_cp_stairs2 = {}, },
				ROUTE_southstairs = {},
			},
		},
		CAPPOINT_Gold_Dropoff =
		{
			ROUTE_goldgrab =
			{
				ROUTE_bankback =
				{
					Weight = 2,
					ROUTE_westbank2 = {},
				},
				ROUTE_bankfront = {},
			},
		},
		ATTACK_Truck_Barrier1_1 =
		{
			ROUTE_TankYardSpawn =
			{
				ROUTE_trb1_stairs = {},
				ROUTE_longalley = { Weight = 2, ROUTE_longstairs = {}, },
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_trb1_stairs = {},
				ROUTE_longalley = { Weight = 2, ROUTE_longstairs = {}, },
			},
		},
		DEFEND_Tank_Barrier1_6 =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_trb1_stairs = {},
				ROUTE_cp_stairs2 =
				{
					Weight = 2,
					ROUTE_cp_stairs = {},
				},
				ROUTE_southstairs = {},
			},
		},
		DEFEND_Tank_Barrier2_6 =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_axisspawn_r = {},
				ROUTE_axisspawn_l = {},
			},
		},
		DEFEND_Bank_6 =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_axisspawn_r = {},
				ROUTE_axisspawn_l = {},
				ROUTE_bankback3 =
				{
					ROUTE_bankback2 = { ROUTE_bankback = {}, },
				},
			},
		},
		DEFEND_Truck_Barrier1_6 =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_axisspawn_r =
				{
					ROUTE_southstairs = { ROUTE_southstairs2 = {}, },
					ROUTE_trb1_stairs = {},
				},
				ROUTE_axisspawn_l = {},
			},
		},
		MOUNTMG42_mg42_bridge =
		{
			ROUTE_AxisSpawn =
			{
				ROUTE_axisspawn_r = {},
				ROUTE_axisspawn_l = {},
			},
			ROUTE_TankYardSpawn =
			{
				ROUTE_bridgeroute =
				{
					Weight = 3,
					ROUTE_bridgeroute2 = {},
				},
				ROUTE_cp_stairs = { Weight = 2,},
			},
			ROUTE_TankYardSpawn2 =
			{
				ROUTE_bridgeroute =
				{
					ROUTE_bridgeroute2 = {},
				},
				ROUTE_cp_stairs = { Weight = 2,},
			},
		},
	};

	//copy some routes
	MapRoutes.ATTACK_Depot_6 = MapRoutes.BUILD_Tank;
	MapRoutes.ATTACK_Depot_7 = MapRoutes.BUILD_Tank;
	MapRoutes.ATTACK_Depot_8 = MapRoutes.BUILD_Tank;
	MapRoutes.ATTACK_Depot_9 = MapRoutes.BUILD_Tank;
	MapRoutes.ATTACK_Depot_10 = MapRoutes.BUILD_Tank;
	MapRoutes.MOUNT_tank = MapRoutes.BUILD_Tank;
	MapRoutes.ATTACK_Tank_Barrier1_1 = MapRoutes.PLANT_Tank_Barrier_1;
	MapRoutes.ATTACK_Tank_Barrier1_2 = MapRoutes.PLANT_Tank_Barrier_1;
	MapRoutes.ATTACK_Tank_Barrier1_3 = MapRoutes.PLANT_Tank_Barrier_1;
	MapRoutes.ATTACK_Tank_Barrier1_4 = MapRoutes.PLANT_Tank_Barrier_1;
	MapRoutes.ATTACK_Tank_Barrier1_5 = MapRoutes.PLANT_Tank_Barrier_1;
	MapRoutes.MOUNTMG42_mg42_bridge = MapRoutes.ATTACK_Tank_Barrier2_1;
	MapRoutes.ATTACK_Tank_Barrier2_2 = MapRoutes.ATTACK_Tank_Barrier2_1;
	MapRoutes.ATTACK_Tank_Barrier2_3 = MapRoutes.ATTACK_Tank_Barrier2_1;
	MapRoutes.ATTACK_Tank_Barrier2_4 = MapRoutes.ATTACK_Tank_Barrier2_1;
	MapRoutes.ATTACK_Tank_Barrier2_5 = MapRoutes.ATTACK_Tank_Barrier2_1;
	MapRoutes.AIRSTRIKE_bBarrier2_1 = MapRoutes.ATTACK_Tank_Barrier2_1;
	MapRoutes.AIRSTRIKE_bBarrier2_2 = MapRoutes.ATTACK_Tank_Barrier2_1;
	MapRoutes.ATTACK_newbarrier2_2 = MapRoutes.ATTACK_newbarrier2_1;
	MapRoutes.ATTACK_newbarrier2_3 = MapRoutes.ATTACK_newbarrier2_1;
	MapRoutes.ATTACK_Bank_2 = MapRoutes.ATTACK_Bank_1;
	MapRoutes.ATTACK_Bank_3 = MapRoutes.ATTACK_Bank_1;
	MapRoutes.ATTACK_Bank_4 = MapRoutes.ATTACK_Bank_1;
	MapRoutes.ATTACK_Bank_5 = MapRoutes.ATTACK_Bank_1;
	MapRoutes.MOUNTMG42_mg42_bank = MapRoutes.ATTACK_Bank_1;
	MapRoutes.MOUNTMG42_mg42_allied = MapRoutes.ATTACK_Truck_Barrier1_1;
	MapRoutes.PLANT_Truck_Barrier_1 = MapRoutes.ATTACK_Truck_Barrier1_1;
	MapRoutes.ATTACK_Truck_Barrier1_2 = MapRoutes.ATTACK_Truck_Barrier1_1;
	MapRoutes.ATTACK_Truck_Barrier1_3 = MapRoutes.ATTACK_Truck_Barrier1_1;
	MapRoutes.ATTACK_Truck_Barrier1_4 = MapRoutes.ATTACK_Truck_Barrier1_1;
	MapRoutes.ATTACK_Truck_Barrier1_5 = MapRoutes.ATTACK_Truck_Barrier1_1;
	MapRoutes.DEFEND_Tank_Barrier1_7 = MapRoutes.DEFEND_Tank_Barrier1_6;
	MapRoutes.DEFEND_Tank_Barrier1_8 = MapRoutes.DEFEND_Tank_Barrier1_6;
	MapRoutes.DEFEND_Tank_Barrier1_9 = MapRoutes.DEFEND_Tank_Barrier1_6;
	MapRoutes.DEFEND_Tank_Barrier1_10 = MapRoutes.DEFEND_Tank_Barrier1_6;
	MapRoutes.DEFEND_Tank_Barrier2_7 = MapRoutes.DEFEND_Tank_Barrier2_6;
	MapRoutes.DEFEND_Tank_Barrier2_8 = MapRoutes.DEFEND_Tank_Barrier2_6;
	MapRoutes.DEFEND_Tank_Barrier2_9 = MapRoutes.DEFEND_Tank_Barrier2_6;
	MapRoutes.DEFEND_Tank_Barrier2_10 = MapRoutes.DEFEND_Tank_Barrier2_6;
	MapRoutes.MOUNTMG42_mg42_bank = MapRoutes.DEFEND_Tank_Barrier2_6;
	MapRoutes.DEFEND_Bank_7 = MapRoutes.DEFEND_Bank_6;
	MapRoutes.DEFEND_Bank_8 = MapRoutes.DEFEND_Bank_6;
	MapRoutes.DEFEND_Bank_9 = MapRoutes.DEFEND_Bank_6;
	MapRoutes.DEFEND_Bank_10 = MapRoutes.DEFEND_Bank_6;
	MapRoutes.DEFEND_Bank_11 = MapRoutes.DEFEND_Bank_6;
	MapRoutes.DEFEND_Bank_12 = MapRoutes.DEFEND_Bank_6;
	MapRoutes.DEFEND_Bank_13 = MapRoutes.DEFEND_Bank_6;
	MapRoutes.DEFEND_Bank_14 = MapRoutes.DEFEND_Bank_6;
	MapRoutes.DEFEND_Truck_Barrier1_7 = MapRoutes.DEFEND_Truck_Barrier1_6;
	MapRoutes.DEFEND_Truck_Barrier1_8 = MapRoutes.DEFEND_Truck_Barrier1_6;
	MapRoutes.DEFEND_Truck_Barrier1_9 = MapRoutes.DEFEND_Truck_Barrier1_6;
	MapRoutes.DEFEND_Truck_Barrier1_10 = MapRoutes.DEFEND_Truck_Barrier1_6;

	Util.Routes(MapRoutes);
	Util.MapDebugPrint( "OnMapLoad" );
};
