//==========================================================================================
//
//	Omni-bot 0.81 script for Wolfsrudel final, by Tardis
//
//	Who 		When			What
//------------------------------------------------------------------------------------------
//	Tardis 		18 December 2010	Spawn Fixes // More Faceings // MG42's
//	Tardis 		04 December 2010	Big Fix  // This Map Has Differences
//	d00d		03 December 2010	added trigger strings
//	Tardis		01 December 2010	initial wolfsrudel_final script
//	d00d		15 October 2009		wolfsrudel3_final for 0.8
//	Blindman	unknown			original waypoints
//
//	Many thanks to BOK Naerling for testing and suggestions
//
//==========================================================================================

global Map =
{
	Debug = 0, // please set to zero before distributing your script

	Allied_Command_Post_Dyno = 0,
	Antenna_Defense_Dyno = 0,
	Axis_Command_Post_Dyno = 0,
	Bunker_Sidewall_Dyno = 0,
	MG_42_Dyno = 0,
	MG_42_Nest_Dyno = 0,
	Main_Radiomast_Dyno = 0,
	Main_Radiomast_1_Dyno = 0,
	Mainbunkergate_Dyno = 0,
	Sidewall_Dyno = 0,
	Woodenbarrier_Dyno = 0,
	bunker_secured = false,
	box1status = "home", // "home", "taken", "secured"
	box2status = "home", // "home", "taken", "secured"
	DefendingTeam = TEAM.AXIS,
	Ant_Def = false, //Antenna_Defense not built at start
	Talk = true, //set Talk to false if you don't want the bots to cheer after winning game:

	Allied_Command_Post_Built = function( trigger )
	{
		Util.MapDebugPrint( "Allied_Command_Post_Built" );
	},

	Allied_Command_Post_Planted = function( trigger )
	{
		Map.Allied_Command_Post_Dyno += 1;
		Util.MapDebugPrint( "Allied_Command_Post_Planted" );
	},

	Allied_Command_Post_Defused = function( trigger )
	{
		Map.Allied_Command_Post_Dyno -= 1;
		Util.MapDebugPrint( "Allied_Command_Post_Defused" );
	},

	Allied_Command_Post_Destroyed = function( trigger )
	{
		Map.Allied_Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Allied_Command_Post_Destroyed" );
	},

	Antenna_Defense_Built = function( trigger )
	{
		Map.Ant_Def = true;
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Antenna_Defense" );
		Util.MapDebugPrint( "Antenna_Defense_Built" );
	},

	Antenna_Defense_Defused = function( trigger )
	{
		Map.Antenna_Defense_Dyno -= 1;
		SetAvailableMapGoals( TEAM.AXIS, false, "AIRSTRIKE_radio" );
		Util.MapDebugPrint( "Antenna_Defense_Defused" );
	},

	Antenna_Defense_Planted = function( trigger )
	{
		Map.Antenna_Defense_Dyno += 1;
		SetAvailableMapGoals( TEAM.AXIS, true, "AIRSTRIKE_radio" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"SMOKEBOMB_ant_def",
			"ATTACK_amast.*",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_mast.*" );
		SetGoalPriority( "SMOKEBOMB_ant_def", 0.9, TEAM.ALLIES );
		Util.MapDebugPrint( "Antenna_Defense_Planted" );
	},

	Antenna_Defense_Destroyed = function( trigger )
	{
		Map.Antenna_Defense_Dyno = 0;
		Map.Ant_Def = false;
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Main_Radiomast_1" );
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Antenna_Defense" );
		SetAvailableMapGoals( TEAM.ALLIES, false, "SMOKEBOMB_ant_def" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ATTACK_amast.*",
			"ATTACK_mast.*",
		});
		Util.MapDebugPrint( "Antenna_Defense_Destroyed" );
	},

	Axis_Command_Post_Built = function( trigger )
	{
		Util.MapDebugPrint( "Axis_Command_Post_Built" );
	},

	Axis_Command_Post_Planted = function( trigger )
	{
		Map.Axis_Command_Post_Dyno += 1;
		Util.MapDebugPrint( "Axis_Command_Post_Planted" );
	},

	Axis_Command_Post_Defused = function( trigger )
	{
		Map.Axis_Command_Post_Dyno -= 1;
		Util.MapDebugPrint( "Axis_Command_Post_Defused" );
	},

	Axis_Command_Post_Destroyed = function( trigger )
	{
		Map.Axis_Command_Post_Dyno = 0;

		Util.MapDebugPrint( "Axis_Command_Post_Destroyed" );
	},

	Bunker_Sidewall_Planted = function( trigger )
	{
		Map.Bunker_Sidewall_Dyno += 1;
		Util.MapDebugPrint( "Bunker_Sidewall_Planted" );
	},

	Bunker_Sidewall_Defused = function( trigger )
	{
		Map.Bunker_Sidewall_Dyno -= 1;
		Util.MapDebugPrint( "Bunker_Sidewall_Defused" );
	},

	Bunker_Sidewall_Destroyed = function( trigger )
	{
		Map.Bunker_Sidewall_Dyno = 0;
		Util.ChangeSpawn(TEAM.ALLIES, 4, 3);
		Util.ChangeSpawn(TEAM.ALLIES, 1, 4);
		Util.ChangeSpawn(TEAM.AXIS, 5, 4);
		Util.ChangeSpawn(TEAM.AXIS, 2, 3);

		if ( Map.Ant_Def == false ) //Defence not built
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Main_Radiomast_1" );
			SetGoalPriority( "PLANT_Main_Radiomast_1", 0.9, TEAM.ALLIES, CLASS.ENGINEER );
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"ATTACK_amast.*",
				"ATTACK_mast.*",
			});
		}
		if ( Map.Ant_Def == true )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"PLANT_Antenna_Defense",
				"SMOKEBOMB_ant_def",
			});
			SetGoalPriority( "PLANT_Antenna_Defense", 0.9, TEAM.ALLIES );
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_amast.*" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_mast.*" );
		}

		Util.EnableGoal( "FLAG.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ROUTE_sidewall_left",
			"PLANT_Woodenbarrier",
			"PLANT_MG_42_Nest",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_start.*" );
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"ROUTE_sidewall_left",
			"DEFEND_fort.*",
			"DEFEND_radiomast.*",
			"DEFEND_radarparts.*",
			"MOUNTMG42_Fort",
			"REPAIRMG42_Fort",
			"BUILD_MG_42_Nest",
			"MOUNTMG42_MG_42_Nest",
			"REPAIRMG42_MG_42_Nest",
			"BUILD_Antenna_Defense",
			"BUILD_Woodenbarrier",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_forwardbunker.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_amast.*" );

		Util.MapDebugPrint( "Bunker_Sidewall_Destroyed" );
	},

	emitterbox1_Taken = function( trigger )
	{
		Map.box1status = "taken";

		if ( Map.box2status != "home" )
		{
			SetAvailableMapGoals(TEAM.AXIS, false, "DEFEND_radarparts.*");
		}
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_cappoint1" );
		Util.EnableGoal( "DEFEND_cappoint1" );
		SetGoalPriority( "DEFEND_cappoint.*", 0.8 );

		Util.MapDebugPrint( "emitterbox1_Taken" );
	},

	emitterbox2_Taken = function( trigger )
	{
		Map.box2status = "taken";

		if ( Map.box1status != "home" )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_radarparts.*" );
		}
		SetAvailableMapGoals( TEAM.ALLIES, true, "CAPPOINT_cappoint2" );
		Util.EnableGoal( "DEFEND_cappoint2" );
		SetGoalPriority( "DEFEND_cappoint.*", 0.8 );

		Util.MapDebugPrint( "emitterbox2_Taken" );
	},

	emitterbox1_Returned = function( trigger )
	{
		Map.box1status = "home";

		if ( Map.box2status != "taken" )
		{
			Util.DisableGoal( "DEFEND_cappoint1" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_cappoint1" );
		}

		SetAvailableMapGoals(TEAM.AXIS, true, "DEFEND_radarparts.*");
		Util.DisableGoal( "DEFEND_cappoint1" );
		Util.MapDebugPrint( "emitterbox1_Returned" );
	},

	emitterbox2_Returned = function( trigger )
	{
		Map.box2status = "home";

		if ( Map.box1status != "taken" )
		{
			Util.DisableGoal( "DEFEND_cappoint2" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "CAPPOINT_cappoint2" );
		}

		SetAvailableMapGoals(TEAM.AXIS, true, "DEFEND_radarparts.*");
		Util.DisableGoal( "DEFEND_cappoint2" );
		Util.MapDebugPrint( "emitterbox2_Returned" );
	},

	emitterbox1_Secured = function( trigger )
	{
		Map.box1status = "secured";

		if ( Map.box2status == "secured" )
		{
			Util.DisableGoal( "CAPPOINT_cappoint1" );
			Util.DisableGoal( "DEFEND_cappoint1" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "SNIPE_compost" );
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_radarparts.*" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_woodenbarrier" );
		}
		else if ( Map.Ant_Def == false ) //Defence not built
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Main_Radiomast_1" );
			SetGoalPriority( "PLANT_Main_Radiomast_1", 0.9, TEAM.ALLIES, CLASS.ENGINEER );
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"ATTACK_amast.*",
				"ATTACK_mast.*",
			});
		}
		else if ( Map.Ant_Def == true )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"PLANT_Antenna_Defense",
				"SMOKEBOMB_ant_def",
			});
			SetGoalPriority( "PLANT_Antenna_Defense", 0.85, TEAM.ALLIES );
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_amast.*" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_mast.*" );
		}

		Util.MapDebugPrint( "emitterbox1_Secured" );
	},

	emitterbox2_Secured = function( trigger )
	{
		Map.box2status = "secured";

		if ( Map.box1status == "secured" )
		{
			Util.DisableGoal( "CAPPOINT_cappoint2" );
			Util.DisableGoal( "DEFEND_cappoint2" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "SNIPE_compost" );
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_radarparts.*" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_woodenbarrier" );
		}
		else if ( Map.Ant_Def == false ) //Defence not built
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Main_Radiomast_1" );
			SetGoalPriority( "PLANT_Main_Radiomast_1", 0.9, TEAM.ALLIES, CLASS.ENGINEER );
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"ATTACK_amast.*",
				"ATTACK_mast.*",
			});
		}
		else if ( Map.Ant_Def == true )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"PLANT_Antenna_Defense",
				"SMOKEBOMB_ant_def",
			});
			SetGoalPriority( "PLANT_Antenna_Defense", 0.85, TEAM.ALLIES );
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_amast.*" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_mast.*" );
		}

		Util.MapDebugPrint( "emitterbox2_Secured" );
	},

	forwardbunker_flag_Axis_Captured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"REPAIRMG42_Bunker",
			"MOUNTMG42_Bunker",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"REPAIRMG42_Bunker",
			"MOUNTMG42_Bunker",
		});

		Util.ChangeSpawn( TEAM.AXIS, 1 );

		Util.MapDebugPrint( "forwardbunker_flag_Axis_Captured" );
	},

	forwardbunker_flag_Allies_Captured = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"REPAIRMG42_Bunker",
			"MOUNTMG42_Bunker",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"REPAIRMG42_Bunker",
			"MOUNTMG42_Bunker",
		});

		Util.ChangeSpawn( TEAM.ALLIES, 1 );

		Util.MapDebugPrint( "forwardbunker_flag_Allies_Captured" );
	},

	Main_Radiomast_1_Planted = function( trigger )
	{
		Map.Main_Radiomast_Dyno += 1;
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_mast.*" );
		Util.MapDebugPrint( "Main_Radiomast_Planted" );
	},

	Main_Radiomast_1_Defused = function( trigger )
	{
		Map.Main_Radiomast_Dyno -= 1;
		Util.MapDebugPrint( "Main_Radiomast_Defused" );
	},

	Main_Radiomast_1_Destroyed = function( trigger )
	{
		Map.Main_Radiomast_Dyno = 0;
		SetAvailableMapGoals( TEAM.AXIS, false, {
			"SNIPE_fort4",
			"SNIPE_fort5",
			"SNIPE_fort6",
			"DEFEND_radiomast.*",
			"PLANTMINE_radiomast.*",
			"BUILD_Antenna_Defense",
			"AIRSTRIKE_radio",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"PLANT_Antenna_Defense",
			"ATTACK_amast.*",
			"ATTACK_mast.*",
		});
		Util.MapDebugPrint( "Main_Radiomast_Destroyed" );
	},

	Mainbunkergate_Planted = function( trigger )
	{
		Map.Mainbunkergate_Dyno += 1;
		Util.MapDebugPrint( "Mainbunkergate_Planted" );
	},

	Mainbunkergate_Defused = function( trigger )
	{
		Map.Mainbunkergate_Dyno -= 1;
		Util.MapDebugPrint( "Mainbunkergate_Defused" );
	},

	Mainbunkergate_Destroyed = function( trigger )
	{
		Map.Mainbunkergate_Dyno = 0;
		Map.bunker_secured = true;

		Util.ChangeSpawn(TEAM.ALLIES, 4, 3);
		Util.ChangeSpawn(TEAM.ALLIES, 1, 4);
		Util.ChangeSpawn(TEAM.AXIS, 5, 4);
		Util.ChangeSpawn(TEAM.AXIS, 2, 3);

		if ( Map.Ant_Def == false ) //Defence not built
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Main_Radiomast_1" );
			SetGoalPriority( "PLANT_Main_Radiomast_1", 0.9, TEAM.ALLIES, CLASS.ENGINEER );
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"ATTACK_amast.*",
				"ATTACK_mast.*",
			});
		}
		else if ( Map.Ant_Def == true )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"PLANT_Antenna_Defense",
				"SMOKEBOMB_ant_def",
			});
			SetGoalPriority( "PLANT_Antenna_Defense", 0.9, TEAM.ALLIES );
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_amast.*" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_mast.*" );
		}

		Util.EnableGoal( "FLAG.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"REPAIRMG42_Bunker",
			"MOUNTMG42_Bunker",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_bunkergate.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"HEALTHCAB_t10000346",
			"AMMOCAB_t10000345",
			"PLANT_Woodenbarrier",
			"PLANT_MG_42_Nest",
		});
		SetAvailableMapGoals( TEAM.ALLIES, false, "CHECKPOINT_forwardbunker_flag" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_amast.*" );

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"CHECKPOINT_forwardbunker_flag",
			"REPAIRMG42_Bunker",
			"MOUNTMG42_Bunker",
			"DEFEND_forwardbunker.*",
			"HEALTHCAB_t10000346",
			"AMMOCAB_t10000345",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"SNIPE_fort.*",
			"MOUNTMG42_Fort",
			"REPAIRMG42_Fort",
			"BUILD_MG_42_Nest",
			"MOUNTMG42_MG_42_Nest",
			"REPAIRMG42_MG_42_Nest",
			"DEFEND_fort.*",
			"DEFEND_radiomast.*",
			"DEFEND_radarparts.*",
			"BUILD_Antenna_Defense",
			"BUILD_Woodenbarrier",
		});

		Util.MapDebugPrint( "Mainbunkergate_Destroyed" );
	},

	MG_42_Built = function( trigger )
	{
		Util.MapDebugPrint( "MG_42_Built" );
	},

	MG_42_Planted = function( trigger )
	{
		Map.MG_42_Dyno += 1;
		Util.MapDebugPrint( "MG_42_Planted" );
	},
	MG_42_Defused = function( trigger )
	{
		Map.MG_42_Dyno -= 1;
		Util.MapDebugPrint( "MG_42_Defused" );
	},

	MG_42_Destroyed = function( trigger )
	{
		Map.MG_42_Dyno = 0;

		Util.MapDebugPrint( "MG_42_Destroyed" );
	},

	MG_42_Nest_Built = function( trigger )
	{
		Util.MapDebugPrint( "MG_42_Nest_Built" );
	},

	MG_42_Nest_Planted = function( trigger )
	{
		Map.MG_42_Nest_Dyno += 1;
		Util.MapDebugPrint( "MG_42_Nest_Planted" );
	},

	MG_42_Nest_Defused = function( trigger )
	{
		Map.MG_42_Nest_Dyno -= 1;
		Util.MapDebugPrint( "MG_42_Nest_Defused" );
	},

	MG_42_Nest_Destroyed = function( trigger )
	{
		Map.MG_42_Nest_Dyno = 0;

		Util.MapDebugPrint( "MG_42_Nest_Destroyed" );
	},

	Sidewall_Planted = function( trigger )
	{
		Map.Sidewall_Dyno += 1;
		Util.MapDebugPrint( "Sidewall_Planted" );
	},

	Sidewall_Defused = function( trigger )
	{
		Map.Sidewall_Dyno -= 1;
		Util.MapDebugPrint( "Sidewall_Defused" );
	},

	Sidewall_Destroyed = function( trigger )
	{
		Map.Sidewall_Dyno = 0;

		Util.ChangeSpawn(TEAM.ALLIES, 4, 3);
		Util.ChangeSpawn(TEAM.ALLIES, 1, 4);
		Util.ChangeSpawn(TEAM.AXIS, 5, 4);
		Util.ChangeSpawn(TEAM.AXIS, 2, 3);

		if ( Map.Ant_Def == false ) //Defence not built
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Main_Radiomast_1" );
			SetGoalPriority( "PLANT_Main_Radiomast_1", 0.9, TEAM.ALLIES, CLASS.ENGINEER );
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"ATTACK_amast.*",
				"ATTACK_mast.*",
			});
		}
		else if ( Map.Ant_Def == true )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"PLANT_Antenna_Defense",
				"SMOKEBOMB_ant_def",
			});
			SetGoalPriority( "PLANT_Antenna_Defense", 0.9, TEAM.ALLIES );
			SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_amast.*" );
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_mast.*" );
		}
		Util.EnableGoal( "FLAG.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ROUTE_sidewall_right",
			"PLANT_Woodenbarrier",
			"PLANT_MG_42_Nest",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, {
			"ROUTE_sidewall_right",
			"DEFEND_fort.*",
			"DEFEND_radiomast.*",
			"DEFEND_radarparts.*",
			Map.Mount_Fort_MG,
			Map.Repair_Fort_MG,
			"BUILD_MG_42_Nest",
			"MOUNTMG42_MG_42_Nest",
			"REPAIRMG42_MG_42_Nest",
			"BUILD_Antenna_Defense",
			"BUILD_Woodenbarrier",
		});
		SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_forwardbunker.*" );
		SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_amast.*" );

		Util.MapDebugPrint( "Sidewall_Destroyed" );
	},

	Woodenbarrier_Built = function( trigger )
	{
		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ROUTE_woodendoor1",
			"ROUTE_woodendoor2",
		});
		SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Woodenbarrier" );

		Util.MapDebugPrint( "Woodenbarrier_Built" );
	},

	Woodenbarrier_Planted = function( trigger )
	{
		Map.Woodenbarrier_Dyno += 1;
		Util.MapDebugPrint( "Woodenbarrier_Planted" );
	},

	Woodenbarrier_Defused = function( trigger )
	{
		Map.Woodenbarrier_Dyno -= 1;
		Util.MapDebugPrint( "Woodenbarrier_Defused" );
	},

	Woodenbarrier_Destroyed = function( trigger )
	{
		Map.Woodenbarrier_Dyno = 0;
		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ROUTE_woodendoor1",
			"ROUTE_woodendoor2",
		});
		SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Woodenbarrier" );
		Util.MapDebugPrint( "Woodenbarrier_Destroyed" );
	},

	Allies_Win = function( trigger )
	{
		//Game Over
		if ( Map.Talk && MAP_TALK )
		{
			ETUtil.WinningChat( TEAM.ALLIES );
			ETUtil.LosingChat( TEAM.AXIS );
		}

		Util.MapDebugPrint( "Allies_Win" );
	},
};

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Allied_Command_Post_Built );
	OnTrigger( "The Antenna Defense has been constructed.", Map.Antenna_Defense_Built );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Axis_Command_Post_Built );
	OnTrigger( "The Woodenbarrier has been constructed.", Map.Woodenbarrier_Built );
	OnTrigger( "Planted at the Allied Command Post.", Map.Allied_Command_Post_Planted );
	OnTrigger( "Planted at the Antenna Defense.", Map.Antenna_Defense_Planted );
	OnTrigger( "Planted at the Axis Command Post.", Map.Axis_Command_Post_Planted );
	OnTrigger( "Planted at the Bunker Sidewall.", Map.Bunker_Sidewall_Planted );
	OnTrigger( "Planted at the Main Radiomast.", Map.Main_Radiomast_1_Planted );
	OnTrigger( "Planted at the Mainbunkergate.", Map.Mainbunkergate_Planted );
	OnTrigger( "Planted at the Sidewall.", Map.Sidewall_Planted );
	OnTrigger( "Planted at the Woodenbarrier.", Map.Woodenbarrier_Planted );
	OnTrigger( "Defused at the Allied Command Post.", Map.Allied_Command_Post_Defused );
	OnTrigger( "Defused at the Antenna Defense.", Map.Antenna_Defense_Defused );
	OnTrigger( "Defused at the Axis Command Post.", Map.Axis_Command_Post_Defused );
	OnTrigger( "Defused at the Bunker Sidewall.", Map.Bunker_Sidewall_Defused );
	OnTrigger( "Defused at the Main Radiomast.", Map.Main_Radiomast_1_Defused );
	OnTrigger( "Defused at the Mainbunkergate.", Map.Mainbunkergate_Defused );
	OnTrigger( "Defused at the Sidewall.", Map.Sidewall_Defused );
	OnTrigger( "Defused at the Woodenbarrier.", Map.Woodenbarrier_Defused );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Allied_Command_Post_Destroyed );
	OnTrigger( "The Allies have destroyed the Antenna defense!", Map.Antenna_Defense_Destroyed );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Axis_Command_Post_Destroyed );
	OnTrigger( "The Allies have breached the Bunkersidewall!", Map.Bunker_Sidewall_Destroyed );
	OnTrigger( "Allies have destroyed the Main Radio Mast!", Map.Main_Radiomast_1_Destroyed );
	OnTrigger( "Allies have breached the Main Entrance and secured the Forward Bunker!", Map.Mainbunkergate_Destroyed );
	OnTrigger( "The Allies have breached the Sidewall!", Map.Sidewall_Destroyed );
	OnTrigger( "The Allies have destroyed the Woodenbarrier!", Map.Woodenbarrier_Destroyed );
	OnTrigger( "Allies have stolen the West Radarparts!", Map.emitterbox1_Taken );
	OnTrigger( "Allies have stolen the East Radarparts!", Map.emitterbox2_Taken );
	OnTrigger( "Flag returned emitterbox1!", Map.emitterbox1_Returned );
	OnTrigger( "Flag returned emitterbox2!", Map.emitterbox2_Returned );
	OnTrigger( "Allies have secured the West Radar Parts!", Map.emitterbox1_Secured );
	OnTrigger( "Allies have secured the East Radar Parts!", Map.emitterbox2_Secured );
	OnTrigger( "Axis reclaim the Forward Bunker!", Map.forwardbunker_flag_Axis_Captured );
	OnTrigger( "allies_bunker_captured", Map.forwardbunker_flag_Allies_Captured );
	OnTrigger( "The Allied MG42 has been constructed.", Map.MG_42_Built );
	OnTrigger( "Axis MG42 has been constructed.", Map.MG_42_Nest_Built );
	OnTrigger( "Planted at the MG 42.", Map.MG_42_Planted );
	OnTrigger( "Planted at the MG 42 Nest.", Map.MG_42_Nest_Planted );
	OnTrigger( "Defused at the MG 42.", Map.MG_42_Defused );
	OnTrigger( "Defused at the MG 42 Nest.", Map.MG_42_Nest_Defused );
	OnTrigger( "The Allied MG42 has been destroyed!", Map.MG_42_Destroyed );
	OnTrigger( "The Axis MG42 has been destroyed!", Map.MG_42_Nest_Destroyed );
	OnTrigger( "Allies successfully stolen the Emitters and destroy the Main Radio Mast!", Map.Allies_Win);

	Util.DisableGoal( ".*", true ); // all but routes
	Util.RemoveGoal( "PLANT_Main_Radiomast" );
