//==========================================================================================
//
//	lighthouse2.gm
//
//	Who		    When			What
//------------------------------------------------------------------------------------------
//  previous version made by crapshoot (probably)
//	Qiki	    18.9.2023		Initial Script, waypoints, navigation
//	native12	29.02.2024		Script
//	Qiki	    28.03.2024		navigates
//	Qiki	    01.04.2024		stuckages
//	native12	01.04.2024		Released
//
//==========================================================================================
//
//	Keep your omni-bot scripts up to date!
//	Bugs and suggestions: PM on https://fearless-assassins.com/

global Map =
{
	Debug = 0,
	Allied_CP = false,
	Axis_CP = false,
	South_Ropes = false,
	Tower_Climbing_Ropes = false,
	West_Ropes = false,
	Anti_Ship_Gun = true,
	Comms_Bunker = true,
	Compound_Gate = true,
	Compound_Wall = true,
	Light = true,
	Main_Entrance = true,
	Forward_Bunker_Allied = true,
	count_axis_ins = {},
	count_axis_beh = {},
	West_Ropes_Left_Player_Count = 0,
	West_Ropes_Right_Player_Count = 0,
	South_Ropes_Left_Player_Count = 0,
	South_Ropes_Right_Player_Count = 0,
	West_Ropes_botId_1 = -1,
	West_Ropes_botId_2 = -1,
	South_Ropes_botId_1 = -1,
	South_Ropes_botId_2 = -1,
	Lighthouse_Door_Open = false,
	Mast_Ladder_In_Use = 0,
	Mast_Ladder_botId = -1,

	DontDispenseAmmo = true,

	Roles =
	{
		AXIS =
		{
			AllBots = true, // each bot is considered for a role
			ATTACKER =
			{
				numbots = 5,
				crucialClass = {CLASS.ENGINEER, CLASS.COVERTOPS},
			},
			ATTACKER1 =
			{
				numbots = 5,
				crucialClass = CLASS.ENGINEER,
			},
			ATTACKER2 =
			{
				numbots = 5,
				crucialClass = CLASS.ENGINEER,
			},
			ATTACKER3 =
			{
				numbots = 5,
				crucialClass = {CLASS.ENGINEER, CLASS.COVERTOPS},
			},
		},

		ALLIES =
		{
			AllBots = true, // each bot is considered for a role
			DEFENDER =
			{
				spawnpt = 3,
				numbots = 5,
				crucialClass = {CLASS.ENGINEER, CLASS.COVERTOPS},
			},
			DEFENDER1 =
			{
				spawnpt = 3,
				numbots = 5,
				crucialClass = CLASS.ENGINEER,
			},
			DEFENDER2 =
			{
				spawnpt = 1,
				numbots = 5,
				crucialClass = {CLASS.ENGINEER, CLASS.COVERTOPS},
			},
			DEFENDER3 =
			{
				spawnpt = 1,
				numbots = 5,
				crucialClass = CLASS.ENGINEER,
			},
		},
	},

	Navigation =
	{
		//  /bot waypoint_setproperty paththrough Navigation_PT:wrong_position_0
		wrong_position_0 =
		{
			navigate = function(_this)
			{
				if ( _this.Bot.GetPosition().z < 1200 )
				{
					_this.Goto(_this.Bot.GetPosition());
					Util.MapDebugPrint( "wrong_position_0" );
				}
				else
				{
					Util.MapDebugPrint( "good_position_0" );
				}
			},
		},

		//  /bot waypoint_setproperty paththrough Navigation_PT:wrong_position_1
		wrong_position_1 =
		{
			navigate = function(_this)
			{
				if ( _this.Bot.GetPosition().z < 1450 )
				{
					_this.Goto(_this.Bot.GetPosition());
					Util.MapDebugPrint( "wrong_position_1" );
				}
				else
				{
					Util.MapDebugPrint( "good_position_1" );
				}
			},
		},

		//  /bot waypoint_setproperty paththrough Navigation_PT:wrong_position_2
		wrong_position_2 =
		{
			navigate = function(_this)
			{
				if ( _this.Bot.GetPosition().z < 1650 )
				{
					_this.Goto(_this.Bot.GetPosition());
					Util.MapDebugPrint( "wrong_position_2" );
				}
				else
				{
					Util.MapDebugPrint( "good_position_2" );
				}
			},
		},

		//  /bot waypoint_setproperty paththrough Navigation_PT:jump
		jump =
		{
			navigate = function(_this)
			{
				_this.Bot.HoldButton(BTN.JUMP, 0.55);
				sleep(0.55);
			},
		},

		//  /bot waypoint_setproperty paththrough Navigation_PT:jump_wait
		jump_wait =
		{
			navigate = function(_this)
			{
				sleep(0.25);
				_this.Bot.HoldButton(BTN.JUMP, 0.55);
				sleep(0.55);
			},
		},

		//  /bot waypoint_setproperty paththrough Navigation_PT:compound_wall_jump
		compound_wall_jump =
		{
			navigate = function(_this)
			{
				Util.MapDebugPrint( "" + GetModName() );

				if ( GetModName() == "Jaymod" or GetModName() == "silEnT" )
				{
					_this.Goto(_this.Bot.GetPosition());
					_this.AddAimRequest(Priority.VeryHigh, "facing", Vec3( 0.939, 0.028, -0.344 ));
					while ( !_this.Bot.MoveTowards(Vec3(-130.536, -686.843, 1084.125), 5) )
					{
						yield();
					}
					_this.Goto(_this.Bot.GetPosition());
					sleep(1);
					_this.Bot.PressButton(BTN.JUMP);
					sleep(0.15);
					_this.Bot.HoldButton(BTN.FORWARD, 3);
					_this.Bot.HoldButton(BTN.SPRINT, 0.1);
					sleep(0.6);
					_this.Bot.HoldButton(BTN.JUMP, 1);
					_this.Bot.HoldButton(BTN.SPRINT, 1.5);
					sleep(1.5);
				}
				else if ( GetModName() == "noquarter" or GetModName() == "etpub" )
				{
					_this.Goto(_this.Bot.GetPosition());
					_this.AddAimRequest(Priority.VeryHigh, "facing", Vec3( 0.952, 0.015, -0.297 ));
					while ( !_this.Bot.MoveTowards(Vec3(-130.536, -686.843, 1084.125), 5) )
					{
						yield();
					}
					_this.Goto(_this.Bot.GetPosition());
					sleep(1);
					_this.Bot.PressButton(BTN.JUMP);
					sleep(0.15);
					_this.Bot.HoldButton(BTN.FORWARD, 3);
					sleep(0.6);
					_this.Bot.HoldButton(BTN.JUMP, 1);
					_this.Bot.HoldButton(BTN.SPRINT, 1.5);
					sleep(1.5);
				}
				else
				{
					_this.Goto(_this.Bot.GetPosition());
					_this.AddAimRequest(Priority.VeryHigh, "facing", Vec3( 0.939, 0.028, -0.344 ));
					while ( !_this.Bot.MoveTowards(Vec3(-130.536, -686.843, 1084.125), 5) )
					{
						yield();
					}
					_this.Goto(_this.Bot.GetPosition());
					sleep(1);
					_this.Bot.PressButton(BTN.JUMP);
					sleep(0.15);
					_this.Bot.HoldButton(BTN.FORWARD, 3);
					_this.Bot.HoldButton(BTN.SPRINT, 3);
					sleep(0.6);
					_this.Bot.HoldButton(BTN.JUMP, 1);
					sleep(1.5);
				}
			},
		},

		//  /bot waypoint_setproperty paththrough Navigation_PT:west_ropes_wait
		west_ropes_wait =
		{
			OnExit = function(_this)
			{
				if ( Map.West_Ropes_botId_1 == _this.Bot.GetGameId() )
				{
					sleep(1.5);
					Map.West_Ropes_botId_1 = -1;
				}

				if ( Map.West_Ropes_botId_2 == _this.Bot.GetGameId() )
				{
					sleep(1.5);
					Map.West_Ropes_botId_2 = -1;
				}
			},
			navigate = function(_this)
			{
				_this.Goto(_this.Bot.GetPosition());

				if ( Map.West_Ropes_botId_1 == -1 )
				{
					Map.West_Ropes_botId_1 = _this.Bot.GetGameId();
					_this.v = Vector3( -2334.632, 93.499, 241.749 );    //left
				}
				else if ( Map.West_Ropes_botId_2 == -1 )
				{
					Map.West_Ropes_botId_2 = _this.Bot.GetGameId();
					_this.v = Vector3( -2331.721, 29.125, 260.077 );    //right
				}
				else
				{
					return;
				}

				while ( Map.West_Ropes_Left_Player_Count != 0 and Map.West_Ropes_Right_Player_Count != 0 )
				{
					yield();
				}

				_this.timer = 0;

				if ( Map.West_Ropes_Left_Player_Count == 0 and Map.West_Ropes_botId_1 == _this.Bot.GetGameId() )
				{
					while ( !_this.Bot.MoveTowards(_this.v, 25) )
					{
						sleep(0.1);
						_this.timer += 1;

						if ( _this.timer == 50 )
						{
							while ( !_this.Bot.MoveTowards(Vec3(-2354.569, 220.195, 233.408), 35) )
							{
								yield();
							}
							break;
						}
					}
				}

				if ( Map.West_Ropes_Right_Player_Count == 0 and Map.West_Ropes_botId_2 == _this.Bot.GetGameId() )
				{
					while ( !_this.Bot.MoveTowards(_this.v, 25) )
					{
						sleep(0.1);
						_this.timer += 1;

						if ( _this.timer == 50 )
						{
							while ( !_this.Bot.MoveTowards(Vec3(-2351.910, -78.048, 243.096), 35) )
							{
								yield();
							}
							break;
						}
					}
				}
			},
		},

		//  /bot waypoint_setproperty paththrough Navigation_PT:mast_ladder_wait
		mast_ladder_wait =
		{
			EvalFunc = function(_this)
			{
				goal = _this.Bot.GetMapGoalName();
				if ( goal )
				{
					pos = Util.GetMapGoalPosition(goal);
					if ( pos )
					{
						return DistanceBetween(pos, Vec3(-484, 2154, 360)) > 200;
					}
				}
				return true;
			},
			OnExit = function(_this)
			{
				if ( Map.Mast_Ladder_botId == _this.Bot.GetGameId() )
				{
					Map.Mast_Ladder_botId = -1;
				}
			},
			navigate = function(_this)
			{
				_this.Goto(_this.Bot.GetPosition());

				while ( Map.Mast_Ladder_In_Use != 0 )
				{
					yield();
				}

				if ( Map.Mast_Ladder_botId == -1 )
				{
					Map.Mast_Ladder_botId = _this.Bot.GetGameId();
				}
				else
				{
					return;
				}

				_this.timer = 0;

				while ( !_this.Bot.MoveTowards(Vec3(-352.927, 85.596, 1054.125), 15) )
				{
					sleep(0.1);
					_this.timer += 1;
					_this.Bot.PressButton(BTN.WALK);

					if ( _this.timer == 50 )
					{
						_this.timer = 0;
						while ( !_this.Bot.MoveTowards(Vec3(-426.775, 68.187, 1048.159), 35) )
						{
							sleep(0.1);
							_this.timer += 1;
							if ( _this.timer == 50 )
							{
								_this.Bot.ExecCommand( "kill" );
							}
						}
						break;
					}
				}
			},
		},

		//  /bot waypoint_setproperty paththrough Navigation_PT:south_ropes_wait
		south_ropes_wait =
		{
			OnExit = function(_this)
			{
				if ( Map.South_Ropes_botId_1 == _this.Bot.GetGameId() )
				{
					Map.South_Ropes_botId_1 = -1;
				}
				if ( Map.South_Ropes_botId_2 == _this.Bot.GetGameId() )
				{
					Map.South_Ropes_botId_2 = -1;
				}
			},
			navigate = function(_this)
			{
				_this.Goto(_this.Bot.GetPosition());

				if ( Map.South_Ropes_botId_1 == -1 )
				{
					Map.South_Ropes_botId_1 = _this.Bot.GetGameId();
					_this.v = Vector3( -607.503, -1355.218, 248.132 );    //left
				}
				else if ( Map.South_Ropes_botId_2 == -1 )
				{
					Map.South_Ropes_botId_2 = _this.Bot.GetGameId();
					_this.v = Vector3( -363.227, -1547.562, 160.244 );    //right
				}
				else
				{
					return;
				}

				while ( Map.South_Ropes_Left_Player_Count != 0 and Map.South_Ropes_Right_Player_Count != 0 )
				{
					yield();
				}

				_this.timer = 0;

				if ( Map.South_Ropes_Left_Player_Count == 0 and Map.South_Ropes_botId_1 == _this.Bot.GetGameId() )
				{
					while ( !_this.Bot.MoveTowards(_this.v, 15) )
					{
						sleep(0.1);

						if ( Map.South_Ropes_Left_Player_Count > 0 )
						{
							_this.Goto(_this.Bot.GetPosition());
							while ( Map.South_Ropes_Left_Player_Count != 0 )
							{
								yield();
							}
						}

						_this.timer += 1;

						if ( _this.timer == 100 )
						{
							while ( !_this.Bot.MoveTowards(Vec3(-567.541, -1358.454, 245.576), 35) )
							{
								yield();
							}
							break;
						}
					}
				}

				if ( Map.South_Ropes_Right_Player_Count == 0 and Map.South_Ropes_botId_2 == _this.Bot.GetGameId() )
				{
					while ( !_this.Bot.MoveTowards(_this.v, 15) )
					{
						sleep(0.1);

						if ( Map.South_Ropes_Right_Player_Count > 0 )
						{
							_this.Goto(_this.Bot.GetPosition());
							while ( Map.South_Ropes_Right_Player_Count != 0 )
							{
								yield();
							}
						}

						_this.timer += 1;

						if ( _this.timer == 100 )
						{
							while ( !_this.Bot.MoveTowards(Vec3(-354.227, -1814.292, 125.160), 35) )
							{
								yield();
							}
							break;
						}
					}
				}
			},
		},


		//  /bot waypoint_setproperty paththrough Navigation_PT:west_ropes_1
		west_ropes_1 =
		{
			navigate = function(_this)
			{
				_this.Goto(_this.Bot.GetPosition());
				_this.AddAimRequest(Priority.VeryHigh, "position", Vec3( -1629, 96, 1200 ));
				sleep(0.75);
				_this.timer = 0;
				while ( _this.Bot.GetPosition().z < 1040 )
				{
					if ( !Map.West_Ropes )
					{
						return;
					}

					_this.Bot.MoveTowards(Vec3( -1629, 96, 1044 ));
					sleep(0.1);
					_this.timer += 1;

					if ( _this.timer == 120 )
					{
						_this.timer = 0;
						_this.ReleaseAimRequest();
						_this.Bot.MoveTowards(Vec3( -2365, 92, 228 ));
						_this.AddAimRequest(Priority.VeryHigh, "position", Vec3( -2365, 92, 228 ));
						while ( _this.Bot.GetPosition().z > 240 )
						{
							_this.timer += 1;
							_this.Bot.HoldButton(BTN.WALK, 0.1);
							if ( _this.timer == 120 )
							{
								_this.timer = 0;
								_this.Bot.ExecCommand( "kill" );
							}
							sleep(0.1);
						}
						break;
					}
				}
			},
		},

		//  /bot waypoint_setproperty paththrough Navigation_PT:west_ropes_2
		west_ropes_2 =
		{
			navigate = function(_this)
			{
				_this.Goto(_this.Bot.GetPosition());
				_this.AddAimRequest(Priority.VeryHigh, "position", Vec3( -1629.555, 27.044, 1150 ));
				sleep(0.75);
				_this.timer = 0;
				while ( _this.Bot.GetPosition().z < 1040 )
				{
					if ( !Map.West_Ropes )
					{
						return;
					}

					_this.Bot.MoveTowards(Vec3( -1630, 27, 1044 ));
					sleep(0.1);
					_this.timer += 1;
					if ( _this.timer == 120 )
					{
						_this.timer = 0;
						_this.ReleaseAimRequest();
						_this.Bot.MoveTowards(Vec3( -2443, -36, 197 ));
						_this.AddAimRequest(Priority.VeryHigh, "position", Vec3( -2443, -36, 197 ));
						while ( _this.Bot.GetPosition().z > 240 )
						{
							_this.timer += 1;
							_this.Bot.HoldButton(BTN.WALK, 0.1);
							if ( _this.timer == 120 )
							{
								_this.timer = 0;
								_this.Bot.ExecCommand( "kill" );
							}
							sleep(0.1);
						}
						break;
					}
				}
			},
		},

		//  /bot waypoint_setproperty paththrough Navigation_PT:south_ropes_1
		south_ropes_1 =
		{
			navigate = function(_this)
			{
				_this.Goto(_this.Bot.GetPosition());
				_this.AddAimRequest(Priority.VeryHigh, "position", Vec3( -518.668, -835.924, 987.464 ));
				sleep(0.75);
				_this.timer = 0;
				while ( _this.Bot.GetPosition().z < 975 )
				{
					if ( !Map.South_Ropes )
					{
						return;
					}

					_this.Bot.MoveTowards(Vec3( -518.668, -835.924, 987.464 ));

					if ( _this.Bot.GetPosition().x < -514 )
					{
						_this.Bot.HoldButton(BTN.STRAFE_R, 0.1);
					}

					sleep(0.1);
					_this.timer += 1;
					if ( _this.timer == 120 )
					{
						_this.timer = 0;
						_this.ReleaseAimRequest();
						_this.Bot.MoveTowards(Vec3( -584.822, -1397.072, 221.741 ));
						_this.AddAimRequest(Priority.VeryHigh, "position", Vec3( -584.822, -1397.072, 221.741 ));
						while ( _this.Bot.GetPosition().z > 240 )
						{
							_this.Bot.HoldButton(BTN.WALK, 0.2);
							sleep(0.2);
						}
						break;
					}
				}
			},
		},

		//  /bot waypoint_setproperty paththrough Navigation_PT:south_ropes_2
		south_ropes_2 =
		{
			navigate = function(_this)
			{
				_this.Goto(_this.Bot.GetPosition());
				_this.AddAimRequest(Priority.VeryHigh, "facing", Vec3( -0.036, 0.720, 0.693 ));
				sleep(1);

				_this.Bot.HoldButton(BTN.FORWARD, 1.5);
				_this.Bot.HoldButton(BTN.SPRINT, 1.5);
				sleep(0.4);
				_this.Bot.HoldButton(BTN.JUMP, 1.15);
				sleep(1.15);

				if ( _this.Bot.GetPosition().z > 305 )
				{
					_this.AddAimRequest(Priority.VeryHigh, "position", Vec3( -398.476, -828.539, 1050 ));
					while ( !_this.Bot.MoveTowards(Vec3(-398.476, -828.539, 1003.795), 35) )
					{
						if ( !Map.South_Ropes )
						{
							return;
						}

						if ( _this.Bot.GetPosition().x > -400 )
						{
							_this.Bot.PressButton(BTN.STRAFE_L);
						}
						yield();
					}
				}
				else
				{
					while ( !_this.Bot.MoveTowards(Vec3(-242.183, -1459.534, 173.727), 35) )
					{
						yield();
					}
				}

			},
		},
	},

	Allied_CP_Built = function( trigger )
	{
		Map.Allied_CP = true;

		Util.MapDebugPrint( "Allied_CP_Built" );

		SetAvailableMapGoals( 0, false, {
			"BUILD_Command_Post",
		});

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

	Allied_CP_Destroyed = function( trigger )
	{
		Map.Allied_CP = false;

		Util.MapDebugPrint( "Allied_CP_Destroyed" );

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

		SetAvailableMapGoals( 0, true, {
			"BUILD_Command_Post",
		});
	},

	CP_Planted = function( trigger )
	{
		Util.SetGoalRange( "DEFUSE_Command_Post.*", 850);

		SetGoalRole( "DEFUSE_Command_Post.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.AMBUSHER });

		if ( !Map.Main_Entrance )
		{
			if ( Map.Comms_Bunker or Map.Light )
			{
				SetGoalRole( "DEFUSE_Command_Post.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.ATTACKER, ROLE.ATTACKER1, ROLE.AMBUSHER });
			}
			else
			{
				SetGoalRole( "DEFUSE_Command_Post.*", { ROLE.ATTACKER, ROLE.ATTACKER1, ROLE.ATTACKER2, ROLE.ATTACKER3, ROLE.AMBUSHER,
														ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER2, ROLE.DEFENDER3 });
			}
		}
		else
		{
			if ( !Map.Comms_Bunker and !Map.Light )
			{
				SetGoalRole( "DEFUSE_Command_Post.*", { ROLE.ATTACKER2, ROLE.ATTACKER3, ROLE.AMBUSHER,
														ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER2, ROLE.DEFENDER3 });
			}
		}
	},

	CP_Defused = function( trigger )
	{
		if ( Map.Allied_CP )
		{
			Util.MapDebugPrint( "Allied_CP_Defused" );
		}
		else
		{
			Util.MapDebugPrint( "Axis_CP_Defused" );
		}
	},

	Axis_CP_Built = function( trigger )
	{
		Map.Axis_CP = true;

		Util.MapDebugPrint( "Axis_CP_Built" );

		SetAvailableMapGoals( 0, false, {
			"BUILD_Command_Post",
		});

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

	Axis_CP_Destroyed = function( trigger )
	{
		Map.Axis_CP = false;

		Util.MapDebugPrint( "Axis_CP_Destroyed" );

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

		SetAvailableMapGoals( 0, true, {
			"BUILD_Command_Post",
		});
	},

	South_Ropes_Built = function( trigger )
	{
		Map.South_Ropes = true;

		Wp.SetWaypointFlag( "South_Ropes_.*", "closed", false );
		DynamicPathsUpdated( TEAM.AXIS, TEAM.ALLIES );

		Util.MapDebugPrint( "South_Ropes_Built" );

		Util.EnableGoal( "ROUTE_SouthRopesWay_.*" );

		if ( Map.Compound_Wall )
		{
			SetGoalRole( "PLANT_compound_wall", ROLE.ATTACKER3 );
		}

		SetGoalRole( "CAMP_Axis_CompoundWall_0.*", ROLE.ATTACKER3 );

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

		if ( !Map.Compound_Wall )
		{
			ClearGoalRole( ".*_Axis_CommsBunker_.*", ROLE.ROAMER );
			ClearGoalRole( ".*_Axis_LightUp_.*", ROLE.ROAMER );

			SetGoalRole( "PLANT_compound_gate", { ROLE.ATTACKER2, ROLE.ATTACKER3 });

			if ( Map.Comms_Bunker and Map.Light )
			{
				SetGoalRole( ".*_Axis_CommsBunker_0.*", ROLE.ATTACKER2 );
				SetGoalRole( ".*_Axis_LightUp_0.*", ROLE.ATTACKER3 );
				SetGoalRole( "PLANT_comms_bunker", ROLE.ATTACKER2 );
				SetGoalRole( "PLANT_light", ROLE.ATTACKER3 );
				SetGoalRole( "BUILD_tower_climbing_ropes", ROLE.ATTACKER3 );
			}
			else
			{
				if ( !Map.Comms_Bunker and Map.Light )
				{
					SetGoalRole( ".*_Axis_LightUp_0.*", ROLE.ATTACKER3 );
					SetGoalRole( ".*_Axis_LightUp_1.*", ROLE.ATTACKER2 );
					SetGoalRole( "PLANT_light", { ROLE.ATTACKER2, ROLE.ATTACKER3 } );
					SetGoalRole( "BUILD_tower_climbing_ropes", { ROLE.ATTACKER2, ROLE.ATTACKER3 } );
				}
				else
				{
					if ( Map.Comms_Bunker and !Map.Light )
					{
						SetGoalRole( ".*_Axis_CommsBunker_0.*", ROLE.ATTACKER2 );
						SetGoalRole( ".*_Axis_CommsBunker_1.*", ROLE.ATTACKER3 );
						SetGoalRole( "PLANT_comms_bunker", { ROLE.ATTACKER2, ROLE.ATTACKER3 } );
					}
				}
			}
		}

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"CAMP_Axis_SouthRopes_.*",
			"BUILD_ropes",
		});
	},

	South_Ropes_Planted = function( trigger )
	{
		Util.MapDebugPrint( "South_Ropes_Planted" );

		Util.SetGoalRange( "DEFUSE_ropes.*", 350);
	},

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

	South_Ropes_Destroyed = function( trigger )
	{
		Map.South_Ropes = false;

		Wp.SetWaypointFlag( "South_Ropes_.*", "closed", true );
		DynamicPathsUpdated( TEAM.AXIS, TEAM.ALLIES );

		Util.MapDebugPrint( "South_Ropes_Destroyed" );

		Util.DisableGoal( "ROUTE_SouthRopesWay_.*" );

		if ( Map.Compound_Wall )
		{
			ClearGoalRole( "PLANT_compound_wall", ROLE.ATTACKER3 );
		}

		ClearGoalRole( "CAMP_Axis_CompoundWall_0.*", ROLE.ATTACKER3 );

		if ( !Map.West_Ropes and !Map.Compound_Wall )
		{
			ClearGoalRole( "PLANT_compound_gate", { ROLE.ATTACKER2, ROLE.ATTACKER3 });
			ClearGoalRole( "PLANT_comms_bunker", { ROLE.ATTACKER2, ROLE.ATTACKER3 } );
			ClearGoalRole( "PLANT_light", { ROLE.ATTACKER2, ROLE.ATTACKER3 } );
			ClearGoalRole( "BUILD_tower_climbing_ropes", { ROLE.ATTACKER2, ROLE.ATTACKER3 } );
			ClearGoalRole( "DEFUSE_tower_climbing_ropes.*", { ROLE.ATTACKER2, ROLE.ATTACKER3 }, true );
			ClearGoalRole( ".*_Axis_LightUp_0.*", ROLE.ATTACKER3 );
			ClearGoalRole( ".*_Axis_LightUp_1.*", ROLE.ATTACKER2 );
			ClearGoalRole( ".*_Axis_CommsBunker_0.*", ROLE.ATTACKER2 );
			ClearGoalRole( ".*_Axis_CommsBunker_1.*", ROLE.ATTACKER3 );

			SetGoalRole( ".*_Axis_CommsBunker_.*", ROLE.ROAMER );
			SetGoalRole( ".*_Axis_LightUp_.*", ROLE.ROAMER );
		}

		foreach( goal in Util.GoalTable("DEFUSE_ropes.*") )
		{
			goal.SetAvailable(TEAM.AXIS, false);
		}

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

		SetAvailableMapGoals( TEAM.AXIS, true, {
			"CAMP_Axis_SouthRopes_.*",
			"BUILD_ropes",
		});
	},

	Tower_Climbing_Ropes_Built = function( trigger )
	{
		Map.Tower_Climbing_Ropes = true;

		Wp.SetWaypointFlag( "Tower_Climbing_Ropes_3", "closed", false );
		Wp.SetWaypointFlag( "Tower_Climbing_Ropes_4", "closed", false );
		Wp.SetWaypointFlag( "Tower_Climbing_Ropes_5", "closed", false );
		DynamicPathsUpdated( TEAM.AXIS, TEAM.ALLIES );

		Util.MapDebugPrint( "Tower_Climbing_Ropes_Built" );

		Util.EnableGoal( "ROUTE_ClimbingRopesWay_.*" );

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"BUILD_tower_climbing_ropes",
		});

		if ( Map.Light and tableCount(Util.GoalTable("DEFUSE_light.*")) == 0 )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"PLANT_tower_climbing_ropes",
			});
		}
	},

	Tower_Climbing_Ropes_Planted = function( trigger )
	{
		Util.MapDebugPrint( "Tower_Climbing_Ropes_Planted" );

		SetGoalRole( "DEFUSE_tower_climbing_ropes.*", ROLE.ROAMER, true );

		if ( Map.Anti_Ship_Gun or Map.Compound_Gate )
		{
			if (( Map.South_Ropes or Map.West_Ropes ) and !Map.Compound_Wall )
			{
				if ( Map.Comms_Bunker and Map.Light )
				{
					SetGoalRole( "DEFUSE_tower_climbing_ropes.*", { ROLE.ATTACKER3, ROLE.SNIPER, ROLE.ROAMER });
				}

				if ( !Map.Comms_Bunker and Map.Light )
				{
					SetGoalRole( "DEFUSE_tower_climbing_ropes.*", { ROLE.ATTACKER2, ROLE.ATTACKER3, ROLE.SNIPER, ROLE.ROAMER });
				}
			}
		}
		else
		{
			if (( Map.South_Ropes or Map.West_Ropes ) and !Map.Compound_Wall )
			{
				if ( Map.Comms_Bunker and Map.Light )
				{
					SetGoalRole( "DEFUSE_tower_climbing_ropes.*", { ROLE.ATTACKER, ROLE.ATTACKER1,
																	ROLE.ATTACKER3, ROLE.SNIPER, ROLE.ROAMER });
				}

				if ( !Map.Comms_Bunker and Map.Light )
				{
					SetGoalRole( "DEFUSE_tower_climbing_ropes.*", { ROLE.ATTACKER, ROLE.ATTACKER1, ROLE.ATTACKER2,
																	ROLE.ATTACKER3, ROLE.SNIPER, ROLE.ROAMER });
				}
			}
			else
			{
				SetGoalRole( "DEFUSE_tower_climbing_ropes.*", { ROLE.ATTACKER, ROLE.ATTACKER1, ROLE.ROAMER });
			}
		}
	},

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

	Tower_Climbing_Ropes_Destroyed = function( trigger )
	{
		Map.Tower_Climbing_Ropes = false;

		Wp.SetWaypointFlag( "Tower_Climbing_Ropes_3", "closed", true );
		Wp.SetWaypointFlag( "Tower_Climbing_Ropes_4", "closed", true );
		Wp.SetWaypointFlag( "Tower_Climbing_Ropes_5", "closed", true );
		DynamicPathsUpdated( TEAM.AXIS, TEAM.ALLIES );

		Util.MapDebugPrint( "Tower_Climbing_Ropes_Destroyed" );

		Util.DisableGoal( "ROUTE_ClimbingRopesWay_.*" );

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

		if ( Map.Light )
		{
			SetAvailableMapGoals( TEAM.AXIS, true, {
				"BUILD_tower_climbing_ropes",
			});
		}

		foreach( goal in Util.GoalTable("DEFUSE_tower_climbing_ropes.*") )
		{
			goal.SetAvailable(TEAM.AXIS, false);
		}
	},

	West_Ropes_Built = function( trigger )
	{
		Map.West_Ropes = true;

		Wp.SetWaypointFlag( "West_Ropes_1", "closed", false );
		Wp.SetWaypointFlag( "West_Ropes_2", "closed", false );
		Wp.SetWaypointFlag( "West_Ropes_3", "closed", false );
		DynamicPathsUpdated( TEAM.AXIS, TEAM.ALLIES );

		Util.MapDebugPrint( "West_Ropes_Built" );

		Util.EnableGoal( "ROUTE_WestRopesWay_.*" );

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

		if ( Map.Compound_Wall )
		{
			SetGoalRole( "PLANT_compound_wall", ROLE.ATTACKER2 );
		}

		SetGoalRole( "CAMP_Axis_CompoundWall_1.*", ROLE.ATTACKER2 );

		if ( !Map.Compound_Wall )
		{
			ClearGoalRole( ".*_Axis_CommsBunker_.*", ROLE.ROAMER );
			ClearGoalRole( ".*_Axis_LightUp_.*", ROLE.ROAMER );

			SetGoalRole( "PLANT_compound_gate", { ROLE.ATTACKER2, ROLE.ATTACKER3 });

			if ( Map.Comms_Bunker and Map.Light )
			{
				SetGoalRole( ".*_Axis_CommsBunker_0.*", ROLE.ATTACKER2 );
				SetGoalRole( ".*_Axis_LightUp_0.*", ROLE.ATTACKER3 );
				SetGoalRole( "PLANT_comms_bunker", ROLE.ATTACKER2 );
				SetGoalRole( "PLANT_light", ROLE.ATTACKER3 );
				SetGoalRole( "BUILD_tower_climbing_ropes", ROLE.ATTACKER3 );
			}
			else
			{
				if ( !Map.Comms_Bunker and Map.Light )
				{
					SetGoalRole( ".*_Axis_LightUp_0.*", ROLE.ATTACKER3 );
					SetGoalRole( ".*_Axis_LightUp_1.*", ROLE.ATTACKER2 );
					SetGoalRole( "PLANT_light", { ROLE.ATTACKER2, ROLE.ATTACKER3 } );
					SetGoalRole( "BUILD_tower_climbing_ropes", { ROLE.ATTACKER2, ROLE.ATTACKER3 } );
				}
				else
				{
					if ( Map.Comms_Bunker and !Map.Light )
					{
						SetGoalRole( ".*_Axis_CommsBunker_0.*", ROLE.ATTACKER2 );
						SetGoalRole( ".*_Axis_CommsBunker_1.*", ROLE.ATTACKER3 );
						SetGoalRole( "PLANT_comms_bunker", { ROLE.ATTACKER2, ROLE.ATTACKER3 } );
					}
				}
			}
		}

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"CAMP_Axis_WestRopes_.*",
			"BUILD_west_ropes",
		});
	},

	West_Ropes_Planted = function( trigger )
	{
		Util.MapDebugPrint( "West_Ropes_Planted" );

		Util.SetGoalRange( "DEFUSE_west_ropes.*", 350);
	},

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

	West_Ropes_Destroyed = function( trigger )
	{
		Map.West_Ropes = false;

		Wp.SetWaypointFlag( "West_Ropes_1", "closed", true );
		Wp.SetWaypointFlag( "West_Ropes_2", "closed", true );
		Wp.SetWaypointFlag( "West_Ropes_3", "closed", true );
		DynamicPathsUpdated( TEAM.AXIS, TEAM.ALLIES );

		Util.MapDebugPrint( "West_Ropes_Destroyed" );

		Util.DisableGoal( "ROUTE_WestRopesWay_.*" );

		if ( Map.Compound_Wall )
		{
			ClearGoalRole( "PLANT_compound_wall", ROLE.ATTACKER2 );
		}

		ClearGoalRole( "CAMP_Axis_CompoundWall_1.*", ROLE.ATTACKER2 );

		if ( !Map.South_Ropes and !Map.Compound_Wall )
		{
			ClearGoalRole( "PLANT_compound_gate", { ROLE.ATTACKER2, ROLE.ATTACKER3 });
			ClearGoalRole( "PLANT_comms_bunker", { ROLE.ATTACKER2, ROLE.ATTACKER3 } );
			ClearGoalRole( "PLANT_light", { ROLE.ATTACKER2, ROLE.ATTACKER3 } );
			ClearGoalRole( "BUILD_tower_climbing_ropes", { ROLE.ATTACKER2, ROLE.ATTACKER3 } );
			ClearGoalRole( "DEFUSE_tower_climbing_ropes.*", { ROLE.ATTACKER2, ROLE.ATTACKER3 }, true );
			ClearGoalRole( ".*_Axis_LightUp_0.*", ROLE.ATTACKER3 );
			ClearGoalRole( ".*_Axis_LightUp_1.*", ROLE.ATTACKER2 );
			ClearGoalRole( ".*_Axis_CommsBunker_0.*", ROLE.ATTACKER2 );
			ClearGoalRole( ".*_Axis_CommsBunker_1.*", ROLE.ATTACKER3 );

			SetGoalRole( ".*_Axis_CommsBunker_.*", ROLE.ROAMER );
			SetGoalRole( ".*_Axis_LightUp_.*", ROLE.ROAMER );
		}

		foreach( goal in Util.GoalTable("DEFUSE_west_ropes.*") )
		{
			goal.SetAvailable(TEAM.AXIS, false);
		}

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

		SetAvailableMapGoals( TEAM.AXIS, true, {
			"CAMP_Axis_WestRopes_.*",
			"BUILD_west_ropes",
		});
	},

	Anti_Ship_Gun_Planted = function( trigger )
	{
		Util.MapDebugPrint( "Anti_Ship_Gun_Planted" );

		if ( Map.Comms_Bunker or Map.Light )
		{
			SetGoalRole( "DEFUSE_anti_ship_gun.*", { ROLE.DEFENDER, ROLE.DEFENDER1 });
		}
		else
		{
			if ( !Map.Comms_Bunker and Map.Light )
			{
				SetGoalRole( "DEFUSE_anti_ship_gun.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER2 });
			}
			else
			{
				if ( Map.Comms_Bunker and !Map.Light )
				{
					SetGoalRole( "DEFUSE_anti_ship_gun.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER3 });
				}
				else
				{
					SetGoalRole( "DEFUSE_anti_ship_gun.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER2, ROLE.DEFENDER3 });
				}
			}
		}
	},

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

	Anti_Ship_Gun_Destroyed = function( trigger )
	{
		Map.Anti_Ship_Gun = false;

		Util.MapDebugPrint( "Anti_Ship_Gun_Destroyed" );

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"PLANT_anti_ship_gun",
			".*_Axis_AntiShipGun_.*",
		});

		foreach( goal in Util.GoalTable("DEFUSE_anti_ship_gun.*") )
		{
			goal.SetAvailable(TEAM.ALLIES, false);
		}

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

		SetGoalRole( ".*MG42_Command_Post", { ROLE.DEFENDER, ROLE.DEFENDER1 });
		SetGoalRole( "PLANTMINE_Allies_Inside_.*", { ROLE.DEFENDER, ROLE.DEFENDER1 });

		Util.SetMaxUsers( 7, "CHECKPOINT_forwardspawn" );

		if ( !Map.Compound_Gate )
		{
			SetGoalRole( "PLANT_comms_bunker", { ROLE.ATTACKER, ROLE.ATTACKER1 });
			SetGoalRole( "PLANT_light", { ROLE.ATTACKER, ROLE.ATTACKER1 } );
			SetGoalRole( "BUILD_tower_climbing_ropes", { ROLE.ATTACKER, ROLE.ATTACKER1 } );
			SetGoalRole( "PLANT_tower_climbing_ropes", { ROLE.DEFENDER, ROLE.DEFENDER1 } );
			SetGoalRole( ".*_Axis_LightBelow_.*", { ROLE.ATTACKER, ROLE.ATTACKER1 });

			if ( Map.Light )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, {
					".*_Axis_LightBelow_.*",
				});
			}
			else
			{
				SetAvailableMapGoals( TEAM.AXIS, true, {
					".*_Axis_LightBelow_1.*",
				});
			}

			if ( !Map.Compound_Wall )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"DEFEND_Allies_CompGateIns_.*",
				});
			}
		}
		else
		{
			SetGoalPriority( "PLANT_compound_gate", 0.71, 0, 0 );

			SetGoalRole( ".*_Axis_CompoundGate_1.*", ROLE.ATTACKER );

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

		SetAvailableMapGoals( TEAM.ALLIES, true, {
			".*MG42_Command_Post",
			".*_Allies_CompGate_.*",
		});

		if ( !Map.Comms_Bunker and !Map.Light )
		{
			ETUtil.WinningChat( TEAM.AXIS );
			ETUtil.LosingChat( TEAM.ALLIES );
		}
	},

	Comms_Bunker_Planted = function( trigger )
	{
		Util.MapDebugPrint( "Comms_Bunker_Planted" );

		if ( Map.Light and Map.Anti_Ship_Gun )
		{
			SetGoalRole( "DEFUSE_comms_bunker.*", ROLE.DEFENDER2 );
		}
		else
		{
			if ( !Map.Light and Map.Anti_Ship_Gun )
			{
				SetGoalRole( "DEFUSE_comms_bunker.*", { ROLE.DEFENDER2, ROLE.DEFENDER3 });
			}
			else
			{
				if ( Map.Light and !Map.Anti_Ship_Gun )
				{
					SetGoalRole( "DEFUSE_comms_bunker.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER2 });
				}
				else
				{
					SetGoalRole( "DEFUSE_comms_bunker.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER2, ROLE.DEFENDER3 });
				}
			}
		}

		Route_67 =
		{
			DEFEND_Allies_CommsBunker_00 = {},
		};

		Route_67["DEFUSE_comms_bunker.*"] =
		{
			ROUTE_Compound_Spawn =
			{
				ROUTE_CommBunkerR_00 =
				{
					Weight = 2,
					ROUTE_CommBunkerR_01 =  {},
				},
				ROUTE_CommBunkerM_00 =
				{
					Weight = 2,
					ROUTE_CommBunkerM_01 = {},
				},
				ROUTE_CommBunkerL_00 =
				{
					ROUTE_CommBunkerL_01 = {},
				},
			},
		};

		Util.Routes(Route_67);
	},

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

	Comms_Bunker_Destroyed = function( trigger )
	{
		Map.Comms_Bunker = false;

		Util.MapDebugPrint( "Comms_Bunker_Destroyed" );

		foreach( goal in Util.GoalTable("DEFUSE_comms_bunker.*") )
		{
			goal.SetAvailable(TEAM.ALLIES, false);
		}

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

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"PLANT_comms_bunker",
			".*_Axis_CommsBunker_.*",
		});

		if ( !Map.Light )
		{
			SetGoalRole( "BUILD_Command_Post", { ROLE.ATTACKER2, ROLE.ATTACKER3, ROLE.DEFENDER2, ROLE.DEFENDER3 });
			SetGoalRole( "PLANT_Command_Post", { ROLE.ATTACKER2, ROLE.ATTACKER3, ROLE.DEFENDER2, ROLE.DEFENDER3 });
			SetGoalRole( "CHECKPOINT_forwardspawn", { ROLE.ATTACKER2, ROLE.ATTACKER3, ROLE.DEFENDER2, ROLE.DEFENDER3 });
			SetGoalRole( "PLANT_compound_gate", { ROLE.ATTACKER2, ROLE.ATTACKER3 });
			SetGoalRole( "PLANT_anti_ship_gun", { ROLE.ATTACKER2, ROLE.ATTACKER3 });
			SetGoalRole( ".*_Axis_LightBelow_.*", { ROLE.ATTACKER2, ROLE.ATTACKER3 });
			SetGoalRole( ".*_Axis_CommsLightDest_.*", { ROLE.ATTACKER2, ROLE.ATTACKER3 });
			SetGoalRole( ".*MG42_Command_Post", { ROLE.ATTACKER2, ROLE.ATTACKER3 });
			SetGoalRole( "SMOKEBOMB_Axis_JumpWay_.*", { ROLE.ATTACKER2, ROLE.ATTACKER3 });

			Util.SetMaxUsers( 8, "CHECKPOINT_forwardspawn" );

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

			if ( Map.Compound_Gate )
			{
				SetGoalPriority( "PLANT_compound_gate", 0.71, 0, 0 );
			}
		}
		else
		{
			if (( Map.West_Ropes or Map.South_Ropes ) and !Map.Compound_Wall )
			{
				SetGoalRole( ".*_Axis_LightUp_1.*", ROLE.ATTACKER2 );
			}

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

		if ( !Map.Anti_Ship_Gun and !Map.Light )
		{
			ETUtil.WinningChat( TEAM.AXIS );
			ETUtil.LosingChat( TEAM.ALLIES );
		}
	},

	Compound_Gate_Planted = function( trigger )
	{
		Util.MapDebugPrint( "Compound_Gate_Planted" );

		SetGoalPriority( "DEFUSE_compound_gate.*", 0.86, TEAM.ALLIES, 0 );

		if ( Map.Comms_Bunker or Map.Light )
		{
			SetGoalRole( "DEFUSE_compound_gate.*", { ROLE.DEFENDER, ROLE.DEFENDER1 });
		}
		else
		{
			if ( !Map.Comms_Bunker and Map.Light )
			{
				SetGoalRole( "DEFUSE_compound_gate.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER2 });
			}
			else
			{
				if ( Map.Comms_Bunker and !Map.Light )
				{
					SetGoalRole( "DEFUSE_compound_gate.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER3 });
				}
				else
				{
					SetGoalRole( "DEFUSE_compound_gate.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER2, ROLE.DEFENDER3 });
				}
			}
		}
	},

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

	Compound_Gate_Destroyed = function( trigger )
	{
		Map.Compound_Gate = false;

		Wp.SetWaypointFlag( "Compound_Gate_Door_.*", { "door", "allies", "infiltrator" }, false );

		Util.MapDebugPrint( "Compound_Gate_Destroyed" );

		foreach( goal in Util.GoalTable("DEFUSE_compound_gate.*") )
		{
			goal.SetAvailable(TEAM.ALLIES, false);
		}

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"PLANT_compound_gate",
			"ROUTE_Tanks_00",
			".*_Axis_CompoundGate_.*",
		});

		if (Map.Light or Map.Comms_Bunker)
		{
			if ( Map.Anti_Ship_Gun )
			{
				SetAvailableMapGoals( TEAM.ALLIES, false, {
					".*_Allies_WestRopes_.*",
					".*_Allies_CompoundWall_.*",
				});

				if ( tableCount(Map.count_axis_ins) < 1 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, {
						".*_Allies_CompGateDest_.*",
						".*_Allies_RopesWest_.*",
						".*_Allies_RopesSouth_.*",
					});
				}
			}
			else
			{
				if ( !Map.Compound_Wall )
				{
					SetAvailableMapGoals( TEAM.ALLIES, true, {
						"DEFEND_Allies_CompGateIns_.*",
					});
				}
			}
		}

		if ( !Map.Anti_Ship_Gun )
		{
			SetGoalRole( "PLANT_comms_bunker", { ROLE.ATTACKER, ROLE.ATTACKER1 });
			SetGoalRole( "PLANT_light", { ROLE.ATTACKER, ROLE.ATTACKER1 } );
			SetGoalRole( "BUILD_tower_climbing_ropes", { ROLE.ATTACKER, ROLE.ATTACKER1 } );
			SetGoalRole( "PLANT_tower_climbing_ropes", { ROLE.DEFENDER, ROLE.DEFENDER1 } );
			SetGoalRole( ".*_Axis_LightBelow_.*", { ROLE.ATTACKER, ROLE.ATTACKER1 });

			if ( Map.Light )
			{
				SetAvailableMapGoals( TEAM.AXIS, true, {
					".*_Axis_LightBelow_.*",
				});
			}
			else
			{
				SetAvailableMapGoals( TEAM.AXIS, true, {
					".*_Axis_LightBelow_1.*",
				});
			}
		}
		else
		{
			SetGoalRole( ".*_Axis_AntiShipGun_1.*", ROLE.ATTACKER1 );

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

	Compound_Wall_Planted = function( trigger )
	{
		Util.MapDebugPrint( "Compound_Wall_Planted" );

		SetGoalPriority( "DEFUSE_compound_wall.*", 0.85, TEAM.ALLIES, 0 );

		if ( Map.Anti_Ship_Gun )
		{
			SetGoalRole( "DEFUSE_compound_wall.*", { ROLE.DEFENDER2, ROLE.DEFENDER3 });
		}
		else
		{
			SetGoalRole( "DEFUSE_compound_wall.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER2, ROLE.DEFENDER3 });
		}
	},

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

	Compound_Wall_Destroyed = function( trigger )
	{
		Map.Compound_Wall = false;

		Wp.SetWaypointFlag( "Compound_Wall_1", "jump", true );
		Wp.SetWaypointFlag( "Compound_Wall_2", "jump", true );
		Wp.SetWaypointFlag( "Compound_Wall_3", "jump", true );

		Util.MapDebugPrint( "Compound_Wall_Destroyed" );

		Util.EnableGoal( "ROUTE_CompoundWallWay_.*" );

		SetGoalPriority( "BUILD_ropes", 0.80, 0, 0 );
		SetGoalPriority( "BUILD_west_ropes", 0.80, 0, 0 );

		foreach( goal in Util.GoalTable("DEFUSE_compound_wall.*") )
		{
			goal.SetAvailable(TEAM.ALLIES, false);
		}

		SetGoalRole( "PLANT_compound_gate", ROLE.SNIPER );
		SetGoalRole( "PLANT_comms_bunker", ROLE.SNIPER );
		SetGoalRole( "PLANT_light", ROLE.SNIPER );
		SetGoalRole( "BUILD_tower_climbing_ropes", ROLE.SNIPER );
		SetGoalRole( ".*_Axis_CommsBunker_.*", ROLE.SNIPER );
		SetGoalRole( ".*_Axis_LightUp_.*", ROLE.SNIPER );

		if ( !Map.Anti_Ship_Gun and !Map.Compound_Gate )
		{
			SetAvailableMapGoals( TEAM.ALLIES, true, {
				"DEFEND_Allies_CompGateIns_.*",
			});
		}

		if ( Map.West_Ropes or Map.South_Ropes )
		{
			ClearGoalRole( ".*_Axis_CommsBunker_.*", ROLE.ROAMER );
			ClearGoalRole( ".*_Axis_LightUp_.*", ROLE.ROAMER );

			SetGoalRole( "PLANT_compound_gate", { ROLE.ATTACKER2, ROLE.ATTACKER3 });

			if ( Map.Comms_Bunker and Map.Light )
			{
				SetGoalRole( ".*_Axis_CommsBunker_0.*", ROLE.ATTACKER2 );
				SetGoalRole( ".*_Axis_LightUp_0.*", ROLE.ATTACKER3 );
				SetGoalRole( "PLANT_comms_bunker", ROLE.ATTACKER2 );
				SetGoalRole( "PLANT_light", ROLE.ATTACKER3 );
				SetGoalRole( "BUILD_tower_climbing_ropes", ROLE.ATTACKER3 );
			}
			else
			{
				if ( !Map.Comms_Bunker and Map.Light )
				{
					SetGoalRole( ".*_Axis_LightUp_0.*", ROLE.ATTACKER3 );
					SetGoalRole( ".*_Axis_LightUp_1.*", ROLE.ATTACKER2 );
					SetGoalRole( "PLANT_light", { ROLE.ATTACKER2, ROLE.ATTACKER3 } );
					SetGoalRole( "BUILD_tower_climbing_ropes", { ROLE.ATTACKER2, ROLE.ATTACKER3 } );
				}
				else
				{
					if ( Map.Comms_Bunker and !Map.Light )
					{
						SetGoalRole( ".*_Axis_CommsBunker_0.*", ROLE.ATTACKER2 );
						SetGoalRole( ".*_Axis_CommsBunker_1.*", ROLE.ATTACKER3 );
						SetGoalRole( "PLANT_comms_bunker", { ROLE.ATTACKER2, ROLE.ATTACKER3 } );
					}
				}
			}
		}

		if ( !Map.Comms_Bunker and !Map.Light )
		{
			SetGoalRole( ".*_Axis_LightBelow_.*", { ROLE.ATTACKER2, ROLE.ATTACKER3 });
		}

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"PLANT_compound_wall",
			"CAMP_Axis_CompoundWall_.*",
		});
	},

	Light_Planted = function( trigger )
	{
		Util.MapDebugPrint( "Light_Planted" );

		if ( Map.Comms_Bunker and Map.Anti_Ship_Gun )
		{
			SetGoalRole( "DEFUSE_light.*", ROLE.DEFENDER3 );
		}
		else
		{
			if ( !Map.Comms_Bunker and Map.Anti_Ship_Gun )
			{
				SetGoalRole( "DEFUSE_light.*", { ROLE.DEFENDER2, ROLE.DEFENDER3 });
			}
			else
			{
				if ( Map.Comms_Bunker and !Map.Anti_Ship_Gun )
				{
					SetGoalRole( "DEFUSE_light.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER3 });
				}
				else
				{
					SetGoalRole( "DEFUSE_light.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER2, ROLE.DEFENDER3 });
				}
			}
		}

		if ( Map.Tower_Climbing_Ropes )
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"PLANT_tower_climbing_ropes",
			});
		}

		Route_66 =
		{
			DEFEND_Allies_LightUp_00 = {},
		};

		Route_66["DEFUSE_light_.*"] =
		{
			ROUTE_Compound_Spawn =
			{
				ROUTE_ClimbingRopesWay_01 =
				{
					ROUTE_ClimbingRopesWay_02A =
					{
						ROUTE_ClimbingRopesWay_02B = {},
					},
					ROUTE_ClimbingRopesWay_03A =
					{
						ROUTE_ClimbingRopesWay_03B = {},
					},
					ROUTE_ClimbingRopesWay_04A =
					{
						ROUTE_ClimbingRopesWay_04B = {},
					},
				},
				ROUTE_StairsToLight_00 =
				{
					Weight = 2,
					ROUTE_StairsToLight_01 =
					{
						ROUTE_StairsToLight_02 = {},
					},
				},
				ROUTE_MastWay_00 =
				{
					Weight = 3,
					ROUTE_MastWay_01 =
					{
						ROUTE_MastWay_02 = {},
					},
				},
			},
		};

		Util.Routes(Route_66);
	},

	Light_Defused = function( trigger )
	{
		Util.MapDebugPrint( "Light_Defused" );

		if ( tableCount(Util.GoalTable("DEFUSE_light.*")) == 1 )
		{
			if ( Map.Tower_Climbing_Ropes )
			{
				SetAvailableMapGoals( TEAM.ALLIES, true, {
					"PLANT_tower_climbing_ropes",
				});
			}
		}
	},

	Light_Destroyed = function( trigger )
	{
		Map.Light = false;

		Util.MapDebugPrint( "Light_Destroyed" );

		foreach( goal in Util.GoalTable("DEFUSE_light.*") )
		{
			goal.SetAvailable(TEAM.ALLIES, false);
		}

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

		SetAvailableMapGoals( TEAM.AXIS, false, {
			".*_Axis_LightUp_.*",
			"PLANT_light",
		});

		if ( !Map.Tower_Climbing_Ropes )
		{
			SetAvailableMapGoals( TEAM.AXIS, false, {
				"BUILD_tower_climbing_ropes",
			});
		}
		else
		{
			SetAvailableMapGoals( TEAM.ALLIES, false, {
				"PLANT_tower_climbing_ropes",
			});
		}

		if ( !Map.Comms_Bunker )
		{
			SetGoalRole( "BUILD_Command_Post", { ROLE.ATTACKER2, ROLE.ATTACKER3, ROLE.DEFENDER2, ROLE.DEFENDER3 });
			SetGoalRole( "PLANT_Command_Post", { ROLE.ATTACKER2, ROLE.ATTACKER3, ROLE.DEFENDER2, ROLE.DEFENDER3 });
			SetGoalRole( "CHECKPOINT_forwardspawn", { ROLE.ATTACKER2, ROLE.ATTACKER3, ROLE.DEFENDER2, ROLE.DEFENDER3 });
			SetGoalRole( "PLANT_compound_gate", { ROLE.ATTACKER2, ROLE.ATTACKER3 });
			SetGoalRole( "PLANT_anti_ship_gun", { ROLE.ATTACKER2, ROLE.ATTACKER3 });
			SetGoalRole( ".*_Axis_LightBelow_.*", { ROLE.ATTACKER2, ROLE.ATTACKER3 });
			SetGoalRole( ".*_Axis_CommsLightDest_.*", { ROLE.ATTACKER2, ROLE.ATTACKER3 });
			SetGoalRole( ".*MG42_Command_Post", { ROLE.ATTACKER2, ROLE.ATTACKER3 });
			SetGoalRole( "SMOKEBOMB_Axis_JumpWay_.*", { ROLE.ATTACKER2, ROLE.ATTACKER3 });

			Util.SetMaxUsers( 8, "CHECKPOINT_forwardspawn" );

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

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

			if ( Map.Compound_Gate )
			{
				SetGoalPriority( "PLANT_compound_gate", 0.71, 0, 0 );
			}
		}
		else
		{
			if (( Map.West_Ropes or Map.South_Ropes ) and !Map.Compound_Wall )
			{
				SetGoalRole( ".*_Axis_CommsBunker_1.*", ROLE.ATTACKER3 );
			}

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

		if ( !Map.Comms_Bunker and !Map.Anti_Ship_Gun )
		{
			ETUtil.WinningChat( TEAM.AXIS );
			ETUtil.LosingChat( TEAM.ALLIES );
		}
	},

	Main_Entrance_Planted = function( trigger )
	{
		Util.MapDebugPrint( "Main_Entrance_Planted" );

		SetGoalPriority( "DEFUSE_main_entrance.*", 0.88, TEAM.ALLIES, 0 );

		if ( Map.Comms_Bunker or Map.Light )
		{
			SetGoalRole( "DEFUSE_main_entrance.*", { ROLE.DEFENDER, ROLE.DEFENDER1 });
		}
		else
		{
			if ( !Map.Comms_Bunker and Map.Light )
			{
				SetGoalRole( "DEFUSE_main_entrance.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER2 });
			}
			else
			{
				if ( Map.Comms_Bunker and !Map.Light )
				{
					SetGoalRole( "DEFUSE_main_entrance.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER3 });
				}
				else
				{
					SetGoalRole( "DEFUSE_main_entrance.*", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.DEFENDER2, ROLE.DEFENDER3 });
				}
			}
		}
	},

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

	Main_Entrance_Destroyed = function( trigger )
	{
		Map.Main_Entrance = false;

		Util.MapDebugPrint( "Main_Entrance_Destroyed" );

		Util.EnableGoal( "ROUTE_MainEntranceWay_.*" );

		foreach( goal in Util.GoalTable("DEFUSE_main_entrance.*") )
		{
			goal.SetAvailable(TEAM.ALLIES, false);
		}

		SetGoalRole( "BUILD_Command_Post", { ROLE.ATTACKER, ROLE.ATTACKER1 });
		SetGoalRole( "PLANT_Command_Post", { ROLE.ATTACKER, ROLE.ATTACKER1 });
		SetGoalRole( "CHECKPOINT_forwardspawn", { ROLE.ATTACKER, ROLE.ATTACKER1 });
		SetGoalRole( "PLANT_compound_gate", { ROLE.ATTACKER, ROLE.ATTACKER1 });
		SetGoalRole( "PLANT_anti_ship_gun", { ROLE.ATTACKER, ROLE.ATTACKER1 });
		SetGoalRole( ".*MG42_Command_Post", { ROLE.ATTACKER, ROLE.ATTACKER1 });

		SetAvailableMapGoals( TEAM.AXIS, false, {
			".*_Axis_MainEntrance.*",
			"PLANT_main_entrance",
			".*MG42_Dock",
		});

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

		if ( !Map.Forward_Bunker_Allied )
		{
			SetGoalPriority( "BUILD_Command_Post", 0.80, TEAM.AXIS, 0 );
		}
		else
		{
			SetGoalPriority( "BUILD_Command_Post", 0.80, TEAM.ALLIES, 0 );
		}

		if ( Map.Compound_Gate and Map.Anti_Ship_Gun )
		{
			SetGoalRole( ".*_Axis_AntiShipGun_0.*", ROLE.ATTACKER );
			SetGoalRole( ".*_Axis_CompoundGate_0.*", ROLE.ATTACKER1 );

			SetAvailableMapGoals( TEAM.AXIS, true, {
				".*_Axis_AntiShipGun_0.*",
				".*_Axis_CompoundGate_0.*",
			});
		}
		else
		{
			if ( !Map.Compound_Gate and Map.Anti_Ship_Gun )
			{
				SetGoalRole( ".*_Axis_AntiShipGun_0.*", ROLE.ATTACKER );
				SetGoalRole( ".*_Axis_AntiShipGun_1.*", ROLE.ATTACKER1 );

				SetAvailableMapGoals( TEAM.AXIS, true, {
					".*_Axis_AntiShipGun_.*",
				});
			}
			else
			{
				if ( Map.Compound_Gate and !Map.Anti_Ship_Gun )
				{
					SetGoalRole( ".*_Axis_CompoundGate_1.*", ROLE.ATTACKER );
					SetGoalRole( ".*_Axis_CompoundGate_0.*", ROLE.ATTACKER1 );

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

	Forward_Bunker_Axis_Captured = function( trigger )
	{
		Map.Forward_Bunker_Allied = false;

		Wp.SetWaypointFlag( "Bunker_Door_.*", { "door", "allies", "infiltrator" }, false );

		Util.MapDebugPrint( "Forward_Bunker_Axis_Captured" );

		Map.Roles.AXIS.ATTACKER.spawnpt = 3;
		Map.Roles.AXIS.ATTACKER1.spawnpt = 3;
		Map.Roles.AXIS.ATTACKER2.spawnpt = 2;
		Map.Roles.AXIS.ATTACKER3.spawnpt = 2;

		Map.Roles.ALLIES.DEFENDER.spawnpt = 1;
		Map.Roles.ALLIES.DEFENDER1.spawnpt = 1;
		Map.Roles.ALLIES.DEFENDER2.spawnpt = 1;
		Map.Roles.ALLIES.DEFENDER3.spawnpt = 1;

		Map.SetSpawn();

		SetGoalPriority( "BUILD_Command_Post", 0.58, TEAM.ALLIES, 0 );

		if ( Map.Main_Entrance )
		{
			SetGoalRole( "BUILD_Command_Post", { ROLE.ATTACKER, ROLE.ATTACKER1 });
			SetGoalRole( "PLANT_Command_Post", { ROLE.ATTACKER, ROLE.ATTACKER1 });
			SetGoalRole( "CHECKPOINT_forwardspawn", { ROLE.ATTACKER, ROLE.ATTACKER1 });
			SetGoalRole( "PLANT_compound_gate", { ROLE.ATTACKER, ROLE.ATTACKER1 });
			SetGoalRole( "PLANT_anti_ship_gun", { ROLE.ATTACKER, ROLE.ATTACKER1 });
		}
		else
		{
			SetGoalPriority( "BUILD_Command_Post", 0.78, TEAM.AXIS, 0 );
		}

		SetAvailableMapGoals( TEAM.AXIS, false, {
			"CHECKPOINT_forwardspawn",
			"SMOKEBOMB_Axis_MainEntrDest_.*",
		});

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

	Forward_Bunker_Allies_Captured = function( trigger )
	{
		Map.Forward_Bunker_Allied = true;

		Wp.SetWaypointFlag( "Bunker_Door_.*", { "door", "allies", "infiltrator" }, true );

		Util.MapDebugPrint( "Forward_Bunker_Allies_Captured" );

		Map.Roles.AXIS.ATTACKER.spawnpt = 2;
		Map.Roles.AXIS.ATTACKER1.spawnpt = 2;
		Map.Roles.AXIS.ATTACKER2.spawnpt = 2;
		Map.Roles.AXIS.ATTACKER3.spawnpt = 2;

		Map.Roles.ALLIES.DEFENDER.spawnpt = 3;
		Map.Roles.ALLIES.DEFENDER1.spawnpt = 3;
		Map.Roles.ALLIES.DEFENDER2.spawnpt = 1;
		Map.Roles.ALLIES.DEFENDER3.spawnpt = 1;

		Map.SetSpawn();

		SetGoalPriority( "BUILD_Command_Post", 0.58, TEAM.AXIS, 0 );

		if ( Map.Main_Entrance )
		{
			ClearGoalRole( "BUILD_Command_Post", { ROLE.ATTACKER, ROLE.ATTACKER1 });
			ClearGoalRole( "PLANT_Command_Post", { ROLE.ATTACKER, ROLE.ATTACKER1 });
			ClearGoalRole( "CHECKPOINT_forwardspawn", { ROLE.ATTACKER, ROLE.ATTACKER1 });
			ClearGoalRole( "PLANT_compound_gate", { ROLE.ATTACKER, ROLE.ATTACKER1 });
			ClearGoalRole( "PLANT_anti_ship_gun", { ROLE.ATTACKER, ROLE.ATTACKER1 });
		}
		else
		{
			SetGoalPriority( "BUILD_Command_Post", 0.78, TEAM.ALLIES, 0 );

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

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

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

	Ignore_Target =
	{
		Name = "Ignore_Target",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			b = Util.IsBot(ent);
			if ( b )
			{
				for ( q = 0; q < 64; q += 1 )
				{
					if ( EntityIsValid(q) )
					{
						b.IgnoreTarget(q, 999);
					}
				}
			}
		},
		OnExit = function(ent)
		{
			b = Util.IsBot(ent);
			if ( b )
			{
				for ( q = 0; q < 64; q += 1 )
				{
					if ( EntityIsValid(q) )
					{
						b.IgnoreTarget(q, 0.1);
					}
				}
			}
		},
	},

	Inside =
	{
		Name = "Inside",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if ( GetEntTeam(ent) == TEAM.AXIS )
			{
				bot = Util.IsBot(ent);
				if(bot)
				{
					if ( Map.Compound_Gate and Map.Compound_Wall )
					{
						bot.SetRoles(ROLE.ROAMER);
					}
				}

				if (Map.count_axis_ins[ent])
				{
					Map.count_axis_ins[ent] += 1;
				}
				else
				{
					Map.count_axis_ins[ent] = 1;
				}

				if ( tableCount(Map.count_axis_ins) > 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, {
						".*_Allies_WestRopes_.*",
						".*_Allies_CompoundWall_.*",
						".*_Allies_CompGateDest_.*",
						".*_Allies_RopesWest_.*",
						".*_Allies_RopesSouth_.*",
					});

					if ( Map.Light and Map.Comms_Bunker )
					{
						SetAvailableMapGoals( TEAM.ALLIES, true, {
							".*_Allies_CommsBunker_0.*",
							".*_Allies_LightUp_0.*",
						});
					}
					else
					{
						if ( !Map.Light and Map.Comms_Bunker )
						{
							SetAvailableMapGoals( TEAM.ALLIES, true, {
								".*_Allies_CommsBunker_.*",
							});
						}
						else
						{
							if ( Map.Light and !Map.Comms_Bunker )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, {
									".*_Allies_LightUp_.*",
								});
							}
						}
					}
				}
			}
		},
		OnExit = function(ent)
		{
			bot = Util.IsBot(ent);
			if(bot){ bot.ClearRoles(ROLE.ROAMER); }

			if (Map.count_axis_ins[ent])
			{
				if (Map.count_axis_ins[ent] > 1)
				{
					Map.count_axis_ins[ent] -= 1;
				}
				else
				{
					Map.count_axis_ins[ent] = null;
				}

				if ( tableCount(Map.count_axis_ins) < 1 )
				{
					Util.MapDebugPrint("Inside trigger is clear");

					SetAvailableMapGoals( TEAM.ALLIES, false, {
						".*_Allies_CommsBunker_.*",
						".*_Allies_LightUp_.*",
					});

					if ( Map.Light or Map.Comms_Bunker )
					{
						if ( Map.Anti_Ship_Gun )
						{
							if ( Map.Compound_Gate )
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, {
									".*_Allies_WestRopes_.*",
									".*_Allies_CompoundWall_.*",
								});
							}
							else
							{
								SetAvailableMapGoals( TEAM.ALLIES, true, {
									".*_Allies_CompGateDest_.*",
									".*_Allies_RopesWest_.*",
									".*_Allies_RopesSouth_.*",
								});
							}
						}
						else
						{
							SetAvailableMapGoals( TEAM.ALLIES, true, {
								".*_Allies_WestRopes_.*",
								".*_Allies_CompoundWall_.*",
							});
						}
					}
				}
			}
		},
	},

	Behind_Main_entrance =
	{
		Name = "Behind_Main_entrance",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if ( GetEntTeam(ent) == TEAM.AXIS )
			{
				bot = Util.IsBot(ent);
				if(bot)
				{
					if ( Map.Main_Entrance )
					{
						bot.SetRoles(ROLE.AMBUSHER);
					}
				}

				if (Map.count_axis_beh[ent])
				{
					Map.count_axis_beh[ent] += 1;
				}
				else
				{
					Map.count_axis_beh[ent] = 1;
				}

				if ( tableCount(Map.count_axis_beh) > 0 )
				{
					SetAvailableMapGoals( TEAM.ALLIES, false, {
						".*_Allies_MainEntrance.*",
					});

					if ( Map.Anti_Ship_Gun )
					{
						SetAvailableMapGoals( TEAM.ALLIES, true, {
							".*_Allies_AntiShipGun_.*",
						});
					}
					else
					{
						SetAvailableMapGoals( TEAM.ALLIES, true, {
							".*_Allies_CompGate_.*",
						});
					}
				}
			}
		},
		OnExit = function(ent)
		{
			bot = Util.IsBot(ent);
			if(bot){ bot.ClearRoles(ROLE.AMBUSHER); }

			if (Map.count_axis_beh[ent])
			{
				if (Map.count_axis_beh[ent] > 1)
				{
					Map.count_axis_beh[ent] -= 1;
				}
				else
				{
					Map.count_axis_beh[ent] = null;
				}

				if ( tableCount(Map.count_axis_beh) < 1 )
				{
					Util.MapDebugPrint("Behind_Main_entrance trigger is clear");

					if ( Map.Anti_Ship_Gun )
					{
						SetAvailableMapGoals( TEAM.ALLIES, false, {
							".*_Allies_AntiShipGun_.*",
							".*_Allies_CompGate_.*",
						});

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

	Walls_above_ropes =
	{
		Name = "\r\n\r\nWalls_above_ropes",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			if ( GetEntTeam(ent) == TEAM.AXIS )
			{
				bot = Util.IsBot(ent);
				if(bot)
				{
					if ( !Map.South_Ropes and !Map.West_Ropes )
					{
						bot.SetRoles(ROLE.SNIPER);
					}
				}
			}
		},
		OnExit = function(ent)
		{
			bot = Util.IsBot(ent);
			if(bot){ bot.ClearRoles(ROLE.SNIPER); }
		},
	},

	West_Ropes_Left =
	{
		Name = "West_Ropes_Left",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			Map.West_Ropes_Left_Player_Count += 1;
		},
		OnExit = function(ent)
		{
			Map.West_Ropes_Left_Player_Count -= 1;

			if ( Map.West_Ropes_Left_Player_Count == 0 )
			{
				Map.West_Ropes_Left_Way_In_Use = false;
			}
		},
	},

	West_Ropes_Right =
	{
		Name = "West_Ropes_Right",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			Map.West_Ropes_Right_Player_Count += 1;
		},
		OnExit = function(ent)
		{
			Map.West_Ropes_Right_Player_Count -= 1;
		},
	},

	South_Ropes_Left =
	{
		Name = "South_Ropes_Left",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			Map.South_Ropes_Left_Player_Count += 1;
		},
		OnExit = function(ent)
		{
			Map.South_Ropes_Left_Player_Count -= 1;
		},
	},

	South_Ropes_Right =
	{
		Name = "South_Ropes_Right",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			Map.South_Ropes_Right_Player_Count += 1;
		},
		OnExit = function(ent)
		{
			Map.South_Ropes_Right_Player_Count -= 1;
		},
	},

	Lighthouse_Door = function()
	{
		sleep(0.5);
		start = Vector3(-750, -220.527, 1115);
		end = Vector3(-750, -250, 1115);
		while ( 1 )
		{
			tr = TraceLine( start, end, null, TRACE.FLOODFILLENT, 0, false );
			if ( tr.fraction == 1 )
			{
				if ( Map.Lighthouse_Door_Open )
				{
					Map.Lighthouse_Door_Open = false;

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

					DynamicPathsUpdated( TEAM.AXIS, TEAM.ALLIES );

					Util.MapDebugPrint( "Lighthouse_Door_Closed" );
				}

				if ( Map.Debug )
				{
					DrawDebugLine( start, end, COLOR.GREEN, 0.1 );
				}
			}
			else
			{
				if ( !Map.Lighthouse_Door_Open )
				{
					Map.Lighthouse_Door_Open = true;

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

					DynamicPathsUpdated( TEAM.AXIS, TEAM.ALLIES );

					Util.MapDebugPrint( "Lighthouse_Door_Opened" );
				}

				if ( Map.Debug )
				{
					DrawDebugLine( start, end, COLOR.RED, 0.1 );
				}
			}
			sleep(0.1);
		}
	},

	Ignore_Breakable =
	{
		Name = "Ignore_Breakable",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			b = Util.IsBot(ent);
			if ( b )
			{
				b.TargetBreakableDist = 0;
			}
		},
		OnExit = function(ent)
		{
			b = Util.IsBot(ent);
			if ( b )
			{
				b.TargetBreakableDist = 100;
			}
		},
	},

	Mast_Ladder =
	{
		Name = "\r\nMast_Ladder",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			Map.Mast_Ladder_In_Use += 1;
			b = Util.IsBot(ent);

			if ( b )
			{
				b.SetRoles(ROLE.ESCORT);

				sleep(5);
				if ( b )
				{
					if ( b.HasRole(ROLE.ESCORT) )
					{
						b.ExecCommand( "kill" );
					}
				}
			}
		},
		OnExit = function(ent)
		{
			Map.Mast_Ladder_In_Use -= 1;
			b = Util.IsBot(ent);
			if ( b )
			{
				b.ClearRoles(ROLE.ESCORT);
			}
		},
	},

	Compound_Wall_Jump =
	{
		Name = "\r\nCompound_Wall_Jump",
		TriggerOnClass = CLASS.ANYPLAYER,
		OnEnter = function(ent)
		{
			Map.Mast_Ladder_In_Use += 1;
			b = Util.IsBot(ent);

			if ( b )
			{
				b.SetRoles(ROLE.ESCORT);

				sleep(5);
				if ( b )
				{
					if ( b.HasRole(ROLE.ESCORT) )
					{
						b.ExecCommand( "kill" );
					}
				}
			}
		},
		OnExit = function(ent)
		{
			Map.Mast_Ladder_In_Use -= 1;
			b = Util.IsBot(ent);
			if ( b )
			{
				b.ClearRoles(ROLE.ESCORT);
			}
		},
	},

	Thirty_second = function( trigger )
	{
		Util.MapDebugPrint( "Thirty_second" );

		sleep(30);

		if ( Map.Light or Map.Comms_Bunker or Map.Anti_Ship_Gun )
		{
			Util.MapDebugPrint( "Allies_Win" );

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

	SetSpawn = function()
	{
		foreach ( id and bot in BotTable )
		{
			Map.SetSpawn1(bot);
		}
	},

	SetSpawn1 = function(bot)
	{
		if ( Map.Forward_Bunker_Allied )
		{
			if ( bot.GetTeam() == TEAM.ALLIES )
			{
				if ( bot.HasRole(ROLE.DEFENDER) or bot.HasRole(ROLE.DEFENDER1) )
				{
					bot.ChangeSpawnPoint(3);
				}
				else
				{
					bot.ChangeSpawnPoint(1);
				}
			}
			else
			{
				bot.ChangeSpawnPoint(2);
			}
		}
		else
		{
			if ( bot.GetTeam() == TEAM.AXIS )
			{
				if ( bot.HasRole(ROLE.ATTACKER) or bot.HasRole(ROLE.ATTACKER1) )
				{
					bot.ChangeSpawnPoint(3);
				}
				else
				{
					bot.ChangeSpawnPoint(2);
				}
			}
			else
			{
				bot.ChangeSpawnPoint(1);
			}
		}
	},
};

global OnMapLoad = function()
{
	if ( Map.Debug )
	{
		Util.DebugColorString = "^3";
	}

	thread ( Map.Lighthouse_Door );

	OnTrigger( "Allied Command Post constructed. Charge speed increased!", Map.Allied_CP_Built );
	OnTrigger( "Axis team has destroyed the Allied Command Post!", Map.Allied_CP_Destroyed );
	OnTrigger( "Planted at the Command Post.", Map.CP_Planted );
	OnTrigger( "Defused at the Command Post.", Map.CP_Defused );
	OnTrigger( "Axis Command Post constructed. Charge speed increased!", Map.Axis_CP_Built );
	OnTrigger( "Allied team has destroyed the Axis Command Post!", Map.Axis_CP_Destroyed );

	OnTrigger( "Axis team has built the cliff assault ropes!", Map.South_Ropes_Built );
	OnTrigger( "Planted at the ropes.", Map.South_Ropes_Planted );
	OnTrigger( "Defused at the ropes.", Map.South_Ropes_Defused );
	OnTrigger( "Allied team has destroyed the assault ropes!", Map.South_Ropes_Destroyed );

	OnTrigger( "Axis team has built the lighthouse tower assault ropes!", Map.Tower_Climbing_Ropes_Built );
	OnTrigger( "Planted at tower climbing ropes.", Map.Tower_Climbing_Ropes_Planted );
	OnTrigger( "Defused at tower climbing ropes.", Map.Tower_Climbing_Ropes_Defused );
	OnTrigger( "Allied team has destroyed the lighthouse tower assault ropes!", Map.Tower_Climbing_Ropes_Destroyed );

	OnTrigger( "Axis team has built the 2nd cliff assault ropes!", Map.West_Ropes_Built );
	OnTrigger( "Planted at the west ropes.", Map.West_Ropes_Planted );
	OnTrigger( "Defused at the west ropes.", Map.West_Ropes_Defused );
	OnTrigger( "Allied team has destroyed the 2nd assault ropes!", Map.West_Ropes_Destroyed );

	OnTrigger( "Planted at the anti ship gun.", Map.Anti_Ship_Gun_Planted );
	OnTrigger( "Defused at the anti ship gun.", Map.Anti_Ship_Gun_Defused );
	OnTrigger( "Axis have destroyed MAIN OBJECTIVE 2 the Anti-Ship Gun!", Map.Anti_Ship_Gun_Destroyed );

	OnTrigger( "Planted at the comms bunker.", Map.Comms_Bunker_Planted );
	OnTrigger( "Defused at the comms bunker.", Map.Comms_Bunker_Defused );
	OnTrigger( "Axis have destroyed MAIN OBJECTIVE 3 the Command Bunker!", Map.Comms_Bunker_Destroyed );

	OnTrigger( "Planted at the compound gate.", Map.Compound_Gate_Planted );
	OnTrigger( "Defused at the compound gate.", Map.Compound_Gate_Defused );
	OnTrigger( "Axis team has breached the compound gate", Map.Compound_Gate_Destroyed );

	OnTrigger( "Planted at the compound wall.", Map.Compound_Wall_Planted );
	OnTrigger( "Defused at the compound wall.", Map.Compound_Wall_Defused );
	OnTrigger( "Axis team has breached the compound wall", Map.Compound_Wall_Destroyed );

	OnTrigger( "Planted at the light.", Map.Light_Planted );
	OnTrigger( "Defused at the light.", Map.Light_Defused );
	OnTrigger( "Axis have destroyed MAIN OBJECTIVE 1 the Light!", Map.Light_Destroyed );

	OnTrigger( "Planted at the main entrance.", Map.Main_Entrance_Planted );
	OnTrigger( "Defused at the main entrance.", Map.Main_Entrance_Defused );
	OnTrigger( "Axis team has breached the main entrance", Map.Main_Entrance_Destroyed );

	OnTrigger( "Axis capture forward bunker - ammo bunker door open!", Map.Forward_Bunker_Axis_Captured );
	OnTrigger( "Allies capture forward bunker - ammo bunker door closed!", Map.Forward_Bunker_Allies_Captured );

	OnTrigger( "thirty second warning.", Map.Thirty_second );

	OnTriggerRegion(AABB(-1205.764,-480.126,1185.125,-1210.764,-475.126,2488), Map.Ignore_Target ); //Tower_Climbing_Ropes
	OnTriggerRegion(AABB(-1078,-500,1185,-1084,-505,2488), Map.Ignore_Target );                     //Tower_Climbing_Ropes
	OnTriggerRegion(AABB(-897,-457,1185,-905,-462,2488), Map.Ignore_Target );                       //Tower_Climbing_Ropes
	OnTriggerRegion(AABB(-800.173,-55.351,1537.125,-180.587,127.653,2771.085), Map.Ignore_Target ); //Tower
	OnTriggerRegion(AABB(660,2732.567,201.125,664.875,2770.567,327.807), Map.Ignore_Target ); //Ladder_At_MOUNTMG42_Dock
	OnTriggerRegion(AABB(920.396,500,705.125,958.396,504.875,1022.247), Map.Ignore_Target ); //Ladder_At_MOUNTMG42_Command_Post
	OnTriggerRegion(AABB(385.125,910,627.125,446.875,922,720), Map.Ignore_Target ); //Main_Entrance_Door

	OnTriggerRegion(AABB(-760.875,-504.403,1025.125,-594.498,-151.125,1139.800), Map.Ignore_Breakable );    //Wooden hut near the lighthouse
	OnTriggerRegion(AABB(-608.875,536.635,1029.125,-506.369,672.726,1103.125), Map.Ignore_Breakable );  //Window at Compound Spawn

	OnTriggerRegion(AABB(-1504.875,-592.875,369.125,-147.125,864.875,2776.395), Map.Inside );
	OnTriggerRegion(AABB(-108.347,-608.875,689.125,0.875,-159.126,1205.693), Map.Inside );
	OnTriggerRegion(AABB(-224.875,-1248.875,689.125,-15.127,-648.373,771.125), Map.Inside );
	OnTriggerRegion(AABB(-108.605,-120.661,689.125,46.177,620.875,764.433), Map.Inside );

	OnTriggerRegion(AABB(31.125,-948.875,625.125,1206.872,914.873,1229.635), Map.Behind_Main_entrance );
	OnTriggerRegion(AABB(-128.875,-128.854,1025.125,-8.484,933.324,1156.963), Map.Behind_Main_entrance );
	OnTriggerRegion(AABB(543.125,-608.875,305.125,1120.875,390.875,550.125), Map.Behind_Main_entrance );

	OnTriggerRegion(AABB(-1933.460,-1283.698,839.934,-6.842,-639.173,1320.197), Map.Walls_above_ropes );
	OnTriggerRegion(AABB(-1926.338,-595.870,975.805,-1535.125,963.331,1139.458), Map.Walls_above_ropes );

	OnTriggerRegion(AABB(-2350.229,74.067,237.125,-2278.194,112.710,344), Map.West_Ropes_Left );
	OnTriggerRegion(AABB(-2350.790,10.279,237.125,-2286.417,48.279,344), Map.West_Ropes_Right );

	OnTriggerRegion(AABB(-632.430,-1310.360,260.329,-543.125,-1273.014,362.455), Map.South_Ropes_Left );
	OnTriggerRegion(AABB(-395.755,-1495.553,161.844,-327.200,-1266.431,362.455), Map.South_Ropes_Right );

	OnTriggerRegion(AABB(-371.857,97.875,1031.125,-332.128,112,1275), Map.Mast_Ladder );
	OnTriggerRegion(AABB(-128.875,-755.594,1004.216,-84.146,-639.125,1127.486), Map.Compound_Wall_Jump );

	RegionTrigger.Create(AABB(-469.125,-307.399,1144.874,-243.104,-269.299,1265.125), "DisableBotPush", "Tanks_Near_Tower");
	RegionTrigger.Create(AABB(-2384.753,-25.649,205.620,-1645.508,172.315,1099.125), "DisableCombatMovement", "West_Ropes");
	RegionTrigger.Create(AABB(-868.941,-374.558,1183.109,-512.138,-233.234,1317.125), "DisableCombatMovement", "Near_Tanks");
	RegionTrigger.Create(AABB(-1675.311,-810.198,955.719,-1477.051,-582.137,1065.327), "DisableCombatMovement", "Corner");
	RegionTrigger.Create(AABB(-220.485,-1270.361,865.125,-39.913,-826.123,1058.177), "DisableBotPush", "Compound_Wall_Bunker");
	RegionTrigger.Create(AABB(-820.143,-976.530,1137.125,-545.996,-378.995,1342.881), "DisableBotPush", "Compound_Wall_Building");
	RegionTrigger.Create(AABB(-733.092,-1032.875,1007.125,-599.125,-959.125,1083.125), "DisableCombatMovement", "Compound_Wall_Building_Out");
	RegionTrigger.Create(AABB(-195.154,-776.822,1015.125,-114.627,-639.125,1135.374), "DisableBotPush", "Compound_Wall_Jump");
	RegionTrigger.Create(AABB(255.125,943.180,625.125,704.812,1298.839,748.142), "DisableCombatMovement", "Main_Entrance_Outside");
	RegionTrigger.Create(AABB(-466.439,-80.310,1233.022,-228.040,154.599,1048.128), "DisableCombatMovement", "Mast");
	RegionTrigger.Create(AABB(-594.536,-888.875,952.351,-12.886,-639.233,1135.723), "DisableCombatMovement", "Compound_Wall");
	RegionTrigger.Create(AABB(423.159,-779.259,745.125,544.878,-255.125,903.528), "DisableCombatMovement", "Net_near_AntiShip");
	RegionTrigger.Create(AABB(-757.295,-1562.277,141.461,-255.681,-1251.514,377.692), "DisableCombatMovement", "South_Ropes");

	Util.DisableGoal( ".*", true );
	Util.DisableGoal( "ROUTE_WestRopesWay_.*" );
	Util.DisableGoal( "ROUTE_SouthRopesWay_.*" );
	Util.DisableGoal( "ROUTE_CompoundWallWay_.*" );
	Util.DisableGoal( "ROUTE_ClimbingRopesWay_.*" );
	Util.DisableGoal( "ROUTE_MainEntranceWay_.*" );

	ETUtil.SetCabinets();

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

	SetAvailableMapGoals( TEAM.AXIS, true, {
		"BUILD_ropes",
		"BUILD_west_ropes",
		"PLANT_compound_gate",
		"PLANT_compound_wall",
		"PLANT_anti_ship_gun",
		"PLANT_comms_bunker",
		"PLANT_light",
		"BUILD_tower_climbing_ropes",
		"PLANT_main_entrance",
		".*MG42_Dock",
		".*MG42_Command_Post",
		".*_Axis_MainEntrance.*",
		".*_Axis_WestRopes_.*",
		".*_Axis_SouthRopes_.*",
		"CAMP_Axis_CompoundWall_.*",
		"SMOKEBOMB_Axis_JumpWay_.*",
		".*_Axis_AntiShipGun_.*",
		".*_Axis_CompoundGate_.*",
		".*_Axis_CommsBunker_.*",
		".*_Axis_LightUp_.*",
		".*_Axis_LightBelow_.*",
	});

	SetAvailableMapGoals( TEAM.ALLIES, true, {
		".*_Allies_MainEntrance.*",
		".*_Allies_WestRopes_.*",
		".*_Allies_CompoundWall_.*",
		"PLANTMINE_Allies_Inside_.*",
	});

	SetGoalRole( "BUILD_Command_Post", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.AMBUSHER });
	SetGoalRole( "PLANT_Command_Post", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.AMBUSHER });
	SetGoalRole( "CHECKPOINT_forwardspawn", { ROLE.DEFENDER, ROLE.DEFENDER1, ROLE.AMBUSHER });

	SetGoalRole( ".*_Allies_MainEntrance.*", { ROLE.DEFENDER, ROLE.DEFENDER1 });
	SetGoalRole( ".*_Allies_AntiShipGun_0.*", ROLE.DEFENDER );
	SetGoalRole( ".*_Allies_CompGate_0.*", ROLE.DEFENDER );
	SetGoalRole( ".*_Allies_AntiShipGun_2.*", ROLE.DEFENDER1 );
	SetGoalRole( ".*_Allies_CompGate_1.*", ROLE.DEFENDER1 );
	SetGoalRole( "DEFEND_Allies_CompGateIns_.*", ROLE.DEFENDER1 );
	SetGoalRole( ".*_Allies_WestRopes_.*", ROLE.DEFENDER2 );
	SetGoalRole( ".*_Allies_CommsBunker_0.*", ROLE.DEFENDER2 );
	SetGoalRole( ".*_Allies_LightUp_1.*", ROLE.DEFENDER2 );
	SetGoalRole( ".*_Allies_CompoundWall_.*", ROLE.DEFENDER3 );
	SetGoalRole( ".*_Allies_CommsBunker_1.*", ROLE.DEFENDER3 );
	SetGoalRole( ".*_Allies_LightUp_0.*", ROLE.DEFENDER3 );
	SetGoalRole( "MOBILEMG42_Allies_AntiShipGun_.*", { ROLE.DEFENDER, ROLE.DEFENDER1 });
	SetGoalRole( "MOBILEMG42_Allies_CompGate_.*", { ROLE.DEFENDER, ROLE.DEFENDER1 });
	SetGoalRole( "AIRSTRIKE_Allies_WestRopes_.*", { ROLE.DEFENDER2, ROLE.DEFENDER3 });
	SetGoalRole( "AIRSTRIKE_Allies_CompoundWall_.*", { ROLE.DEFENDER2, ROLE.DEFENDER3 });
	SetGoalRole( "PLANTMINE_Allies_Inside_.*", { ROLE.DEFENDER2, ROLE.DEFENDER3 });
	SetGoalRole( "PLANT_ropes", { ROLE.DEFENDER2, ROLE.DEFENDER3 });
	SetGoalRole( "PLANT_west_ropes", { ROLE.DEFENDER2, ROLE.DEFENDER3 });
	SetGoalRole( "PLANT_tower_climbing_ropes", { ROLE.DEFENDER2, ROLE.DEFENDER3 });
	SetGoalRole( ".*_Allies_CompGateDest_.*", { ROLE.DEFENDER2, ROLE.DEFENDER3 });
	SetGoalRole( ".*_Allies_RopesWest_.*", { ROLE.DEFENDER2, ROLE.DEFENDER3 });
	SetGoalRole( ".*_Allies_RopesSouth_.*", { ROLE.DEFENDER2, ROLE.DEFENDER3 });
	SetGoalRole( ".*_Allies_AntiShipReinf_.*", { ROLE.DEFENDER2, ROLE.DEFENDER3 });

	SetGoalRole( "PLANT_compound_gate", { ROLE.AMBUSHER, ROLE.ROAMER });
	SetGoalRole( "PLANT_comms_bunker", ROLE.ROAMER );
	SetGoalRole( "PLANT_light", ROLE.ROAMER );
	SetGoalRole( "BUILD_tower_climbing_ropes", ROLE.ROAMER );
	SetGoalRole( "DEFUSE_tower_climbing_ropes.*", ROLE.ROAMER, true );
	SetGoalRole( ".*_Axis_CommsBunker_.*", ROLE.ROAMER );
	SetGoalRole( ".*_Axis_LightUp_.*", ROLE.ROAMER );
	SetGoalRole( ".*_Axis_LightBelow_.*", ROLE.ROAMER );
	SetGoalRole( "PLANT_anti_ship_gun", ROLE.AMBUSHER );
	SetGoalRole( ".*MG42_Command_Post", ROLE.AMBUSHER );
	SetGoalRole( ".*_Axis_AntiShipGun_.*", ROLE.AMBUSHER );
	SetGoalRole( ".*_Axis_CompoundGate_.*", ROLE.AMBUSHER );
	SetGoalRole( ".*_Axis_CommsLightDest_.*", ROLE.AMBUSHER );
	SetGoalRole( "BUILD_ropes", ROLE.ATTACKER3 );
	SetGoalRole( "DEFUSE_ropes.*", { ROLE.ATTACKER2, ROLE.ATTACKER3, ROLE.SNIPER }, true );
	SetGoalRole( "BUILD_west_ropes", ROLE.ATTACKER2 );
	SetGoalRole( "DEFUSE_west_ropes.*", { ROLE.ATTACKER2, ROLE.ATTACKER3, ROLE.SNIPER }, true );
	SetGoalRole( "PLANT_compound_wall", { ROLE.SNIPER, ROLE.ROAMER });
	SetGoalRole( "CAMP_Axis_CompoundWall_.*", ROLE.SNIPER );
	SetGoalRole( "PLANT_main_entrance", { ROLE.ATTACKER, ROLE.ATTACKER1, ROLE.AMBUSHER });
	SetGoalRole( ".*MG42_Dock", { ROLE.ATTACKER, ROLE.ATTACKER1 });
	SetGoalRole( "SNIPE_Axis_MainEntrance_.*", { ROLE.ATTACKER, ROLE.ATTACKER1 });
	SetGoalRole( "SMOKEBOMB_Axis_JumpWay_.*", { ROLE.ATTACKER, ROLE.ATTACKER1 });
	SetGoalRole( "SMOKEBOMB_Axis_MainEntrance_.*", { ROLE.ATTACKER, ROLE.ATTACKER1 });
	SetGoalRole( "SMOKEBOMB_Axis_MainEntrDest_.*", { ROLE.ATTACKER, ROLE.ATTACKER1 });
	SetGoalRole( "ATTACK_Axis_MainEntrance_.*", ROLE.ATTACKER );
	SetGoalRole( "ATTACK_Axis_MainEntranceUp_.*", ROLE.ATTACKER1 );
	SetGoalRole( "CAMP_Axis_WestRopes_.*", ROLE.ATTACKER2 );
	SetGoalRole( "CAMP_Axis_SouthRopes_.*", ROLE.ATTACKER3 );
	SetGoalRole( "SMOKEBOMB_Axis_SouthRopes_.*", { ROLE.ATTACKER2, ROLE.ATTACKER3 });

	//"RolePriorityBonus" compensation for some goals:
	SetGoalPriority( "CAMP_Axis_.*", 0.51, TEAM.AXIS, 0 );
	SetGoalPriority( "CAMP_Axis_CompoundWall_.*", 0.53, TEAM.AXIS, 0 );
	SetGoalPriority( ".*_Axis_CommsBunker_0.*", 0.53, TEAM.AXIS, 0 );
	SetGoalPriority( ".*_Axis_LightUp_0.*", 0.53, TEAM.AXIS, 0 );
	SetGoalPriority( ".*_Axis_LightUp_01", 0.52, TEAM.AXIS, 0 );
	SetGoalPriority( ".*_Axis_AntiShipGun_0.*", 0.53, TEAM.AXIS, 0 );
	SetGoalPriority( ".*_Axis_CompoundGate_0.*", 0.53, TEAM.AXIS, 0 );
	SetGoalPriority( "MOUNTMG42_.*", 0.60, 0, 0 );
	SetGoalPriority( "REPAIRMG42_.*", 0.71, 0, 0 );
	SetGoalPriority( "SMOKEBOMB_.*", 0.70, 0, 0 );
	SetGoalPriority( "SMOKEBOMB_Axis_MainEntrDest_.*", 0.72, 0, 0 );
	SetGoalPriority( "SMOKEBOMB_Axis_JumpWay_.*", 0.72, 0, 0 );
	SetGoalPriority( "SNIPE_Axis_MainEntrance_.*", 0.79, 0, 0 );
	SetGoalPriority( "BUILD_.*", 0.80, 0, 0 );
	SetGoalPriority( "BUILD_Command_Post", 0.58, 0, 0 );  //lower than checkpoint
	SetGoalPriority( "DEFUSE_Command_Post", 0.58, 0, 0, true );  //lower than checkpoint
	SetGoalPriority( "CHECKPOINT_forwardspawn", 0.60, 0, 0 );
	SetGoalPriority( "PLANT_.*", 0.71, 0, 0 );
	SetGoalPriority( "PLANT_compound_gate", 0.70, 0, 0 );
	SetGoalPriority( "BUILD_tower_climbing_ropes", 0.72, 0, 0 );
	SetGoalPriority( "BUILD_ropes", 0.70, 0, 0 );
	SetGoalPriority( "BUILD_west_ropes", 0.70, 0, 0 );

	SetGoalPriority( "DEFEND_Allies_LightUp_00", 0.51, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_LightUp_02", 0.51, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_LightUp_03", 0.51, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_LightUp_04", 0.51, TEAM.ALLIES, 0 );
	SetGoalPriority( "DEFEND_Allies_CompGateIns_.*", 0.52, TEAM.ALLIES, 0 );
	SetGoalPriority( "CALLARTILLERY_.*", 0.70, TEAM.ALLIES, 0 );
	SetGoalPriority( "AIRSTRIKE_.*", 0.70, TEAM.ALLIES, 0 );

	Util.SetMaxUsers( 1, "DEFEND_.*" );
	Util.SetMaxUsers( 1, "SMOKEBOMB_.*" );
	Util.SetMaxUsers( 1, "MOUNTMG42_.*" );
	Util.SetMaxUsers( 1, "REPAIRMG42_Dock" );
	Util.SetMaxUsers( 1, "PLANT_ropes" );
	Util.SetMaxUsers( 1, "PLANT_west_ropes" );
	Util.SetMaxUsers( 1, "BUILD_tower_climbing_ropes" );
	Util.SetMaxUsers( 2, "BUILD_Command_Post" );
	Util.SetMaxUsers( 2, "PLANT_Command_Post" );
	Util.SetMaxUsers( 5, "CHECKPOINT_forwardspawn" );

	Util.SetGoalRange( "SMOKEBOMB_Axis_SouthRopes_10", 350);
	Util.SetGoalRange( "SMOKEBOMB_Axis_SouthRopes_11", 300);
	Util.SetGoalRange( "SMOKEBOMB_Axis_MainEntrDest_.*", 450);
	Util.SetGoalRange( "SMOKEBOMB_Axis_JumpWay_.*", 280);
	Util.SetGoalRange( "BUILD_tower_climbing_ropes", 900);

	Util.SetGoalPosition( -468.802, -741.715, 1034.125, "PLANT_ropes" );
	Util.SetGoalPosition( -1645.254, 99.035, 1044.125, "PLANT_west_ropes" );
	Util.SetGoalPosition( -1091.168, -521.104, 2486.344, "PLANT_tower_climbing_ropes" );
	Util.SetGoalPosition( -145.044, 320, 1119.5, "PLANT_compound_gate" );
	Util.SetGoalPosition( -994.879, -95.888, 2608.125, "PLANT_light" );

	Util.AddUseWp( "PLANT_compound_gate", { "Compound_Gate_1", "Compound_Gate_2" } );
	Util.AddUseWp( "PLANT_main_entrance", { "Main_Entrance_1", "Main_Entrance_2" } );
	Util.AddUseWp( "PLANT_compound_wall", { "Compound_Wall_2", "Compound_Wall_4" } );
	Util.AddUseWp( "PLANT_tower_climbing_ropes", { "Tower_Climbing_Ropes_1", "Tower_Climbing_Ropes_2" } );
	Util.AddUseWp( "PLANT_anti_ship_gun", "Anti_Ship_Gun_1" );
	Util.AddUseWp( "BUILD_west_ropes", "West_Ropes_4" );

	Wp.SetWaypointFlag( "Tower_Climbing_Ropes_3", "closed", true );
	Wp.SetWaypointFlag( "Tower_Climbing_Ropes_4", "closed", true );
	Wp.SetWaypointFlag( "Tower_Climbing_Ropes_5", "closed", true );
	Wp.SetWaypointFlag( "Compound_Wall_1", "jump", false );
	Wp.SetWaypointFlag( "Compound_Wall_2", "jump", false );
	Wp.SetWaypointFlag( "Compound_Wall_3", "jump", false );
	Wp.SetWaypointFlag( "Bunker_Door_.*", { "door", "allies", "infiltrator" }, true );
	Wp.SetWaypointFlag( "Compound_Gate_Door_.*", { "door", "allies", "infiltrator" }, true );
	Wp.SetWaypointFlag( "West_Ropes_1", "closed", true );
	Wp.SetWaypointFlag( "West_Ropes_2", "closed", true );
	Wp.SetWaypointFlag( "West_Ropes_3", "closed", true );
	Wp.SetWaypointFlag( "South_Ropes_.*", "closed", true );
	Wp.SetWaypointFlag( "Lighthouse_Door", "closed", false );

	WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, WEAPON.MP40, true );
	WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, WEAPON.THOMPSON, true );
	WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, WEAPON.PANZERFAUST, false );
	WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, WEAPON.FLAMETHROWER, false );

	if(GetGameState() == "Playing")
	{
		sleep(5);
		EchoToScreen(0,"^3Omni-bot map script ^3by ^1Q^2i^3k^4i ^3and ^1n^2a^4t^8i^3v^5e12 ^3");
		Util.BotChat( 0, "say", "^3Omni-bot map script ^3by ^1Q^2i^3k^4i ^3and ^1n^2a^4t^8i^3v^5e12^7" , 1 );
	}
};

