/********************************************************
Script and waypoints made by  =VOC= Naerling
********************************************************/

global Map =
{
	Debug = false,
	Quiet = true,
	//set Talk to false if you don't want the bots talking ingame:
	Talk = true,
	Gas_Dropoff = false,
	Gas = false,

	Ammo_Cabinet_south_ammocabinet = "AMMOCAB_south_ammocabinet",
	Ammo_Cabinet_south_ammocabinet_1 = "AMMOCAB_south_ammocabinet_1",
	Health_Cabinet_south_healthcabinet = "HEALTHCAB_south_healthcabinet",
	Health_Cabinet_south_healthcabinet_1 = "HEALTHCAB_south_healthcabinet_1",
	Call_Artillery_checkpoint_1 = "CALLARTILLERY_checkpoint_1",
	Call_Artillery_checkpoint_2 = "CALLARTILLERY_checkpoint_2",
	Call_Artillery_checkpoint_3 = "CALLARTILLERY_checkpoint_3",
	Call_Artillery_checkpoint_4 = "CALLARTILLERY_checkpoint_4",
	Call_Artillery_checkpoint_5 = "CALLARTILLERY_checkpoint_5",
	Call_Artillery_checkpoint_6 = "CALLARTILLERY_checkpoint_6",
	Artillery_S_arty_1 = "ARTILLERY_S_arty_1",
	Artillery_S_arty_2 = "ARTILLERY_S_arty_2",
	Artillery_S_arty_3 = "ARTILLERY_S_arty_3",
	Artillery_S_arty_4 = "ARTILLERY_S_arty_4",
	Flag_gastanks = "FLAG_gastanks",
	Cappoint_Dropoff = "CAPPOINT_Dropoff",
	Cappoint_Hide = "CAPPOINT_Hide",
	Build_Command_Post = "BUILD_Command_Post",
	Build_Gastank_Dropoff = "BUILD_Gastank_Dropoff",
	Build_Tank = "BUILD_Tank",
	Build_Tank_Barrier_1 = "BUILD_Tank_Barrier_1",
	Build_Tank_Barrier_2 = "BUILD_Tank_Barrier_2",
	Build_Truck_Door = "BUILD_Truck_Door",
	Build_town_barbed_wires = "BUILD_town_barbed_wires",
	Build_town_mg = "BUILD_town_mg",
	Plant_Breakable_Fence = "PLANT_Breakable_Fence",
	Plant_Command_Post = "PLANT_Command_Post",
	Plant_Gastank_Dropoff = "PLANT_Gastank_Dropoff",
	Plant_Tank_Barrier_2 = "PLANT_Tank_Barrier_2",
	Plant_Truck_Door = "PLANT_Truck_Door",
	Plant_town_barbed_wires = "PLANT_town_barbed_wires",
	Plant_town_mg = "PLANT_town_mg",
	Mount_2902 = "MOUNTMG42_2902", //house, right side
	Mount_2903 = "MOUNTMG42_2903", //house, left side
	Mount_3076 = "MOUNTMG42_3076", //house, outside
	Mount_3514 = "MOUNTMG42_3514", //lookout at house, right
	Mount_3515 = "MOUNTMG42_3515", //lookout at house, left
	Mount_3516 = "MOUNTMG42_3516", //...
	Mount_3517 = "MOUNTMG42_3517",
	Mount_3518 = "MOUNTMG42_3518",
	Mount_3519 = "MOUNTMG42_3519",
	Mount_3520 = "MOUNTMG42_3520",
	Mount_3521 = "MOUNTMG42_3521",
	Mount_4241 = "MOUNTMG42_4241", //near axis spawn
	Mount_54 = "MOUNTMG42_54",
	Mount_town_mg = "MOUNTMG42_town_mg",
	Repair_2902 = "REPAIRMG42_2902",
	Repair_2903 = "REPAIRMG42_2903",
	Repair_3076 = "REPAIRMG42_3076",
	Repair_3514 = "REPAIRMG42_3514",
	Repair_3515 = "REPAIRMG42_3515",
	Repair_3516 = "REPAIRMG42_3516",
	Repair_3517 = "REPAIRMG42_3517",
	Repair_3518 = "REPAIRMG42_3518",
	Repair_3519 = "REPAIRMG42_3519",
	Repair_3520 = "REPAIRMG42_3520",
	Repair_3521 = "REPAIRMG42_3521",
	Repair_4241 = "REPAIRMG42_4241",
	Repair_54 = "REPAIRMG42_54",
	Repair_town_mg = "REPAIRMG42_town_mg",
	Mover_tank = "MOVER_tank",

	Navigation =
	{

		rope_1_pt =
		{
			navigate = function(_this)
			{
				_this.Bot.HoldButton(BTN.FORWARD, 4);
				sleep(4);
			},
		},
		ladder_1_pt =
		{
			navigate = function(_this)
			{
				_this.Bot.HoldButton(BTN.FORWARD, 3);
				sleep(3);
			},
		},
		ladder_2_pt =
		{
			navigate = function(_this)
			{
				_this.Bot.HoldButton(BTN.FORWARD, 3);
				sleep(3);
			},
		},
		ladder_3_pt =
		{
			navigate = function(_this)
			{
				_this.Bot.HoldButton(BTN.FORWARD, 4);
				sleep(4);
			},
		},
		ladder_4_pt =
		{
			navigate = function(_this)
			{
				_this.Bot.HoldButton(BTN.FORWARD, 5);
				sleep(5);
			},
		},
		jump_1_pt =
		{
			navigate = function(_this)
			{
				_this.Bot.PressButton(BTN.JUMP);
				_this.Bot.HoldButton(BTN.FORWARD, 1);
				sleep(1);
			},
		},
	},

	//Some regions for the tank
	tank_region_1 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_a_region1_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_a_tank_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_a_region1_.*" );

		Util.MapDebugPrint( "tank_region_1" );
	},

	tank_region_2 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_a_region1_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_a_region2_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_a_region1_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_a_region2_.*" );

		Util.MapDebugPrint( "tank_region_2" );
	},

	tank_region_3 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_a_region2_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"ATTACK_a_region3_1",
			"ATTACK_a_region3_2",
			"ATTACK_a_region3_3",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_a_region2_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_a_region3_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"CALLARTILLERY_checkpoint_4",
			"CALLARTILLERY_checkpoint_5",
			"ARTILLERY_S_arty_3",
		});

		Util.MapDebugPrint( "tank_region_3" );
	},

	tank_region_4 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_a_region3_.*");
		SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_a_region4_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_a_region3_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_a_region4_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Tank_Barrier_1" );
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Tank_Barrier_1" );

		Util.MapDebugPrint( "tank_region_4" );
	},

	tank_region_5 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"CALLARTILLERY_checkpoint_4",
			"CALLARTILLERY_checkpoint_5",
			"ARTILLERY_S_arty_3",
			"ATTACK_a_region4_.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_a_region5_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_a_region4_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_a_region5_.*",
			"PLANT_Tank_Barrier_2",
		});

		Util.MapDebugPrint( "tank_region_5" );
	},

	tank_region_6 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_a_region5_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"ATTACK_a_region6_3",
			"ATTACK_a_region6_4",
			"ATTACK_a_region6_5",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_a_region5_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_a_region6_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"CALLARTILLERY_checkpoint_6",
			"CALLARTILLERY_checkpoint_5",
			"ARTILLERY_S_arty_4",
		});

		Util.MapDebugPrint( "tank_region_6" );
	},

	tank_region_7 = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "ATTACK_a_region6_.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, "ATTACK_a_region7_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_a_region7_.*",
			"ATTACK_a_region7_.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Tank_Barrier_2" );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"BUILD_Tank_Barrier_2",
			"CALLARTILLERY_checkpoint_6",
			"CALLARTILLERY_checkpoint_5",
			"ARTILLERY_S_arty_4",
		});

		Util.MapDebugPrint( "tank_region_7" );
	},

	//CP
	Allied_Command_Post_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"BUILD_Command_Post",
			"PLANT_Command_Post",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Command_Post" );
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Command_Post" );

		Util.MapDebugPrint( "Allied_Command_Post_Built" );
	},

	Allied_Command_Post_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Command_Post" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );
		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Command_Post" );

		Util.MapDebugPrint( "Allied_Command_Post_Destroyed" );
	},

	Axis_Command_Post_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"BUILD_Command_Post",
			"PLANT_Command_Post",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Command_Post" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Command_Post" );

		Util.MapDebugPrint( "Axis_Command_Post_Built" );
	},

	Axis_Command_Post_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );
		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Command_Post" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Command_Post" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );

		Util.MapDebugPrint( "Axis_Command_Post_Destroyed" );
	},

	//TANK & BARRIERS
	Tank_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"MOUNT_tank",
			"ESCORT_tank",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_tank" );

		foreach ( id and bot in BotTable )
		{
			if ( bot.GetTeam() == TEAM.ALLIES )
			{
				r = RandRange(0,10);
				if( r < 2 )
				{
					bot.SayVoice(VOICE.ESCORT_VEHICLE);
				}
			}
		}

		Util.MapDebugPrint( "Tank_Built" );
	},

	Tank_Destroyed = function( trigger )
	{
		Util.SetPositionGoal( "BUILD_Tank", "MOVER_tank" );
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"MOUNT_tank",
			"ESCORT_tank",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_tank" );

		Util.MapDebugPrint( "Tank_Destroyed" );
	},

	Tank_stolen = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Tank_Barrier_1" );

		Util.MapDebugPrint( "Tank_stolen" );
	},

	Tank_Barrier_1_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Tank_Barrier_1" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"BUILD_Gastank_Dropoff",
			"BUILD_Tank_Barrier_2",
		});

		Util.MapDebugPrint( "Tank_Barrier_1_Built" );
	},

	Tank_Barrier_1_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Tank_Barrier_1" );

		Util.MapDebugPrint( "Tank_Barrier_1_Destroyed" );
	},

	Tank_Barrier_2_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Tank_Barrier_2" );

		Util.MapDebugPrint( "Tank_Barrier_2_Built" );
	},

	Tank_Barrier_2_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Tank_Barrier_2" );

		Util.MapDebugPrint( "Tank_Barrier_2_Destroyed" );
	},

	//AXIS BASE
	Gastank_Dropoff_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Gastank_Dropoff" );
		Map.Gas_Dropoff = true;

		if ( Map.Gas )
		{
			Groups.DisableAxis(Groups.group5);
			Groups.EnableAxis(Groups.group4);

			Util.MapDebugPrint("Going to Dropoff");
		}

		Util.MapDebugPrint( "Gastank_Dropoff_Built" );
	},

	Gastank_Dropoff_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Gastank_Dropoff" );
		Map.Gas_Dropoff = false;

		if ( Map.Gas )
		{
			Groups.DisableAxis(Groups.group4);
			Groups.EnableAxis(Groups.group5);

			Util.MapDebugPrint("Going to Hide");
		}

		Util.MapDebugPrint( "Gastank_Dropoff_Destroyed" );
	},

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

	//ALLIED TOWN
	Truck_Door_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Truck_Door" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Tank" );
		SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Truck_Door" );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"DEFEND_d_start_.*",
			"CALLARTILLERY_checkpoint_3",
			"ARTILLERY_S_arty_2",
			"FLAG_gastanks",
		});

		Util.MapDebugPrint( "Truck_Door_Built" );
	},

	Truck_Door_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Truck_Door" );
		SetAvailableMapGoals( TEAM.AXIS, false, "PLANT_Truck_Door" );
		SetAvailableMapGoals( TEAM.AXIS, true, "FLAG_gastanks" );

		Util.MapDebugPrint( "Truck_Door_Destroyed" );
	},

	town_barbed_wires_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_town_barbed_wires" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"PLANT_town_barbed_wires",
			"DEFEND_d_bwire_.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_d_truck_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"CALLARTILLERY_checkpoint_1",
			"CALLARTILLERY_checkpoint_2",
			"ARTILLERY_S_arty_1",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_d_start_.*" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "MOUNTMG42_town_mg" );
		Wp.SetWaypointFlag("bwire", "closed", true);

		Util.MapDebugPrint( "town_barbed_wires_Built" );
	},

	town_barbed_wires_Destroyed = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_town_barbed_wires" );
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"PLANT_town_barbed_wires",
			"DEFEND_d_bwire_.*",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"DEFEND_d_bwire_1",
			"DEFEND_d_truck_.*",
			"PLANT_town_mg",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"CALLARTILLERY_checkpoint_1",
			"CALLARTILLERY_checkpoint_2",
			"ARTILLERY_S_arty_1",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "MOUNTMG42_town_mg" );
		Wp.SetWaypointFlag("bwire", "closed", false);

		if ( Map.Talk && MAP_TALK )
		{
			foreach ( id and bot in BotTable )
			{
				if ( bot.GetTeam() == TEAM.ALLIES )
				{
					r = RandRange(0,10);
					if( r < 2 )
					{
						bot.SayVoice(VOICE.INCOMING);
					}
				}
			}
		}

		Util.MapDebugPrint( "town_barbed_wires_Destroyed" );
	},

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

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

	gastanks_Taken = function( trigger )
	{
		Wp.SetWaypointFlag( "jump_1", "closed", true );
		Groups.DisableAllies(Groups.group1);
		Groups.EnableAllies(Groups.group3);
		Map.Gas = true;

		if ( Map.Gas_Dropoff )
		{
			Groups.DisableAxis(Groups.group2);
			Groups.EnableAxis(Groups.group4);

			Util.MapDebugPrint("Going to Dropoff");
		}
		else
		{
			Groups.DisableAxis(Groups.group2);
			Groups.EnableAxis(Groups.group5);

			Util.MapDebugPrint("Going to Hide");
		}

		Util.MapDebugPrint( "gastanks_Taken" );
	},

	gastanks_Returned = function( trigger )
	{
		Wp.SetWaypointFlag( "jump_1", "closed", false );
		Groups.DisableAxis(Groups.group4);
		Groups.DisableAxis(Groups.group5);
		Groups.EnableAxis(Groups.group7);
		Groups.DisableAllies(Groups.group3);
		Groups.EnableAllies(Groups.group6);
		Map.Gas = false;

		Util.MapDebugPrint( "gastanks_Returned" );
	},

	//WIN!
	Axis_win = function( trigger )
	{
		ETUtil.WinningChat( TEAM.AXIS );
		ETUtil.LosingChat( TEAM.ALLIES );
		Util.MapDebugPrint( "Axis_win" );
	},

	Allies_win = function( trigger )
	{
		ETUtil.WinningChat( TEAM.ALLIES );
		ETUtil.LosingChat( TEAM.AXIS );
		Util.MapDebugPrint( "Allies_win" );
	},

	tank_at_location = function(trigger)
	{
		switch(Map.VehicleLocation)
		{
			case 1:
			{
				ETUtil.SetExcludeIndexes( "ESCORT_tank" );
				Map.tank_region_1();
			}
			case 2:
			{
				Map.tank_region_2();
			}
			case 3:
			{
				Map.tank_region_3();
			}
			case 4:
			{
				Map.tank_region_4();
			}
			case 5:
			{
				Map.tank_region_5();
			}
			case 6:
			{
				Map.tank_region_6();
			}
			case 7:
			{
				Map.tank_region_7();
			}
		}
		Util.MapDebugPrint("tank at location " + Map.VehicleLocation, true);
	},
};