//Add Use Wp
	Util.AddUseWp("PLANT_Mainbunkergate", "maingate");
	Util.AddUseWp("PLANT_Mainbunkergate", "maingate1");
	Util.AddUseWp("PLANT_Mainbunkergate", "maingate2");
	Util.AddUseWp("PLANT_Sidewall", "sidewall_right");
	Util.AddUseWp("PLANT_Bunker_Sidewall", "sidewall_left");
	Util.AddUseWp("PLANT_Main_Radiomast_1", "Main_Radio");
	Util.AddUseWp("PLANT_Main_Radiomast_1", "Main_Radio1");
	Util.AddUseWp("PLANT_Main_Radiomast_1", "Main_Radio2");
	Util.AddUseWp("PLANT_Main_Radiomast_1", "Main_Radio3");
	Util.AddUseWp("PLANT_Main_Radiomast_1", "Main_Radio4");
	Util.AddUseWp("PLANT_Main_Radiomast_1", "Main_Radio5");
//SetAvailableMapGoals ALLIES
	SetAvailableMapGoals( TEAM.ALLIES, true, {
		Map.Mount_Bunker_MG,
		Map.Repair_Bunker_MG,
		"SNIPE_compost",
		"BUILD_Allied_Command_Post",
		"PLANT_Mainbunkergate",
		"PLANT_Sidewall",
		"PLANT_Bunker_Sidewall",
		"ATTACK_bunkergate.*",
		"CHECKPOINT_forwardbunker_flag",
	});
