CCCPaste

Tau Mission

import("ScarUtil.scar")
import("WXPScarUtil.scar")

function OnGameSetup()
	
	Setup_Player(2, "BERKYT", "tau_race", 1)
	Setup_Player(3, "Drone Tau", "npc_race", 0)
	
	g_Player2 = World_GetPlayerAt(2)
	
	Misc_PlayerTeamColor(g_Player2, "default_2")
	
	g_playerID = 0
	timerWaveKroot = 0
	timerFireWarrior = 0
	timerTank = 0
	timerSuperKroot = 0
	timerSuperTank = 0
	timerReinforcement = 0
	timerResearch = 0
	timerBase = 0
	timerOneMin = 0
	timerWinOrLose = 0
	timerCrysis = 0
	timerGlobal = 0
	timerReinforcementTau = 0
	timerAttackReinforcement = 0
	timerWavesWarriorCount = 0
	timerBaseKroot = 0
	timerFifteenMin = 0
	timerBaseTank = 0
	timerTwelveMin = 0
	timerBaseSuperKroot = 0
	timerTwentyMin = 0
	timerShift = 0
	timer30Min = 0
	g_SluggaLodout = 999
	checkDarkScreen = 1
	checkDarkScreen1 = 1
	
	checkSeePlayerArray = {1,1,1,1,1,1,1,1,1,1,1,1,1}
	
	checkWinOrLose = false
	Fow_OFF = false -- For off or on fow -- ONLY FOR TEST'S BATTTLES----------------------------------------------------------------------------------------------------------------------------------------------------------------
	
	g_ObjectiveIssued = nil
	g_ObjectiveEvent = nil
	
	sg_Bulders1 = "sg_BulderTau1"
	sg_Bulders2 = "sg_BulderTau2"
	
end

function OnInit()

	EGroup_Destroy("eg_DeleteSPNpc")

	--Camera_FocusOnTargetMarker("mkr_Player_HQ", 0)
	
	Cmd_MoveToMarker(sg_Bulders1, "mkr_DebugArmy1")
	Cmd_MoveToMarker(sg_Bulders2, "mkr_DebugArmy1")
	
	Fade_Start(2, true)
	
	
	Util_StartNIS( EVENTS.NIS_Opening ) 
	
	--local eg = "eg_All_Sp"
	--Entity_ForceAddOn(eg, "addon_tau_list_post_2)
	--local eg_LPTau = "eg_LP_Tau1"

	--Objective_Exists
	--Objective_ShowScreen ()
		
	--Player_GrantResearch ( World_GetPlayerAt(2)  "BERKYT",  String  researchName)
	--Player_GrantResearch ( World_GetPlayerAt(2),  String  researchName)
	--Player_SetMaxPopulationRes( World_GetPlayerAt(0),  100)
	
	SpawnEthereal()
	--Pick()
	Rule_SetupMusicPlaylist()
	LpTauAddon()
	
	Cpu_Enable(g_Player2, false)
	
	Rule_Add(Rule_CheckTrigger1)
	Rule_Add(Rule_CheckTrigger2)
	Rule_Add(Rule_CheckTrigger3)
	Rule_Add(Rule_CheckTrigger4)
	Rule_Add(Rule_CheckTrigger5)
	Rule_Add(Rule_CheckTrigger6)
	Rule_Add(Rule_CheckTrigger7)
	Rule_Add(Rule_CheckTrigger8)
	Rule_Add(WinOrLose)
	Rule_Add(AttackBaseTau)
	Rule_Add(Rule_CheckSeePlayer1)
	Rule_Add(Rule_CheckSeePlayer2)
	Rule_Add(Rule_CheckSeePlayer3)
	Rule_Add(Rule_CheckSeePlayer4)
	Rule_Add(Rule_CheckSeePlayer5)
	Rule_Add(Rule_CheckSeePlayer6)
	Rule_Add(SpawnCrisis)
	Rule_Add(AboutFortress)
	--TEST--------------------
	
	--SGroup_DestroyAllSquads("sg_AllSquads") -- ONLY FOR TEST'S BATTTLES----------------------------------------------------------------------------------------------------------------------------------------------------------------
	--Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(0), "sg_T4554TAU4", "space_marine_squad_assault", "mkr_MainHero1", 9, 9) -- ONLY FOR TEST'S BATTTLES----------------------------------------------------------------------------------------------------------------------------------------------------------------
	--Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(1), "sg_T4554TAU41", "space_marine_squad_assault", "mkr_MainHero2", 9, 9) -- ONLY FOR TEST'S BATTTLES----------------------------------------------------------------------------------------------------------------------------------------------------------------
	--Rule_AddOneShot(DebugArmy, 5) -- ONLY FOR TEST'S BATTTLES----------------------------------------------------------------------------------------------------------------------------------------------------------------
	
	--Rule_AddOneShot( TEST1, 10)
	--Rule_AddOneShot( TEST2, 10)
	--Rule_AddOneShot( TEST3, 10)
	--Rule_AddOneShot( TEST4, 10)
	--Rule_AddOneShot( TEST5, 10)
	--Rule_AddOneShot( TEST6, 10)
	
	--TEST--------------------
	Rule_AddOneShot(MainObjective, 40)
	Rule_AddOneShot( Waves, 60 * 5)
	Rule_AddOneShot( StartGame, 45)
	Rule_AddOneShot( Testers, 7)
	Rule_AddOneShot( EnjoyTheGame, 21)

	--Rule_AddOneShot(Rule_FrealLeap, 1)
	
	Rule_AddIntervalEx( WebMoney, 60, 3)
	
	Rule_AddInterval(Timer, 1)
	Rule_AddInterval(Reinforcement, 1)
	Rule_AddInterval(TauResearch, 1)
	Rule_AddInterval(BarracudaWaves, 14 * 60)
	Rule_AddInterval(WebMoneyInterval, 15 * 60)
	

	
	--g_SkullProbeSgName = "sg_SkullProbeR3r89efidbrgfed"
	--g_EvaSquadSgName = "sg_EvaR3efpdcnbgyuik"
	--g_FinalOrksSgName = "sg_ZelenieParniRrgefdipkrmnedgh"
	
	--FOW_RevealAll()
	
	
end

Scar_AddInit(OnInit)

-- Base functions

function Testers()

	Util_MissionTitle("Testers: Hensuto and Demer Nkardaz")
	
	if(Fow_OFF) then 
	
		FOW_RevealAll()
	
	end

end

function EnjoyTheGame()

	Util_MissionTitle("Enjoy the game! :)")

end

function WebMoney()

	Util_MissionTitle("WebMoney: RUB: R515364081475; USD: Z262863085617 (Check ReadMe-file)")

end

function WebMoneyInterval()

	Util_MissionTitle("WebMoney: RUB: R515364081475; USD: Z262863085617 (Check ReadMe-file)")

end