global OnMapLoad = function()
{
	//Some goal offsets
	Util.SetGoalOffset( -40, -30, -80, "PLANT_Truck_Door" );
	Util.SetGoalOffset( -40, -20, 0, "PLANT_town_barbed_wires" );
	Util.SetGoalOffset( 30, -20, -30, "BUILD_Tank_Barrier_1" );
	Util.SetGoalOffset( 40, 0, -30, "BUILD_town_barbed_wires" );
	Util.SetGoalOffset( 0, -40, -30, "BUILD_town_mg" );
	Util.SetGoalPosition( -1367.559, -294.619, 824.125, "PLANT_Tank_Barrier_1" );

	//Triggers
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Axis_Command_Post_Built );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Axis_Command_Post_Destroyed );
	OnTrigger( "The Gastank Dropoff has been constructed.", Map.Gastank_Dropoff_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( "Truck Door has been constructed.", Map.Truck_Door_Built );
	OnTrigger( "Barbed Wire in Town has been constructed.", Map.town_barbed_wires_Built );
	OnTrigger( "Allied team has built the town mg!", Map.town_mg_Built );
	OnTrigger( "Allied team has breached the Fence!", Map.Breakable_Fence_Destroyed );
	OnTrigger( "The Gastank Dropoff have been destroyed!", Map.Gastank_Dropoff_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( "Truck Doors have been destroyed!", Map.Truck_Door_Destroyed );
	OnTrigger( "Barbed Wire in Town have been destroyed!", Map.town_barbed_wires_Destroyed );
	OnTrigger( "Axis team has destroyed the town mg!", Map.town_mg_Destroyed );
	OnTrigger( "Axis have stolen The Gas Tanks!", Map.gastanks_Taken );
	OnTrigger( "Flag returned gastanks!", Map.gastanks_Returned );
	OnTrigger( "Allied team has stolen the Tank!", Map.Tank_stolen );
	OnTrigger( "The Tank has been damaged!", Map.Tank_Destroyed );
	OnTrigger( "The Poison Gas will be spread!", Map.Axis_win );
	OnTrigger( "Allied team has destroyed the Messerschmitt!", Map.Allies_win );
	OnTrigger( "tank at location", Map.tank_at_location );

	//Set up some positional triggers for the tank
	location1 = OnTriggerRegion(AABB(-1775.026,1045.656,799.125,-1421.508,1146.446,873.125),RegionTrigger.VehicleTrigger);
	location2 = OnTriggerRegion(AABB(-1792.841,584.240,799.127,-1410.538,683.663,873.127),RegionTrigger.VehicleTrigger);
	location3 = OnTriggerRegion(AABB(-1786.409,-44.594,799.125,-1425.646,45.629,873.125),RegionTrigger.VehicleTrigger);
	location4 = OnTriggerRegion(AABB(-1801.509,-550.380,799.125,-1408.607,-425.444,873.125),RegionTrigger.VehicleTrigger);
	location5 = OnTriggerRegion(AABB(-1750.606,-1296.500,799.125,-1454.202,-1139.917,873.125),RegionTrigger.VehicleTrigger);
	location6 = OnTriggerRegion(AABB(-1107.397,-1129.271,799.125,-926.152,-839.543,873.125),RegionTrigger.VehicleTrigger);
	location7 = OnTriggerRegion(AABB(-629.411,-454.820,799.125,-310.991,-225.979,873.125),RegionTrigger.VehicleTrigger);

	//Set some goal properties
	Util.SetMaxUsersInProgress( 2, "BUILD.*" );
	Util.SetMaxUsersInProgress( 2, "PLANT.*" );
	Util.SetMaxUsersInProgress( 3, "FLAG.*" );
	Util.SetMaxUsersInProgress( 1, "DEFEND_.*" );
	Util.SetMaxUsersInProgress( 1, "ATTACK_.*" );
	Util.SetMaxUsersInProgress( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 1, "MOUNT_tank" );
	Util.SetMaxUsers( 2, "ESCORT_tank" );

	ETUtil.SetExcludeIndexes( "ESCORT_tank", {5} );

	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=60, MaxCampTime=120});
	SetMapGoalProperties( "ATTACK_.*", {MinCampTime=30, MaxCampTime=60});
	SetMapGoalProperties( "DEFEND_.*", {MinCampTime=30, MaxCampTime=60});

	//Set some priorities for main goals
	SetGoalPriority( "MOUNT_tank", 0.8 );
	SetGoalPriority( "BUILD_Command_Post", 0.7 );
	SetGoalPriority( "PLANT_Breakable_Fence", 0.7 );
	SetGoalPriority( "PLANT_Command_Post", 0.7 );
	SetGoalPriority( "PLANT_town_mg", 0.7 );
	SetGoalPriority( "BUILD_town_mg", 0.7 );
	SetGoalPriority( "ATTACK_a_plane_.*", 0.7 );
	SetGoalPriority( "ATTACK_a_plane_6", 0.8 );
	SetGoalPriority( "ATTACK_a_hangar_.*", 0.7 );
	SetGoalPriority( "DEFEND_d_plane_.*", 0.7 );
	SetGoalPriority( "DEFEND_d_hangar_.*", 0.7 );

	//Disable Goals
	Util.DisableGoal( ".*"/*, true */); // cs: no routes in the map

	//Enable part 1 goals
	Groups.EnableAllies(Groups.group1);
	Groups.EnableAxis(Groups.group2);

	Util.MapDebugPrint( "Script for Flughafen by =VOC= Naerling was succesfully loaded!" );
};