//SetAvailableMapGoals AXIS
	SetAvailableMapGoals( TEAM.AXIS, true, {
		"PLANTMINE_.*",
		"DEFEND_start.*",
		"DEFEND_forwardbunker.*",
		"BUILD_Axis_Command_Post",
		"HEALTHCAB_t10000346",
		"AMMOCAB_t10000345",
		"CHECKPOINT_forwardbunker_flag",
	});
/*** PRIORITY ***/
	SetGoalPriority( "CHECKPOINT_forwardbunker_flag", 0.0, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Mainbunkergate", 0.82, TEAM.ALLIES, CLASS.ENGINEER );
/*** GOAL POSITIONS ***/
	Util.SetGoalOffset( -10, 0, 0, "PLANT_Woodenbarrier" );
// Max users per goal
	Util.SetMaxUsers( 2, "REVIVE_.*" );
	Util.SetMaxUsers( 2, "DEFUSE_.*" );
	Util.SetMaxUsers( 3, "FLAG_.*" );
	Util.SetMaxUsers( 1, "PLANT_.*" );
	Util.SetMaxUsers( 1, "BUILD_.*" );
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 3, "CHECKPOINT.*" );
// Camp times
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=15, MaxCampTime=90} );
	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=10, MaxCampTime=60} );
	SetMapGoalProperties( "SNIPE_.*", {MinCampTime=10, MaxCampTime=80} );

