//==========================================================================================
//
//	el_kef_final.gm
//
//	Who              	When			What
//------------------------------------------------------------------------------------------
//	native12		20 January 2011		Initial Script
//	native12		20 February 2011	Partially finished
//	native12		22 February 2011	Minor cleaning
//	native12		24 February 2011	Minor cleaning
//	native12		25 February 2011	Minor fix
//	native12		4 March 2011		Minor fix
//	native12		6 March 2011		Release
//	native12		07.05.2012		Reduced count of waypoints, minor fix in gm & goals
//------------------------------------------------------------------------------------------
//	el_kef_final.way	07.05.2012
//	el_kef_final_goals.gm	07.05.2012
//==========================================================================================
//ToDo:	Maybe cleaning duplicate commands in single triggers (not necessary)
//

global Map =
{
	Debug = 0, // please set to zero before distributing your script
	Talk = true,
	talk = 1,
	DefendingTeam = TEAM.AXIS,

	Barricade_Dyno = 0,
	Command_Post_Dyno = 0,
	door_Dyno = 0,
	village_Gate_Dyno = 0,
	village_house_wall_Dyno = 0,
	village_gate = 1,	//intact
	village_house_wall = 1,	//intact
	BarricadeBuilt = 0,
	GoldTaken = 0,
	GoldDropped = 0,
	DoorBuilt = 0,
	AlliesInTrigger1 = 0,
	AlliesInTrigger2 = 0,
	AlliesInTrigger3 = 0,
	AlliesInTrigger4 = 0,
	AlliesInTrigger5 = 0,
	CovertOpsInTrigger1 = 0,
	CovertOpsInTrigger2 = 0,
	CovertOpsInTrigger3 = 0,
	CovertOpsInTrigger4 = 0,
	CovertOpsInTrigger5 = 0,
	EngInTrigger1 = 0,
	EngInTrigger2 = 0,
	EngInTrigger3 = 0,
	EngInTrigger4 = 0,
	EngInTrigger5 = 0,
	AlliesNearGold = 0,
	AlliedCP = 0,
	AxisCP = 0,
	AlliedFlag = 0,
	AxisFlag = 1,
	AxisInTrigger = 0,

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

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

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

	// region triggers
	iw1 = 0,

	flag_Axis_Captured = function( trigger )
	{

		Map.AlliedFlag = 0;
		Map.AxisFlag = 1;

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

		if ( Map.AlliedCP == 0 )
		{
			Util.ChangeSpawn( TEAM.ALLIES, 2 );	//Town entrance

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

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

			SetAvailableMapGoals( TEAM.AXIS, true, {
				"AIRSTRIKE_Axis_Start_31",
				"CALLARTILLERY_Axis_Start_29",
				"ARTILLERY_S_Axis_Start_30",
				"MOBILEMG42_Axis_Start_.*",
				"PLANTMINE_Axis_Start_.*",
			});

			sleep(0.5);

			Util.SetMaxUsers( 5, "CHECKPOINT_.*" );

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

			Util.MapDebugPrint( "^5flag_Axis_Captured, allied CP not built" );
		}
		else
		{
			Util.ChangeSpawn( TEAM.ALLIES, 5 );	//CP

			Util.SetMaxUsers( 1, "CHECKPOINT_.*" );

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

			Util.MapDebugPrint( "^5flag_Axis_Captured, allied CP built" );
		}
	},

	flag_Allies_Captured = function( trigger )
	{

		Map.AlliedFlag = 1;
		Map.AxisFlag = 0;

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"AIRSTRIKE_Allies_Start_8",
			"CHECKPOINT_flag",
		});

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"AIRSTRIKE_Axis_Start_31",
			"CALLARTILLERY_Axis_Start_29",
			"ARTILLERY_S_Axis_Start_30",
			"MOBILEMG42_Axis_Start_.*",
			"PLANTMINE_Axis_Start_.*",
		});

		if ( Map.AxisInTrigger > 0 )
		{
			if ( Map.AlliedCP == 0 )
			{
				Util.ChangeSpawn( TEAM.ALLIES, 1 );	//Town square

				SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT_flag" );
				sleep(0.5);

				Util.SetMaxUsers( 5, "CHECKPOINT_.*" );

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

				Util.MapDebugPrint( "^5flag_Allies_Captured, allied CP not built" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT_flag" );
				sleep(0.5);

				Util.SetMaxUsers( 1, "CHECKPOINT_.*" );

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

				Util.ChangeSpawn( TEAM.ALLIES, 5 );	//CP

				Util.MapDebugPrint( "^5flag_Allies_Captured, allied CP built" );
			}
		}
		else
		{
			if ( Map.village_Gate_Dyno > 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, {
					".*_Axis_Start_.*",
					"CHECKPOINT_flag",
					"DEFUSE_village_Gate_.*",
				});

				SetAvailableMapGoals( TEAM.AXIS, true, {
					"AMMOCAB_north_ammocabinet",
					"HEALTHCAB_north_healthcabinet",
				});

				if ( Map.AlliedCP == 0 )
				{
					if ( Map.AxisCP == 0 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );
					}

					if ( Map.GoldTaken == 0 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"DEFEND_Axis_CP_.*",
							"DEFEND_Axis_villageCenter_.*",
							"CALLARTILLERY_Axis_villageCenter_7",
							"ARTILLERY_S_Axis_villageCenter_8",
						});

						if ( Map.BarricadeBuilt == 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, {
								"DEFEND_Axis_AtBarricade_1",
								"DEFEND_Axis_AtBarricade_2",
								"DEFEND_Axis_AtBarricade_3",
								"DEFEND_Axis_AtBarricade_4",
							});
						}
						else
						{
							SetAvailableMapGoals( TEAM.AXIS, true, {
								"DEFEND_Axis_AtBarricade_7",
								"DEFEND_Axis_AtBarricade_8",
								"DEFEND_Axis_AtBarricade_9",
								"CALLARTILLERY_Axis_AtBarricade_5",
								"ARTILLERY_S_Axis_AtBarricade_6",
							});
						}

						if ( Map.DoorBuilt == 1 )
						{
							if ( Map.village_house_wall == 1 )
							{
								SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_CP_1" );
							}
							else
							{
								SetAvailableMapGoals( TEAM.AXIS, true, {
									"MOBILEMG42_Axis_CP_5",
									"MOBILEMG42_Axis_CP_6",
								});
							}
						}
					}
				}

				if ( Map.BarricadeBuilt == 0 )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Barricade" );
				}

				if ( Map.DoorBuilt == 1 )
				{
					if ( Map.GoldTaken == 0 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Axis_NearGold_.*" );
					}
				}
				else
				{
					if ( Map.GoldTaken == 0 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"MOBILEMG42_Axis_NearGold_1",
							"MOBILEMG42_Axis_NearGold_2",
							"BUILD_door",
						});

						if ( Map.AlliedCP == 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, {
								"DEFEND_Axis_AtGold_1",
								"DEFEND_Axis_AtGold_2",
								"DEFEND_Axis_AtGold_3",
								"DEFEND_Axis_AtGold_4",
							});
						}
						else
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Axis_AtGold_.*" );
						}
					}
				}

				Util.MapDebugPrint( "^5flag_Allies_Captured, axis arenīt in village, village gate planted" );
			}
			else
			{
				if ( Map.AlliedCP == 0 )
				{
					Util.ChangeSpawn( TEAM.ALLIES, 1 );	//Town square

					SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT_flag" );
					sleep(0.5);

					Util.SetMaxUsers( 5, "CHECKPOINT_.*" );

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

					Util.MapDebugPrint( "^5flag_Allies_Captured, axis arenīt in village, village gate not planted, allied CP not built" );
				}
				else
				{
					SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT_flag" );
					sleep(0.5);

					Util.SetMaxUsers( 1, "CHECKPOINT_.*" );

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

					Util.ChangeSpawn( TEAM.ALLIES, 5 );	//CP

					Util.MapDebugPrint( "^5flag_Allies_Captured, axis arenīt in village, village gate not planted, allied CP built" );
				}
			}
		}
	},

	Trigger_1 =
	{
		Name = "trigger_1",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if ( Map.village_gate == 1 )	//intact
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.AlliesInTrigger1 += 1;

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

					if ( GetEntClass(ent) == CLASS.ENGINEER )
					{
						Map.EngInTrigger1 += 1;

						Util.MapDebugPrint( "^5Engineer entered into Village" );
					}
					if ( GetEntClass(ent) == CLASS.COVERTOPS )
					{
						Map.CovertOpsInTrigger1 += 1;

						Util.MapDebugPrint( "^5CovertOps entered into Village" );
					}

					foreach ( id and bot in BotTable )
					{
						if ( bot.GetTeam() == TEAM.AXIS )
						{
							bot.SayTeam("Allies are in Village!");
							break;
						}
					}

					if ( Map.DoorBuilt == 0 )
					{
						if ( Map.GoldTaken == 0 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_gold" );

							SetAvailableMapGoals( TEAM.AXIS, true, {
								"DEFEND_Axis_AtGold_1",
								"DEFEND_Axis_AtGold_2",
								"DEFEND_Axis_AtGold_5",
							});

							Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, door not built, gold not taken" );
						}
					}
					else
					{
						if ( Map.GoldTaken == 0 )
						{
							if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, {
									"PLANT_door",
									"ATTACK_Allied_NearGold_2",
									"ATTACK_Allied_NearGold_4",
								});

								SetAvailableMapGoals( TEAM.AXIS, true, {
									"DEFEND_Axis_NearGold_1",
									"DEFEND_Axis_NearGold_2",
								});

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, door built, gold not taken, allied engs or covertops are in village" );
							}
						}
					}

					if ( Map.AlliedCP == 0 )
					{
						if ( Map.AxisCP == 1 )
						{
							if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Axis_NearGold_1" );

								SetAvailableMapGoals( TEAM.AXIS, true, {
									"DEFEND_Axis_CP_3",
									"DEFEND_Axis_CP_4",
								});

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

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village" );

								if ( Map.GoldTaken == 0 )
								{
									if ( Map.DoorBuilt == 1 )
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village, gold not taken, door built" );
									}
									else
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, {
											"ATTACK_Allied_CP_2",
											"ATTACK_Allied_CP_4",
										});

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village, gold not taken, door not built" );
									}
								}

								if ( Map.BarricadeBuilt == 1 )
								{
									SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

									Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village, barricade built" );
								}
							}
						}
						else
						{
							if ( Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Axis_NearGold_1" );

								SetAvailableMapGoals( TEAM.AXIS, true, {
									"DEFEND_Axis_CP_3",
									"DEFEND_Axis_CP_4",
								});

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

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village" );

								if ( Map.GoldTaken == 0 )
								{
									if ( Map.DoorBuilt == 1 )
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village, gold not taken, door built" );
									}
									else
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, {
											"ATTACK_Allied_CP_2",
											"ATTACK_Allied_CP_4",
										});

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village, gold not taken, door not built" );
									}
								}

								if ( Map.BarricadeBuilt == 1 )
								{
									SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

									Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village, barricade built" );
								}
							}
						}
					}
					else
					{
						if ( Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
						{
							if ( Map.village_house_wall == 1 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_village_house_wall" );

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP built, allied engs are in village, village house wall built" );
							}
						}

						if ( Map.BarricadeBuilt == 1 )
						{
							if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP built, allied engs or covertops are in village, barricade built" );
							}
						}
					}
				}
			}
		},
		OnExit = function(ent)
		{
			if ( Map.village_gate == 1 )	//intact
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.AlliesInTrigger1 -= 1;

					if ( GetEntClass(ent) == CLASS.ENGINEER )
					{
						Map.EngInTrigger1 -= 1;

						if ( Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Command_Post" );

							if ( Map.village_house_wall == 1 and Map.AlliedCP == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_village_house_wall" );
							}

							if ( Map.DoorBuilt == 1 and Map.AlliedCP == 0 and Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_door" );
							}

							if ( Map.AxisCP == 1 and Map.AlliedCP == 0 and Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );
							}

							if ( Map.BarricadeBuilt == 1 and Map.AlliedCP == 0 and Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Barricade" );
							}
						}
					}
					if ( GetEntClass(ent) == CLASS.COVERTOPS )
					{
						Map.CovertOpsInTrigger1 -= 1;

						if ( Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
						{
							if ( Map.DoorBuilt == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, {
									"PLANT_door",
									"PLANT_Barricade",
								});
							}

							if ( Map.AxisCP == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );
							}

							if ( Map.BarricadeBuilt == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Barricade" );
							}
						}
					}
					if ( Map.GoldTaken == 0 and Map.AlliedCP == 0 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_gold" );
					}

					if ( Map.village_gate == 1 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, {
							".*_Allied_CP_.*",
							".*_Allied_AtGold_.*",
							".*_Allied_AtTruck_.*",
							".*_Allied_NearGold_.*",
							".*_Allied_AtBarricade_.*",
							"BUILD_Command_Post",
							"PLANT_village_house_wall",
							"PLANT_door",
							"PLANT_Command_Post",
							"PLANT_Barricade",
							"FLAG_gold",
							"CAPPOINT_Truck",
						});

						SetAvailableMapGoals( TEAM.AXIS, false, {
							".*_Axis_AtGold_.*",
							".*_Axis_AtTruck_.*",
							".*_Axis_NearGold_.*",
							".*_Axis_CP_.*",
							".*_Axis_villageCenter_.*",
							".*_Axis_AtBarricade_.*",
						});

						if ( Map.AxisFlag == 1 )
						{
							Util.ChangeSpawn( TEAM.ALLIES, 2 );	//Town entrance

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

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

							SetAvailableMapGoals( TEAM.ALLIES, true, {
								"AIRSTRIKE_Allies_Start_8",
								".*_Allies_Start_.*",
							});

							SetAvailableMapGoals( TEAM.AXIS, true, {
								"AIRSTRIKE_Axis_Start_31",
								"CALLARTILLERY_Axis_Start_29",
								"ARTILLERY_S_Axis_Start_30",
								"MOBILEMG42_Axis_Start_.*",
								"PLANTMINE_Axis_Start_.*",
								".*_Axis_Start_.*",
							});

							sleep(0.5);

							Util.SetMaxUsers( 5, "CHECKPOINT_.*" );

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

							Util.MapDebugPrint( "^5flag_is_Axis, allied CP not built" );
						}
						else
						{
							SetAvailableMapGoals( TEAM.ALLIES, false, {
								"AIRSTRIKE_Allies_Start_8",
								"CHECKPOINT_flag",
							});

							SetAvailableMapGoals( TEAM.AXIS, false, {
								"AIRSTRIKE_Axis_Start_31",
								"CALLARTILLERY_Axis_Start_29",
								"ARTILLERY_S_Axis_Start_30",
								"MOBILEMG42_Axis_Start_.*",
								"PLANTMINE_Axis_Start_.*",
							});

							Util.ChangeSpawn( TEAM.ALLIES, 1 );	//Town square

							SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT_flag" );
							sleep(0.5);

							Util.SetMaxUsers( 5, "CHECKPOINT_.*" );

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

							Util.MapDebugPrint( "^5flag_is_Allied, allied CP not built" );
						}
					}
				}
			}
		},
	},

	Trigger_2 =
	{
		Name = "trigger_2",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if ( Map.village_gate == 1 )	//intact
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.AlliesInTrigger2 += 1;

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

					if ( GetEntClass(ent) == CLASS.ENGINEER )
					{
						Map.EngInTrigger2 += 1;

						Util.MapDebugPrint( "^5Engineer entered into Village" );
					}
					if ( GetEntClass(ent) == CLASS.COVERTOPS )
					{
						Map.CovertOpsInTrigger2 += 1;

						Util.MapDebugPrint( "^5CovertOps entered into Village" );
					}

					if ( Map.DoorBuilt == 0 )
					{
						if ( Map.GoldTaken == 0 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_gold" );

							SetAvailableMapGoals( TEAM.AXIS, true, {
								"DEFEND_Axis_AtGold_1",
								"DEFEND_Axis_AtGold_2",
								"DEFEND_Axis_AtGold_5",
							});

							Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, door not built, gold not taken" );
						}
					}
					else
					{
						if ( Map.GoldTaken == 0 )
						{
							if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, {
									"PLANT_door",
									"ATTACK_Allied_NearGold_2",
									"ATTACK_Allied_NearGold_4",
								});

								SetAvailableMapGoals( TEAM.AXIS, true, {
									"DEFEND_Axis_NearGold_1",
									"DEFEND_Axis_NearGold_2",
								});

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, door built, gold not taken, allied engs or covertops are in village" );
							}
						}
					}

					if ( Map.AlliedCP == 0 )
					{
						if ( Map.AxisCP == 1 )
						{
							if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Axis_NearGold_1" );

								SetAvailableMapGoals( TEAM.AXIS, true, {
									"DEFEND_Axis_CP_3",
									"DEFEND_Axis_CP_4",
								});

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

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village" );

								if ( Map.GoldTaken == 0 )
								{
									if ( Map.DoorBuilt == 1 )
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village, gold not taken, door built" );
									}
									else
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, {
											"ATTACK_Allied_CP_2",
											"ATTACK_Allied_CP_4",
										});

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village, gold not taken, door not built" );
									}
								}

								if ( Map.BarricadeBuilt == 1 )
								{
									SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

									Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village, barricade built" );
								}
							}
						}
						else
						{
							if ( Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Axis_NearGold_1" );

								SetAvailableMapGoals( TEAM.AXIS, true, {
									"DEFEND_Axis_CP_3",
									"DEFEND_Axis_CP_4",
								});

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

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village" );

								if ( Map.GoldTaken == 0 )
								{
									if ( Map.DoorBuilt == 1 )
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village, gold not taken, door built" );
									}
									else
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, {
											"ATTACK_Allied_CP_2",
											"ATTACK_Allied_CP_4",
										});

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village, gold not taken, door not built" );
									}
								}

								if ( Map.BarricadeBuilt == 1 )
								{
									SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

									Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village, barricade built" );
								}
							}
						}
					}
					else
					{
						if ( Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
						{
							if ( Map.village_house_wall == 1 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_village_house_wall" );

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP built, allied engs are in village, village house wall built" );
							}
						}

						if ( Map.BarricadeBuilt == 1 )
						{
							if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP built, allied engs or covertops are in village, barricade built" );
							}
						}
					}
				}
			}
		},
		OnExit = function(ent)
		{
			if ( Map.village_gate == 1 )	//intact
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.AlliesInTrigger2 -= 1;

					if ( GetEntClass(ent) == CLASS.ENGINEER )
					{
						Map.EngInTrigger2 -= 1;

						if ( Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Command_Post" );

							if ( Map.village_house_wall == 1 and Map.AlliedCP == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_village_house_wall" );
							}

							if ( Map.DoorBuilt == 1 and Map.AlliedCP == 0 and Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_door" );
							}

							if ( Map.AxisCP == 1 and Map.AlliedCP == 0 and Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );
							}

							if ( Map.BarricadeBuilt == 1 and Map.AlliedCP == 0 and Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Barricade" );
							}
						}
					}
					if ( GetEntClass(ent) == CLASS.COVERTOPS )
					{
						Map.CovertOpsInTrigger2 -= 1;

						if ( Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
						{
							if ( Map.DoorBuilt == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, {
									"PLANT_door",
									"PLANT_Barricade",
								});
							}

							if ( Map.AxisCP == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );
							}

							if ( Map.BarricadeBuilt == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Barricade" );
							}
						}
					}
					if ( Map.GoldTaken == 0 and Map.AlliedCP == 0 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_gold" );
					}

					if ( Map.village_gate == 1 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, {
							".*_Allied_CP_.*",
							".*_Allied_AtGold_.*",
							".*_Allied_AtTruck_.*",
							".*_Allied_NearGold_.*",
							".*_Allied_AtBarricade_.*",
							"BUILD_Command_Post",
							"PLANT_village_house_wall",
							"PLANT_door",
							"PLANT_Command_Post",
							"PLANT_Barricade",
							"FLAG_gold",
							"CAPPOINT_Truck",
						});

						SetAvailableMapGoals( TEAM.AXIS, false, {
							".*_Axis_AtGold_.*",
							".*_Axis_AtTruck_.*",
							".*_Axis_NearGold_.*",
							".*_Axis_CP_.*",
							".*_Axis_villageCenter_.*",
							".*_Axis_AtBarricade_.*",
						});

						if ( Map.AxisFlag == 1 )
						{
							Util.ChangeSpawn( TEAM.ALLIES, 2 );	//Town entrance

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

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

							SetAvailableMapGoals( TEAM.ALLIES, true, {
								"AIRSTRIKE_Allies_Start_8",
								".*_Allies_Start_.*",
							});

							SetAvailableMapGoals( TEAM.AXIS, true, {
								"AIRSTRIKE_Axis_Start_31",
								"CALLARTILLERY_Axis_Start_29",
								"ARTILLERY_S_Axis_Start_30",
								"MOBILEMG42_Axis_Start_.*",
								"PLANTMINE_Axis_Start_.*",
								".*_Axis_Start_.*",
							});

							sleep(0.5);

							Util.SetMaxUsers( 5, "CHECKPOINT_.*" );

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

							Util.MapDebugPrint( "^5flag_is_Axis, allied CP not built" );
						}
						else
						{
							SetAvailableMapGoals( TEAM.ALLIES, false, {
								"AIRSTRIKE_Allies_Start_8",
								"CHECKPOINT_flag",
							});

							SetAvailableMapGoals( TEAM.AXIS, false, {
								"AIRSTRIKE_Axis_Start_31",
								"CALLARTILLERY_Axis_Start_29",
								"ARTILLERY_S_Axis_Start_30",
								"MOBILEMG42_Axis_Start_.*",
								"PLANTMINE_Axis_Start_.*",
							});

							Util.ChangeSpawn( TEAM.ALLIES, 1 );	//Town square

							SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT_flag" );
							sleep(0.5);

							Util.SetMaxUsers( 5, "CHECKPOINT_.*" );

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

							Util.MapDebugPrint( "^5flag_is_Allied, allied CP not built" );
						}
					}
				}
			}
		},
	},

	Trigger_3 =
	{
		Name = "trigger_3",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if ( Map.village_gate == 1 )	//intact
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.AlliesInTrigger3 += 1;

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

					if ( GetEntClass(ent) == CLASS.ENGINEER )
					{
						Map.EngInTrigger3 += 1;

						Util.MapDebugPrint( "^5Engineer entered into Village" );
					}
					if ( GetEntClass(ent) == CLASS.COVERTOPS )
					{
						Map.CovertOpsInTrigger3 += 1;

						Util.MapDebugPrint( "^5CovertOps entered into Village" );
					}

					foreach ( id and bot in BotTable )
					{
						if ( bot.GetTeam() == TEAM.AXIS )
						{
							bot.SayTeam("Allies are in Village!");
							break;
						}
					}

					if ( Map.DoorBuilt == 0 )
					{
						if ( Map.GoldTaken == 0 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_gold" );

							SetAvailableMapGoals( TEAM.AXIS, true, {
								"DEFEND_Axis_AtGold_1",
								"DEFEND_Axis_AtGold_2",
								"DEFEND_Axis_AtGold_5",
							});

							Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, door not built, gold not taken" );
						}
					}
					else
					{
						if ( Map.GoldTaken == 0 )
						{
							if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, {
									"PLANT_door",
									"ATTACK_Allied_NearGold_2",
									"ATTACK_Allied_NearGold_4",
								});

								SetAvailableMapGoals( TEAM.AXIS, true, {
									"DEFEND_Axis_NearGold_1",
									"DEFEND_Axis_NearGold_2",
								});

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, door built, gold not taken, allied engs or covertops are in village" );
							}
						}
					}

					if ( Map.AlliedCP == 0 )
					{
						if ( Map.AxisCP == 1 )
						{
							if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Axis_NearGold_1" );

								SetAvailableMapGoals( TEAM.AXIS, true, {
									"DEFEND_Axis_CP_3",
									"DEFEND_Axis_CP_4",
								});

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

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village" );

								if ( Map.GoldTaken == 0 )
								{
									if ( Map.DoorBuilt == 1 )
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village, gold not taken, door built" );
									}
									else
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, {
											"ATTACK_Allied_CP_2",
											"ATTACK_Allied_CP_4",
										});

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village, gold not taken, door not built" );
									}
								}

								if ( Map.BarricadeBuilt == 1 )
								{
									SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

									Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village, barricade built" );
								}
							}
						}
						else
						{
							if ( Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Axis_NearGold_1" );

								SetAvailableMapGoals( TEAM.AXIS, true, {
									"DEFEND_Axis_CP_3",
									"DEFEND_Axis_CP_4",
								});

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

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village" );

								if ( Map.GoldTaken == 0 )
								{
									if ( Map.DoorBuilt == 1 )
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village, gold not taken, door built" );
									}
									else
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, {
											"ATTACK_Allied_CP_2",
											"ATTACK_Allied_CP_4",
										});

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village, gold not taken, door not built" );
									}
								}

								if ( Map.BarricadeBuilt == 1 )
								{
									SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

									Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village, barricade built" );
								}
							}
						}
					}
					else
					{
						if ( Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
						{
							if ( Map.village_house_wall == 1 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_village_house_wall" );

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP built, allied engs are in village, village house wall built" );
							}
						}

						if ( Map.BarricadeBuilt == 1 )
						{
							if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP built, allied engs or covertops are in village, barricade built" );
							}
						}
					}
				}
			}
		},
		OnExit = function(ent)
		{
			if ( Map.village_gate == 1 )	//intact
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.AlliesInTrigger3 -= 1;

					if ( GetEntClass(ent) == CLASS.ENGINEER )
					{
						Map.EngInTrigger3 -= 1;

						if ( Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Command_Post" );

							if ( Map.village_house_wall == 1 and Map.AlliedCP == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_village_house_wall" );
							}

							if ( Map.DoorBuilt == 1 and Map.AlliedCP == 0 and Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_door" );
							}

							if ( Map.AxisCP == 1 and Map.AlliedCP == 0 and Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );
							}

							if ( Map.BarricadeBuilt == 1 and Map.AlliedCP == 0 and Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Barricade" );
							}
						}
					}
					if ( GetEntClass(ent) == CLASS.COVERTOPS )
					{
						Map.CovertOpsInTrigger3 -= 1;

						if ( Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
						{
							if ( Map.DoorBuilt == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, {
									"PLANT_door",
									"PLANT_Barricade",
								});
							}

							if ( Map.AxisCP == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );
							}

							if ( Map.BarricadeBuilt == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Barricade" );
							}
						}
					}
					if ( Map.GoldTaken == 0 and Map.AlliedCP == 0 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_gold" );
					}

					if ( Map.village_gate == 1 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, {
							".*_Allied_CP_.*",
							".*_Allied_AtGold_.*",
							".*_Allied_AtTruck_.*",
							".*_Allied_NearGold_.*",
							".*_Allied_AtBarricade_.*",
							"BUILD_Command_Post",
							"PLANT_village_house_wall",
							"PLANT_door",
							"PLANT_Command_Post",
							"PLANT_Barricade",
							"FLAG_gold",
							"CAPPOINT_Truck",
						});

						SetAvailableMapGoals( TEAM.AXIS, false, {
							".*_Axis_AtGold_.*",
							".*_Axis_AtTruck_.*",
							".*_Axis_NearGold_.*",
							".*_Axis_CP_.*",
							".*_Axis_villageCenter_.*",
							".*_Axis_AtBarricade_.*",
						});

						if ( Map.AxisFlag == 1 )
						{
							Util.ChangeSpawn( TEAM.ALLIES, 2 );	//Town entrance

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

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

							SetAvailableMapGoals( TEAM.ALLIES, true, {
								"AIRSTRIKE_Allies_Start_8",
								".*_Allies_Start_.*",
							});

							SetAvailableMapGoals( TEAM.AXIS, true, {
								"AIRSTRIKE_Axis_Start_31",
								"CALLARTILLERY_Axis_Start_29",
								"ARTILLERY_S_Axis_Start_30",
								"MOBILEMG42_Axis_Start_.*",
								"PLANTMINE_Axis_Start_.*",
								".*_Axis_Start_.*",
							});

							sleep(0.5);

							Util.SetMaxUsers( 5, "CHECKPOINT_.*" );

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

							Util.MapDebugPrint( "^5flag_is_Axis, allied CP not built" );
						}
						else
						{
							SetAvailableMapGoals( TEAM.ALLIES, false, {
								"AIRSTRIKE_Allies_Start_8",
								"CHECKPOINT_flag",
							});

							SetAvailableMapGoals( TEAM.AXIS, false, {
								"AIRSTRIKE_Axis_Start_31",
								"CALLARTILLERY_Axis_Start_29",
								"ARTILLERY_S_Axis_Start_30",
								"MOBILEMG42_Axis_Start_.*",
								"PLANTMINE_Axis_Start_.*",
							});

							Util.ChangeSpawn( TEAM.ALLIES, 1 );	//Town square

							SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT_flag" );
							sleep(0.5);

							Util.SetMaxUsers( 5, "CHECKPOINT_.*" );

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

							Util.MapDebugPrint( "^5flag_is_Allied, allied CP not built" );
						}
					}
				}
			}
		},
	},

	Trigger_4 =
	{
		Name = "trigger_4",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if ( Map.village_gate == 1 )	//intact
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.AlliesInTrigger4 += 1;

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

					if ( GetEntClass(ent) == CLASS.ENGINEER )
					{
						Map.EngInTrigger4 += 1;

						Util.MapDebugPrint( "^5Engineer entered into Village" );
					}
					if ( GetEntClass(ent) == CLASS.COVERTOPS )
					{
						Map.CovertOpsInTrigger4 += 1;

						Util.MapDebugPrint( "^5CovertOps entered into Village" );
					}

					if ( Map.DoorBuilt == 0 )
					{
						if ( Map.GoldTaken == 0 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_gold" );

							SetAvailableMapGoals( TEAM.AXIS, true, {
								"DEFEND_Axis_AtGold_1",
								"DEFEND_Axis_AtGold_2",
								"DEFEND_Axis_AtGold_5",
							});

							Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, door not built, gold not taken" );
						}
					}
					else
					{
						if ( Map.GoldTaken == 0 )
						{
							if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, {
									"PLANT_door",
									"ATTACK_Allied_NearGold_2",
									"ATTACK_Allied_NearGold_4",
								});

								SetAvailableMapGoals( TEAM.AXIS, true, {
									"DEFEND_Axis_NearGold_1",
									"DEFEND_Axis_NearGold_2",
								});

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, door built, gold not taken, allied engs or covertops are in village" );
							}
						}
					}

					if ( Map.AlliedCP == 0 )
					{
						if ( Map.AxisCP == 1 )
						{
							if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Axis_NearGold_1" );

								SetAvailableMapGoals( TEAM.AXIS, true, {
									"DEFEND_Axis_CP_3",
									"DEFEND_Axis_CP_4",
								});

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

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village" );

								if ( Map.GoldTaken == 0 )
								{
									if ( Map.DoorBuilt == 1 )
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village, gold not taken, door built" );
									}
									else
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, {
											"ATTACK_Allied_CP_2",
											"ATTACK_Allied_CP_4",
										});

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village, gold not taken, door not built" );
									}
								}

								if ( Map.BarricadeBuilt == 1 )
								{
									SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

									Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village, barricade built" );
								}
							}
						}
						else
						{
							if ( Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Axis_NearGold_1" );

								SetAvailableMapGoals( TEAM.AXIS, true, {
									"DEFEND_Axis_CP_3",
									"DEFEND_Axis_CP_4",
								});

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

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village" );

								if ( Map.GoldTaken == 0 )
								{
									if ( Map.DoorBuilt == 1 )
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village, gold not taken, door built" );
									}
									else
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, {
											"ATTACK_Allied_CP_2",
											"ATTACK_Allied_CP_4",
										});

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village, gold not taken, door not built" );
									}
								}

								if ( Map.BarricadeBuilt == 1 )
								{
									SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

									Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village, barricade built" );
								}
							}
						}
					}
					else
					{
						if ( Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
						{
							if ( Map.village_house_wall == 1 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_village_house_wall" );

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP built, allied engs are in village, village house wall built" );
							}
						}

						if ( Map.BarricadeBuilt == 1 )
						{
							if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP built, allied engs or covertops are in village, barricade built" );
							}
						}
					}
				}
			}
		},
		OnExit = function(ent)
		{
			if ( Map.village_gate == 1 )	//intact
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.AlliesInTrigger4 -= 1;

					if ( GetEntClass(ent) == CLASS.ENGINEER )
					{
						Map.EngInTrigger4 -= 1;

						if ( Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Command_Post" );

							if ( Map.village_house_wall == 1 and Map.AlliedCP == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_village_house_wall" );
							}

							if ( Map.DoorBuilt == 1 and Map.AlliedCP == 0 and Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_door" );
							}

							if ( Map.AxisCP == 1 and Map.AlliedCP == 0 and Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );
							}

							if ( Map.BarricadeBuilt == 1 and Map.AlliedCP == 0 and Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Barricade" );
							}
						}
					}
					if ( GetEntClass(ent) == CLASS.COVERTOPS )
					{
						Map.CovertOpsInTrigger4 -= 1;

						if ( Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
						{
							if ( Map.DoorBuilt == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, {
									"PLANT_door",
									"PLANT_Barricade",
								});
							}

							if ( Map.AxisCP == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );
							}

							if ( Map.BarricadeBuilt == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Barricade" );
							}
						}
					}
					if ( Map.GoldTaken == 0 and Map.AlliedCP == 0 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_gold" );
					}

					if ( Map.village_gate == 1 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, {
							".*_Allied_CP_.*",
							".*_Allied_AtGold_.*",
							".*_Allied_AtTruck_.*",
							".*_Allied_NearGold_.*",
							".*_Allied_AtBarricade_.*",
							"BUILD_Command_Post",
							"PLANT_village_house_wall",
							"PLANT_door",
							"PLANT_Command_Post",
							"PLANT_Barricade",
							"FLAG_gold",
							"CAPPOINT_Truck",
						});

						SetAvailableMapGoals( TEAM.AXIS, false, {
							".*_Axis_AtGold_.*",
							".*_Axis_AtTruck_.*",
							".*_Axis_NearGold_.*",
							".*_Axis_CP_.*",
							".*_Axis_villageCenter_.*",
							".*_Axis_AtBarricade_.*",
						});

						if ( Map.AxisFlag == 1 )
						{
							Util.ChangeSpawn( TEAM.ALLIES, 2 );	//Town entrance

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

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

							SetAvailableMapGoals( TEAM.ALLIES, true, {
								"AIRSTRIKE_Allies_Start_8",
								".*_Allies_Start_.*",
							});

							SetAvailableMapGoals( TEAM.AXIS, true, {
								"AIRSTRIKE_Axis_Start_31",
								"CALLARTILLERY_Axis_Start_29",
								"ARTILLERY_S_Axis_Start_30",
								"MOBILEMG42_Axis_Start_.*",
								"PLANTMINE_Axis_Start_.*",
								".*_Axis_Start_.*",
							});

							sleep(0.5);

							Util.SetMaxUsers( 5, "CHECKPOINT_.*" );

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

							Util.MapDebugPrint( "^5flag_is_Axis, allied CP not built" );
						}
						else
						{
							SetAvailableMapGoals( TEAM.ALLIES, false, {
								"AIRSTRIKE_Allies_Start_8",
								"CHECKPOINT_flag",
							});

							SetAvailableMapGoals( TEAM.AXIS, false, {
								"AIRSTRIKE_Axis_Start_31",
								"CALLARTILLERY_Axis_Start_29",
								"ARTILLERY_S_Axis_Start_30",
								"MOBILEMG42_Axis_Start_.*",
								"PLANTMINE_Axis_Start_.*",
							});

							Util.ChangeSpawn( TEAM.ALLIES, 1 );	//Town square

							SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT_flag" );
							sleep(0.5);

							Util.SetMaxUsers( 5, "CHECKPOINT_.*" );

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

							Util.MapDebugPrint( "^5flag_is_Allied, allied CP not built" );
						}
					}
				}
			}
		},
	},

	Trigger_5 =
	{
		Name = "trigger_5",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if ( Map.village_gate == 1 )	//intact
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.AlliesInTrigger5 += 1;

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

					if ( GetEntClass(ent) == CLASS.ENGINEER )
					{
						Map.EngInTrigger5 += 1;

						Util.MapDebugPrint( "^5Engineer entered into Village" );
					}
					if ( GetEntClass(ent) == CLASS.COVERTOPS )
					{
						Map.CovertOpsInTrigger5 += 1;

						Util.MapDebugPrint( "^5CovertOps entered into Village" );
					}

					if ( Map.DoorBuilt == 0 )
					{
						if ( Map.GoldTaken == 0 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_gold" );

							SetAvailableMapGoals( TEAM.AXIS, true, {
								"DEFEND_Axis_AtGold_1",
								"DEFEND_Axis_AtGold_2",
								"DEFEND_Axis_AtGold_5",
							});

							Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, door not built, gold not taken" );
						}
					}
					else
					{
						if ( Map.GoldTaken == 0 )
						{
							if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, {
									"PLANT_door",
									"ATTACK_Allied_NearGold_2",
									"ATTACK_Allied_NearGold_4",
								});

								SetAvailableMapGoals( TEAM.AXIS, true, {
									"DEFEND_Axis_NearGold_1",
									"DEFEND_Axis_NearGold_2",
								});

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, door built, gold not taken, allied engs or covertops are in village" );
							}
						}
					}

					if ( Map.AlliedCP == 0 )
					{
						if ( Map.AxisCP == 1 )
						{
							if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Axis_NearGold_1" );

								SetAvailableMapGoals( TEAM.AXIS, true, {
									"DEFEND_Axis_CP_3",
									"DEFEND_Axis_CP_4",
								});

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

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village" );

								if ( Map.GoldTaken == 0 )
								{
									if ( Map.DoorBuilt == 1 )
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village, gold not taken, door built" );
									}
									else
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, {
											"ATTACK_Allied_CP_2",
											"ATTACK_Allied_CP_4",
										});

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village, gold not taken, door not built" );
									}
								}

								if ( Map.BarricadeBuilt == 1 )
								{
									SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

									Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP built, allied engs or covertops are in village, barricade built" );
								}
							}
						}
						else
						{
							if ( Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.AXIS, false, "DEFEND_Axis_NearGold_1" );

								SetAvailableMapGoals( TEAM.AXIS, true, {
									"DEFEND_Axis_CP_3",
									"DEFEND_Axis_CP_4",
								});

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

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village" );

								if ( Map.GoldTaken == 0 )
								{
									if ( Map.DoorBuilt == 1 )
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village, gold not taken, door built" );
									}
									else
									{
										SetAvailableMapGoals( TEAM.ALLIES, true, {
											"ATTACK_Allied_CP_2",
											"ATTACK_Allied_CP_4",
										});

										Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village, gold not taken, door not built" );
									}
								}

								if ( Map.BarricadeBuilt == 1 )
								{
									SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

									Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP not built, axis CP not built, allied engs or covertops are in village, barricade built" );
								}
							}
						}
					}
					else
					{
						if ( Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
						{
							if ( Map.village_house_wall == 1 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_village_house_wall" );

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP built, allied engs are in village, village house wall built" );
							}
						}

						if ( Map.BarricadeBuilt == 1 )
						{
							if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

								Util.MapDebugPrint( "^5Allies entered into Village, village gate intact, allied CP built, allied engs or covertops are in village, barricade built" );
							}
						}
					}
				}
			}
		},
		OnExit = function(ent)
		{
			if ( Map.village_gate == 1 )	//intact
			{
				if( GetEntTeam(ent) == TEAM.ALLIES )
				{
					Map.AlliesInTrigger5 -= 1;

					if ( GetEntClass(ent) == CLASS.ENGINEER )
					{
						Map.EngInTrigger5 -= 1;

						if ( Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Command_Post" );

							if ( Map.village_house_wall == 1 and Map.AlliedCP == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_village_house_wall" );
							}

							if ( Map.DoorBuilt == 1 and Map.AlliedCP == 0 and Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_door" );
							}

							if ( Map.AxisCP == 1 and Map.AlliedCP == 0 and Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );
							}

							if ( Map.BarricadeBuilt == 1 and Map.AlliedCP == 0 and Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Barricade" );
							}
						}
					}
					if ( GetEntClass(ent) == CLASS.COVERTOPS )
					{
						Map.CovertOpsInTrigger5 -= 1;

						if ( Map.CovertOpsInTrigger1 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.CovertOpsInTrigger5 == 0 )
						{
							if ( Map.DoorBuilt == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, {
									"PLANT_door",
									"PLANT_Barricade",
								});
							}

							if ( Map.AxisCP == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );
							}

							if ( Map.BarricadeBuilt == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
							{
								SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Barricade" );
							}
						}
					}
					if ( Map.GoldTaken == 0 and Map.AlliedCP == 0 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_gold" );
					}

					if ( Map.village_gate == 1 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, {
							".*_Allied_CP_.*",
							".*_Allied_AtGold_.*",
							".*_Allied_AtTruck_.*",
							".*_Allied_NearGold_.*",
							".*_Allied_AtBarricade_.*",
							"BUILD_Command_Post",
							"PLANT_village_house_wall",
							"PLANT_door",
							"PLANT_Command_Post",
							"PLANT_Barricade",
							"FLAG_gold",
							"CAPPOINT_Truck",
						});

						SetAvailableMapGoals( TEAM.AXIS, false, {
							".*_Axis_AtGold_.*",
							".*_Axis_AtTruck_.*",
							".*_Axis_NearGold_.*",
							".*_Axis_CP_.*",
							".*_Axis_villageCenter_.*",
							".*_Axis_AtBarricade_.*",
						});

						if ( Map.AxisFlag == 1 )
						{
							Util.ChangeSpawn( TEAM.ALLIES, 2 );	//Town entrance

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

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

							SetAvailableMapGoals( TEAM.ALLIES, true, {
								"AIRSTRIKE_Allies_Start_8",
								".*_Allies_Start_.*",
							});

							SetAvailableMapGoals( TEAM.AXIS, true, {
								"AIRSTRIKE_Axis_Start_31",
								"CALLARTILLERY_Axis_Start_29",
								"ARTILLERY_S_Axis_Start_30",
								"MOBILEMG42_Axis_Start_.*",
								"PLANTMINE_Axis_Start_.*",
								".*_Axis_Start_.*",
							});

							sleep(0.5);

							Util.SetMaxUsers( 5, "CHECKPOINT_.*" );

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

							Util.MapDebugPrint( "^5flag_is_Axis, allied CP not built" );
						}
						else
						{
							SetAvailableMapGoals( TEAM.ALLIES, false, {
								"AIRSTRIKE_Allies_Start_8",
								"CHECKPOINT_flag",
							});

							SetAvailableMapGoals( TEAM.AXIS, false, {
								"AIRSTRIKE_Axis_Start_31",
								"CALLARTILLERY_Axis_Start_29",
								"ARTILLERY_S_Axis_Start_30",
								"MOBILEMG42_Axis_Start_.*",
								"PLANTMINE_Axis_Start_.*",
							});

							Util.ChangeSpawn( TEAM.ALLIES, 1 );	//Town square

							SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT_flag" );
							sleep(0.5);

							Util.SetMaxUsers( 5, "CHECKPOINT_.*" );

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

							Util.MapDebugPrint( "^5flag_is_Allied, allied CP not built" );
						}
					}
				}
			}
		},
	},

	village_Gate_Planted = function( trigger )
	{
		Map.village_Gate_Dyno += 1;

		if ( Map.AxisFlag == 0 and Map.AxisInTrigger == 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				".*_Axis_Start_.*",
				"CHECKPOINT_flag",
				"DEFUSE_village_Gate_.*",
			});

			SetAvailableMapGoals( TEAM.AXIS, true, {
				"AMMOCAB_north_ammocabinet",
				"HEALTHCAB_north_healthcabinet",
			});

			if ( Map.AlliedCP == 0 )
			{
				if ( Map.AxisCP == 0 )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );
				}

				if ( Map.GoldTaken == 0 )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, {
						"DEFEND_Axis_CP_.*",
						"DEFEND_Axis_villageCenter_.*",
						"CALLARTILLERY_Axis_villageCenter_7",
						"ARTILLERY_S_Axis_villageCenter_8",
					});

					if ( Map.BarricadeBuilt == 0 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"DEFEND_Axis_AtBarricade_1",
							"DEFEND_Axis_AtBarricade_2",
							"DEFEND_Axis_AtBarricade_3",
							"DEFEND_Axis_AtBarricade_4",
						});
					}
					else
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"DEFEND_Axis_AtBarricade_7",
							"DEFEND_Axis_AtBarricade_8",
							"DEFEND_Axis_AtBarricade_9",
							"CALLARTILLERY_Axis_AtBarricade_5",
							"ARTILLERY_S_Axis_AtBarricade_6",
						});
					}

					if ( Map.DoorBuilt == 1 )
					{
						if ( Map.village_house_wall == 1 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_CP_1" );
						}
						else
						{
							SetAvailableMapGoals( TEAM.AXIS, true, {
								"MOBILEMG42_Axis_CP_5",
								"MOBILEMG42_Axis_CP_6",
							});
						}
					}
				}
			}

			if ( Map.BarricadeBuilt == 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Barricade" );
			}

			if ( Map.DoorBuilt == 1 )
			{
				if ( Map.GoldTaken == 0 )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Axis_NearGold_.*" );
				}
			}
			else
			{
				if ( Map.GoldTaken == 0 )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, {
						"MOBILEMG42_Axis_NearGold_1",
						"MOBILEMG42_Axis_NearGold_2",
						"BUILD_door",
					});

					if ( Map.AlliedCP == 0 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"DEFEND_Axis_AtGold_1",
							"DEFEND_Axis_AtGold_2",
							"DEFEND_Axis_AtGold_3",
							"DEFEND_Axis_AtGold_4",
						});
					}
					else
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Axis_AtGold_.*" );
					}
				}
			}

			Util.MapDebugPrint( "^5village_Gate_Planted, flag allies captured, axis arenīt in Town" );
		}
		else
		{
			Util.MapDebugPrint( "^5village_Gate_Planted" );
		}
	},

	village_Gate_Defused = function( trigger )
	{
		Map.village_Gate_Dyno -= 1;

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

	village_Gate_Destroyed = function( trigger )
	{

		Map.AlliedFlag = 1;
		Map.AxisFlag = 0;

		Map.village_Gate_Dyno = 0;
		Map.village_gate = 0;

		Util.ChangeSpawn( TEAM.AXIS, 3 );

		Wp.SetWaypointFlag( "door_1", "door", false);
		Wp.SetWaypointFlag( "door_1", "axis", false);
		Wp.SetWaypointFlag( "door_2", "door", false);
		Wp.SetWaypointFlag( "door_2", "axis", false);

		Wp.SetWaypointFlag( "ladder_1", "closed", false);
		Wp.SetWaypointFlag( "ladder_2", "closed", false);

		DeleteTriggerRegion( Map.iw1 );
		DeleteTriggerRegion("trigger_1");
		DeleteTriggerRegion("trigger_2");
		DeleteTriggerRegion("trigger_3");
		DeleteTriggerRegion("trigger_4");
		DeleteTriggerRegion("trigger_5");
		DeleteTriggerRegion("trigger_7");

		Map.AlliesInTrigger1 = 0;
		Map.AlliesInTrigger2 = 0;
		Map.AlliesInTrigger3 = 0;
		Map.AlliesInTrigger4 = 0;
		Map.AlliesInTrigger5 = 0;
		Map.CovertOpsInTrigger1 = 0;
		Map.CovertOpsInTrigger2 = 0;
		Map.CovertOpsInTrigger3 = 0;
		Map.CovertOpsInTrigger4 = 0;
		Map.CovertOpsInTrigger5 = 0;
		Map.EngInTrigger1 = 0;
		Map.EngInTrigger2 = 0;
		Map.EngInTrigger3 = 0;
		Map.EngInTrigger4 = 0;
		Map.EngInTrigger5 = 0;
		Map.AxisInTrigger = 0;

		SetAvailableMapGoals( TEAM.AXIS, false, {
			".*_Axis_Start_.*",
			"CHECKPOINT_flag",
			"DEFUSE_village_Gate_.*",
		});

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			".*_Allies_Start_.*",
			"CHECKPOINT_flag",
		});

		SetAvailableMapGoals( TEAM.AXIS, true, {
			"AMMOCAB_north_ammocabinet",
			"HEALTHCAB_north_healthcabinet",
		});

		SetGoalPriority( "DEFEND_Axis_AtGold_.*", 0.56, TEAM.AXIS, 0 );
		SetGoalPriority( "DEFEND_Axis_AtGold_.*", 0.79, TEAM.AXIS, CLASS.COVERTOPS );

		if ( Map.AlliedCP == 0 )
		{
			if ( Map.AxisCP == 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );
			}

			if ( Map.GoldTaken == 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Axis_CP_.*" );

				if ( Map.DoorBuilt == 1 )
				{
					if ( Map.village_house_wall == 1 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_CP_1" );
					}
					else
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"MOBILEMG42_Axis_CP_5",
							"MOBILEMG42_Axis_CP_6",
						});
					}

					SetAvailableMapGoals( TEAM.AXIS, true, {
						"DEFEND_Axis_villageCenter_.*",
						"CALLARTILLERY_Axis_villageCenter_7",
						"ARTILLERY_S_Axis_villageCenter_8",
					});

					if ( Map.BarricadeBuilt == 0 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"DEFEND_Axis_AtBarricade_1",
							"DEFEND_Axis_AtBarricade_2",
							"DEFEND_Axis_AtBarricade_3",
							"DEFEND_Axis_AtBarricade_4",
						});
					}
					else
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"DEFEND_Axis_AtBarricade_7",
							"DEFEND_Axis_AtBarricade_8",
							"DEFEND_Axis_AtBarricade_9",
							"CALLARTILLERY_Axis_AtBarricade_5",
							"ARTILLERY_S_Axis_AtBarricade_6",
						});
					}
				}
			}
		}

		if ( Map.BarricadeBuilt == 0 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Barricade" );
		}

		if ( Map.DoorBuilt == 1 )
		{
			if ( Map.GoldTaken == 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Axis_NearGold_.*" );
			}
		}
		else
		{
			if ( Map.GoldTaken == 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"MOBILEMG42_Axis_NearGold_1",
					"MOBILEMG42_Axis_NearGold_2",
					"BUILD_door",
				});

				if ( Map.AlliedCP == 0 )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, {
						"DEFEND_Axis_AtGold_1",
						"DEFEND_Axis_AtGold_2",
						"DEFEND_Axis_AtGold_3",
						"DEFEND_Axis_AtGold_4",
					});
				}
				else
				{
					SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Axis_AtGold_.*" );
				}
			}
		}

		sleep(2);

		if ( Map.village_house_wall == 1 )
		{
			SetGoalPriority( "PLANT_village_house_wall", 0.95, TEAM.ALLIES, CLASS.ENGINEER );

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

		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ROUTE_Allied_VillageGate_1",
			"AMMOCAB_north_ammocabinet",
			"HEALTHCAB_north_healthcabinet",
		});

		if ( Map.AlliedCP == 0 )
		{
			if ( Map.AxisCP == 0 )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Command_Post" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Command_Post" );
			}

			if ( Map.GoldTaken == 0 )
			{
				if ( Map.BarricadeBuilt == 1 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, {
						"ATTACK_Allied_AtBarricade_.*",
						"CALLARTILLERY_Allied_AtBarricade_.*",
						"ARTILLERY_S_Allied_AtBarricade_.*",
						"AIRSTRIKE_Allied_AtBarricade_6",
					});
				}

				if ( Map.DoorBuilt == 1 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );
				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, {
						"ATTACK_Allied_CP_2",
						"ATTACK_Allied_CP_4",
					});
				}
			}
		}

		if ( Map.BarricadeBuilt == 1 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );
		}

		if ( Map.DoorBuilt == 1 )
		{
			if ( Map.GoldTaken == 0 )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"PLANT_door",
					"ATTACK_Allied_NearGold_.*",
				});
			}
		}
		else
		{
			if ( Map.GoldTaken == 0 )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"FLAG_gold",
					"ATTACK_Allied_AtGold_.*",
				});
			}
		}

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

	Barricade_Built = function( trigger )
	{

		Map.BarricadeBuilt = 1;

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"ROUTE_BackWayFlag_1",
			"ROUTE_BackWayFlag_2",
			"ROUTE_BackWayFlag_3",
		});

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

		if ( Map.village_gate == 1 )	//intact
		{
			if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

				Util.MapDebugPrint( "^5Barricade_Built, village gate intact, allied eng or covertops in village" );

				while ( Map.village_gate == 1 and Map.BarricadeBuilt == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
				{
					yield();
				}

				if ( Map.village_gate == 1 and Map.BarricadeBuilt == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.CovertOpsInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.EngInTrigger5 == 0 and Map.CovertOpsInTrigger5 == 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Barricade" );

					Util.MapDebugPrint( "^5Barricade_Built, village gate intact, allied eng or covertops arenīt in village" );
				}
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Barricade" );

				Util.MapDebugPrint( "^5Barricade_Built, village gate intact, allied eng or covertops arenīt in village" );
			}
		}
		else
		{
			SetAvailableMapGoals( TEAM.AXIS, false, ".*_Axis_AtBarricade_.*" );

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

			if ( Map.AlliedCP == 0 and Map.GoldTaken == 0 and Map.DoorBuilt == 1 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, {
					".*_Axis_villageCenter_.*",
					"DEFEND_Axis_AtBarricade_7",
					"DEFEND_Axis_AtBarricade_8",
					"DEFEND_Axis_AtBarricade_9",
					"CALLARTILLERY_Axis_AtBarricade_5",
					"ARTILLERY_S_Axis_AtBarricade_6",
				});

				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"ATTACK_Allied_AtBarricade_.*",
					"CALLARTILLERY_Allied_AtBarricade_.*",
					"ARTILLERY_S_Allied_AtBarricade_.*",
					"AIRSTRIKE_Allied_AtBarricade_6",
				});
			}

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

	Barricade_Planted = function( trigger )
	{
		Map.Barricade_Dyno += 1;

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

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

	Barricade_Defused = function( trigger )
	{
		Map.Barricade_Dyno -= 1;

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

	Barricade_Destroyed = function( trigger )
	{
		Map.Barricade_Dyno = 0;
		Map.BarricadeBuilt = 0;

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

		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ROUTE_BackWayFlag_1",
			"ROUTE_BackWayFlag_2",
			"ROUTE_BackWayFlag_3",
		});

		if ( Map.village_gate == 1 )	//intact
		{
			if ( Map.AlliesInTrigger1 > 0 or Map.AlliesInTrigger2 > 0 or Map.AlliesInTrigger3 > 0 or Map.AlliesInTrigger4 > 0 or Map.AlliesInTrigger5 > 0 )
			{
				if ( Map.GoldTaken == 0 )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Barricade" );

					Util.MapDebugPrint( "^5Barricade_destroyed, village gate intact, allies are in village, gold not taken" );
				}
				else
				{
					SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Barricade" );

					Util.MapDebugPrint( "^5Barricade_destroyed, village gate intact, allies are in village, gold taken" );
				}
			}
			else
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Barricade" );

				Util.MapDebugPrint( "^5Barricade_destroyed, village gate intact, allies arenīt in village" );
			}
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, ".*_Allied_AtBarricade_.*" );

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

			if ( Map.GoldTaken == 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Barricade" );

				if ( Map.AlliedCP == 0 and Map.DoorBuilt == 1 )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, {
						".*_Axis_villageCenter_.*",
						"DEFEND_Axis_AtBarricade_1",
						"DEFEND_Axis_AtBarricade_2",
						"DEFEND_Axis_AtBarricade_3",
						"DEFEND_Axis_AtBarricade_4",
					});
				}

				Util.MapDebugPrint( "^5Barricade_Destroyed, gold not taken" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Barricade" );

				Util.MapDebugPrint( "^5Barricade_Destroyed, gold taken" );
			}
		}
	},

	door_Built = function( trigger )
	{

		Map.DoorBuilt = 1;

		Wp.SetWaypointFlag( "transmitter_door_1", "door", true);
		Wp.SetWaypointFlag( "transmitter_door_2", "door", true);
		Wp.SetWaypointFlag( "transmitter_door_2", "axis", true);

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

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

		if ( Map.village_gate == 1 )	//intact
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Allied_AtGold_.*" );

			if ( Map.AlliesNearGold > 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, ".*_Axis_AtGold_.*" );

				if ( Map.GoldTaken == 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_gold" );

					SetAvailableMapGoals( TEAM.AXIS, true, {
						".*_Axis_AtGold_6",
						".*_Axis_AtGold_9",
					});
				}

				Util.MapDebugPrint( "^5door_Built, village gate intact, allies in room with gold" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_gold" );

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

				Util.MapDebugPrint( "^5door_Built, village gate intact, allies arenīt in room with gold" );
			}

			if ( Map.AlliesInTrigger1 > 0 or Map.AlliesInTrigger2 > 0 or Map.AlliesInTrigger3 > 0 or Map.AlliesInTrigger4 > 0 or Map.AlliesInTrigger5 > 0 )
			{
				if ( Map.GoldTaken == 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_NearGold_.*" );

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

					Util.MapDebugPrint( "^5door_Built, village gate intact, allies in village, gold not taken" );
				}

				if ( Map.AlliedCP == 0 )
				{
					if ( Map.village_house_wall == 1 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_CP_1" );

						Util.MapDebugPrint( "^5door_Built, village gate intact, allies in village, allied CP not built, village house wall intact" );
					}
					else
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"MOBILEMG42_Axis_CP_5",
							"MOBILEMG42_Axis_CP_6",
						});

						Util.MapDebugPrint( "^5door_Built, village gate intact, allies in village, allied CP not built, village house wall destroyed" );
					}
				}
				else
				{
					SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_NearGold_.*" );

					Util.MapDebugPrint( "^5door_Built, village gate intact, allies in village, allied CP built" );
				}

				if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
				{
					if ( Map.GoldTaken == 1 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_door" );

						Util.MapDebugPrint( "^5door_Built, village gate intact, allied eng or covertops in village, gold taken" );
					}
					else
					{
						SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_door" );

						Util.MapDebugPrint( "^5door_Built, village gate intact, allied eng or covertops in village, gold not taken" );

						while ( Map.village_gate == 1 and Map.DoorBuilt == 1 and Map.GoldTaken == 0 and Map.AlliedCP == 0 and Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
						{
							yield();
						}

						if ( Map.village_gate == 1 and Map.DoorBuilt == 1 and Map.GoldTaken == 0 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.CovertOpsInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.EngInTrigger5 == 0 and Map.CovertOpsInTrigger5 == 0 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_door" );

							Util.MapDebugPrint( "^5door_Built, village gate intact, allied eng or covertops arenīt in village, gold not taken" );
						}
					}
				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_door" );

					Util.MapDebugPrint( "^5door_Built, village gate intact, allied eng or covertops arenīt in village" );
				}

				while ( Map.AlliesNearGold > 0 )
				{
					yield();
				}

				if ( Map.AlliesNearGold == 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_gold" );

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

				while ( Map.village_gate == 1 and Map.DoorBuilt == 1 and Map.AlliedCP == 0 and Map.AlliesInTrigger1 > 0 or Map.AlliesInTrigger2 > 0 or Map.AlliesInTrigger3 > 0 or Map.AlliesInTrigger4 > 0 or Map.AlliesInTrigger5 > 0 )
				{
					yield();
				}

				if ( Map.village_gate == 1 and Map.DoorBuilt == 1 and Map.AlliedCP == 0 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Allied_NearGold_.*" );

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

					Util.MapDebugPrint( "^5door_Built, village gate intact, allies arenīt in village" );
				}
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Allied_NearGold_.*" );

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

				Util.MapDebugPrint( "^5door_Built, village gate intact, allies arenīt in village" );
			}
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Allied_AtGold_.*" );

			if ( Map.AlliesNearGold > 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, ".*_Axis_AtGold_.*" );

				if ( Map.GoldTaken == 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_gold" );

					SetAvailableMapGoals( TEAM.AXIS, true, {
						".*_Axis_AtGold_6",
						".*_Axis_AtGold_9",
					});
				}

				Util.MapDebugPrint( "^5door_Built, allies in room with gold" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_gold" );

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

				Util.MapDebugPrint( "^5door_Built, allies arenīt in room with gold" );
			}

			if ( Map.GoldTaken == 1 )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_door" );

				Util.MapDebugPrint( "^5door_Built, gold taken" );

			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"PLANT_door",
					"ATTACK_Allied_NearGold_.*",
				});

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

				Util.MapDebugPrint( "^5door_Built, gold not taken" );

				if ( Map.AlliedCP == 0 )
				{
					SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMG42_Axis_NearGold_.*" );

					SetAvailableMapGoals( TEAM.AXIS, true, {
						"DEFEND_Axis_CP_.*",
						".*_Axis_villageCenter_.*",
					});

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

					Util.MapDebugPrint( "^5door_Built, gold not taken, allied CP not built" );

					if ( Map.BarricadeBuilt == 0 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"DEFEND_Axis_AtBarricade_1",
							"DEFEND_Axis_AtBarricade_2",
							"DEFEND_Axis_AtBarricade_3",
							"DEFEND_Axis_AtBarricade_4",
						});

						Util.MapDebugPrint( "^5door_Built, gold not taken, allied CP not built, barricade not built" );
					}
					else
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"DEFEND_Axis_AtBarricade_7",
							"DEFEND_Axis_AtBarricade_8",
							"DEFEND_Axis_AtBarricade_9",
							"CALLARTILLERY_Axis_AtBarricade_5",
							"ARTILLERY_S_Axis_AtBarricade_6",
						});

						SetAvailableMapGoals( TEAM.ALLIES, true, {
							"ATTACK_Allied_AtBarricade_.*",
							"CALLARTILLERY_Allied_AtBarricade_.*",
							"ARTILLERY_S_Allied_AtBarricade_.*",
							"AIRSTRIKE_Allied_AtBarricade_6",
						});

						Util.MapDebugPrint( "^5door_Built, gold not taken, allied CP not built, barricade built" );
					}

					if ( Map.village_house_wall == 1 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_CP_1" );

						Util.MapDebugPrint( "^5door_Built, gold not taken allied CP not built, village house wall intact" );
					}
					else
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"MOBILEMG42_Axis_CP_5",
							"MOBILEMG42_Axis_CP_6",
						});

						Util.MapDebugPrint( "^5door_Built, gold not taken allied CP not built, village house wall destroyed" );
					}

					if ( Map.AxisCP == 0 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );

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

						Util.MapDebugPrint( "^5door_Built, gold not taken allied CP and axis CP not built" );
					}
				}
				else
				{
					SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_NearGold_.*" );

					Util.MapDebugPrint( "^5door_Built, gold not taken, allied CP built" );
				}
			}

			while ( Map.AlliesNearGold > 0 )
			{
				yield();
			}

			if ( Map.AlliesNearGold == 0 )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_gold" );

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

	door_Planted = function( trigger )
	{
		Map.door_Dyno += 1;

		if ( Map.GoldTaken == 1 )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_door_.*" );

			Util.MapDebugPrint( "^5door_Planted, gold taken" );
		}
		else
		{
			if ( Map.AxisCP == 1 and Map.Command_Post_Dyno > 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "DEFUSE_Command_Post_.*" );

				SetGoalPriority( "DEFUSE_door_.*", 1.2, TEAM.AXIS, CLASS.ENGINEER );

				SetAvailableMapGoals( TEAM.AXIS, true, "DEFUSE_door_.*" );
				sleep(0.5);
				SetAvailableMapGoals( TEAM.AXIS, true, "DEFUSE_Command_Post_.*" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "DEFUSE_door_.*" );
			}

			Util.MapDebugPrint( "^5door_Planted, gold not taken" );
		}
	},

	door_Defused = function( trigger )
	{
		Map.door_Dyno -= 1;

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

	door_Destroyed = function( trigger )
	{
		Map.door_Dyno = 0;
		Map.DoorBuilt = 0;

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

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

		Wp.SetWaypointFlag( "transmitter_door_1", "door", false);
		Wp.SetWaypointFlag( "transmitter_door_2", "door", false);
		Wp.SetWaypointFlag( "transmitter_door_2", "axis", false);

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

		if ( Map.village_gate == 1 )	//intact
		{
			if ( Map.GoldTaken == 0 )
			{
				if ( Map.AlliesInTrigger1 > 0 or Map.AlliesInTrigger2 > 0 or Map.AlliesInTrigger3 > 0 or Map.AlliesInTrigger4 > 0 or Map.AlliesInTrigger5 > 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, {
						"FLAG_gold",
						"ATTACK_Allied_AtGold_.*",
					});

					SetAvailableMapGoals( TEAM.AXIS, true, {
						".*_Axis_AtGold_.*",
						"BUILD_door",
					});

					Util.MapDebugPrint( "^5door_Destroyed, village gate intact, gold not taken, allies in village" );

					while ( Map.village_gate == 1 and Map.DoorBuilt == 0 and Map.GoldTaken == 0 and Map.AlliedCP == 0 and Map.AlliesInTrigger1 > 0 or Map.AlliesInTrigger2 > 0 or Map.AlliesInTrigger3 > 0 or Map.AlliesInTrigger4 > 0 or Map.AlliesInTrigger5 > 0 )
					{
						yield();
					}

					if ( Map.village_gate == 1 and Map.DoorBuilt == 0 and Map.GoldTaken == 0 and Map.AlliedCP == 0 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, {
							"FLAG_gold",
							"ATTACK_Allied_AtGold_.*",
						});

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

						Util.MapDebugPrint( "^5door_Destroyed, village gate intact, gold not taken, allies arenīt in village" );
					}
				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, {
						"FLAG_gold",
						"ATTACK_Allied_AtGold_.*",
					});

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

					Util.MapDebugPrint( "^5door_Destroyed, village gate intact, gold not taken, allies arenīt in village" );
				}
			}
			else
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_door" );

				Util.MapDebugPrint( "^5door_Destroyed, village gate intact, gold taken" );
			}
		}
		else
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				".*_Axis_villageCenter_.*",
				".*_Axis_AtBarricade_.*",
				"MOBILEMG42_Axis_CP_.*",
			});

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

			if ( Map.GoldTaken == 1 )
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_door" );

				Util.MapDebugPrint( "^5door_Destroyed, gold taken" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"FLAG_gold",
					"ATTACK_Allied_AtGold_.*",
				});

				SetAvailableMapGoals( TEAM.AXIS, true, {
					".*_Axis_AtGold_.*",
					"BUILD_door",
					"MOBILEMG42_Axis_NearGold_.*",
				});

				Util.MapDebugPrint( "^5door_Destroyed, gold not taken" );
			}
		}
	},

	village_house_wall_Planted = function( trigger )
	{
		Map.village_house_wall_Dyno += 1;

		if ( Map.Command_Post_Dyno > 0)
		{
			SetGoalPriority( "DEFUSE_village_house_wall_.*", 1.1, TEAM.AXIS, CLASS.ENGINEER );
		}

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

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

	village_house_wall_Defused = function( trigger )
	{
		Map.village_house_wall_Dyno -= 1;

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

	village_house_wall_Destroyed = function( trigger )
	{
		Map.village_house_wall_Dyno = 0;
		Map.village_house_wall = 0;

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

		Wp.SetWaypointFlag( "window", "jump", true);

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

		if ( Map.AlliedCP == 0 and Map.DoorBuilt == 1 )
		{
			if ( Map.GoldTaken == 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"MOBILEMG42_Axis_CP_5",
					"MOBILEMG42_Axis_CP_6",
				});
			}
		}
		else
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"MOBILEMG42_Axis_CP_5",
				"MOBILEMG42_Axis_CP_6",
			});

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

		SetAvailableMapGoals( TEAM.ALLIES, true, {
			"ROUTE_FrontCPWay_1",
			"ROUTE_FrontCPWay_2",
			"ROUTE_Wall",
			"ROUTE_FrontCPWayFlag_1",
			"ROUTE_FrontCPWayFlag_2",
		});

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

	Trigger_HouseWithGold =
	{
		Name = "trigger_withGold",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if( GetEntTeam(ent) == TEAM.ALLIES )
			{
				Map.AlliesNearGold += 1;

				foreach ( id and bot in BotTable )
				{
					if ( bot.GetTeam() == TEAM.AXIS )
					{
						bot.SayTeam("Allies are inside House near documents!");
						break;
					}
				}

				Util.MapDebugPrint( "^5allies are in room with gold" );
			}
		},
		OnExit = function(ent)
		{
			if( GetEntTeam(ent) == TEAM.ALLIES )
			{
				Map.AlliesNearGold -= 1;

				if ( Map.AlliesNearGold == 0 and Map.GoldTaken == 0 )
				{
					foreach ( id and bot in BotTable )
					{
						if ( bot.GetTeam() == TEAM.AXIS )
						{
							bot.SayTeam("Room with documents is clear!");
							break;
						}
					}

					Util.MapDebugPrint( "^5allies arenīt in room with gold" );
				}
			}
		},
	},

	Trigger_7 =
	{
		Name = "trigger_7",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if( GetEntTeam(ent) == TEAM.AXIS )
			{
				Map.AxisInTrigger += 1;
			}
		},
		OnExit = function(ent)
		{
			if( GetEntTeam(ent) == TEAM.AXIS )
			{
				Map.AxisInTrigger -= 1;
			}
			if ( Map.AxisInTrigger == 0 )
			{
				Util.MapDebugPrint( "^5axis arenīt in Town" );
			}
		},
	},

	gold_Taken = function( trigger )
	{

		Map.GoldTaken = 1;
		Map.GoldDropped = 0;

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"FLAG_gold",
			".*_Allied_AtGold_.*",
			".*_Allied_NearGold_.*",
			".*_Allied_CP_.*",
			".*_Allied_AtBarricade_.*",
		});

		SetAvailableMapGoals( TEAM.AXIS, false, {
			".*_Axis_AtGold_.*",
			".*_Axis_NearGold_.*",
			".*_Axis_CP_.*",
			".*_Axis_AtBarricade_.*",
			".*_Axis_villageCenter_.*",
		});

		if ( Map.DoorBuilt == 1 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_door" );

			Util.MapDebugPrint( "^5gold_Taken, door built" );
		}
		else
		{
			SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_door" );

			Util.MapDebugPrint( "^5gold_Taken, door not built" );
		}

		if ( Map.AlliedCP == 0 and Map.AxisCP == 0 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Command_Post" );

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

			Util.MapDebugPrint( "^5gold_Taken, allied CP and axis CP not built" );
		}
		else if  ( Map.AxisCP == 1 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_Command_Post" );

			Util.MapDebugPrint( "^5gold_Taken, axis CP built" );
		}
		else if  ( Map.AlliedCP == 1 )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, "PLANT_Command_Post" );

			Util.MapDebugPrint( "^5gold_Taken, allied CP built" );
		}

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

		if ( Map.village_gate == 1 )	//intact
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"DEFEND_Allied_AtTruck_4",
				"DEFEND_Allied_AtTruck_5",
				"DEFEND_Allied_AtTruck_6",
				"DEFEND_Allied_AtTruck_7",
			});

			SetAvailableMapGoals( TEAM.AXIS, true, {
				"DEFEND_Axis_AtTruck_1",
				"DEFEND_Axis_AtTruck_2",
				"DEFEND_Axis_AtTruck_3",
				"DEFEND_Axis_AtTruck_9",
			});
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "DEFEND_Allied_AtTruck_.*" );

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

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

	gold_Dropped = function( trigger )
	{

		Map.GoldDropped = 1;

		if ( Map.village_gate == 1 )	//intact
		{
			if ( Map.AlliesInTrigger1 > 0 or Map.AlliesInTrigger2 > 0 or Map.AlliesInTrigger3 > 0 or Map.AlliesInTrigger4 > 0 or Map.AlliesInTrigger5 > 0 )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_gold_dropped" );

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

				Util.MapDebugPrint( "^5gold_Dropped, village gate intact, allies in village" );

				while ( Map.village_gate == 1 and Map.GoldDropped == 1 and Map.AlliedCP == 0 and Map.AlliesInTrigger1 > 0 or Map.AlliesInTrigger2 > 0 or Map.AlliesInTrigger3 > 0 or Map.AlliesInTrigger4 > 0 or Map.AlliesInTrigger5 > 0 )
				{
					yield();
				}

				if ( Map.village_gate == 1 and Map.GoldDropped == 1 and Map.AlliedCP == 0 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_gold_dropped" );

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

					Util.MapDebugPrint( "^5gold_Dropped, village gate intact, allies arenīt in village" );
				}
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_gold_dropped" );

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

				Util.MapDebugPrint( "^5gold_Dropped, village gate intact, allies arenīt in village" );
			}
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "FLAG_gold_dropped" );

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

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

	gold_Returned = function( trigger )
	{

		Map.GoldTaken = 0;
		Map.GoldDropped = 0;

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"CAPPOINT_Truck",
			"DEFEND_Allied_AtTruck_.*",
		});

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

		if ( Map.village_gate == 1 )	//intact
		{
			if ( Map.AlliesInTrigger1 > 0 or Map.AlliesInTrigger2 > 0 or Map.AlliesInTrigger3 > 0 or Map.AlliesInTrigger4 > 0 or Map.AlliesInTrigger5 > 0 )
			{
				if ( Map.BarricadeBuilt == 0 )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Barricade" );

					Util.MapDebugPrint( "^5gold returned, village gate intact, allies in village, barricade not built" );
				}
				if ( Map.DoorBuilt == 1 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_NearGold_.*" );

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

					if ( Map.AlliedCP == 0 )
					{
						if ( Map.AxisCP == 0 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );

							Util.MapDebugPrint( "^5gold returned, village gate intact, allies in village, boor built, allied CP and axis CP not built" );
						}

						if ( Map.village_house_wall == 1 )
						{
							SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_CP_1" );

							Util.MapDebugPrint( "^5gold returned, village gate intact, allies in village, boor built, allied CP not built, village house wall intact" );
						}
						else
						{
							SetAvailableMapGoals( TEAM.AXIS, true, {
								"MOBILEMG42_Axis_CP_5",
								"MOBILEMG42_Axis_CP_6",
							});

							Util.MapDebugPrint( "^5gold returned, village gate intact, allies in village, boor built, allied CP not built, village house wall destroyed" );
						}
					}
					else
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_NearGold_.*" );

						Util.MapDebugPrint( "^5gold returned, village gate intact, allies in village, boor built, allied CP built" );
					}

					if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_door" );

						Util.MapDebugPrint( "^5gold returned, village gate intact, door built, allied eng or covertops in village" );

						while ( Map.village_gate == 1 and Map.DoorBuilt == 1 and Map.GoldTaken == 0 and Map.AlliedCP == 0 and Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
						{
							yield();
						}

						if ( Map.village_gate == 1 and Map.DoorBuilt == 1 and Map.GoldTaken == 0 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.CovertOpsInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.EngInTrigger5 == 0 and Map.CovertOpsInTrigger5 == 0 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_door" );

							Util.MapDebugPrint( "^5gold returned, village gate intact, door built, allied eng or covertops arenīt in village" );
						}
					}
					else
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, "PLANT_door" );

						Util.MapDebugPrint( "^5gold returned, village gate intact, door built, allied eng or covertops arenīt in village" );
					}

					while ( Map.village_gate == 1 and Map.DoorBuilt == 1 and Map.AlliedCP == 0 and Map.AlliesInTrigger1 > 0 or Map.AlliesInTrigger2 > 0 or Map.AlliesInTrigger3 > 0 or Map.AlliesInTrigger4 > 0 or Map.AlliesInTrigger5 > 0 )
					{
						yield();
					}

					if ( Map.village_gate == 1 and Map.DoorBuilt == 1 and Map.AlliedCP == 0 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, "ATTACK_Allied_NearGold_.*" );

						Util.MapDebugPrint( "^5gold returned, village gate intact, allies arenīt in village" );
					}
				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, {
						"FLAG_gold",
						"ATTACK_Allied_AtGold_.*",
					});

					SetAvailableMapGoals( TEAM.AXIS, true, {
						"DEFEND_Axis_AtGold_.*",
						"MOBILEMG42_Axis_NearGold_.*",
						"BUILD_door",
					});

					Util.MapDebugPrint( "^5gold returned, village gate intact, allies in village, door not built" );

					while ( Map.village_gate == 1 and Map.DoorBuilt == 0 and Map.AlliedCP == 0 and Map.AlliesInTrigger1 > 0 or Map.AlliesInTrigger2 > 0 or Map.AlliesInTrigger3 > 0 or Map.AlliesInTrigger4 > 0 or Map.AlliesInTrigger5 > 0 )
					{
						yield();
					}

					if ( Map.village_gate == 1 and Map.DoorBuilt == 0 and Map.AlliedCP == 0 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, {
							"FLAG_gold",
							"ATTACK_Allied_AtGold_.*",
						});

						SetAvailableMapGoals( TEAM.AXIS, false, {
							"DEFEND_Axis_AtGold_.*",
							"MOBILEMG42_Axis_NearGold_.*",
							"BUILD_door",
						});

						Util.MapDebugPrint( "^5gold returned, village gate intact, allies arenīt in village, door not built" );
					}
				}
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, {
					"FLAG_gold",
					"ATTACK_Allied_AtGold_.*",
				});

				SetAvailableMapGoals( TEAM.AXIS, false, {
					"DEFEND_Axis_AtGold_.*",
					"MOBILEMG42_Axis_NearGold_.*",
					"BUILD_door",
				});

				Util.MapDebugPrint( "^5gold returned, village gate intact, allies arenīt in village" );
			}
		}
		else
		{
			if ( Map.AlliedCP == 0 and Map.DoorBuilt == 1 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Axis_CP_.*" );

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

				Util.MapDebugPrint( "^5gold_Returned, allied CP not built, door built" );

				if ( Map.AxisCP == 0 )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Command_Post" );

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

					Util.MapDebugPrint( "^5gold_Returned, allied CP and axis CP not built, door built" );
				}

				if ( Map.village_house_wall == 1 )	//intact
				{
					SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_CP_1" );	//near ammocab

					Util.MapDebugPrint( "^5gold_Returned, allied CP not built, door built, village house wall intact" );
				}
				else
				{
					SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_CP_5" );	//near CP
					SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_CP_6" );	//near CP

					Util.MapDebugPrint( "^5gold_Returned, allied CP not built, door built, village house wall destroyed" );
				}
			}

			if ( Map.AlliedCP == 0 and Map.DoorBuilt == 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"MOBILEMG42_Axis_NearGold_.*",
					"DEFEND_Axis_CP_.*",
				});

				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"ATTACK_Allied_CP_2",
					"ATTACK_Allied_CP_4",
					"BUILD_Command_Post",
				});

				Util.MapDebugPrint( "^5gold_Returned, allied CP not built, door not built" );
			}

			if ( Map.AlliedCP == 1 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, ".*_Axis_NearGold_.*" );
			}

			if ( Map.DoorBuilt == 0 )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"FLAG_gold",
					".*_Allied_AtGold_.*",
				});

				SetAvailableMapGoals( TEAM.AXIS, true, {
					".*_Axis_AtGold_.*",
					"BUILD_door",
				});

				Util.MapDebugPrint( "^5gold_Returned, door not built" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, ".*_Allied_NearGold_.*" );

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

				Util.MapDebugPrint( "^5gold_Returned, door built" );
			}

			if ( Map.BarricadeBuilt == 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Barricade" );

				Util.MapDebugPrint( "^5gold_Returned, barricade not built" );

				if ( Map.AlliedCP == 0 and Map.DoorBuilt == 1 )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, {
						".*_Axis_villageCenter_.*",
						"DEFEND_Axis_AtBarricade_1",
						"DEFEND_Axis_AtBarricade_2",
						"DEFEND_Axis_AtBarricade_3",
						"DEFEND_Axis_AtBarricade_4",
					});

					Util.MapDebugPrint( "^5gold_Returned, barricade not built, allied CP not built" );
				}
			}
			else
			{
				Util.MapDebugPrint( "^5gold_Returned, barricade built" );

				if ( Map.AlliedCP == 0 and Map.DoorBuilt == 1 )
				{
					SetAvailableMapGoals( TEAM.AXIS, true, {
						".*_Axis_villageCenter_.*",
						"DEFEND_Axis_AtBarricade_7",
						"DEFEND_Axis_AtBarricade_8",
						"DEFEND_Axis_AtBarricade_9",
						"CALLARTILLERY_Axis_AtBarricade_5",
						"ARTILLERY_S_Axis_AtBarricade_6",
					});

					SetAvailableMapGoals( TEAM.ALLIES, true, {
						"ATTACK_Allied_AtBarricade_.*",
						"CALLARTILLERY_Allied_AtBarricade_.*",
						"ARTILLERY_S_Allied_AtBarricade_.*",
						"AIRSTRIKE_Allied_AtBarricade_6",
					});

					Util.MapDebugPrint( "^5gold_Returned, barricade built, allied CP not built" );
				}
			}
		}
	},

	gold_Secured = function( trigger )
	{

		ETUtil.WinningChat( TEAM.ALLIES );
		ETUtil.LosingChat( TEAM.AXIS );

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

	Allied_Command_Post_Built = function( trigger )
	{

		Map.AlliedCP = 1;

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

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

		SetAvailableMapGoals( TEAM.ALLIES, false, {
			"BUILD_Command_Post",
			"ATTACK_Allied_CP_.*",
		});

		if ( Map.village_gate == 1 )	//intact
		{
			Util.ChangeSpawn( TEAM.ALLIES, 5 );	//CP

			if ( Map.village_house_wall == 1 )
			{
				SetGoalPriority( "PLANT_village_house_wall", 0.95, TEAM.ALLIES, CLASS.ENGINEER );

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

				Util.MapDebugPrint( "^5Allied_Command_Post_Built, village gate intact, village house wall intact" );
			}

			SetAvailableMapGoals( TEAM.AXIS, false, {
				".*_Axis_Start_.*",
				"CHECKPOINT_flag",
				"DEFUSE_village_Gate_.*",
			});

			SetAvailableMapGoals( TEAM.AXIS, true, {
				"AMMOCAB_north_ammocabinet",
				"HEALTHCAB_north_healthcabinet",
			});

			SetAvailableMapGoals( TEAM.ALLIES, false, {
				".*_Allies_Start_.*",
				"CHECKPOINT_flag",
			});

			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"AMMOCAB_north_ammocabinet",
				"HEALTHCAB_north_healthcabinet",
			});

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

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

			SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMG42_Axis_CP_.*" );
			SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_NearGold_.*" );

			Util.MapDebugPrint( "^5Allied_Command_Post_Built, village gate intact" );

			if ( Map.BarricadeBuilt == 1 )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

				Util.MapDebugPrint( "^5Allied_Command_Post_Built, village gate intact, barricade built" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Barricade" );

				Util.MapDebugPrint( "^5Allied_Command_Post_Built, village gate intact, barricade destroyed" );
			}

			if ( Map.DoorBuilt == 1 )
			{
				if ( Map.GoldTaken == 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, {
						"PLANT_door",
						"ATTACK_Allied_NearGold_.*",
					});

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

					Util.MapDebugPrint( "^5Allied_Command_Post_Built, village gate intact, door built, gold not taken" );
				}
			}
			else
			{
				if ( Map.GoldTaken == 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, {
						"FLAG_gold",
						"ATTACK_Allied_AtGold_.*",
					});

					SetAvailableMapGoals( TEAM.AXIS, true, {
						"BUILD_door",
						"DEFEND_Axis_AtGold_.*",
					});

					Util.MapDebugPrint( "^5Allied_Command_Post_Built, village gate intact, door not built, gold not taken" );
				}
			}
		}
		else
		{
			Util.RandomSpawn( TEAM.ALLIES, 5 );

			SetAvailableMapGoals( TEAM.AXIS, false, {
				"DEFEND_Axis_CP_.*",
				"MOBILEMG42_Axis_CP_.*",
				".*_Axis_villageCenter_.*",
				".*_Axis_AtBarricade_.*",
			});

			SetAvailableMapGoals( TEAM.ALLIES, false, {
				".*_Allied_AtBarricade_.*",
				"ATTACK_Allied_CP_.*",
			});

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

			Util.MapDebugPrint( "^5Allied_Command_Post_Built, village gate destroyed" );

			if ( Map.BarricadeBuilt == 1 )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "PLANT_Barricade" );

				Util.MapDebugPrint( "^5Allied_Command_Post_Built, village gate destroyed, barricade built" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "BUILD_Barricade" );

				Util.MapDebugPrint( "^5Allied_Command_Post_Built, village gate destroyed, barricade not built" );
			}

			if ( Map.DoorBuilt == 1 )
			{
				if ( Map.GoldTaken == 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, {
						"PLANT_door",
						"ATTACK_Allied_NearGold_.*",
					});

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

					Util.MapDebugPrint( "^5Allied_Command_Post_Built, village gate destroyed, door built, gold not taken" );
				}
			}
			else
			{
				if ( Map.GoldTaken == 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, {
						"FLAG_gold",
						"ATTACK_Allied_AtGold_.*",
					});

					SetAvailableMapGoals( TEAM.AXIS, true, {
						"BUILD_door",
						"DEFEND_Axis_AtGold_.*",
					});

					Util.MapDebugPrint( "^5Allied_Command_Post_Built, village gate destroyed, door not built, gold not taken" );
				}
			}
		}
	},

	Axis_Command_Post_Built = function( trigger )
	{

		Map.AxisCP = 1;

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

		if ( Map.village_gate == 1 )	//intact
		{
			if ( Map.AlliesInTrigger1 > 0 or Map.AlliesInTrigger2 > 0 or Map.AlliesInTrigger3 > 0 or Map.AlliesInTrigger4 > 0 or Map.AlliesInTrigger5 > 0 )
			{
				if ( Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Command_Post" );

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

					Util.MapDebugPrint( "^5Axis_Command_Post_Built, village gate intact, allied eng or covertops in village" );

					if ( Map.GoldTaken == 0 )
					{
						if ( Map.DoorBuilt == 1 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );

							Util.MapDebugPrint( "^5Axis_Command_Post_Built, village gate intact, allied eng or covertops in village, gold not taken, door built" );
						}
						else
						{
							SetAvailableMapGoals( TEAM.ALLIES, true, {
								"ATTACK_Allied_CP_2",
								"ATTACK_Allied_CP_4",
							});

							Util.MapDebugPrint( "^5Axis_Command_Post_Built, village gate intact, allied eng or covertops in village, gold not taken, door not built" );
						}
					}

					while ( Map.village_gate == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 > 0 or Map.CovertOpsInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.CovertOpsInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.CovertOpsInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.CovertOpsInTrigger4 > 0 or Map.EngInTrigger5 > 0 or Map.CovertOpsInTrigger5 > 0 )
					{
						yield();
					}

					if ( Map.village_gate == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.CovertOpsInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.CovertOpsInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.CovertOpsInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.CovertOpsInTrigger4 == 0 and Map.EngInTrigger5 == 0 and Map.CovertOpsInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, {
							"PLANT_Command_Post",
							"ATTACK_Allied_CP_.*",
						});

						Util.MapDebugPrint( "^5Axis_Command_Post_Built, village gate intact, allied eng or covertops arenīt in village" );
					}
				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, {
						"PLANT_Command_Post",
						"ATTACK_Allied_CP_.*",
					});

					Util.MapDebugPrint( "^5Axis_Command_Post_Built, village gate intact, allied eng or covertops arenīt in village" );
				}
			}
			else
			{
				Util.MapDebugPrint( "^5Axis_Command_Post_Built, village gate intact, allies arenīt in village" );
			}
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, "BUILD_Command_Post" );

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

			Util.MapDebugPrint( "^5Axis_Command_Post_Built" );

			if ( Map.GoldTaken == 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "DEFEND_Axis_CP_.*" );

				Util.MapDebugPrint( "^5Axis_Command_Post_Built, gold not taken" );

				if ( Map.DoorBuilt == 1 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );

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

					Util.MapDebugPrint( "^5Axis_Command_Post_Built, gold not taken, door built" );

					if ( Map.village_house_wall == 1 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_CP_1" );

						Util.MapDebugPrint( "^5Axis_Command_Post_Built, gold not taken, door built, village house wall intact" );
					}
					else
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"MOBILEMG42_Axis_CP_5",
							"MOBILEMG42_Axis_CP_6",
						});

						Util.MapDebugPrint( "^5Axis_Command_Post_Built, gold not taken, door built, village house wall destroyed" );
					}
				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, {
						"ATTACK_Allied_CP_2",
						"ATTACK_Allied_CP_4",
					});

					Util.MapDebugPrint( "^5Axis_Command_Post_Built, gold not taken, door not built" );
				}
			}
		}
	},

	Command_Post_Planted = function( trigger )
	{
		Map.Command_Post_Dyno += 1;

		if ( Map.village_gate == 1 )	//intact
		{
			if ( Map.AlliedCP == 1 )
			{
				if ( Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, {
						"DEFUSE_Command_Post_.*",
						"ATTACK_Allied_CP_2",
						"ATTACK_Allied_CP_4",
					});

					Util.MapDebugPrint( "^5Allied command post planted, village gate intact, allied eng in village" );

					while ( Map.village_gate == 1 and Map.AlliedCP == 1 and Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
					{
						yield();
					}

					if ( Map.village_gate == 1 and Map.AlliedCP == 1 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, {
							"DEFUSE_Command_Post_.*",
							"ATTACK_Allied_CP_2",
							"ATTACK_Allied_CP_4",
						});

						Util.MapDebugPrint( "^5Allied command post planted, village gate intact, allied eng isnīt in village" );
					}
				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, {
						"DEFUSE_Command_Post_.*",
						"ATTACK_Allied_CP_2",
						"ATTACK_Allied_CP_4",
					});

					Util.MapDebugPrint( "^5Allied command post planted, village gate intact, allied eng isnīt in village" );
				}
			}
			else
			{
				if ( Map.village_house_wall_Dyno > 0)
				{
					SetGoalPriority( "DEFUSE_village_house_wall_.*", 1.1, TEAM.AXIS, CLASS.ENGINEER );
				}

				Util.MapDebugPrint( "^5Axis command post planted, village gate intact" );
			}
		}
		else
		{
			if ( Map.AlliedCP == 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, "DEFUSE_Command_Post_.*" );
			}
			else
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, "DEFUSE_Command_Post_.*" );
			}

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

	Command_Post_Defused = function( trigger )
	{
		Map.Command_Post_Dyno -= 1;

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

	Allied_Command_Post_Destroyed = function( trigger )
	{
		Map.Command_Post_Dyno = 0;
		Map.AlliedCP = 0;

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

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

		if ( Map.AxisFlag == 1 )
		{
			Util.ChangeSpawn( TEAM.ALLIES, 2 );	//Town entrance
		}
		else
		{
			Util.ChangeSpawn( TEAM.ALLIES, 1 );	//Town square
		}

		if ( Map.village_gate == 1 )	//intact
		{
			if ( Map.AlliesInTrigger1 > 0 or Map.AlliesInTrigger2 > 0 or Map.AlliesInTrigger3 > 0 or Map.AlliesInTrigger4 > 0 or Map.AlliesInTrigger5 > 0 )
			{
				if ( Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Command_Post" );

					Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed, village gate intact, allied eng in village" );

					if ( Map.GoldTaken == 0 )
					{
						if ( Map.DoorBuilt == 1 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );

							Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed, village gate intact, allied eng in village, gold not taken, door built" );
						}
						else
						{
							SetAvailableMapGoals( TEAM.ALLIES, true, {
								"ATTACK_Allied_CP_2",
								"ATTACK_Allied_CP_4",
							});

							Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed, village gate intact, allied eng in village, gold not taken, door not built" );
						}
					}
					while ( Map.village_gate == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
					{
						yield();
					}

					if ( Map.village_gate == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, {
							"BUILD_Command_Post",
							"ATTACK_Allied_CP_.*",
						});

						Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed, village gate intact, allied engs arenīt in village" );
					}
				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, {
						"BUILD_Command_Post",
						"ATTACK_Allied_CP_.*",
					});

					Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed, village gate intact, allied engs arenīt in village" );
				}

				while ( Map.village_gate == 1 and Map.GoldTaken == 0 and Map.AlliesInTrigger1 > 0 or Map.AlliesInTrigger2 > 0 or Map.AlliesInTrigger3 > 0 or Map.AlliesInTrigger4 > 0 or Map.AlliesInTrigger5 > 0 )
				{
					yield();
				}

				if ( Map.village_gate == 1 and Map.GoldTaken == 0 and Map.AlliesInTrigger1 == 0 and Map.AlliesInTrigger2 == 0 and Map.AlliesInTrigger3 == 0 and Map.AlliesInTrigger4 == 0 and Map.AlliesInTrigger5 == 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, "FLAG_gold" );

					Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed, village gate intact, gold not taken, allies arenīt in village" );
				}

				while ( Map.village_gate == 1 and Map.AlliesInTrigger1 > 0 or Map.AlliesInTrigger2 > 0 or Map.AlliesInTrigger3 > 0 or Map.AlliesInTrigger4 > 0 or Map.AlliesInTrigger5 > 0 )
				{
					yield();
				}

				if ( Map.AlliedFlag == 1 )
				{
					SetAvailableMapGoals( TEAM.AXIS, false, "CHECKPOINT_flag" );
					sleep(0.5);

					Util.SetMaxUsers( 5, "CHECKPOINT_.*" );

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

					Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed, village gate intact, allies arenīt in village, flag allies captured" );
				}
			}
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Command_Post" );

			Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed" );

			if ( Map.GoldTaken == 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"DEFEND_Axis_CP_.*",
					"BUILD_Command_Post",
				});

				Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed, gold not taken" );

				if ( Map.DoorBuilt == 1 )
				{
					SetAvailableMapGoals( TEAM.AXIS, false, "MOBILEMG42_Axis_NearGold_.*" );

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

					SetAvailableMapGoals( TEAM.AXIS, true, {
						"DEFEND_Axis_villageCenter_.*",
						"CALLARTILLERY_Axis_villageCenter_7",
						"ARTILLERY_S_Axis_villageCenter_8",
					});

					Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed, gold not taken, door built" );

					if ( Map.village_house_wall == 1 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_CP_1" );

						Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed, gold not taken, door built, village house wall built" );
					}
					else
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"MOBILEMG42_Axis_CP_5",
							"MOBILEMG42_Axis_CP_6",
						});

						Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed, gold not taken, door built, village house wall destroyed" );
					}

					if ( Map.BarricadeBuilt == 0 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"DEFEND_Axis_AtBarricade_1",
							"DEFEND_Axis_AtBarricade_2",
							"DEFEND_Axis_AtBarricade_3",
							"DEFEND_Axis_AtBarricade_4",
						});

						Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed, gold not taken, door built, barricade not built" );
					}
					else
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"DEFEND_Axis_AtBarricade_7",
							"DEFEND_Axis_AtBarricade_8",
							"DEFEND_Axis_AtBarricade_9",
							"CALLARTILLERY_Axis_AtBarricade_5",
							"ARTILLERY_S_Axis_AtBarricade_6",
						});

						SetAvailableMapGoals( TEAM.ALLIES, true, {
							"ATTACK_Allied_AtBarricade_.*",
							"CALLARTILLERY_Allied_AtBarricade_.*",
							"ARTILLERY_S_Allied_AtBarricade_.*",
							"AIRSTRIKE_Allied_AtBarricade_6",
						});

						Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed, gold not taken, door built, barricade built" );
					}

				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, {
						"ATTACK_Allied_CP_2",
						"ATTACK_Allied_CP_4",
					});

					Util.MapDebugPrint( "^5Allied_Command_Post_Destroyed, gold not taken, door not built" );
				}
			}
		}
	},

	Axis_Command_Post_Destroyed = function( trigger )
	{
		Map.Command_Post_Dyno = 0;
		Map.AxisCP = 0;

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

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

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

		if ( Map.village_gate == 1 )	//intact
		{
			if ( Map.AlliesInTrigger1 > 0 or Map.AlliesInTrigger2 > 0 or Map.AlliesInTrigger3 > 0 or Map.AlliesInTrigger4 > 0 or Map.AlliesInTrigger5 > 0 )
			{
				if ( Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Command_Post" );

					if ( Map.GoldTaken == 0 )
					{
						if ( Map.DoorBuilt == 1 )
						{
							SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );
						}
						else
						{
							SetAvailableMapGoals( TEAM.ALLIES, true, {
								"ATTACK_Allied_CP_2",
								"ATTACK_Allied_CP_4",
							});
						}
					}
					Util.MapDebugPrint( "^5Axis_Command_Post_Destroyed, village gate intact, allied eng in village" );

					while ( Map.village_gate == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 > 0 or Map.EngInTrigger2 > 0 or Map.EngInTrigger3 > 0 or Map.EngInTrigger4 > 0 or Map.EngInTrigger5 > 0 )
					{
						yield();
					}

					if ( Map.village_gate == 1 and Map.AlliedCP == 0 and Map.EngInTrigger1 == 0 and Map.EngInTrigger2 == 0 and Map.EngInTrigger3 == 0 and Map.EngInTrigger4 == 0 and Map.EngInTrigger5 == 0 )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, {
							"BUILD_Command_Post",
							"ATTACK_Allied_CP_.*",
						});

						Util.MapDebugPrint( "^5Axis_Command_Post_Destroyed, village gate intact, allied engs arenīt in village" );
					}
				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, {
						"BUILD_Command_Post",
						"ATTACK_Allied_CP_.*",
					});

					Util.MapDebugPrint( "^5Axis_Command_Post_Destroyed, village gate intact, allied eng isnīt in village" );
				}
			}
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, "BUILD_Command_Post" );

			Util.MapDebugPrint( "^5Axis_Command_Post_Destroyed" );

			if ( Map.GoldTaken == 0 )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, {
					"DEFEND_Axis_CP_.*",
					"BUILD_Command_Post",
				});

				Util.MapDebugPrint( "^5Axis_Command_Post_Destroyed, gold not taken" );

				if ( Map.DoorBuilt == 1 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, "ATTACK_Allied_CP_.*" );

					Util.MapDebugPrint( "^5Axis_Command_Post_Destroyed, gold not taken, door built" );

					if ( Map.village_house_wall == 1 )
					{
						SetAvailableMapGoals( TEAM.AXIS, true, "MOBILEMG42_Axis_CP_1" );

						Util.MapDebugPrint( "^5Axis_Command_Post_Destroyed, gold not taken, door built, village house wall intact" );
					}
					else
					{
						SetAvailableMapGoals( TEAM.AXIS, true, {
							"MOBILEMG42_Axis_CP_5",
							"MOBILEMG42_Axis_CP_6",
						});

						Util.MapDebugPrint( "^5Axis_Command_Post_Destroyed, gold not taken, door built, village house wall destroyed" );
					}
				}
				else
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, {
						"ATTACK_Allied_CP_2",
						"ATTACK_Allied_CP_4",
					});

					Util.MapDebugPrint( "^5Axis_Command_Post_Destroyed, gold not taken, door not built" );
				}
			}
			else
			{
				SetAvailableMapGoals( TEAM.AXIS, false, "BUILD_Command_Post" );

				Util.MapDebugPrint( "^5Axis_Command_Post_Destroyed, gold taken" );
			}
		}
	},
};