function StartGame()

	Util_StartNIS( EVENTS.NIS_StartGame ) 
	
	--FOW_RevealAll()
	
	--Rule_AddOneShot(Dialog, 5)
	
	Util_StartNIS( EVENTS.NIS_DialogShasAunroyr ) 
	
	--Util_StartNIS( EVENTS.NIS_Kroot ) 
	--Util_StartNIS( EVENTS.NIS_SuperKroot ) 
	--Util_StartNIS( EVENTS.NIS_FireWarrior ) 
	--Util_StartNIS( EVENTS.NIS_Tank ) 
	--Util_StartNIS( EVENTS.NIS_SuperTank ) 
	--Util_StartNIS( EVENTS.NIS_Reinforcement ) 

end 

function Dialog()

	Util_StartNIS( EVENTS.NIS_DialogShas ) 
	
end 

function TEST1()
	Util_StartNIS( EVENTS.NIS_Kroot ) 
end
function TEST2()
	Util_StartNIS( EVENTS.NIS_SuperKroot ) 
end
function TEST3()
	Util_StartNIS( EVENTS.NIS_FireWarrior ) 
end
function TEST4()
	Util_StartNIS( EVENTS.NIS_Tank ) 
end
function TEST5()
	Util_StartNIS( EVENTS.NIS_SuperTank ) 
end
function TEST6()
	Util_StartNIS( EVENTS.NIS_Reinforcement ) 
end

function Waves()

	timerShift = 0
	Rule_AddInterval(Check_Sp1, 1)
	Rule_AddInterval(Check_Sp2, 1)
	Rule_AddInterval(Check_Sp3, 1)
	Rule_AddInterval(Check_Sp4, 1)
	Rule_AddInterval(Check_Sp5, 1)
	Rule_AddInterval(BaseWaveTau, 90)

end 

function MainObjective()

	Ping_Marker("mkr_PingMainObjective", false, attack)
	local obj_table = {title_id = 10077899, short_desc_id = 10077900, help_tip_id = 10077901}
	Objective_Add(obj_table, true)
	
	Ping_Marker("mkr_DebugArmy1", false, attack)
	local obj_table1 = {title_id = 10077902, short_desc_id = 10077903, help_tip_id = 10077904}
	Objective_Add(obj_table1, true)

end

function SpawnEthereal()

	local index = World_GetRand(1, 8)
	
	Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_sdflkwepor3uo", "tau_ethereal_squad", "mkr_Win"..index, 1, 1)
	--Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_sdflkwepor3uo", "tau_ethereal_squad", "mkr_MainHero1", 1, 1)
	Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "usdfoiuwhef", "tau_honor_guard_fire_warrior_squad_advance_sp", "mkr_Win"..index, 2, 9)
	Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "usdfoiuwhef", "tau_pathfinder_squad", "mkr_Win"..index, 2, 9)
	Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "usdfoiuwhef", "tau_hammerhead_gunship_squad", "mkr_Win"..index, 2, 1)
	Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "usdfoiuwhef", "tau_krootox_squad", "mkr_Win"..index, 2, 1)
	
	Cmd_SetStance("sg_sdflkwepor3uo", STANCE_StandGround)
	Cpu_LockSGroupAcrossPlayers("sg_sdflkwepor3uo")

end

function TauResearch()

	if(timerResearch == 5)then
	
		Player_GrantResearch ( World_GetPlayerAt(2),  "tau_feral_leap_research")
		print("tau_feral_leap_research")
		
	elseif(timerResearch == 60 * 12 + 30) then
	
		Player_GrantResearch ( World_GetPlayerAt(2),  "tau_wargear_upgrade_05_advanced_sensor_array_research")
		print("tau_advanced_pulse_rifle_research")
	
	elseif(timerResearch == 60 * 16) then
	
		Player_GrantResearch ( World_GetPlayerAt(2),  "tau_improved_metallurgy")
		print("tau_improved_metallurgy_research")
		Player_GrantResearch ( World_GetPlayerAt(2),  "tau_targeting_optics")
		print("tau_targeting_optics_research")
	
	end

end

function LpTauAddon()

	local CountArrayLp = {"eg_LP_Tau1","eg_LP_Tau2","eg_LP_Tau3","eg_LP_Tau4","eg_LP_Tau5","eg_LP_Tau6","eg_LP_Tau7","eg_LP_Tau8","eg_LP_Tau9","eg_LP_Tau10","eg_LP_Tau11",
	"eg_LP_Tau12","eg_LP_Tau13","eg_LP_Tau14","eg_LP_Tau15","eg_LP_Tau16","eg_LP_Tau17","eg_LP_Tau18","eg_LP_Tau19"}

	for i = 1, table.getn(CountArrayLp) do

		if(i == 19) then
		
			--eg_LP_Tau19
			EGroup_ForceAddOn("eg_LP_Tau19", "addon_tau_list_post_1")
		
		else 
		
			EGroup_ForceAddOn("eg_LP_Tau"..i, "addon_tau_list_post_2")
		
		end
		
	end
	
--	EGroup_ForceAddOn("eg_LP_Tau19", "addon_tau_list_post_1")

end

function CheckEndGame()

	if (SGroup_Count("sg_sdflkwepor3uo") == 0) then
	
		Util_StartNIS( EVENTS.NIS_Win ) 
	
		--local title_id_1 = 10077899
		--Objective_SetState ( title_id_1,  OS_Complete)
		
		if(checkDarkScreen1 == 1) then
		
			checkDarkScreen1 = 0
		
			Fade_Start(2, false)
		
		end

		checkWinOrLose = true
		
	end
	
	if (SGroup_Count(sg_Bulders1) == 0 and SGroup_Count(sg_Bulders2) == 0) then
		
		if(checkDarkScreen == 1) then
		
			checkDarkScreen = 0
		
			Fade_Start(2, false)
		
		end

		checkWinOrLose = true
		
	end

end

function WinOrLose()

	if(timerWinOrLose == 3) then
	
		World_SetGameOver()
	
	end 

end

function DebugArmy()

	for i = 1, 7 do 
	
		--Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(0), "sg_o934b65hoi5hnyb6"..i, "space_marine_squad_assault", "mkr_DebugArmy"..i, 9, 9)
	
		Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(0), "sg_o934b65hoi5hnyb6"..i, "guard_squad_baneblade", "mkr_DebugArmy"..i, 5, 1)
		Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(0), "sg_o934b65hoi5hnyb6"..i, "eldar_squad_fire_prism", "mkr_DebugArmy"..i, 5, 1)
		Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(0), "sg_o934b65hoi5hnyb6"..i, "ork_squad_slugga", "mkr_DebugArmy"..i, 6, 99)
	
	end
	
end