// Trigger regions
	iw1 = OnTriggerRegion( AABB(886.986,1651.562,-107.619,1229.688,1733.052,18.487), RegionTrigger.IntrusionWarning );
	iw2 = OnTriggerRegion( AABB(-520.193,1228.610,-100.474,-198.019,1466.299,20.148), RegionTrigger.IntrusionWarning );
	iw3 = OnTriggerRegion( AABB(-1246.095,2780.623,-77.464,-1124.188,2983.294,122.278), RegionTrigger.IntrusionWarning );
	iw4 = OnTriggerRegion( AABB(-438.591,3570.216,-116.766,-166.126,4001.469,92.246), RegionTrigger.IntrusionWarning );

/*** ROUTES ***/
	MapRoutes =
	{
		CAPPOINT_cappoint2 =
		{
			ROUTE_objective =
			{
				ROUTE_frontdoor1 =
				{
					ROUTE_sidewall_left = {},
					ROUTE_sidewall_right = {},
					ROUTE_maingate = {},
				},
				ROUTE_woodendoor1 =
				{
					ROUTE_woodendoor2 =
					{
						ROUTE_sidewall_left = {},
						ROUTE_sidewall_right = {},
						ROUTE_maingate = {},
					}
				}
			},
		},
		BUILD_Allied_Command_Post =
		{
			ROUTE_cabinspawn =
			{
				ROUTE_backdoor = {},
				ROUTE_frontdoor =	{ ROUTE_logs = {} }
			},
			ROUTE_watertower =
			{
				ROUTE_left = {},
				ROUTE_right = {}
			}
		},
		PLANT_Forwardbunkerdoor =
		{
			ROUTE_cabinspawn =
			{
				ROUTE_hill =
				{
					ROUTE_right = {},
				},
			},
		},
		CHECKPOINT_forwardbunker_flag =
		{
			ROUTE_watertower =
			{
				ROUTE_left =
				{
					ROUTE_bunker = {},
					ROUTE_middle = {},
					ROUTE_logs = {},
				},
				ROUTE_right =
				{
					ROUTE_bunker = {},
					ROUTE_middle = {},
					ROUTE_tunnel = {},
				}
			},
			ROUTE_cabinspawn =
			{
				ROUTE_backdoor =
				{
					ROUTE_logs = {},
				},
				ROUTE_frontdoor =
				{
					ROUTE_bunker = {},
					ROUTE_middle = {},
					ROUTE_bunkerdoor = { ROUTE_tunnel = {} }
				},
				ROUTE_middle = {},
				ROUTE_bunkerdoor = {},
			},
			ROUTE_axisspawn =
			{
				ROUTE_axisdoor = {},
				ROUTE_gate = {},
				ROUTE_ladder = {},
			},
		},
		PLANT_Allied_Command_Post =
		{
			ROUTE_axisspawn =
			{
				ROUTE_axisdoor = {},
				ROUTE_gate = {},
				ROUTE_ladder = {},
			},
		},
		PLANT_Woodenbarrier =
		{
			ROUTE_bunkerspawn =
			{
				ROUTE_sidewall_left = {},
				ROUTE_sidewall_right = {},
				ROUTE_maingate = {},
			},
			ROUTE_cabinspawn =
			{
				ROUTE_backdoor =
				{
					ROUTE_logs = {},
					ROUTE_sidewall_left = {},
					ROUTE_sidewall_right = {},
					ROUTE_maingate = {},
				},
				ROUTE_frontdoor =
				{
					ROUTE_bunker = {},
					ROUTE_middle = {},
					ROUTE_bunkerdoor = { ROUTE_tunnel = {} },
					ROUTE_sidewall_left = {},
					ROUTE_sidewall_right = {},
					ROUTE_maingate = {},
				},
				ROUTE_middle = {},
				ROUTE_bunkerdoor = {},
			},
		}
	};
	MapRoutes.PLANT_Sidewall = MapRoutes.CHECKPOINT_forwardbunker_flag;
	MapRoutes.PLANT_Bunker_Sidewall = MapRoutes.CHECKPOINT_forwardbunker_flag;
	MapRoutes.PLANT_Mainbunkergate = MapRoutes.CHECKPOINT_forwardbunker_flag;
	MapRoutes.PLANT_Main_Radiomast = MapRoutes.PLANT_Woodenbarrier;
	MapRoutes.PLANT_Antenna_Defense = MapRoutes.PLANT_Woodenbarrier;
	MapRoutes.FLAG_emitterbox1 = MapRoutes.PLANT_Woodenbarrier;
	MapRoutes.FLAG_emitterbox2 = MapRoutes.PLANT_Woodenbarrier;
	MapRoutes.BUILD_Antenna_Defense = MapRoutes.PLANT_Allied_Command_Post;
	MapRoutes.BUILD_Woodenbarrier = MapRoutes.PLANT_Allied_Command_Post;

	Util.Routes(MapRoutes);

	SetAvailableMapGoals( TEAM.ALLIES, false, {
		"ROUTE_sidewall_left",
		"ROUTE_sidewall_right",
	});
	SetAvailableMapGoals( TEAM.AXIS, false, {
		"ROUTE_sidewall_left",
		"ROUTE_sidewall_right",
	});

	Util.MapDebugPrint( "Omni-bot map script for " + GetMapName() + " executed." );
};

global OnBotJoin = function( bot )
{
	bot.TargetBreakableDist = 90.0;
	bot.MaxViewDistance = 2400; //SNOW

	// Start Spawn location Allies // Axis
	Util.RandomBotSpawn( bot, TEAM.ALLIES, 3 );
	Util.ChangeBotSpawn( bot, TEAM.AXIS, 1 );

	if ( !Map.bunker_secured )
	{
		Util.RandomBotSpawn( bot, TEAM.ALLIES, 3 );
		Util.ChangeBotSpawn( bot, TEAM.ALLIES, 1, 4 );
		Util.RandomBotSpawn( bot, TEAM.AXIS, 5 );
		// 4 allies should spawn at the bunker
	}
};