global OnBotJoin = function( bot )
{
	bot.TargetBreakableDist = 100;
	bot.MaxViewDistance = 2200;
	w = bot.GetWeapon(WEAPON.MOUNTABLE_MG42);
	w.PrimaryFire.AimOffsetZ = 20;

	Map.SetSpawn1(bot);
};

global InitializeRoutes = function()
{
	MapRoutes =
	{
		SNIPE_Axis_MainEntrance_32 =
		{
			ROUTE_Beach_Spawn =
			{
				ROUTE_Water_01 =
				{
					ROUTE_Water_02 =
					{
						ROUTE_Water_03 =
						{
							ROUTE_Water_04 = {},
						},
					},
				},
			},
		},

		PLANT_compound_gate =
		{
			ROUTE_Beach_Spawn =
			{
				ROUTE_MainEntranceWay_00 =
				{
					ROUTE_MainEntranceWay_01 =
					{
						ROUTE_MainEntranceWay_02 = {},
					},
				},
				ROUTE_WestRopesWay_00 =
				{
					ROUTE_WestRopesWay_01 = {},
				},
				ROUTE_SouthRopesWay_00 =
				{
					ROUTE_SouthRopesWay_01 =
					{
						ROUTE_SouthRopesWay_02 = {},
					},
				},
			},
		},

		PLANT_main_entrance =
		{
			ROUTE_Beach_Spawn =
			{
				ROUTE_MainEntrWay_00 =
				{
					ROUTE_MainEntrWay_01 = {},
				},
				ROUTE_WestRopesWay_00 =
				{
					ROUTE_WestRopesWay_01 =
					{
						ROUTE_JumpToAntiship = {},
						ROUTE_CompoundWallWay_01 =
						{
							Weight = 2,
							ROUTE_MastWay_10 =
							{
								ROUTE_CompoundGateWay = {},
							},
							ROUTE_Tanks_00 =
							{
								ROUTE_CompoundGateWay = {},
							},
						},
					},
				},
				ROUTE_SouthRopesWay_00 =
				{
					ROUTE_SouthRopesWay_01 =
					{
						ROUTE_SouthRopesWay_02 =
						{
							ROUTE_JumpToAntiship = {},
							ROUTE_CompoundWallWay_01 =
							{
								Weight = 2,
								ROUTE_MastWay_10 =
								{
									ROUTE_CompoundGateWay = {},
								},
								ROUTE_Tanks_00 =
								{
									ROUTE_CompoundGateWay = {},
								},
							},
						},
					},
				},
			},
		},
	};

	MapRoutes["SNIPE_Axis_MainEntrance_.*"] =
	{
		ROUTE_Beach_Spawn =
		{
			ROUTE_Water_01 =
			{
				ROUTE_Water_02 =
				{
					ROUTE_Water_03 =
					{
						ROUTE_Water_04 =
						{
							ROUTE_Water_05 = {},
						},
					},
				},
			},
		},
	};

	MapRoutes[".*_Axis_CompoundWall_.*"] =
	{
		ROUTE_Beach_Spawn =
		{
			ROUTE_WestRopesWay_00 =
			{
				ROUTE_WestRopesWay_01 = {},
			},
			ROUTE_SouthRopesWay_00 =
			{
				ROUTE_SouthRopesWay_01 =
				{
					ROUTE_SouthRopesWay_02 = {},
				},
			},
		},
	};

	MapRoutes[".*_Axis_LightUp_.*"] =
	{
		ROUTE_Beach_Spawn =
		{
			ROUTE_WestRopesWay_00 =
			{
				ROUTE_WestRopesWay_01 =
				{
					ROUTE_CompoundWallWay_00 =
					{
						Weight = 2,
						ROUTE_CompoundWallWay_C01 =
						{
							ROUTE_CompoundWallWay_S00 =
							{
								ROUTE_CompoundWallWay_S01 =
								{
									ROUTE_CompoundWallWay_S02 = {},
								},
							},
							ROUTE_CompoundWallWay_S03 =
							{
								ROUTE_CompoundWallWay_S01 =
								{
									ROUTE_CompoundWallWay_S02 = {},
								},
							},
						},
					},
					ROUTE_CompoundWallWay_01 =
					{
						ROUTE_ClimbingRopesWay_00 =
						{
							ROUTE_ClimbingRopesWay_01 =
							{
								ROUTE_ClimbingRopesWay_02A =
								{
									ROUTE_ClimbingRopesWay_02B = {},
								},
								ROUTE_ClimbingRopesWay_03A =
								{
									ROUTE_ClimbingRopesWay_03B = {},
								},
								ROUTE_ClimbingRopesWay_04A =
								{
									ROUTE_ClimbingRopesWay_04B = {},
								},
							},
						},
					},
				},
			},
			ROUTE_SouthRopesWay_00 =
			{
				ROUTE_SouthRopesWay_01 =
				{
					ROUTE_SouthRopesWay_02 =
					{
						ROUTE_CompoundWallWay_00 =
						{
							Weight = 2,
							ROUTE_CompoundWallWay_C01 =
							{
								ROUTE_CompoundWallWay_S00 =
								{
									ROUTE_CompoundWallWay_S01 =
									{
										ROUTE_CompoundWallWay_S02 = {},
									},
								},
								ROUTE_CompoundWallWay_S03 =
								{
									ROUTE_CompoundWallWay_S01 =
									{
										ROUTE_CompoundWallWay_S02 = {},
									},
								},
							},
						},
						ROUTE_CompoundWallWay_01 =
						{
							ROUTE_ClimbingRopesWay_00 =
							{
								ROUTE_ClimbingRopesWay_01 =
								{
									ROUTE_ClimbingRopesWay_02A =
									{
										ROUTE_ClimbingRopesWay_02B = {},
									},
									ROUTE_ClimbingRopesWay_03A =
									{
										ROUTE_ClimbingRopesWay_03B = {},
									},
									ROUTE_ClimbingRopesWay_04A =
									{
										ROUTE_ClimbingRopesWay_04B = {},
									},
								},
							},
						},
					},
				},
			},
		},
	};

	MapRoutes[".*_Axis_CommsBunker_.*"] =
	{
		ROUTE_Beach_Spawn =
		{
			ROUTE_WestRopesWay_00 =
			{
				ROUTE_WestRopesWay_01 =
				{
					ROUTE_CompoundWallWay_00 =
					{
						ROUTE_CompoundWallWay_R01 =
						{
							ROUTE_CompoundWallWay_R02 = {},
						},
						ROUTE_CompoundWallWay_L01 =
						{
							ROUTE_CompoundWallWay_L02 =
							{
								ROUTE_CompoundWallWay_L03 =
								{
									ROUTE_CompoundWallWay_L04 = {},
								},
							},
						},
						ROUTE_CompoundWallWay_C01 =
						{
							ROUTE_CompoundWallWay_C02 =
							{
								ROUTE_CompoundWallWay_L03 =
								{
									ROUTE_CompoundWallWay_L04 = {},
								},
							},
						},
					},
				},
			},
			ROUTE_SouthRopesWay_00 =
			{
				ROUTE_SouthRopesWay_01 =
				{
					ROUTE_SouthRopesWay_02 =
					{
						ROUTE_CompoundWallWay_00 =
						{
							ROUTE_CompoundWallWay_R01 =
							{
								ROUTE_CompoundWallWay_R02 = {},
							},
							ROUTE_CompoundWallWay_L01 =
							{
								ROUTE_CompoundWallWay_L02 =
								{
									ROUTE_CompoundWallWay_L03 =
									{
										ROUTE_CompoundWallWay_L04 = {},
									},
								},
							},
							ROUTE_CompoundWallWay_C01 =
							{
								ROUTE_CompoundWallWay_C02 =
								{
									ROUTE_CompoundWallWay_L03 =
									{
										ROUTE_CompoundWallWay_L04 = {},
									},
								},
							},
						},
					},
				},
			},
		},
	};

	MapRoutes[".*_Axis_AntiShipGun_.*"] =
	{
		ROUTE_Beach_Spawn =
		{
			ROUTE_MainEntranceWay_00 =
			{
				Weight = 2,
				ROUTE_MainEntranceWay_01 =
				{
					ROUTE_MainEntranceWay_02 = {},
				},
			},
			ROUTE_WestRopesWay_00 =
			{
				ROUTE_WestRopesWay_01 =
				{
					ROUTE_JumpToAntiship = {},
					ROUTE_CompoundWallWay_01 =
					{
						Weight = 2,
						ROUTE_MastWay_10 =
						{
							ROUTE_CompoundGateWay = {},
						},
						ROUTE_Tanks_00 =
						{
							ROUTE_CompoundGateWay = {},
						},
					},
				},
			},
			ROUTE_SouthRopesWay_00 =
			{
				ROUTE_SouthRopesWay_01 =
				{
					ROUTE_SouthRopesWay_02 =
					{
						ROUTE_JumpToAntiship = {},
						ROUTE_CompoundWallWay_01 =
						{
							Weight = 2,
							ROUTE_MastWay_10 =
							{
								ROUTE_CompoundGateWay = {},
							},
							ROUTE_Tanks_00 =
							{
								ROUTE_CompoundGateWay = {},
							},
						},
					},
				},
			},
		},
	};

	MapRoutes[".*_Allies_CommsBunker_.*"] =
	{
		ROUTE_Compound_Spawn =
		{
			ROUTE_CommBunkerR_00 =
			{
				Weight = 2,
				ROUTE_CommBunkerR_01 =  {},
			},
			ROUTE_CommBunkerM_00 =
			{
				Weight = 2,
				ROUTE_CommBunkerM_01 = {},
			},
			ROUTE_CommBunkerL_00 =
			{
				ROUTE_CommBunkerL_01 = {},
			},
		},
	};

	MapRoutes[".*_Allies_LightUp_.*"] =
	{
		ROUTE_Compound_Spawn =
		{
			ROUTE_ClimbingRopesWay_01 =
			{
				ROUTE_ClimbingRopesWay_02A =
				{
					ROUTE_ClimbingRopesWay_02B = {},
				},
				ROUTE_ClimbingRopesWay_03A =
				{
					ROUTE_ClimbingRopesWay_03B = {},
				},
				ROUTE_ClimbingRopesWay_04A =
				{
					ROUTE_ClimbingRopesWay_04B = {},
				},
			},
			ROUTE_StairsToLight_00 =
			{
				Weight = 2,
				ROUTE_StairsToLight_01 =
				{
					ROUTE_StairsToLight_02 = {},
				},
			},
			ROUTE_MastWay_00 =
			{
				Weight = 3,
				ROUTE_MastWay_01 =
				{
					ROUTE_MastWay_02 = {},
				},
			},
		},
	};

	MapRoutes["ATTACK_Axis_MainEntranceUp_.*"] = MapRoutes.PLANT_main_entrance;
	MapRoutes[".*MG42_Dock"] = MapRoutes["SNIPE_Axis_MainEntrance_.*"];
	MapRoutes.PLANT_compound_wall = MapRoutes[".*_Axis_CompoundWall_.*"];
	MapRoutes.PLANT_light = MapRoutes[".*_Axis_LightUp_.*"];
	MapRoutes.PLANT_comms_bunker = MapRoutes[".*_Axis_CommsBunker_.*"];
	MapRoutes.PLANT_anti_ship_gun = MapRoutes[".*_Axis_AntiShipGun_.*"];
	MapRoutes.PLANT_Command_Post = MapRoutes[".*_Axis_AntiShipGun_.*"];
	MapRoutes.BUILD_Command_Post = MapRoutes[".*_Axis_AntiShipGun_.*"];
	MapRoutes.CHECKPOINT_forwardspawn = MapRoutes[".*_Axis_AntiShipGun_.*"];
	MapRoutes.MOUNTMG42_Command_Post = MapRoutes[".*_Axis_AntiShipGun_.*"];

	Util.Routes(MapRoutes);
};