function AttackBaseTau()

 --Player 1 

	if(timerCrysis == 60) then
		
		if(EGroup_IsCapturedByPlayer("eg_Sp_Capture1", World_GetPlayerAt(0), false)) then

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU234234")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU234234") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU234234", "tau_pathfinder_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_Capture("sg_TunnelSaboteurs_TAU234234", "eg_Sp_Capture1")	
					
			end

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU23424444434")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU23424444434") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU23424444434", "tau_crisis_suit_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU23424444434", "mkr_AttackSp1")		
					
			end
			
		end
		
		if(EGroup_IsCapturedByPlayer("eg_Sp_Capture2", World_GetPlayerAt(0), false)) then

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU23427734")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU23427734") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU23427734", "tau_pathfinder_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_Capture("sg_TunnelSaboteurs_TAU23427734", "eg_Sp_Capture2")
					
			end

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU2342444114434")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU2342444114434") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2342444114434", "tau_crisis_suit_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU2342444114434", "mkr_AttackSp2")		
					
			end
			
		end
		
		if(EGroup_IsCapturedByPlayer("eg_Sp_Capture3", World_GetPlayerAt(0), false)) then

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU23423qw4")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU23423qw4") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU23423qw4", "tau_pathfinder_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_Capture("sg_TunnelSaboteurs_TAU23423qw4", "eg_Sp_Capture3")
					
			end

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU234244f44434")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU234244f44434") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU234244f44434", "tau_crisis_suit_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU234244f44434", "mkr_AttackSp3")		
					
			end
			
		end

		if(EGroup_IsCapturedByPlayer("eg_Sp_Capture4", World_GetPlayerAt(0), false)) then

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU234qwwqqw234")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU234qwwqqw234") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU234qwwqqw234", "tau_pathfinder_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_Capture("sg_TunnelSaboteurs_TAU234qwwqqw234", "eg_Sp_Capture4")
					
			end

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU234df24444434")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU234df24444434") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU234df24444434", "tau_crisis_suit_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU234df24444434", "mkr_AttackSp4")		
					
			end
			
		end
		
		if(EGroup_IsCapturedByPlayer("eg_Sp_Capture5", World_GetPlayerAt(0), false)) then

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU2311121212az4234")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU2311121212az4234") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2311121212az4234", "tau_pathfinder_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_Capture("sg_TunnelSaboteurs_TAU2311121212az4234", "eg_Sp_Capture5")
					
			end

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU23424444werwdf434")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU23424444werwdf434") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU23424444werwdf434", "tau_crisis_suit_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU23424444werwdf434", "mkr_AttackSp5")		
					
			end
					
		end
		
		-- Player 2

		if(EGroup_IsCapturedByPlayer("eg_Sp_Capture1", World_GetPlayerAt(1), false)) then

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU234234")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU234234") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU234234", "tau_pathfinder_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_Capture("sg_TunnelSaboteurs_TAU234234", "eg_Sp_Capture1")	
					
			end

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU23424444434")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU23424444434") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU23424444434", "tau_crisis_suit_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU23424444434", "mkr_AttackSp1")		
					
			end
			
		end
		
		if(EGroup_IsCapturedByPlayer("eg_Sp_Capture2", World_GetPlayerAt(1), false)) then

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU23427734")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU23427734") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU23427734", "tau_pathfinder_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_Capture("sg_TunnelSaboteurs_TAU23427734", "eg_Sp_Capture2")
					
			end

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU2342444114434")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU2342444114434") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2342444114434", "tau_crisis_suit_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU2342444114434", "mkr_AttackSp2")		
					
			end
			
		end
		
		if(EGroup_IsCapturedByPlayer("eg_Sp_Capture3", World_GetPlayerAt(1), false)) then

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU23423qw4")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU23423qw4") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU23423qw4", "tau_pathfinder_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_Capture("sg_TunnelSaboteurs_TAU23423qw4", "eg_Sp_Capture3")
					
			end

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU234244f44434")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU234244f44434") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU234244f44434", "tau_crisis_suit_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU234244f44434", "mkr_AttackSp3")		
					
			end
			
		end

		if(EGroup_IsCapturedByPlayer("eg_Sp_Capture4", World_GetPlayerAt(1), false)) then

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU234qwwqqw234")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU234qwwqqw234") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU234qwwqqw234", "tau_pathfinder_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_Capture("sg_TunnelSaboteurs_TAU234qwwqqw234", "eg_Sp_Capture4")
					
			end

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU234df24444434")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU234df24444434") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU234df24444434", "tau_crisis_suit_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU234df24444434", "mkr_AttackSp4")		
					
			end
			
		end
		
		if(EGroup_IsCapturedByPlayer("eg_Sp_Capture5", World_GetPlayerAt(1), false)) then

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU2311121212az4234")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU2311121212az4234") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2311121212az4234", "tau_pathfinder_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_Capture("sg_TunnelSaboteurs_TAU2311121212az4234", "eg_Sp_Capture5")
					
			end

			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU23424444werwdf434")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU23424444werwdf434") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU23424444werwdf434", "tau_crisis_suit_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU23424444werwdf434", "mkr_AttackSp5")		
					
			end
					
		end
	
	end

end

function BaseWaveTau() 

	--if(timerReinforcementTau > 90) then
	
		--timerReinforcementTau = 0
		
		SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434")
		
		if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434") then
		
			print("function BaseWaveTau -> if1")
			-- ??????? ?? ??????? x ?? y
			-- math.fmod(x, y)- eta huinya tut ne rabotaet!
				
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434", "tau_fire_warrior_squad", "mkr_AttackBaseTau", 2, 3)
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434", "tau_crisis_suit_squad", "mkr_AttackBaseTau", 1, 1)
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434", "tau_kroot_carnivore_squad", "mkr_AttackBaseTau", 1, 5)
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434", "tau_pathfinder_squad", "mkr_AttackBaseTau", 1, 2)
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434", "tau_vespid_auxiliary_squad", "mkr_AttackBaseTau", 1, 9)
			
			print("math.mod(timerBase, 10) ", math.mod(timerBase, 10))
			
			if(timerFireWarrior > 60) then
			
				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434", "tau_stealth_team_squad", "mkr_AttackBaseTau", 1, 3)
			
			end
			
			if(math.mod(timerBase, 10) == 0 and timerBase > 1) then
			
				print(math.mod(timerBase, 10))
				print("function BaseWaveTau -> if2")
						
				local countWarrior = 0 
				
				for i = 1, timerBase / 10 do
					
					countWarrior = i
					
				end
				
				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434", "tau_fire_warrior_squad", "mkr_AttackBaseTau", countWarrior + 1, 6)
				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434", "tau_stealth_team_squad", "mkr_AttackBaseTau", countWarrior + 1, 3)
				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434", "tau_crisis_suit_squad", "mkr_AttackBaseTau", countWarrior + 1, 1)
				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434", "tau_kroot_carnivore_squad", "mkr_AttackBaseTau", countWarrior + 1, 9)
				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434", "tau_pathfinder_squad", "mkr_AttackBaseTau", countWarrior + 1, 9)
				
				if(math.mod(countWarrior, 2) == 0) then
				
					Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434", "tau_skyray_squad", "mkr_AttackBaseTau", countWarrior / 2 + 1, 9)				
				
				end

				
			end
				
			Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434", "mkr_Player_HQ")		
			
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "pweurpowieurpowier2", "tau_stealth_team_squad", "mkr_AttackBaseTau", 2, 3)
			
			Cmd_AttackSGroup("pweurpowieurpowier2", sg_Bulders1)
			
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "pweurpowieurpowier21", "tau_stealth_team_squad", "mkr_AttackBaseTau", 2, 3)
			
			Cmd_AttackSGroup("pweurpowieurpowier21", sg_Bulders2)
			
				--sg_Bulders1 = "sg_BulderTau1"
				--sg_Bulders2 = "sg_BulderTau2"
		
			for i = 1, 2 do
			
				SGroup_AddLeaders ( "sg_TunnelSaboteurs_TAU2342wdfgdfh444werwdf434")
				SGroup_AddLeaders ( "pweurpowieurpowier2")
				SGroup_AddLeaders ( "pweurpowieurpowier21")
				
			end
			
			if(checkSeePlayerArray[7] == 1) then
			
				checkSeePlayerArray[7] = 0
			
				Util_StartNIS( EVENTS.NIS_ReinforcementTau )
		
			elseif(checkSeePlayerArray[7] == 0) then
			
				local rand = World_GetRand(1,5)
				
				if(rand == 1) then
				
					Util_StartNIS( EVENTS.NIS_ReinforcementTau )
				
				end
			
			end
			
			
		end
	
	--end
	