global OnMapLoad = function()
{
	// Register callback functions
	OnTrigger( "^6The barricade has been built", Map.Barricade_Built );
	OnTrigger( "Planted at Barricade.", Map.Barricade_Planted );
	OnTrigger( "Defused at Barricade.", Map.Barricade_Defused );
	OnTrigger( "^6The barricade has been destroyed", Map.Barricade_Destroyed );

	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( "Planted at the Command Post.", Map.Command_Post_Planted );
	OnTrigger( "Planted at Command Post.", Map.Command_Post_Planted );	//for nitmod
	OnTrigger( "Defused at the Command Post.", Map.Command_Post_Defused );
	OnTrigger( "Defused at Command Post.", Map.Command_Post_Defused );	//for nitmod
	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( "^6The security door has been set up", Map.door_Built );
	OnTrigger( "Planted at the door.", Map.door_Planted );
	OnTrigger( "Planted at door.", Map.door_Planted );	//for nitmod
	OnTrigger( "Defused at the door.", Map.door_Defused );
	OnTrigger( "Defused at door.", Map.door_Defused );	//for nitmod
	OnTrigger( "^6The security door has been breached", Map.door_Destroyed );

	OnTrigger( "Planted at the village Gate.", Map.village_Gate_Planted );
	OnTrigger( "Planted at village Gate.", Map.village_Gate_Planted );	//for nitmod
	OnTrigger( "Defused at the village Gate.", Map.village_Gate_Defused );
	OnTrigger( "Defused at village Gate.", Map.village_Gate_Defused );	//for nitmod
	OnTrigger( "^6The Village Gate has been breached!", Map.village_Gate_Destroyed );

	OnTrigger( "Planted at the village house wall.", Map.village_house_wall_Planted );
	OnTrigger( "Planted at village house wall.", Map.village_house_wall_Planted );	//for nitmod
	OnTrigger( "Defused at the village house wall.", Map.village_house_wall_Defused );
	OnTrigger( "Defused at village house wall.", Map.village_house_wall_Defused );	//for nitmod
	OnTrigger( "^6The Town wall has been breached!", Map.village_house_wall_Destroyed );

	OnTrigger( "^6Allies have stolen the transmitter", Map.gold_Taken );
	OnTrigger( "Allies have stolen The Transmitter!", Map.gold_Taken );
	OnTrigger( "The Transmitter dropped.", Map.gold_Dropped );
	OnTrigger( "Flag returned gold!", Map.gold_Returned );
	OnTrigger( "^6Allies have secured the transmitter", Map.gold_Secured );

	OnTrigger( "^6The Town flag has been reclaimed!", Map.flag_Axis_Captured );
	OnTrigger( "^6The Town flag has been captured!", Map.flag_Allies_Captured );

	if ( Map.village_gate == 1 )
	{
		//Util.ChangeSpawn( TEAM.ALLIES, 2 );
		Util.ChangeSpawn( TEAM.AXIS, 1 );
	}
	else
	{
		//Util.ChangeSpawn( TEAM.ALLIES, 1 );
		Util.ChangeSpawn( TEAM.AXIS, 3 );
	}

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

	foreach ( id and bot in BotTable )
	{
		if ( bot.GetTeam()  == TEAM.AXIS )
		{
			WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, WEAPON.MOBILE_MG42, true );
		}
	}

	SetAvailableMapGoals( TEAM.AXIS, false, ".*" );
	SetAvailableMapGoals( TEAM.AXIS, true, {
		"ROUTE_.*",
		".*_Axis_Start_.*",
	});

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		"ROUTE_.*",
		".*_Allies_Start_.*",
		"CHECKPOINT_flag",
		"PLANT_village_Gate",
	});

	SetGoalPriority( "PLANT_.*", 0.90, 0, CLASS.COVERTOPS );

	//SetGoalPriority( "PLANT_door", 0.91, 0, CLASS.COVERTOPS );
	SetGoalPriority( "PLANT_door", 0.92, TEAM.ALLIES, CLASS.COVERTOPS );
	SetGoalPriority( "PLANT_Command_Post", 0.93, TEAM.ALLIES, CLASS.COVERTOPS );
	SetGoalPriority( "PLANT_.*", 0.55, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_village_Gate", 0.82, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_village_house_wall", 0.81, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "ATTACK_Allied_CP_.*", 0.81, TEAM.ALLIES, 0 );
	SetGoalPriority( "ATTACK_Allied_CP_.*", 0.50, TEAM.ALLIES, CLASS.ENGINEER );
	SetGoalPriority( "ATTACK_Allied_NearGold_.*", 0.51, TEAM.ALLIES, 0 );
	SetGoalPriority( "ATTACK_Allied_AtBarricade_.*", 0.52, TEAM.ALLIES, 0 );
	SetGoalPriority( "ATTACK_Allied_AtGold_.*", 0.53, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allied_AtTruck_.*", 0.54, TEAM.ALLIES, 0 );
	SetGoalPriority( "CALLARTILLERY_Allied_.*", 0.81, TEAM.ALLIES, CLASS.FIELDOPS );
	SetGoalPriority( "CALLARTILLERY_Allied_AtBarricade_7", 0.82, TEAM.ALLIES, CLASS.FIELDOPS );
	SetGoalPriority( "ARTILLERY_S_Allied_.*", 0.81, TEAM.ALLIES, CLASS.FIELDOPS );
	SetGoalPriority( "ARTILLERY_S_Allied_AtBarricade_8", 0.82, TEAM.ALLIES, CLASS.FIELDOPS );

	SetGoalPriority( "PLANTMINE_Axis_Start_12", 0.80, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANTMINE_Axis_Start_13", 0.80, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_Barricade", 0.91, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "BUILD_door", 0.92, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "DEFEND_Axis_Start_28", 0.51, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_Start_32", 0.51, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_NearGold_.*", 0.52, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_CP_.*", 0.53, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_villageCenter_.*", 0.54, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_AtBarricade_.*", 0.55, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_AtGold_.*", 0.56, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_AtTruck_.*", 0.71, TEAM.AXIS, 0 );
	SetGoalPriority( "DEFEND_Axis_AtGold_.*", 0.9, TEAM.AXIS, CLASS.COVERTOPS );
	SetGoalPriority( "DEFEND_Axis_AtGold_.*", 0.9, TEAM.AXIS, CLASS.FIELDOPS );
	SetGoalPriority( "PLANT_.*", 0.7, TEAM.AXIS, CLASS.ENGINEER );
	SetGoalPriority( "PLANT_Command_Post", 0.9, TEAM.AXIS, CLASS.COVERTOPS );

	// Max users per goal
	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "GRENADE_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 5, "CHECKPOINT_.*" );
	Util.SetMaxUsers( 8, "FLAG.*" );

	// Camp times
	SetMapGoalProperties( "MOUNTMG42_.*", {MinCampTime=15, MaxCampTime=90} );
	SetMapGoalProperties( "MOBILEMG42_.*", {MinCampTime=240, MaxCampTime=360} );

	Wp.SetWaypointFlag( "door_1", "door", true);
	Wp.SetWaypointFlag( "door_1", "axis", true);
	Wp.SetWaypointFlag( "door_2", "door", true);
	Wp.SetWaypointFlag( "door_2", "axis", true);

	Wp.SetWaypointFlag( "transmitter_door_1", "door", false);
	Wp.SetWaypointFlag( "transmitter_door_2", "door", false);
	Wp.SetWaypointFlag( "transmitter_door_2", "axis", false);

	Wp.SetWaypointFlag( "window", "jump", false);

	Wp.SetWaypointFlag( "ladder_1", "closed", true);
	Wp.SetWaypointFlag( "ladder_2", "closed", true);

	Util.AddUseWp( "PLANT_village_Gate", "plant_0" );
	Util.AddUseWp( "PLANT_village_Gate", "plant_2" );
	Util.AddUseWp( "PLANT_village_house_wall", "plant_1" );
	Util.AddUseWp( "PLANT_village_house_wall", "plant_3" );
	Util.AddUseWp( "PLANT_Barricade", "plant_4" );
	Util.AddUseWp( "PLANT_Barricade", "plant_5" );
	Util.AddUseWp( "PLANT_door", "transmitter_door_1" );
	Util.AddUseWp( "PLANT_door", "transmitter_door_2" );

	// Region triggers
	NP1 = OnTriggerRegion(AABB(-1024.875,-425.962,-598.875,-610.552,46.879,-488.462), RegionTrigger.DisableBotPush);
	NP4 = OnTriggerRegion(AABB(304.193,873.059,-542.875,387.064,971.885,-460.875), RegionTrigger.DisableBotPush);
	NPX = OnTriggerRegion(AABB(-1743.467,-2482.851,-643.368,-1505.955,-2197.131,-492.875), RegionTrigger.DisableBotPush);
	DCMTrigger1 = OnTriggerRegion(AABB(-360.729,182.488,-207.346,-317.832,345.819,-132.456), RegionTrigger.DisableCombatMovement);
	DCMTrigger2 = OnTriggerRegion(AABB(2335.125,224.332,-590.875,2373.125,262.332,-516.875), RegionTrigger.DisableCombatMovement);
	DCMTrigger3 = OnTriggerRegion(AABB(1071.125,-703.089,-222.875,1189.458,-632.198,-112.875), RegionTrigger.DisableCombatMovement);
	DCM1 = OnTriggerRegion(AABB(-1832.875,-256.873,-574.875,-1559.126,-63.125,-383.550), RegionTrigger.DisableCombatMovement);
	NP8 = OnTriggerRegion(AABB(1071.125,-703.089,-222.875,1189.458,-632.198,-112.875), RegionTrigger.DisableBotPush);
	Map.iw1 = OnTriggerRegion(AABB(-636.863,1215.126,-518.875,-511.125,1303.816,-432.875), RegionTrigger.IntrusionWarning);
	trigger1 = OnTriggerRegion(AABB(-708.316,1215.125,-518.875,0.846,1606.874,-142.983), Map.Trigger_1);
	trigger2 = OnTriggerRegion(AABB(-48.036,-3184.875,-654.875,3840.875,1600.875,-68.126), Map.Trigger_2);
	trigger3 = OnTriggerRegion(AABB(-1088.874,417.828,-182.875,-251.136,1024.874,-65.047), Map.Trigger_3);
	trigger4 = OnTriggerRegion(AABB(-329.756,831.127,-598.875,66.064,960.874,-452.875), Map.Trigger_4);
	trigger5 = OnTriggerRegion(AABB(-656.875,-2192.875,-654.875,21.395,-1252.008,-454.288), Map.Trigger_5);
	trigger6 = OnTriggerRegion(AABB(2841.512,-2493.462,-654.875,3520.874,-2151.406,-243.513), Map.Trigger_HouseWithGold);
	trigger7 = OnTriggerRegion(AABB(-2856.874,-872.274,-598.875,-224.219,1664.875,-31.930), Map.Trigger_7);

	MapRoutes =
	{
		CHECKPOINT_flag =
		{
			ROUTE_Allied_FirstSpawn =
			{
				ROUTE_Allied_SpawnDoor =
				{
					ROUTE_Allied_FirstTunnel_Entrance =
					{
						Weight = 2,
						ROUTE_Allied_FirstTunnel_Left =
						{
							Weight = 2,
							ROUTE_Allied_OldCityStairs =
							{
								Weight = 2,
								ROUTE_Allied_OldCityLadder =
								{
									Weight = 2,
								},
							},
							ROUTE_Allied_OldCitySquare1 =
							{
								ROUTE_OldCitySpawn1 =
								{

								},
							},
						},
						ROUTE_Allied_FirstTunnel_Right =
						{
							ROUTE_OldCityHouse =
							{
								ROUTE_OldCityHouseWindow =
								{

								},
							},
							ROUTE_Allied_OldCitySquare2 =
							{
								Weight = 2,
								ROUTE_OldCitySpawn1 =
								{

								},
							},
						},
					},
					ROUTE_Allied_RightWay1 =
					{
						ROUTE_Allied_RightWay2 =
						{
							ROUTE_Allied_RightWay3 =
							{
								ROUTE_Allied_RightWayWindow =
								{
									ROUTE_Allied_OldCitySquare2 =
									{
										ROUTE_OldCitySpawn1 =
										{

										},
									},
								},
							},
						},
					},
				},
			},
			ROUTE_Axis_SecondSpawn =
			{
				ROUTE_Axis_VillageLadder =
				{
					ROUTE_Axis_VillageUpstairsRoom =
					{

					},
				},
				ROUTE_Wall_1 =
				{
					ROUTE_Wall_2 =
					{
						ROUTE_Wall_3 =
						{
							ROUTE_Wall_4 =
							{
								ROUTE_Wall_5 =
								{
									ROUTE_Wall_6 =
									{
										ROUTE_Wall_7 =
										{
											ROUTE_Axis_VillageDoor =
											{

											},
										},
									},
								},
							},
						},
					},
				},
			},
		},
		ATTACK_Allies_Start_1 =
		{
			ROUTE_Allied_FirstSpawn =
			{
				ROUTE_Allied_SpawnDoor =
				{
					ROUTE_Allied_RightWay1 =
					{
						ROUTE_Allied_RightWay2 =
						{
							ROUTE_Allied_RightWay3 =
							{
								ROUTE_Allied_RightWayWindow1 =
								{

								},
							},
						},
					},
					ROUTE_Allied_FirstTunnel_Entrance =
					{
						ROUTE_Allied_FirstTunnel_Left =
						{
							ROUTE_Allied_OldCitySquare1 =
							{

							},
						},
						ROUTE_Allied_FirstTunnel_Right =
						{

						},
					},
				},
			},
		},
		PLANT_village_Gate =
		{
			ROUTE_Allied_FirstSpawn =
			{
				ROUTE_Allied_SpawnDoor =
				{
					ROUTE_Allied_RightWay1 =
					{
						ROUTE_Allied_RightWay2 =
						{
							ROUTE_Allied_RightWay3 =
							{
								ROUTE_Allied_RightWayWindow1 =
								{

								},
							},
						},
					},
					ROUTE_Allied_FirstTunnel_Entrance =
					{
						ROUTE_Allied_FirstTunnel_Right =
						{

						},
					},
				},
			},
		},
		PLANT_Barricade =
		{
			ROUTE_Allied_TownSpawn_1 =
			{
				ROUTE_Allied_VillageGate_1 =
				{
					ROUTE_BackWay_1 =
					{
						Weight = 3,
						ROUTE_BackWay_2 =
						{
							ROUTE_BackWay_3 =
							{

							},
						},
					},
					ROUTE_FrontWay_1 =
					{
						ROUTE_FrontWay_2 =
						{
							ROUTE_FrontWay_3 =
							{

							},
						},
					},
				},
			},
			ROUTE_Allied_CP_1 =
			{
				ROUTE_FrontCPWay_1 =
				{
					Weight = 3,
					ROUTE_FrontCPWay_2 =
					{
						ROUTE_Wall =
						{
							ROUTE_FrontWay_2 =
							{
								ROUTE_FrontWay_3 =
								{

								},
							},
						},
					},
				},
				ROUTE_BackCPWay_1 =
				{
					ROUTE_SquareWayBarricade_1 =
					{
						ROUTE_SquareWayBarricade_2 =
						{

						},
					},
				},
			},
		},
		DEFEND_Axis_villageCenter_6 =
		{
			ROUTE_Axis_SecondSpawn =
			{
				ROUTE_SquareWayBarricade_1 =
				{
					ROUTE_BackCPWay_1 =
					{
						ROUTE_FrontCPWay_1 =
						{
							ROUTE_FrontCPWay_2 =
							{

							},
						},
					},
				},
			},
		},
		PLANT_Command_Post =
		{
			ROUTE_Axis_SecondSpawn =
			{
				ROUTE_SquareWayCP_1 =
				{
					Weight = 3,
					ROUTE_Wall =
					{
						ROUTE_FrontCPWay_2 =
						{
							ROUTE_FrontCPWay_1 =
							{

							},
						},
					},
				},
				ROUTE_SquareWayBarricade_1 =
				{
					ROUTE_BackCPWay_1 =
					{

					},
				},
			},
		},
		FLAG_gold =
		{
			ROUTE_Allied_TownSpawn_1 =
			{
				ROUTE_Allied_VillageGate_1 =
				{
					ROUTE_BackWayFlag_1 =
					{
						Weight = 3,
						ROUTE_BackWayFlag_2 =
						{
							ROUTE_BackWayFlag_3 =
							{
								ROUTE_SquareWayBarricade_3 =
								{
									ROUTE_TransmitterDoor =
									{

									},
								},
							},
						},
					},
					ROUTE_FrontWayFlag_1 =
					{
						ROUTE_FrontWayFlag_2 =
						{
							ROUTE_FrontWayFlag_3 =
							{
								ROUTE_SquareWayBarricade_3 =
								{
									ROUTE_TransmitterDoor =
									{

									},
								},
							},
						},
					},
				},
			},
			ROUTE_Allied_CP_1 =
			{
				ROUTE_FrontCPWayFlag_1 =
				{
					ROUTE_FrontCPWayFlag_2 =
					{
						ROUTE_Wall =
						{
							ROUTE_FrontWayFlag_2 =
							{
								ROUTE_FrontWayFlag_3 =
								{
									ROUTE_SquareWayBarricade_3 =
									{
										ROUTE_TransmitterDoor =
										{

										},
									},
								},
							},
						},
					},
				},
				ROUTE_BackCPWay_1 =
				{
					ROUTE_SquareWayCabinets =
					{
						ROUTE_SquareWayFlag_1 =
						{
							ROUTE_TransmitterDoor =
							{

							},
						},
					},
				},
			},
		},
		CAPPOINT_Truck =
		{
			ROUTE_Gold_1 =
			{
				ROUTE_TransmitterDoor =
				{
					ROUTE_SquareWayBarricade_3 =
					{
						Weight = 3,
						ROUTE_BackWayFlag_3 =
						{
							ROUTE_BackWayFlag_2 =
							{
								ROUTE_BackWayFlag_1 =
								{
									ROUTE_CappointBackStairs_1 =
									{
										ROUTE_CappointBackStairs_2 =
										{

										},
									},
								},
							},
						},
					},
					ROUTE_SquareWayFlag_1 =
					{
						ROUTE_SquareWayCP_1 =
						{
							ROUTE_FrontWayFlag_1 =
							{
								ROUTE_CappointFrontStairs_1 =
								{

								},
								ROUTE_Allied_VillageGate_1 =
								{
									ROUTE_Axis_VillageDoor =
									{

									},
								},
							},
						},
					},
				},
				ROUTE_Balcony =
				{
					ROUTE_SquareWayBarricade_3 =
					{
						Weight = 3,
						ROUTE_BackWayFlag_3 =
						{
							ROUTE_BackWayFlag_2 =
							{
								ROUTE_BackWayFlag_1 =
								{
									ROUTE_CappointBackStairs_1 =
									{
										ROUTE_CappointBackStairs_2 =
										{

										},
									},
								},
							},
						},
					},
					ROUTE_SquareWayFlag_1 =
					{
						ROUTE_SquareWayCP_1 =
						{
							ROUTE_FrontWayFlag_1 =
							{
								ROUTE_CappointFrontStairs_1 =
								{

								},
								ROUTE_Allied_VillageGate_1 =
								{
									ROUTE_Axis_VillageDoor =
									{

									},
								},
							},
						},
					},
				},
			},
			ROUTE_Gold_2 =
			{
				ROUTE_TransmitterDoor =
				{
					ROUTE_SquareWayBarricade_3 =
					{
						Weight = 3,
						ROUTE_BackWayFlag_3 =
						{
							ROUTE_BackWayFlag_2 =
							{
								ROUTE_BackWayFlag_1 =
								{
									ROUTE_CappointBackStairs_1 =
									{
										ROUTE_CappointBackStairs_2 =
										{

										},
									},
								},
							},
						},
					},
					ROUTE_SquareWayFlag_1 =
					{
						ROUTE_SquareWayCP_1 =
						{
							ROUTE_FrontWayFlag_1 =
							{
								ROUTE_CappointFrontStairs_1 =
								{

								},
								ROUTE_Allied_VillageGate_1 =
								{
									ROUTE_Axis_VillageDoor =
									{

									},
								},
							},
						},
					},
				},
				ROUTE_Balcony =
				{
					ROUTE_SquareWayBarricade_3 =
					{
						Weight = 3,
						ROUTE_BackWayFlag_3 =
						{
							ROUTE_BackWayFlag_2 =
							{
								ROUTE_BackWayFlag_1 =
								{
									ROUTE_CappointBackStairs_1 =
									{
										ROUTE_CappointBackStairs_2 =
										{

										},
									},
								},
							},
						},
					},
					ROUTE_SquareWayFlag_1 =
					{
						ROUTE_SquareWayCP_1 =
						{
							ROUTE_FrontWayFlag_1 =
							{
								ROUTE_CappointFrontStairs_1 =
								{

								},
								ROUTE_Allied_VillageGate_1 =
								{
									ROUTE_Axis_VillageDoor =
									{

									},
								},
							},
						},
					},
				},
			},
			ROUTE_Gold_3 =
			{
				ROUTE_TransmitterDoor =
				{
					ROUTE_SquareWayBarricade_3 =
					{
						Weight = 3,
						ROUTE_BackWayFlag_3 =
						{
							ROUTE_BackWayFlag_2 =
							{
								ROUTE_BackWayFlag_1 =
								{
									ROUTE_CappointBackStairs_1 =
									{
										ROUTE_CappointBackStairs_2 =
										{

										},
									},
								},
							},
						},
					},
					ROUTE_SquareWayFlag_1 =
					{
						ROUTE_SquareWayCP_1 =
						{
							ROUTE_FrontWayFlag_1 =
							{
								ROUTE_CappointFrontStairs_1 =
								{

								},
								ROUTE_Allied_VillageGate_1 =
								{
									ROUTE_Axis_VillageDoor =
									{

									},
								},
							},
						},
					},
				},
				ROUTE_Balcony =
				{
					ROUTE_SquareWayBarricade_3 =
					{
						Weight = 3,
						ROUTE_BackWayFlag_3 =
						{
							ROUTE_BackWayFlag_2 =
							{
								ROUTE_BackWayFlag_1 =
								{
									ROUTE_CappointBackStairs_1 =
									{
										ROUTE_CappointBackStairs_2 =
										{

										},
									},
								},
							},
						},
					},
					ROUTE_SquareWayFlag_1 =
					{
						ROUTE_SquareWayCP_1 =
						{
							ROUTE_FrontWayFlag_1 =
							{
								ROUTE_CappointFrontStairs_1 =
								{

								},
								ROUTE_Allied_VillageGate_1 =
								{
									ROUTE_Axis_VillageDoor =
									{

									},
								},
							},
						},
					},
				},
			},
			ROUTE_Gold_4 =
			{
				ROUTE_TransmitterDoor =
				{
					ROUTE_SquareWayBarricade_3 =
					{
						Weight = 3,
						ROUTE_BackWayFlag_3 =
						{
							ROUTE_BackWayFlag_2 =
							{
								ROUTE_BackWayFlag_1 =
								{
									ROUTE_CappointBackStairs_1 =
									{
										ROUTE_CappointBackStairs_2 =
										{

										},
									},
								},
							},
						},
					},
					ROUTE_SquareWayFlag_1 =
					{
						ROUTE_SquareWayCP_1 =
						{
							ROUTE_FrontWayFlag_1 =
							{
								ROUTE_CappointFrontStairs_1 =
								{

								},
								ROUTE_Allied_VillageGate_1 =
								{
									ROUTE_Axis_VillageDoor =
									{

									},
								},
							},
						},
					},
				},
				ROUTE_Balcony =
				{
					ROUTE_SquareWayBarricade_3 =
					{
						Weight = 3,
						ROUTE_BackWayFlag_3 =
						{
							ROUTE_BackWayFlag_2 =
							{
								ROUTE_BackWayFlag_1 =
								{
									ROUTE_CappointBackStairs_1 =
									{
										ROUTE_CappointBackStairs_2 =
										{

										},
									},
								},
							},
						},
					},
					ROUTE_SquareWayFlag_1 =
					{
						ROUTE_SquareWayCP_1 =
						{
							ROUTE_FrontWayFlag_1 =
							{
								ROUTE_CappointFrontStairs_1 =
								{

								},
								ROUTE_Allied_VillageGate_1 =
								{
									ROUTE_Axis_VillageDoor =
									{

									},
								},
							},
						},
					},
				},
			},
		},
	};

	MapRoutes.ATTACK_Allies_Start_2 = MapRoutes.ATTACK_Allies_Start_1;
	MapRoutes.ATTACK_Allies_Start_3 = MapRoutes.ATTACK_Allies_Start_1;
	MapRoutes.ATTACK_Allies_Start_4 = MapRoutes.ATTACK_Allies_Start_1;
	MapRoutes.ATTACK_Allies_Start_5 = MapRoutes.ATTACK_Allies_Start_1;
	MapRoutes.ATTACK_Allies_Start_6 = MapRoutes.ATTACK_Allies_Start_1;
	MapRoutes.ATTACK_Allies_Start_7 = MapRoutes.ATTACK_Allies_Start_1;
	MapRoutes.DEFEND_Axis_Start_16 = MapRoutes.CHECKPOINT_flag;
	MapRoutes.DEFEND_Axis_Start_17 = MapRoutes.CHECKPOINT_flag;
	MapRoutes.DEFEND_Axis_Start_18 = MapRoutes.CHECKPOINT_flag;
	MapRoutes.DEFEND_Axis_Start_19 = MapRoutes.CHECKPOINT_flag;
	MapRoutes.DEFEND_Axis_Start_20 = MapRoutes.CHECKPOINT_flag;
	MapRoutes.DEFEND_Axis_Start_21 = MapRoutes.CHECKPOINT_flag;
	MapRoutes.DEFEND_Axis_Start_22 = MapRoutes.CHECKPOINT_flag;
	MapRoutes.DEFEND_Axis_Start_23 = MapRoutes.CHECKPOINT_flag;
	MapRoutes.DEFEND_Axis_Start_24 = MapRoutes.CHECKPOINT_flag;
	MapRoutes.DEFEND_Axis_Start_25 = MapRoutes.CHECKPOINT_flag;
	MapRoutes.DEFEND_Axis_Start_26 = MapRoutes.CHECKPOINT_flag;
	MapRoutes.DEFEND_Axis_Start_27 = MapRoutes.CHECKPOINT_flag;
	MapRoutes.DEFEND_Axis_Start_28 = MapRoutes.CHECKPOINT_flag;

	MapRoutes.CALLARTILLERY_Axis_villageCenter_7 = MapRoutes.DEFEND_Axis_villageCenter_6;

	MapRoutes.ATTACK_Allied_AtGold_1 = MapRoutes.FLAG_gold;
	MapRoutes.ATTACK_Allied_AtGold_2 = MapRoutes.FLAG_gold;
	MapRoutes.ATTACK_Allied_AtGold_3 = MapRoutes.FLAG_gold;
	MapRoutes.ATTACK_Allied_AtGold_4 = MapRoutes.FLAG_gold;

	MapRoutes.ATTACK_Allied_NearGold_1 = MapRoutes.FLAG_gold;
	MapRoutes.ATTACK_Allied_NearGold_2 = MapRoutes.FLAG_gold;
	MapRoutes.ATTACK_Allied_NearGold_3 = MapRoutes.FLAG_gold;
	MapRoutes.ATTACK_Allied_NearGold_4 = MapRoutes.FLAG_gold;
	MapRoutes.ATTACK_Allied_NearGold_5 = MapRoutes.FLAG_gold;
	MapRoutes.ATTACK_Allied_NearGold_6 = MapRoutes.FLAG_gold;
	MapRoutes.ATTACK_Allied_NearGold_7 = MapRoutes.FLAG_gold;

	MapRoutes.PLANT_door = MapRoutes.FLAG_gold;

	MapRoutes.DEFEND_Axis_AtTruck_1 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Axis_AtTruck_2 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Axis_AtTruck_3 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Axis_AtTruck_4 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Axis_AtTruck_5 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Axis_AtTruck_6 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Axis_AtTruck_7 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Axis_AtTruck_8 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Axis_AtTruck_9 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Axis_AtTruck_10 = MapRoutes.CAPPOINT_Truck;

	MapRoutes.DEFEND_Allied_AtTruck_1 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Allied_AtTruck_2 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Allied_AtTruck_3 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Allied_AtTruck_4 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Allied_AtTruck_5 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Allied_AtTruck_6 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Allied_AtTruck_7 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Allied_AtTruck_8 = MapRoutes.CAPPOINT_Truck;
	MapRoutes.DEFEND_Allied_AtTruck_9 = MapRoutes.CAPPOINT_Truck;

	Util.Routes(MapRoutes);

	SetAvailableMapGoals( TEAM.ALLIES, false, {
		"ROUTE_Allied_VillageGate_1",
		"ROUTE_FrontCPWay_1",
		"ROUTE_FrontCPWay_2",
		"ROUTE_Wall",
		"ROUTE_FrontCPWayFlag_1",
		"ROUTE_FrontCPWayFlag_2",
	});

	Util.MapDebugPrint( "^5Omni-bot map script for " + GetMapName() + " executed." );
};

global OnBotJoin = function( bot )
{

	if ( Map.village_gate == 1 )
	{
		//Util.ChangeSpawn( TEAM.ALLIES, 2 );
		Util.ChangeSpawn( TEAM.AXIS, 1 );
	}
	else
	{
		//Util.ChangeSpawn( TEAM.ALLIES, 1 );
		Util.ChangeSpawn( TEAM.AXIS, 3 );
	}

	foreach ( id and bot in BotTable )
	{
		if ( bot.GetTeam()  == TEAM.AXIS )
		{
			WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, WEAPON.MOBILE_MG42, true );
		}
	}
};