//Some properties for bots that join
global OnBotJoin = function( bot )
{
	bot.TargetBreakableDist = 100.0;
	bot.MaxViewDistance = 1200;
};

//Groups
global Groups =
{
	//Allies part 1
	group1 =
	{
		Map.Build_Truck_Door,
		Map.Build_town_barbed_wires,
		Map.Build_Command_Post,
		Map.Build_town_mg,
		Map.Repair_town_mg,
		Map.Plant_Breakable_Fence,
		"ATTACK_a_truck_.*",
		"ATTACK_a_tank_.*",
	},

	//Axis part 1
	group2 =
	{
		"DEFEND_d_start_.*",
		"DEFEND_d_truck_.*",
		"ARTILLERY_S_arty_2",
		"CALLARTILLERY_checkpoint_3",
		Map.Build_Tank_Barrier_1,
		Map.Build_Command_Post,
		Map.Flag_gastanks,
		Map.Mount_3518,
		Map.Mount_3519,
		Map.Mount_3076,
		Map.Mount_4241,
		Map.Repair_3518,
		Map.Repair_3519,
		Map.Repair_3076,
		Map.Repair_4241,
	},

	//Allies part 2
	group3 =
	{
		Map.Plant_Gastank_Dropoff,
		"ATTACK_a_plane_.*",
		"ATTACK_a_hangar_.*",
	},

	//Axis part 2
	group4 =
	{
		Map.Flag_gastanks,
		Map.Cappoint_Dropoff,
		Map.Build_Gastank_Dropoff,
		"DEFEND_d_hangar_.*",
		"DEFEND_d_plane_.*",
	},

	//Axis part 3
	group5 =
	{
		Map.Flag_gastanks,
		Map.Build_Gastank_Dropoff,
		Map.Cappoint_Hide,
		"DEFEND_d_hangar_.*",
		"DEFEND_d_plane_.*",
	},

	//Allies after tanks stolen
	group6 =
	{
		Map.Build_Truck_Door,
		Map.Build_town_barbed_wires,
		Map.Build_Command_Post,
		Map.Build_town_mg,
		Map.Repair_town_mg,
		Map.Plant_Breakable_Fence,
	},

	//Axis after tanks stolen
	group7 =
	{
		Map.Build_Tank_Barrier_1,
		Map.Build_Tank_Barrier_2,
		Map.Build_Command_Post,
		Map.Build_Gastank_Dropoff,
		Map.Flag_gastanks,
		Map.Mount_3518,
		Map.Mount_3519,
		Map.Mount_3076,
		Map.Mount_4241,
		Map.Repair_3518,
		Map.Repair_3519,
		Map.Repair_3076,
		Map.Repair_4241,
	},

	EnableAllies = function(group)
	{
		foreach (id and goal in group)
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, goal );
			Util.MapDebugPrint("EnableAllies: enabling " + goal, true);
		}
	},

	EnableAxis = function(group)
	{
		foreach (id and goal in group)
		{
			SetAvailableMapGoals( TEAM.AXIS, true, goal );
			Util.MapDebugPrint("EnableAxis: enabling " + goal, true);
		}
	},

	DisableAllies = function(group)
	{
		foreach (id and goal in group)
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, goal );
			Util.MapDebugPrint("DisableAllies: disabling " + goal, true);
		}
	},

	DisableAxis = function(group)
	{
		foreach (id and goal in group)
		{
			SetAvailableMapGoals( TEAM.AXIS, false, goal );
			Util.MapDebugPrint("DisableAxis: disabling " + goal, true);
		}
	},
};