end

function Timer()

	CheckEndGame()

	timerShift = timerShift + 1 

	timerAttackReinforcement = timerAttackReinforcement + 1 

	timerReinforcementTau = timerReinforcementTau + 1

	timerGlobal = timerGlobal + 1
	
	--print("timerBase: ", timerBase)

	timerResearch = timerResearch + 1
	timerOneMin = timerOneMin + 1
	
	if(timerOneMin == 60 * 10) then
		
		timerBase = timerBase + 10
		
		timerOneMin = 0
	
	end
	
	timerFifteenMin = timerFifteenMin + 1
	
	if(timerFifteenMin == 60 * 15) then
	
		timerBaseKroot = timerBaseKroot + 15
		
		timerFifteenMin = 0
	
	end
	
	timerTwelveMin = timerTwelveMin + 1
	
	if(timerTwelveMin == 60 * 12) then
	
		timerBaseTank = timerBaseTank + 12
		
		timerTwelveMin = 0
	
	end
	
	timerTwentyMin = timerTwentyMin + 1
	
	if(timerTwentyMin == 60 * 20) then
	
		timerBaseSuperKroot = timerBaseSuperKroot + 20
		
		timerTwentyMin = 0
	
	end

	if (timerTank == 241) then
		
		timerTank = 0
	
	end
	
	timerTank = timerTank + 1

	if (timerFireWarrior == 301) then
		
		timerFireWarrior = 0
	
	end
	
	timerFireWarrior = timerFireWarrior + 1
	
	if (timerWaveKroot == 301) then
		
		timerWaveKroot = 0
	
	end
	
	timerWaveKroot = timerWaveKroot + 1	
	
	if (timerSuperKroot == 701) then

		timerSuperKroot = 0
	
	end
	
	timerSuperKroot = timerSuperKroot + 1	
	
	
	if (timerSuperTank == 701) then

		timerSuperTank = 0
	
	end
	
	timerSuperTank = timerSuperTank + 1
	
	
	if (timerReinforcement == 301) then

		timerReinforcement = 0
	
	end
	
	timerReinforcement = timerReinforcement + 1
	
	if(checkWinOrLose == true) then
	
		timerWinOrLose = timerWinOrLose + 1
	
	end
	
	if(timerCrysis == 61) then
	
		timerCrysis = 0
	
	end
	
	timerCrysis = timerCrysis + 1
	
	if(timer30Min == 40 * 60) then
	
		timer30Min = 0
	
	end
	
	timer30Min = timer30Min + 1
	
end

--function Pick()

	--for i = 1, 5 do
	
		--Ping_Marker("mkr_SpawnTauWave"..i, false, attack)
	
	--end

--end


function Rule_SetupMusicPlaylist()

	Util_MissionTitle("By: BERKYT")

	t_music = {"MU_IG_STR_Tau", "MU_IG_RAC_Tau", "MU_IG_STR_Tau_perc", "MU_IG_STR_Tau_perc_str", "MU_IG_STR_Tau_perc_brass"}
	Playlist_Manager( PC_Music, t_music, true, true , {20, 40})
	t_ambient_sound = {"ambient_space"}
	Playlist_Manager( PC_Ambient, t_ambient_sound, true, true , {2, 4})
	
end

function playerHasAnySquadAtMarker(playerId, mkr)

    local sgName = "sg_phasam_17684187"

    SGroup_CreateIfNotFound(sgName)
    SGroup_Clear(sgName)
    Player_GetAllSquadsNearMarker(playerId, sgName, mkr)

    if (SGroup_Count(sgName) > 0) then
        return true
    end

    return false

end

-- Game logic

--function Rule_FrealLeap()

	--Player_GrantResearch(World_GetPlayerAt(2),  "tau_feral_leap_research")

--end

function BarracudaWaves()

	SGroup_CreateIfNotFound("sg_tau_barracuda_squad")
	
	if SGroup_IsEmpty("sg_tau_barracuda_squad") then
	
		Util_CreateSquadsAtMarker(World_GetPlayerAt(2),"sg_tau_barracuda_squad","tau_barracuda_squad","mkr_AttackBaseTau",2,1)
		
		local rand = World_GetRand(1,3) 
		
		if(checkSeePlayerArray[13] == 1) then
			
			Util_StartNIS( EVENTS.NIS_BarracudaWaves )
			
			print("IF1 -BarracudaWaves-")
		
			checkSeePlayerArray[13] = 0
		
		elseif(rand == 1) then
		
			Util_StartNIS( EVENTS.NIS_BarracudaWaves )
		
		end
		
		Cmd_AttackMoveMarker("sg_tau_barracuda_squad", "mkr_Player_HQ")	
	
	end

	
end

function AboutFortress()

	if(check2323 == nil) then
	
		if(playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_AboutFortress") or playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_AboutFortress")) then
		
			Util_StartNIS( EVENTS.NIS_AboutFortress )
			
			check2323 = true
		
		end 
	
	end

end

-- Kroots
function Rule_CheckSeePlayer1()

	if (g_orksFromTrigger0Created115 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_CheckSeePlayer1") or playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_CheckSeePlayer1")) then
		
			Util_StartNIS( EVENTS.NIS_Kroot ) 
			
			Ping_Marker("mkr_SpawnTauWave1", false, attack)
			
			g_orksFromTrigger0Created115 = true
			
			--?????? obj_table:
			local obj_table = {title_id = 10077884, short_desc_id = 10077885, help_tip_id = 10077886}
			--???????? ????? ????, ????????? ??????? ?????. 
			Objective_Add(obj_table, false)

			--?????????? ???? OS_Complete ??? OS_Failed 
			
		end

    end  
	
	if((EGroup_IsCapturedByPlayer("eg_Sp_Capture1", World_GetPlayerAt(0), false) or EGroup_IsCapturedByPlayer("eg_Sp_Capture1", World_GetPlayerAt(1), false)) and checkSeePlayerArray[1] == 1) then

		checkSeePlayerArray[1] = 0
		
		local title_id_1 = 10077884
		Objective_SetState ( title_id_1,  OS_Complete)
			
	end

end 
--Fire Warrior
function Rule_CheckSeePlayer2()

	if (g_orksFromTrigger0Created1151 == nil) then
	
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_CheckSeePlayer2") or playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_CheckSeePlayer2")) then
		
			Util_StartNIS( EVENTS.NIS_FireWarrior ) 
			
			--Util_StartNIS( EVENTS.NIS_Sector3 ) 
		
			Ping_Marker("mkr_SpawnTauWave2", false, attack)
			
			g_orksFromTrigger0Created1151 = true
			
			--?????? obj_table:
			local obj_table = {title_id = 10077887, short_desc_id = 10077888, help_tip_id = 10077889}
			--???????? ????? ????, ????????? ??????? ?????. 
			Objective_Add(obj_table, false)

			--?????????? ???? OS_Complete ??? OS_Failed 
			
		end

    end  
	
	if((EGroup_IsCapturedByPlayer("eg_Sp_Capture2", World_GetPlayerAt(0), false) or EGroup_IsCapturedByPlayer("eg_Sp_Capture2", World_GetPlayerAt(1), false)) and checkSeePlayerArray[2] == 1) then

		checkSeePlayerArray[2] = 0
		
		local title_id_1 = 10077887
		Objective_SetState ( title_id_1,  OS_Complete)
			
	end

end 
--Tanks
function Rule_CheckSeePlayer3()

	if (g_orksFromTrigger0Created1152 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_CheckSeePlayer3") or playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_CheckSeePlayer3")) then
			
			Util_StartNIS( EVENTS.NIS_Tank ) 
			
			Ping_Marker("mkr_SpawnTauWave3", false, attack)
			
			g_orksFromTrigger0Created1152 = true
			
			--?????? obj_table:
			local obj_table = {title_id = 10077890, short_desc_id = 10077891, help_tip_id = 10077892}
			--???????? ????? ????, ????????? ??????? ?????. 
			Objective_Add(obj_table, false)

			--?????????? ???? OS_Complete ??? OS_Failed 
			
		end

    end  
	
	if((EGroup_IsCapturedByPlayer("eg_Sp_Capture3", World_GetPlayerAt(0), false) or EGroup_IsCapturedByPlayer("eg_Sp_Capture3", World_GetPlayerAt(1), false)) and checkSeePlayerArray[3] == 1) then

		checkSeePlayerArray[3] = 0
		
		local title_id_1 = 10077890
		Objective_SetState ( title_id_1,  OS_Complete)
			
	end

end 
--Krootox
function Rule_CheckSeePlayer4()

	if (g_orksFromTrigger0Created1153 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_CheckSeePlayer4") or playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_CheckSeePlayer4")) then
			
			Util_StartNIS( EVENTS.NIS_SuperKroot ) 
			
			Ping_Marker("mkr_SpawnTauWave4", false, attack)
			
			g_orksFromTrigger0Created1153 = true
			
			--?????? obj_table:
			local obj_table = {title_id = 10077893, short_desc_id = 10077894, help_tip_id = 10077895}
			--???????? ????? ????, ????????? ??????? ?????. 
			Objective_Add(obj_table, false)

			--?????????? ???? OS_Complete ??? OS_Failed 
			
		end

    end  
	
	if((EGroup_IsCapturedByPlayer("eg_Sp_Capture4", World_GetPlayerAt(0), false) or EGroup_IsCapturedByPlayer("eg_Sp_Capture4", World_GetPlayerAt(1), false)) and checkSeePlayerArray[4] == 1) then

		checkSeePlayerArray[4] = 0
		
		local title_id_1 = 10077893
		Objective_SetState ( title_id_1,  OS_Complete)
			
	end

end 
--Riba Molot
function Rule_CheckSeePlayer5()

	if (g_orksFromTrigger0Created1154 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_CheckSeePlayer5") or playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_CheckSeePlayer5")) then
			
			Util_StartNIS( EVENTS.NIS_SuperTank ) 
			
			Ping_Marker("mkr_SpawnTauWave5", false, attack)
			
			g_orksFromTrigger0Created1154 = true
			
			--?????? obj_table:
			local obj_table = {title_id = 10077881, short_desc_id = 10077882, help_tip_id = 10077883}
			--???????? ????? ????, ????????? ??????? ?????. 
			Objective_Add(obj_table, false)

			--?????????? ???? OS_Complete ??? OS_Failed 
			
		end

    end  
	
	if((EGroup_IsCapturedByPlayer("eg_Sp_Capture5", World_GetPlayerAt(0), false) or EGroup_IsCapturedByPlayer("eg_Sp_Capture5", World_GetPlayerAt(1), false)) and checkSeePlayerArray[5] == 1) then

		checkSeePlayerArray[5] = 0
		
		local title_id_1 = 10077881
		Objective_SetState ( title_id_1,  OS_Complete)
			
	end

end 
--Reinforcement
function Rule_CheckSeePlayer6()

	if (g_orksFromTrigger0Created1154756 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_CheckSeePlayerReinforcementBase") or playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_CheckSeePlayerReinforcementBase")) then
			
			Util_StartNIS( EVENTS.NIS_Reinforcement )
			
			Ping_Marker("mkr_AttackAndDestroy", false, attack)
			
			g_orksFromTrigger0Created1154756 = true
			
			--?????? obj_table:
			local obj_table = {title_id = 10077896, short_desc_id = 10077897, help_tip_id = 10077898}
			--???????? ????? ????, ????????? ??????? ?????. 
			Objective_Add(obj_table, false)

			--?????????? ???? OS_Complete ??? OS_Failed 
			
		end

    end  
	
	if((EGroup_IsCapturedByPlayer("eg_Sp_Reinforcement", World_GetPlayerAt(0), false) or EGroup_IsCapturedByPlayer("eg_Sp_Reinforcement", World_GetPlayerAt(1), false)) and checkSeePlayerArray[6] == 1) then

		checkSeePlayerArray[6] = 0
		
		local title_id_1 = 10077896
		Objective_SetState ( title_id_1,  OS_Complete)
			
	end

end 

function Rule_CheckTrigger1()

    if (g_orksFromTrigger0Created == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_JumpToStells1")) then
		
			Util_StartNIS( EVENTS.NIS_Sector3 ) 
			
			g_orksFromTrigger0Created = true
            CreateAndMoveTau1(World_GetPlayerAt(2))
			
		end

    end  
	
	if (g_orksFromTrigger0Created == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_JumpToStells1")) then
			
			g_orksFromTrigger0Created = true
            CreateAndMoveTau1(World_GetPlayerAt(2))
			
		end

    end

end

function CreateAndMoveTau1(playerId)

    local markerToJump = "mkr_JumpToStells1"
    local markerFromSpawn = "mkr_StellsFrom1"

    local sg = "sg_spOrksTriger1"
	local bp = "tau_stealth_team_squad"
    local mkr = ""
    local num = 1

    Util_CreateSquadsAtMarkerEx(playerId, sg, bp, markerFromSpawn, num, g_SluggaLodout)
	
	local rand = World_GetRand(1,5)
	
	if(rand == 1) then
	
		Util_CreateSquadsAtMarkerEx(playerId, sg,"tau_crisis_suit_squad" , markerFromSpawn, num, 1)
	
	end

	Cmd_JumpToMarker(sg, markerToJump)

end

function Rule_CheckTrigger2()

    if (g_orksFromTrigger0Created1 == nil) then
	
	
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_JumpToStells2")) then
			
			g_orksFromTrigger0Created1 = true
            CreateAndMoveTau2(World_GetPlayerAt(2))
			
		end

    end

    if (g_orksFromTrigger0Created1 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_JumpToStells2")) then
			
			g_orksFromTrigger0Created1 = true
            CreateAndMoveTau2(World_GetPlayerAt(2))
			
		end

    end

end

function CreateAndMoveTau2(playerId)

    local markerToJump = "mkr_JumpToStells2"
    local markerFromSpawn = "mkr_StellsFrom2"

    local sg = "sg_spOrksTriger2"
	local bp = "tau_stealth_team_squad"
    local mkr = ""
    local num = 1



    Util_CreateSquadsAtMarkerEx(playerId, sg, bp, markerFromSpawn, num, g_SluggaLodout)
	
	local rand = World_GetRand(1,5)
	
	if(rand == 1) then
	
		Util_CreateSquadsAtMarkerEx(playerId, sg, "tau_crisis_suit_squad", markerFromSpawn, num, 1)
	
	end


	Cmd_JumpToMarker(sg, markerToJump)

end

function Rule_CheckTrigger3()

    if (g_orksFromTrigger0Created2 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_JumpToStells3")) then
			
			g_orksFromTrigger0Created2 = true
            CreateAndMoveTau3(World_GetPlayerAt(2))
			
		end

    end

    if (g_orksFromTrigger0Created2 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_JumpToStells3")) then
			
			g_orksFromTrigger0Created2 = true
            CreateAndMoveTau3(World_GetPlayerAt(2))
			
		end

    end

end

function CreateAndMoveTau3(playerId)

    local markerToJump = "mkr_JumpToStells3"
    local markerFromSpawn = "mkr_StellsFrom3"

    local sg = "sg_spOrksTriger3"
	local bp = "tau_stealth_team_squad"
    local mkr = ""
    local num = 1



    Util_CreateSquadsAtMarkerEx(playerId, sg, bp, markerFromSpawn, num, g_SluggaLodout)
	
	local rand = World_GetRand(1,5)
	
	if(rand == 1) then
	
		Util_CreateSquadsAtMarkerEx(playerId, sg, "tau_crisis_suit_squad", markerFromSpawn, num, 1)
	
	end


	Cmd_JumpToMarker(sg, markerToJump)

end

function Rule_CheckTrigger4()

    if (g_orksFromTrigger0Created3 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_JumpToStells4")) then
			
			g_orksFromTrigger0Created3 = true
            CreateAndMoveTau4(World_GetPlayerAt(2))
			
		end

    end

    if (g_orksFromTrigger0Created3 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_JumpToStells4")) then
			
			g_orksFromTrigger0Created3 = true
            CreateAndMoveTau4(World_GetPlayerAt(2))
			
		end

    end

end

function CreateAndMoveTau4(playerId)

    local markerToJump = "mkr_JumpToStells4"
    local markerFromSpawn = "mkr_StellsFrom4"

    local sg = "sg_spOrksTriger4"
	local bp = "tau_stealth_team_squad"
    local mkr = ""
    local num = 1



    Util_CreateSquadsAtMarkerEx(playerId, sg, bp, markerFromSpawn, num, g_SluggaLodout)
	
	local rand = World_GetRand(1,5)
	
	if(rand == 1) then
	
		Util_CreateSquadsAtMarkerEx(playerId, sg,"tau_crisis_suit_squad" , markerFromSpawn, num, 1)
	
	end


	Cmd_JumpToMarker(sg, markerToJump)

end

function Rule_CheckTrigger5()

    if (g_orksFromTrigger0Created4 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_JumpToStells5")) then
			
			g_orksFromTrigger0Created4 = true
            CreateAndMoveTau5(World_GetPlayerAt(2))
			
		end

    end

    if (g_orksFromTrigger0Created4 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_JumpToStells5")) then
			
			g_orksFromTrigger0Created4 = true
            CreateAndMoveTau5(World_GetPlayerAt(2))
			
		end

    end

end

function CreateAndMoveTau5(playerId)

    local markerToJump = "mkr_JumpToStells5"
    local markerFromSpawn = "mkr_StellsFrom5"

    local sg = "sg_spOrksTriger5"
	local bp = "tau_stealth_team_squad"
    local mkr = ""
    local num = 1



    Util_CreateSquadsAtMarkerEx(playerId, sg, bp, markerFromSpawn, num, g_SluggaLodout)
	
	local rand = World_GetRand(1,5)
	
	if(rand == 1) then
	
		Util_CreateSquadsAtMarkerEx(playerId, sg, "tau_crisis_suit_squad", markerFromSpawn, num, 1)
	
	end


	Cmd_JumpToMarker(sg, markerToJump)

end

function Rule_CheckTrigger6()

    if (g_orksFromTrigger0Created5 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_JumpToStells6")) then
			
			g_orksFromTrigger0Created5 = true
            CreateAndMoveTau6(World_GetPlayerAt(2))
			
		end

    end
	
    if (g_orksFromTrigger0Created5 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_JumpToStells6")) then
			
			g_orksFromTrigger0Created5 = true
            CreateAndMoveTau6(World_GetPlayerAt(2))
			
		end

    end

end

function CreateAndMoveTau6(playerId)

    local markerToJump = "mkr_JumpToStells6"
    local markerFromSpawn = "mkr_StellsFrom6"

    local sg = "sg_spOrksTriger6"
	local bp = "tau_stealth_team_squad"
    local mkr = ""
    local num = 3



    Util_CreateSquadsAtMarkerEx(playerId, sg, bp, markerFromSpawn, num, g_SluggaLodout)
	
	local rand = World_GetRand(1,5)
	
	if(rand == 1) then
	
		Util_CreateSquadsAtMarkerEx(playerId, sg, "tau_crisis_suit_squad", markerFromSpawn, num, 1)
	
	end


	Cmd_JumpToMarker(sg, markerToJump)

end

function Rule_CheckTrigger7()

    if (g_orksFromTrigger0Created6 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_Surprise")) then
			
			g_orksFromTrigger0Created6 = true
            CreateAndMoveTau7(World_GetPlayerAt(2))
			
		end

    end
	
    if (g_orksFromTrigger0Created6 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_Surprise")) then
			
			g_orksFromTrigger0Created6 = true
            CreateAndMoveTau7(World_GetPlayerAt(2))
			
		end

    end

end

function CreateAndMoveTau7(playerId)

    local markerToJump = "mkr_Player_HQ"
    local markerFromSpawn = "mkr_SurpriseWave"

    local sg = "sg_spOrksTriger7"
	local bp = "tau_krootox_squad"
    local mkr = ""
    local num = 3



    Util_CreateSquadsAtMarkerEx(playerId, sg, bp, markerFromSpawn, num, g_SluggaLodout)
    Util_CreateSquadsAtMarkerEx(playerId, sg, "tau_hammerhead_gunship_squad", markerFromSpawn, num, g_SluggaLodout)
    Util_CreateSquadsAtMarkerEx(playerId, sg, "tau_pathfinder_squad", markerFromSpawn, num, g_SluggaLodout)
	
	local rand = World_GetRand(1,5)
	
	if(rand == 1) then
	
		Util_CreateSquadsAtMarkerEx(playerId, sg,"tau_crisis_suit_squad" , markerFromSpawn, num, 1)
	
	end


	Cmd_AttackMoveMarker(sg, markerToJump)

end

function SpawnCrisis()

    if (g_orksFromTrigger0Created112 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_CheckCrysis"))then --or playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_CheckCrysis" ) then
		
			g_orksFromTrigger0Created112 = true

			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "123123123", "tau_crisis_suit_squad", "mkr_Crysis1", 1, 1)
			Cmd_JumpToMarker("123123123", "mkr_ToCrysis1")
			
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "1231231231", "tau_crisis_suit_squad", "mkr_Crysis2", 1, 1)
			Cmd_JumpToMarker("1231231231", "mkr_ToCrysis2")	
			
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "123123123121", "tau_crisis_suit_squad", "mkr_Crysis3", 1, 1)
			Cmd_JumpToMarker("123123123121", "mkr_ToCrysis3")
	
		end
	
	end

end

function Rule_CheckTrigger8()

    if (g_orksFromTrigger0Created7 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(0), "mkr_JumpToStells7")) then
			
			g_orksFromTrigger0Created7 = true
            CreateAndMoveTau8(World_GetPlayerAt(2))
			
		end

    end

    if (g_orksFromTrigger0Created7 == nil) then
	
        if (playerHasAnySquadAtMarker(World_GetPlayerAt(1), "mkr_JumpToStells7")) then
			
			g_orksFromTrigger0Created7 = true
            CreateAndMoveTau8(World_GetPlayerAt(2))
			
		end

    end

end

function CreateAndMoveTau8(playerId)

    local markerToJump = "mkr_JumpToStells7"
    local markerFromSpawn = "mkr_StellsFrom7"

    local sg = "sg_spOrksTriger8"
	local bp = "tau_stealth_team_squad"
    local mkr = ""
    local num = 2



    Util_CreateSquadsAtMarkerEx(playerId, sg, bp, markerFromSpawn, num, g_SluggaLodout)
	
	local rand = World_GetRand(1,15)
	
	if(rand == 1) then
	
		Util_CreateSquadsAtMarkerEx(playerId, sg, "tau_crisis_suit_squad", markerFromSpawn, num, 1)
	
	end


	Cmd_JumpToMarker(sg, markerToJump)

end

function Check_Sp1()

	if (not EGroup_IsCapturedByPlayer("eg_Sp_Capture1", World_GetPlayerAt(0), false) and not EGroup_IsCapturedByPlayer("eg_Sp_Capture1", World_GetPlayerAt(1), false)) then
	
		if(timerShift > 3 * 60) then
		
			if(checkSeePlayerArray[8] == 1) then
			
				checkSeePlayerArray[8] = 0
				
				timerWaveKroot = 0
			
			elseif(timerWaveKroot == 300) then
			
				print("WAVE SP1")
			
				SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU1")
					
				if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU1") then
					
					Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU1", "tau_kroot_carnivore_squad", "mkr_SpawnTauWave1", 3, 5)
					
					if(math.mod(timerBaseKroot, 15) == 0 and timerBaseKroot > 1) then
					
						local countWarrior = 0 
						
						for i = 1, timerBaseKroot / 15 do
							
							countWarrior = i
							
						end
						
						Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU1", "tau_kroot_carnivore_squad", "mkr_SpawnTauWave1", countWarrior + 1, 5)
						
					end
					
					Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU1", "mkr_Player_HQ")
					
				end
				
			end
			
		end
	
	end

end

function Check_Sp2()

	if (not EGroup_IsCapturedByPlayer("eg_Sp_Capture2", World_GetPlayerAt(0), false) and not EGroup_IsCapturedByPlayer("eg_Sp_Capture2", World_GetPlayerAt(1), false)) then
	
		if(timerShift > 2 * 60) then
		
			if(checkSeePlayerArray[9] == 1) then
			
				checkSeePlayerArray[9] = 0
				
				timerFireWarrior = 0
			
			elseif(timerFireWarrior == 300) then
			
				print("WAVE SP2")
			
				SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU2")
		
				if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU2") then

					Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2", "tau_fire_warrior_squad", "mkr_SpawnTauWave2", 3, 6)
					Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2", "tau_crisis_suit_squad", "mkr_SpawnTauWave2", 1, 1)
					
					if(math.mod(timerBaseSuperKroot, 20) == 0 and timerBaseSuperKroot > 1) then
								
						local countWarrior = 0 
						
						for i = 1, timerBaseSuperKroot / 20 do
							
							countWarrior = i
							
						end
						
						Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2", "tau_fire_warrior_squad", "mkr_SpawnTauWave2", countWarrior + 1, 6)
						Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2", "tau_crisis_suit_squad", "mkr_SpawnTauWave2", countWarrior + 1, 1)
						
					end
					
					for i = 1, 2 do
			
						SGroup_AddLeaders ( "sg_TunnelSaboteurs_TAU2")
		
					end
					
					Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU2", "mkr_Player_HQ")
					
				end
			
			end
		
		end
		
	end

end


function Check_Sp3()

	if (not EGroup_IsCapturedByPlayer("eg_Sp_Capture3", World_GetPlayerAt(0), false) and not EGroup_IsCapturedByPlayer("eg_Sp_Capture3", World_GetPlayerAt(1), false)) then
	
		if(timerShift > 6 * 60) then
		
			if(checkSeePlayerArray[10] == 1) then
			
				checkSeePlayerArray[10] = 0
				
				timerTank = 0
			
			elseif(timerTank == 240) then
			
				print("WAVE SP3")
			
				SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU3")
		
				if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU3") then
				
					if(timerGlobal > 700) then
					
						Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU3", "tau_drone_squad", "mkr_SpawnTauWave3", 2, 5)
					
					end 

					Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU3", "tau_skyray_squad", "mkr_SpawnTauWave3", 1, 1)
					Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU3", "tau_drone_harbinger_squad", "mkr_SpawnTauWave3", 1, 1)
					
					if(math.mod(timerBaseSuperKroot, 20) == 0 and timerBaseSuperKroot > 1) then
								
						local countWarrior = 0 
						
						for i = 1, timerBaseSuperKroot / 20 do
							
							countWarrior = i
							
						end
						
						Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU3", "tau_skyray_squad", "mkr_SpawnTauWave3", countWarrior + 1, 1)
						Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU3", "tau_drone_harbinger_squad", "mkr_SpawnTauWave3", countWarrior + 1, 1)
						
					end
					
					Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU3", "mkr_Player_HQ")
					
				end
			
			end
		
		end

	end

end

function Check_Sp4()

	if (not EGroup_IsCapturedByPlayer("eg_Sp_Capture4", World_GetPlayerAt(0), false) and not EGroup_IsCapturedByPlayer("eg_Sp_Capture4", World_GetPlayerAt(1), false)) then
	
		if(timerShift > 7 * 60) then
		
			if(checkSeePlayerArray[11] == 1) then
			
				checkSeePlayerArray[11] = 0
				
				timerSuperKroot = 0
			
			elseif(timerSuperKroot == 700) then
			
				print("WAVE SP4")
			
				SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU4")
					
				if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU4") then
					
					Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU4", "tau_krootox_squad", "mkr_SpawnTauWave4", 2, 2)
					
					if(math.mod(timer30Min, 40) == 0 and timer30Min > 1) then
								
						local countWarrior = 0 
						
						for i = 1, timer30Min / 40 do
							
							countWarrior = i
							
						end
						
						Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU4", "tau_krootox_squad", "mkr_SpawnTauWave4", countWarrior + 1, 1)
						--Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU4", "tau_drone_harbinger_squad", "mkr_SpawnTauWave2", countWarrior + 1, 1)
						
					end
					
					Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU4", "mkr_Player_HQ")
					
				end
				
			end
		
		end
		
	end

end

function Check_Sp5()

	if (not EGroup_IsCapturedByPlayer("eg_Sp_Capture5", World_GetPlayerAt(0), false) and not EGroup_IsCapturedByPlayer("eg_Sp_Capture5", World_GetPlayerAt(1), false)) then
	
		if(timerShift > 7 * 60) then
		
			if(checkSeePlayerArray[12] == 1) then
			
				checkSeePlayerArray[12] = 0
				
				timerSuperTank = 0
			
			elseif(timerSuperTank == 700) then
			
				print("WAVE SP5")
			
				SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU5")
		
				if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU5") then

					Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU5", "tau_hammerhead_gunship_squad", "mkr_SpawnTauWave5", 2, 5)
					
					if(math.mod(timer30Min, 40) == 0 and timer30Min > 1) then
								
						local countWarrior = 0 
						
						for i = 1, timer30Min / 40 do
							
							countWarrior = i
							
						end
						
						Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU5", "tau_hammerhead_gunship_squad", "mkr_SpawnTauWave5", countWarrior + 1, 1)
						--Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU4", "tau_drone_harbinger_squad", "mkr_SpawnTauWave2", countWarrior + 1, 1)
						
					end
					
					Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU5", "mkr_Player_HQ")
					
				end
			
			end
		
		end
		
	end

end

function Reinforcement()

	if (EGroup_IsCapturedByPlayer("eg_Sp_Reinforcement", World_GetPlayerAt(0), false)) then
	
		--EGroup_SetPlayerOwner("eg_Reinforcement", World_GetPlayerAt(0))

		SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU6")
		
		if(timerAttackReinforcement > 90) then 
		
			timerAttackReinforcement = 0
	
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU6") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU6", "tau_krootox_squad", "mkr_AttackBaseTau", 2, 5)
				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU6", "tau_hammerhead_gunship_squad", "mkr_AttackBaseTau", 2, 5)
				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU6", "tau_drone_squad", "mkr_AttackBaseTau", 2, 5)
				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU6", "tau_skyray_squad", "mkr_AttackBaseTau", 1, 1)
				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU6", "tau_drone_harbinger_squad", "mkr_AttackBaseTau", 1, 1)
				Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU6", "mkr_AttackAndDestroy")
					
			end
				
			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU2311121ewew212az4234")
		
			if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU2311121ewew212az4234") then

				Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2311121ewew212az4234", "tau_stealth_team_squad", "mkr_AttackBaseTau", 2, 3)
				Cmd_Capture("sg_TunnelSaboteurs_TAU2311121ewew212az4234", "eg_Sp_Reinforcement")
					
			end
			
			SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU827623489")
		
		end
		
		if(timerReinforcement == 300 and SGroup_IsEmpty("sg_TunnelSaboteurs_TAU827623489")) then

			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(0), "sg_TunnelSaboteurs_TAU827623489", "tau_hammerhead_gunship_squad", "mkr_AttackAndDestroy", 4, 1)
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(0), "sg_TunnelSaboteurs_TAU827623489", "tau_fire_warrior_squad", "mkr_AttackAndDestroy", 4, 6)
			
			for i = 1, 2 do
		
				SGroup_AddLeaders ( "sg_TunnelSaboteurs_TAU827623489")
			
			end	
		
		end
			
	end

	if (EGroup_IsCapturedByPlayer("eg_Sp_Reinforcement", World_GetPlayerAt(1), false)) then
	
		--EGroup_SetPlayerOwner("eg_Reinforcement", World_GetPlayerAt(1))

		SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU6")
	
		if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU6") then

			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU6", "tau_krootox_squad", "mkr_AttackBaseTau", 2, 5)
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU6", "tau_hammerhead_gunship_squad", "mkr_AttackBaseTau", 2, 5)
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU6", "tau_drone_squad", "mkr_AttackBaseTau", 2, 5)
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU6", "tau_skyray_squad", "mkr_AttackBaseTau", 1, 1)
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU6", "tau_drone_harbinger_squad", "mkr_AttackBaseTau", 1, 1)
			Cmd_AttackMoveMarker("sg_TunnelSaboteurs_TAU6", "mkr_AttackAndDestroy")
				
		end
			
		SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU2311121ewew212az4234")
	
		if SGroup_IsEmpty("sg_TunnelSaboteurs_TAU2311121ewew212az4234") then

			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(2), "sg_TunnelSaboteurs_TAU2311121ewew212az4234", "tau_stealth_team_squad", "mkr_AttackBaseTau", 2, 3)
			Cmd_Capture("sg_TunnelSaboteurs_TAU2311121ewew212az4234", "eg_Sp_Reinforcement")
				
		end
		
		SGroup_CreateIfNotFound("sg_TunnelSaboteurs_TAU827623489")
			
		if(timerReinforcement == 300 and SGroup_IsEmpty("sg_TunnelSaboteurs_TAU827623489")) then
		
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(1), "sg_TunnelSaboteurs_TAU827623489", "tau_hammerhead_gunship_squad", "mkr_AttackAndDestroy", 4, 1)
			Util_CreateSquadsAtMarkerEx(World_GetPlayerAt(1), "sg_TunnelSaboteurs_TAU827623489", "tau_fire_warrior_squad", "mkr_AttackAndDestroy", 4, 6)
		
		end
			
	end

end