Mission 6 Event File
Руководства
/
Mission 6 Event File
Обновлено 3 years ago от Merric

-- todo -- Eldar Hidden Base Intel -- Avalanches and ambushes


-- RESEARCH FUNCS

-- Disables, enables, and grants research items

function SetResearchLevel() -- restrict -- buildings Player_RestrictBuilding( g_Player1, "space_marine_orbital_relay" ) -- research --~ Player_RestrictResearch( g_Player1, "marine_force_commander_daemon_hammer_research" ) -- units Player_RestrictSquad( g_Player1, "space_marine_squad_land_raider" ) Player_RestrictSquad( g_Player1, "space_marine_squad_terminator" ) Player_RestrictSquad( g_Player1, "space_marine_squad_terminator_assault" ) -- grant -- research Player_GrantResearch( g_Player1, "squad_cap_research" ) Player_GrantResearch( g_Player1, "marine_scout_infiltrate_research" )

Rule_Remove( SetResearchLevel )

end


--IMPORTS

import("ScarUtil.scar")


--GLOBAL VARIABLES

-- objectives. -- we create a list of objectives so we can iterate through them nicely -- set the state to 1 when the objective is marked complete g_objectiveList = {} g_objectiveList["EstablishBase"] = {title="Establish a Base", id=0 ,desc="Description of objective",priority="Primary", state=0} g_objectiveList["ReachMountainTop"] = {title="Reach the Mountain Top", id=0 ,desc="Description of objective",priority="Primary", state=0} g_objectiveList["StopDemolitionSquad"] = {title="Stop the Demolition Squad", id=0 ,desc="Description of objective",priority="Primary", state=0} g_objectiveList["DestroyEldarBases"] = {title="Destroy All Eldar Bases", id=0 ,desc="Description of objective",priority="Secondary", state=0} g_objectiveList["DestroyEldarWebwayGates"] = {title="Destroy All Eldar Webway Gates", id=0 ,desc="Description of objective",priority="Secondary", state=0} g_objectiveList["FindChaos"] = {title="Find Evidence of Forces of Chaos", id=0 ,desc="Description of objective",priority="Secondary", state=0}


--GAME SETUP

function OnGameSetup() -- setup players. you only need to do this for players that have a starting point g_Player1 = Setup_Player(0, "$261200", "space_marine_race", 1)

-- this is the bad guys!
g_Player2 = Setup_Player(1, "$261202", "eldar_race", 2)

-- this is the Player's Ally
g_Player3 = Setup_Player(2, "$261208", "npc_race", TEAM_NEUTRAL )

-- yikes, evil orks!
g_Player4 = Setup_Player(3, "$261206", "ork_race", 3)

-- Eldar ambient
g_Player5 = Setup_Player(4, "$261204", "eldar_race", 2)

-- this is the Player's Ally
g_Player6 = Setup_Player(5, "$261208", "npc_race", 1 )


-- this function should actually be passing in the variable that defines what difficulty we are at
-- you can use this function to scale the value of difficulty level variblaes
	
--These variables allow webway gate created units to know that the player is in multiple positions, and attack randomly in both.
g_PlayerAtSecondPostion = 0
g_PlayerAtThirdPosition = 0

g_Eldar_Final_Attack = 0

-- This is the variable used by webway controllers to change what is being produced at gates.
g_WebwayControl = 0

g_Difficulty_Level = 1

end

function OnGameRestore() g_Player1 = World_GetPlayerAt(0) g_Player2 = World_GetPlayerAt(1) g_Player3 = World_GetPlayerAt(2) g_Player4 = World_GetPlayerAt(3) g_Player5 = World_GetPlayerAt(4) g_Player6 = World_GetPlayerAt(5) end


--ON INITIALIZATION

--OnInit should be used for pregame functions, things that should happen before the player officially enters the world.

function OnInit()

DisableAI()

Rule_Add( SetResearchLevel )

-- Starting first NIS
Rule_Add( Rule_StartNIS )

-- begin checking for all primary objectives complete
--Rule_AddInterval(Rule_PlayerHasWon,1) 

SGroup_DeSpawn( "sg_NISCLOSE_Group" )
SGroup_DeSpawn( "sg_NISCLOSE_Group_2" )
EGroup_DeSpawn( "eg_PlayersHQ" )
SGroup_DeSpawn( "sg_Eldar_Final_Attack" )

SetCommanderPowerSword( g_Player1 )

--setup for opening NIS
Fade_Start( 0, false )
W40k_Letterbox( true, 0 )	

--start mission
Rule_AddOneShot( Mission_Start, 0 )

-- MUSIC
SetupMusicPlaylist()
-- for now just play the music straight away
Sound_PlaylistStart( PC_Music )

SetDifficultyLevel( Difficulty_Get() )

end

-- This registers your init function with scar. This call has to be made after the defintion -- of the function and it must be called in global scope (global scope means not in any function -- or table) Scar_AddInit(OnInit)

function DisableAI() Cpu_LockSGroupAcrossPlayers( "sg_Eldar_Ambient" ) Cpu_EnableAll( 0 )

end


--SPACE MARINES

--SET RESEARCH UPGRADES AND GIVES function Rule_MarineResearchState() Player_GrantResearch( g_Player1, "squad_cap_research" ) Player_GrantResearch( g_Player1, "support_cap_research" ) end

-- call this with an interval to ensure the mission ends after a period of time, instead of immediately function Rule_GameOver() World_SetGameOver() end

-- checks all the objectives and determines if the player needs to have won the mission -- add this rule to automatically complete the mission once all primary objectives are complete function Rule_PlayerHasWon() -- loop through all primary objectives. if all complete, then end local numberOfPrimaryObjectives = 0 local numberOfCompletePrimaryObjectives = 0 for k,v in pairs(g_objectiveList) do if v.priority == "Primary" then numberOfPrimaryObjectives = numberOfPrimaryObjectives + 1 if v.state == 1 then numberOfCompletePrimaryObjectives = numberOfCompletePrimaryObjectives + 1 end end end --I altered this area to play the final NIS before announcing the player has won. if numberOfPrimaryObjectives == numberOfCompletePrimaryObjectives then

	Util_StartNIS( EVENTS.NIS_Closing ) 

	Rule_Remove( Rule_PlayerHasWon )

	Rule_AddIntervalEx(Rule_PlayerWinActivate,5,1)
	
end

end

function Rule_FinalNISOver()

if Event_IsRunning( EVENTS.NIS_Closing ) == false then

	World_SetTeamWin(g_Player1,"")
	Rule_AddIntervalEx(Rule_GameOver,5,1)
		
	Rule_Remove(Rule_FinalNISOver)		
	
end

end

--Start Mission function Mission_Start()

	obj_table_P1 = { title_id = 260010, short_desc_id = 260011, help_tip_id = 260012 }
	obj_table_P2 = { title_id = 260020, short_desc_id = 260021, help_tip_id = 260022 }
	obj_table_P3 = { title_id = 260030, short_desc_id = 260031, help_tip_id = 260032 }
	obj_table_S1 = { title_id = 260040, short_desc_id = 260041, help_tip_id = 260042 }
	obj_table_S2 = { title_id = 260050, short_desc_id = 260051, help_tip_id = 260052 }

end


-- MUSIC/SOUND

function SetupMusicPlaylist() -- clear the current playlist Sound_PlaylistClear( PC_Music ) -- add tracks to the playlist Sound_PlaylistAddTrack( PC_Music, "music_EldarThemev2" ) Sound_PlaylistAddTrack( PC_Music, "music_EldarTheme" ) Sound_PlaylistAddTrack( PC_Music, "music_theme_spacemarines_01" ) Sound_PlaylistAddTrack( PC_Music, "ambient_ingame_04" ) Sound_PlaylistAddTrack( PC_Music, "stinger_mysterious_stinger" ) Sound_PlaylistAddTrack( PC_Music, "stinger_tensedanger" ) -- mark these tracks to play randomly Sound_PlaylistSetorder( PC_Music, false ) -- add 5 to 10 seconds silence between tracks Sound_PlaylistSetSilence( PC_Music, 30, 150 )

Sound_PlaylistPlayNow( PC_Music, "stinger_pressure_stinger" )

Sound_PlaylistClear( PC_Ambient )
-- add tracks to the playlist    
Sound_PlaylistAddTrack( PC_Ambient, "ambient_wind" )
Sound_PlaylistAddTrack( PC_Ambient, "Ambient-Prototype-Battle BG" )
-- mark these tracks to play randomly
Sound_PlaylistSetorder( PC_Ambient, false )
-- add 5 to 10 seconds silence between tracks
Sound_PlaylistSetSilence( PC_Ambient, 30, 90 )	

end


-- DIFFICULTY LEVEL

-- the functions here set the difficulty level for the mission. Should be called from OnGameSetup function SetDifficultyLevel( difficultyLevel )

Difficulty_SetForAll( difficultyLevel )

-- easy
if difficultyLevel == DIFFICULTY_EASY then

	g_Difficulty_Level = 1
	
-- medium
elseif difficultyLevel == DIFFICULTY_NORMAL then

	g_Difficulty_Level = 2
	
-- hard
elseif difficultyLevel == DIFFICULTY_HARD then

	g_Difficulty_Level = 3
	
end

end


--PLAYER MUST HAVE UNITS

function Rule_PlayerLoses()

g_building_exceptions = 
{
	"space_marine_mine_field",
	"space_marine_listening_post",
	"space_marine_turret_bolter"
}

g_unit_exceptions = 
{
	"space_marine_squad_librarian",
	"space_marine_squad_force_commander"
}

if( Player_HasBuildingsExcept(g_Player1, g_building_exceptions) == false ) then
	if( Player_HasSquadsExcept(g_Player1, g_unit_exceptions ) == false ) then
		World_SetTeamWin( g_Player2, "" )
		Rule_AddIntervalEx( Rule_GameOver,5,1 )
		Rule_Remove( Rule_PlayerLoses )
	end
end

end

--SAFETY NET --[[ Safety FC ]]

function Rule_TheReturners()

Util_TrackCharacterAndDropPodIn( g_Player1, "sg_NIS_Gabriel", "space_marine_squad_force_commander", "mk_FC_Rez" )
Util_TrackCharacterAndDropPodIn( g_Player1, "sg_NIS_Isador", "space_marine_squad_librarian", "mk_Librarian_Rez" )

end

--[[function Rule_FCDead()

SGroup_AddGroup(SGroup_CreateIfNotFound("sg_ALL"), Player_GetSquads(g_Player1))
local blueprinttable = Util_MakeBlueprintTable("space_marine_squad_force_commander")

if not SGroup_ContainsBlueprints("sg_ALL", blueprinttable, false) then
	Rule_AddOneShot(Rule_FCResurrect, 1)
	Rule_Remove(Rule_FCDead)
end

SGroup_Clear( SGroup_CreateIfNotFound("sg_FC") )

end

function Rule_FCResurrect() Util_CreateSquadsAndDropPodIn(g_Player1, "sg_FC", "space_marine_squad_force_commander", Marker_GetPosition(Marker_FromName("mk_FC_Rez", "basic_marker")), 1, 1) Rule_AddInterval(Rule_FCDead, 5) end

--[[ Safety LIB ]] function Rule_LIBDead()

SGroup_AddGroup(SGroup_CreateIfNotFound("sg_ALL"), Player_GetSquads(g_Player1))
local blueprinttable = Util_MakeBlueprintTable("space_marine_squad_librarian")

if not SGroup_ContainsBlueprints("sg_ALL", blueprinttable, false) then
	Rule_AddOneShot(Rule_LIBResurrect, 1)
	Rule_Remove(Rule_LIBDead)
end

SGroup_Clear( SGroup_CreateIfNotFound("sg_LIB") )

end

function Rule_LIBResurrect() Util_CreateSquadsAndDropPodIn(g_Player1, "sg_LIB", "space_marine_squad_librarian", Marker_GetPosition(Marker_FromName("mk_Librarian_Rez", "basic_marker")), 1, 1) Rule_AddInterval(Rule_LIBDead, 5) end]]

--[[ Safety Servitor ]] function Rule_ServitorDead()

SGroup_AddGroup(SGroup_CreateIfNotFound("sg_ALL"), Player_GetSquads(g_Player1))
local blueprinttable = Util_MakeBlueprintTable("space_marine_squad_servitor")

if not SGroup_ContainsBlueprints("sg_ALL", blueprinttable, false) then
	Rule_AddOneShot(Rule_ServitorResurrect, 1)
	Rule_Remove(Rule_ServitorDead)
end

SGroup_Clear( SGroup_CreateIfNotFound("sg_Servitor_Dead_Squad") )

end

function Rule_ServitorResurrect() Util_CreateSquadsAndDropPodIn(g_Player1, "sg_Servitor_Dead_Squad", "space_marine_squad_servitor", Marker_GetPosition(Marker_FromName("mk_Drop_Pod_Servitors_2", "basic_marker")), 1, 1) Rule_AddInterval(Rule_ServitorDead, 5) end


---START OPENING NIS

function Rule_StartNIS()

Util_StartNIS( EVENTS.NIS_Opening ) 

Rule_AddInterval(Rule_StartNISOver,1)

Rule_Remove( Rule_StartNIS )

end

--gets everything going after NIS is over function Rule_StartNISOver()

if Event_IsRunning( EVENTS.NIS_Opening ) == false then

	-- here you add any rules you want to have at the start of the mission
	Rule_AddOneShot(Rule_EstablishBase, 1)
	--Rule_AddInterval(Rule_PlayerNearMountainTop,1)
	Rule_AddInterval(Rule_ImperialGuardEncounter,1)
	Rule_AddInterval(Rule_EldarWebwayGateObjective,1)

	Rule_AddInterval( Rule_PlayerLoses, 1 )
	
	Cmd_SetStance( "sg_Eldar_Ambient", STANCE_Attack )
	
	-- Creating all the groups used for creating Eldar near Webway Gates.
	SGroup_Create("sg_EldarAtWebwayGate_1")
	SGroup_Create("sg_EldarAtWebwayGate_2")
	SGroup_Create("sg_EldarAtWebwayGate_3")
	SGroup_Create("sg_EldarAtWebwayGate_4")
	SGroup_Create("sg_EldarAtWebwayGate_5")
	SGroup_Create("sg_EldarAtWebwayGate_6")
	SGroup_Create("sg_EldarAtWebwayGate_7")
	SGroup_Create("sg_EldarAtWebwayGate_8")
	SGroup_Create("sg_EldarAtWebwayGate_9")
	SGroup_Create("sg_EldarAtWebwayGate_10")
	
	Rule_Remove( Rule_StartNISOver )

end

end

function CheatClosing() --~ SGroup_ReSpawn("sg_NIS_AllFinalNISSquads")

Rule_RemoveAll()

Util_StartNIS( EVENTS.NIS_Closing )

Rule_AddInterval(Rule_FinalNISOver,1)	

--~ print("cheat!") --~ Unrestrict_SquadWithAlerts( g_Player1, "space_marine_squad_assault", "$42908", 408006 ) end

 ------------------------------------------------------------------

------------------PRIMARY OBJECTIVES SECTION------------------

 ------------------------------------------------------------------

--ESTABLISH A BASE

function Rule_EstablishBase()

--Util_StartIntel( EVENTS.IE_StartIntel )

-- save now
Util_Autosave( "$260100" ) 

Objective_Add( obj_table_P1, 1 )
	
Rule_Remove(Rule_EstablishBase)

end

function Rule_Establish_Base_Delay()

if EGroup_IsEmpty( "eg_FirstWebwayGate" ) then	
	
	Rule_AddOneShot( Rule_PlayerHasEstablishBase, 10 )
	
	Rule_Remove( Rule_Establish_Base_Delay )
	
end

end

function Rule_PlayerHasEstablishBase()

if SGroup_Exists( "sg_Servitors" ) == false then

	SGroup_Create( "sg_Servitors" )
	
end

Util_CreateSquadsAndDropPodIn(g_Player1, "sg_Servitors", "space_marine_squad_servitor", Marker_GetPosition(Marker_FromName("mk_Drop_Pod_Servitors", "basic_marker")), 1, 1)
Util_CreateSquadsAndDropPodIn(g_Player1, "sg_Servitors_2", "space_marine_squad_servitor", Marker_GetPosition(Marker_FromName("mk_Drop_Pod_Servitors_2", "basic_marker")), 1, 1)

--[[Safety Nets]]
Rule_AddInterval(Rule_TheReturners, 5)	
--Rule_AddInterval(Rule_LIBDead, 5)	
Rule_AddInterval(Rule_ServitorDead, 5)	
	
Rule_AddInterval( Rule_HQ_Intel_Done, 1)

Util_StartIntel( EVENTS.IE_Fortify )

--Starting up Ambushes
Rule_AddInterval( Rule_Spyder_Ambush_1, 2 )
Rule_AddInterval( Rule_Spyder_Ambush_2, 2 )
Rule_AddInterval( Rule_Spyder_Ambush_3, 2 )
Rule_AddInterval( Rule_Player_At_End, 2 )
		
--Starts countdown to Brom's arrival
Rule_AddOneShot( Rule_BromReinforceArrives, 180 )

Rule_Remove(Rule_PlayerHasEstablishBase)

end

function Rule_HQ_Intel_Done()

if Event_IsRunning( EVENTS.IE_Fortify ) == false then

	if SGroup_IsEmpty( "sg_Servitors" ) == false then

		EGroup_ReSpawn("eg_PlayersHQ")
		Util_ResetAndRebuild( "eg_PlayersHQ", "sg_Servitors" )

		Cpu_Enable( g_Player2, 1 ) 

		if g_Difficulty_Level == 1 then
		
			Cpu_SetDifficultyForDummies( g_Player2, AD_Easy )
		
		end
		
		if g_Difficulty_Level == 2 then
		
			Cpu_SetDifficultyForDummies( g_Player2, AD_Standard )
		
		end

		if g_Difficulty_Level == 3 then
		
			Cpu_SetDifficultyForDummies( g_Player2, AD_Hard )
		
		end

		Player_RestrictSquad( g_Player2, "eldar_squad_avatar" )

		Rule_AddInterval( Rule_HQ_Autosave, 1 )
		
		Rule_Remove( Rule_HQ_Intel_Done )

	end

end

end

function Rule_HQ_Autosave()

if Player_HasBuildingType( g_Player1, "space_marine_hq" ) == true then

	-- Adding the next objectives with this call, and a secondary objective
	Rule_AddInterval(Rule_ReachMountainTop,2)
	Rule_AddInterval(Rule_EldarBaseObjective_Establish,2)
	Rule_AddInterval(Rule_EldarBaseObjective_Establish_Hidden,2)

	Objective_SetState( obj_table_P1.title_id, OS_Complete )

	Util_StartIntel( EVENTS.IE_Fortify_2 )
	
	Rule_AddInterval( Rule_HQ_Autosave_Delay, 5 )
	
	Rule_Remove( Rule_ServitorDead )
	
	Rule_Remove ( Rule_HQ_Autosave )

end
	

end

function Rule_HQ_Autosave_Delay()

if Event_IsAnyRunning() == false then

	Util_Autosave( "$260101" ) 

	Rule_Remove( Rule_HQ_Autosave_Delay )
	
end

end


--STOP THE DEMOLITION SQUAD

function Rule_PlayerNearMountainTop()

-- Here I establish whether any player squads are near the markers at the top of the mountain
for i=1,2 do

	Player_GetAllSquadsNearMarker(g_Player1,"sg_SquadsNearMountainTop","mk_DemolitionSquadActivate_"..i )

end

-- If any player squads are at the top of the mount then I activate the 'stop demolition team' objective
if  SGroup_IsEmpty("sg_SquadsNearMountainTop") == false then

	
	--Start timer that determines if the player has killed the demo team in time
	Timer_Start(1,450)
	
	Util_StartIntel( EVENTS.IE_BlowItUp )
	
	Rule_Add(Rule_PlayerDidNotStopDemolitionTeam)
	Rule_Add(Rule_PlayerStoppedDemolitionTeam)

	Rule_Remove(Rule_PlayerNearMountainTop)

end

end

function Rule_PlayerDidNotStopDemolitionTeam()

--If the player does not kill the demo team before the timer elapses then they lose the mission.
if	Timer_GetRemaining(1) == 0 then
	Player_Kill(g_Player1)
	
	Rule_Remove(Rule_PlayerDidNotStopDemolitionTeam)
	Rule_Remove(Rule_PlayerStoppedDemolitionTeam)
	
end

end

function Rule_PlayerStoppedDemolitionTeam()

--If the player kills the demolition team before the timer elapses then they complete the objective.
if	SGroup_IsEmpty("sg_DemoltionSquad") then
	
	-- mark the objective state to complete
	g_objectiveList["StopDemolitionSquad"].state = 1

	Rule_Remove(Rule_PlayerDidNotStopDemolitionTeam)
	Rule_Remove(Rule_PlayerStoppedDemolitionTeam)

end

end


--REACH THE MOUNTAIN TOP

function Rule_ReachMountainTop()

Objective_Add( obj_table_P2, 1 )
	
Util_Ping_LoopingMkr( "Ping_Pass", "mk_Final_NIS" )

-- Establishing the Objective
Rule_AddInterval(Rule_PlayerHasReachedMountainTop, 2)

Rule_Remove(Rule_ReachMountainTop)

end

function Rule_PlayerHasReachedMountainTop()

Player_GetAllSquadsNearMarker(g_Player1,"sg_SquadsAtMountainTop","mk_PlayerAtMountainTop")

-- If the player reaches the top of the mountain then this objective is complete.
if  SGroup_IsEmpty("sg_SquadsAtMountainTop") == false and
	SGroup_IsEmpty("sg_Eldar_Final_Attack") == true and
	EGroup_IsEmpty("eg_Final_Eldar_Buildings") == true then

	Rule_RemoveAll()

	Objective_SetState( obj_table_P2.title_id, OS_Complete )
	Util_Ping_Stop( "Ping_Pass" )						
	
	Util_StartNIS( EVENTS.NIS_Closing ) 

	Rule_AddInterval(Rule_FinalNISOver,1)
	
	-- mark the objective state to complete
	g_objectiveList["ReachMountainTop"].state = 1
	
	Rule_Remove(Rule_PlayerHasReachedMountainTop)
	
end

end

 ------------------------------------------------------------------

------------------SECONDARY OBJECTIVES SECTION------------------

 ------------------------------------------------------------------

--DESTROY ELDAR BASES

function Rule_EldarBaseObjective_Establish()

if EGroup_IsUnderAttack( "eg_EldarBase_1", 0) or
	EGroup_IsUnderAttack( "eg_EldarBase_2", 0) then
			
	Rule_AddOneShot( Rule_EldarBaseObjective, 1 )
	
	Rule_Remove( Rule_EldarBaseObjective_Establish )

end

end

function Rule_EldarBaseObjective_Establish_Hidden()

if EGroup_IsUnderAttack( "eg_EldarBase_2", 0) then

	Util_StartIntel( EVENTS.IE_HiddenBase )
	
	Rule_Remove( Rule_EldarBaseObjective_Establish_Hidden )

end

end

function Rule_EldarBaseObjective()

Objective_Add( obj_table_S1, 0 )
	
-- Establishing the Objective
Rule_AddInterval(Rule_EldarBasesDestroyed,1)

Rule_Remove(Rule_EldarBaseObjective)

end

function Rule_EldarBasesDestroyed()

-- This function establishes whether the player is near the Imperial Guardsmen, and triggers action when they are.
if  EGroup_IsEmpty("eg_EldarBase_1") and
	EGroup_IsEmpty("eg_EldarBase_2") == true then
	

	Objective_SetState( obj_table_S1.title_id, OS_Complete )

	-- save now
	Util_Autosave( "$260103" ) 

	-- mark the objective state to complete
	g_objectiveList["DestroyEldarBases"].state = 1

	Rule_Remove(Rule_EldarBasesDestroyed)
	
end

end


--DESTROY ELDAR WEBWAY GATES

function Rule_EldarWebwayGateObjective()

-- Checks to see if the first webway gate is under attack, then activates trigger.
if  EGroup_IsUnderAttack( "eg_FirstWebwayGate", 1 ) == true then
	
	-- save now
	--Util_Autosave( "$260102" ) 

	Objective_Add( obj_table_S2, 0 )
	
	Util_StartIntel( EVENTS.IE_WebwayGates )
	
	Ping_Marker( "mk_FirstWebwayGate", false )

	
	Rule_AddInterval( Rule_Establish_Base_Delay, 2 )
	
	-- Establishing the Objective
	Rule_AddInterval(Rule_EldarGatesDestroyed,5)
	-- Setting up the Webway Gate Controllers that determine what Webway Gates build
	Rule_Add(Rule_WebwayGateControllerTimers)

	Rule_Remove(Rule_EldarWebwayGateObjective)
	
end

end

function Rule_EldarGatesDestroyed()

-- This function establishes whether the player is near the Imperial Guardsmen, and triggers action when they are.
if  EGroup_IsEmpty("eg_EldarWebwayGates") == true then
	

	Objective_SetState( obj_table_S2.title_id, OS_Complete )

	-- save now
	--Util_Autosave( "$260104" ) 
	
	-- mark the objective state to complete
	g_objectiveList["DestroyEldarWebwayGates"].state = 1

	Rule_Remove(Rule_EldarGatesDestroyed)
	
end

end

 ------------------------------------------------------------------

------------------GENERAL ENCOUNTERS SECTION------------------

 ------------------------------------------------------------------

--IMPERIAL GUARD ENCOUNTER

function Rule_ImperialGuardEncounter()

-- This function establishes whether the player is near the Imperial Guardsmen, and triggers action when they are.
Player_GetAllSquadsNearMarker(g_Player1,"sg_SquadsNearImperialGuard","mk_ImperialGuardPosition")

if  SGroup_IsEmpty("sg_SquadsNearImperialGuard") == false and 
	SGroup_IsEmpty( "sg_ImperialGuardsmen" ) == false then
	
	Util_StartIntel( EVENTS.IE_LostGuard )
	
	Ping_Marker( "mk_ImperialGuardPosition", false )
	
	FOW_RevealSGroup( SGroup_FromName( "sg_ImperialGuardsmen" ), 240 )
	
	Rule_Remove(Rule_ImperialGuardEncounter)
	
	Rule_Add(Rule_PlayerReachedImperialGuard)
	
end

if SGroup_IsEmpty( "sg_ImperialGuardsmen" ) == true then

	Rule_Remove( Rule_ImperialGuardEncounter )

end

end

function Rule_PlayerReachedImperialGuard()

if Event_IsRunning( EVENTS.IE_LostGuard ) == false then
	-- The Guardsmen move to the Eldar Webway Gate to show the marines.
	Cmd_MoveToMarker("sg_ImperialGuardsmen","mk_WebwayGate_3")

	Rule_AddInterval(Rule_ImperialGuardGetAmbushed,0.5)

	Rule_Remove(Rule_PlayerReachedImperialGuard)	

end

end

function Rule_ImperialGuardGetAmbushed()

-- This triggers an ambush when the Imperial Guardsmen get near the webway gate.
Player_GetAllSquadsNearMarker(g_Player3,"sg_ImperialGuardReachWebway","mk_WebwayGate_3")

if  SGroup_IsEmpty("sg_ImperialGuardReachWebway") == false then	

	--mmmm....Eldar ambush
	Util_CreateSquadsAtMarkerEx(g_Player2,"sg_EldarAmbush1","eldar_guardian_squad","mk_WebwayGate_3",1,15)
	Util_CreateSquadsAtMarkerEx(g_Player2,"sg_EldarAmbush1","eldar_squad_warp_spider","mk_WebwayGate_3",1,10)
	Cpu_LockSGroupAcrossPlayers( "sg_EldarAmbush1" )

	SGroup_SetPlayerOwner("sg_ImperialGuardsmen",g_Player1)
	
	Rule_Remove(Rule_ImperialGuardGetAmbushed)	

end

end

 ------------------------------------------------------------------

---------------------------COMBAT SECTION---------------------------

 ------------------------------------------------------------------

--COLONEL BROM'S REINFORCEMENTS

-- triggered from the Establish Base Primary Objective function Rule_BromReinforceArrives()

Rule_AddOneShot( Rule_BromIntelEvent, 1 )

Rule_Remove( Rule_BromReinforceArrives )

end

function Rule_BromIntelEvent()

Util_StartIntel( EVENTS.IE_BromArrives )

Ping_Marker( "mk_ImperialGuardStart", false )

for i=1,4 do

	Util_CreateSquadsAtMarkerEx( g_Player6, "sg_IG_Men_"..i, "guard_squad_soldier", "mk_IG_Men_Start_"..i, 1, 15 )
	Util_CreateSquadsAtMarker( g_Player6, "sg_IG_Tank_"..i, "guard_squad_lemun_russ", "mk_IG_Tank_Start_"..i, 1 )

end

Util_CreateSquadsAtMarker( g_Player6, "sg_IG_Brom", "guard_squad_colonel", "mk_IG_Brom_Start", 1 )

for i=1,4 do

	Cmd_AttackMoveMarker( "sg_IG_Men_"..i, "mk_IG_Men_"..i )
	Cmd_AttackMoveMarker( "sg_IG_Tank_"..i, "mk_IG_Tank_"..i )

end

Cmd_MoveToMarker( "sg_IG_Brom", "mk_IG_Brom" )


for i=1,4 do

	Cmd_SetStance( "sg_IG_Men_"..i, STANCE_StandGround )
	Cmd_SetStance( "sg_IG_Tank_"..i, STANCE_StandGround )
	
	SGroup_AddGroup( SGroup_CreateIfNotFound( "sg_IG_Total" ), SGroup_FromName( "sg_IG_Men_"..i ))
	SGroup_AddGroup( SGroup_CreateIfNotFound( "sg_IG_Total" ), SGroup_FromName( "sg_IG_Tank_"..i ))
	SGroup_AddGroup( SGroup_CreateIfNotFound( "sg_IG_Total" ), SGroup_FromName( "sg_IG_Brom" ))

end

Cmd_SetStance( "sg_IG_Brom", STANCE_StandGround )

Cpu_Enable( g_Player4, 1 )

Cpu_ForceAttack( g_Player4, g_Player1 )


if g_Difficulty_Level == 1 then
	
	Rule_AddInterval( Rule_OrkAttack, 300 )

end

if g_Difficulty_Level == 2 then

	Rule_AddInterval( Rule_OrkAttack, 270 )
		
end

if g_Difficulty_Level == 3 then

	Rule_AddInterval( Rule_OrkAttack, 240 )

end

Rule_AddInterval( Rule_Switch_Imp_Guard_Player, 10 )

Rule_AddInterval( Rule_Double_Check_Guard_Player, 1 )

--Rule_AddInterval( Rule_Orks_Made_It, 60 )

--Rule_AddInterval( Rule_ImperialGuardDead, 5 )

Rule_Remove( Rule_BromIntelEvent )

end

function Rule_Double_Check_Guard_Player()

if SGroup_CheckActiveCommand( "sg_IG_Total",SQUADSTATEID_Idle, false ) == true then

	for i=1,4 do

		Cmd_AttackMoveMarker( "sg_IG_Men_"..i, "mk_IG_Men_"..i )
		Cmd_AttackMoveMarker( "sg_IG_Tank_"..i, "mk_IG_Tank_"..i )

	end

	Cmd_MoveToMarker( "sg_IG_Brom", "mk_IG_Brom" )

end

end

function Rule_Switch_Imp_Guard_Player()

if Prox_AnySquadNearMarker( "sg_IG_Total", "mk_Orks_Attack_Here" ) == true then

	for i=1,4 do
		
		SGroup_SetPlayerOwner( "sg_IG_Tank_"..i, g_Player1 )
		SGroup_SetPlayerOwner( "sg_IG_Men_"..i, g_Player1 )
		SGroup_SetPlayerOwner( "sg_IG_Brom", g_Player1 )
	
	end

	Rule_Remove( Rule_Double_Check_Guard_Player )
	
	Rule_Remove( Rule_Switch_Imp_Guard_Player )
	
end

end


--ORK ATTACKS ON IMPERIAL GUARD

function Rule_OrkAttack()

if SGroup_Exists( "sg_OrkAttack" ) == false then

	SGroup_Create( "sg_OrkAttack" )
	
end


if SGroup_IsEmpty( "sg_OrkAttack" ) == true then

	if	g_WebwayControl == 0 then
		
			Util_CreateSquadsAtMarkerEx(g_Player4,"sg_OrkAttack","ork_squad_slugga","mk_OrkStart",1,15)
			Rule_AddOneShot(Rule_OrksAttackCommand,1)
	
	end

	if	g_WebwayControl == 1 then
		
			Util_CreateSquadsAtMarkerEx(g_Player4,"sg_OrkAttack","ork_squad_slugga","mk_OrkStart",1,15)
			
			if g_Difficulty_Level >= 2 then
	
				Util_CreateSquadsAtMarkerEx(g_Player4,"sg_OrkAttack","ork_squad_tankbusta","mk_OrkStart",1,15)

			end
			
			Rule_AddOneShot(Rule_OrksAttackCommand,1)
	
	end
	
	if	g_WebwayControl == 2 then
		
			Util_CreateSquadsAtMarkerEx(g_Player4,"sg_OrkAttack","ork_squad_slugga","mk_OrkStart",1,15)
			Util_CreateSquadsAtMarkerEx(g_Player4,"sg_OrkAttack","ork_squad_tankbusta","mk_OrkStart",1,15)
			
			if g_Difficulty_Level >= 2 then
	
				Util_CreateSquadsAtMarkerEx(g_Player4,"sg_OrkAttack","ork_squad_stormboy","mk_OrkStart",1,15)
				Util_CreateSquadsAtMarkerEx(g_Player4,"sg_OrkAttack","ork_squad_killa_kan","mk_OrkStart",1,1)
				
			end
			
			Rule_AddOneShot(Rule_OrksAttackCommand,1)
	
	end
	
	if	g_WebwayControl == 3 then
		
			Util_CreateSquadsAtMarkerEx(g_Player4,"sg_OrkAttack","ork_squad_slugga","mk_OrkStart",1,15)
			Util_CreateSquadsAtMarkerEx(g_Player4,"sg_OrkAttack","ork_squad_tankbusta","mk_OrkStart",1,15)
			
			if g_Difficulty_Level >= 2 then
				Util_CreateSquadsAtMarkerEx(g_Player4,"sg_OrkAttack","ork_squad_stormboy","mk_OrkStart",1,15)
				Util_CreateSquadsAtMarkerEx(g_Player4,"sg_OrkAttack","ork_squad_killa_kan","mk_OrkStart",1,1)
				Util_CreateSquadsAtMarkerEx(g_Player4,"sg_OrkAttack","ork_squad_looted_tank","mk_OrkStart",1,1)
			end
			
			Util_CreateSquadsAtMarkerEx(g_Player4,"sg_OrkAttack","ork_squad_mek_boy","mk_OrkStart",1,1)
			
			Rule_AddOneShot(Rule_OrksAttackCommand,1)
	
	end

end

end

function Rule_OrksAttackCommand()

Cmd_AttackMoveMarker("sg_OrkAttack","mk_Orks_Attack_Here")

Rule_Remove(Rule_OrksAttackCommand)

end

function Rule_Orks_Made_It()

Player_GetAllSquadsNearMarker(g_Player4,"sg_Orks_Who_Made_It","mk_Orks_Attack_Here")

if  SGroup_IsEmpty("sg_Orks_Who_Made_It") == false then

	Cmd_AttackMoveMarker( "sg_Orks_Who_Made_It", "mk_PlayerAtHQ" )
	
end

end

--[[function Rule_ImperialGuardDead()

if SGroup_IsEmpty( "sg_ImperialGuardDefense" ) == true then
	
	Rule_Remove( Rule_OrkAttack )
	
end

end]]


--SPYDER AMBUSHES

function Rule_Spyder_Ambush_1()

Player_GetAllSquadsNearMarker(g_Player1,"sg_Player_Near_Ambush_1","mk_Spyder_Ambush_1")

if  SGroup_IsEmpty("sg_Player_Near_Ambush_1") == false then
	
	Util_CreateSquadsAtMarkerEx(g_Player5,"sg_Spyder_Ambush_1","eldar_squad_warp_spider","mk_Spyder_Ambush_1_Pos",1,10)

	Rule_Remove( Rule_Spyder_Ambush_1 )
	
	Rule_AddInterval( Rule_Spyder_Ambush_1_Attack, 1 )
	
end

end

function Rule_Spyder_Ambush_1_Attack()

Cmd_AttackMoveMarker( "sg_Spyder_Ambush_1", "mk_Spyder_Ambush_1" )

Rule_Remove( Rule_Spyder_Ambush_1_Attack )

end

function Rule_Spyder_Ambush_2()

Player_GetAllSquadsNearMarker(g_Player1,"sg_Player_Near_Ambush_2","mk_Spyder_Ambush_2")

if  SGroup_IsEmpty("sg_Player_Near_Ambush_2") == false then
	
	Util_CreateSquadsAtMarkerEx(g_Player5,"sg_Spyder_Ambush_2","eldar_squad_warp_spider","mk_Spyder_Ambush_2_Pos",1,10)

	Rule_Remove( Rule_Spyder_Ambush_2 )

	Rule_AddInterval( Rule_Spyder_Ambush_2_Attack, 1 )
	
end

end

function Rule_Spyder_Ambush_2_Attack()

Cmd_AttackMoveMarker( "sg_Spyder_Ambush_2", "mk_Spyder_Ambush_2" )

Rule_Remove( Rule_Spyder_Ambush_2_Attack )

end

function Rule_Spyder_Ambush_3()

Player_GetAllSquadsNearMarker(g_Player1,"sg_Player_Near_Ambush_3","mk_Spyder_Ambush_3")

if  SGroup_IsEmpty("sg_Player_Near_Ambush_3") == false then
	
	Util_CreateSquadsAtMarkerEx(g_Player5,"sg_Spyder_Ambush_3","eldar_squad_warp_spider","mk_Spyder_Ambush_3_Pos",1,10)

	Rule_Remove( Rule_Spyder_Ambush_3 )

	Rule_AddInterval( Rule_Spyder_Ambush_3_Attack, 1 )
	
end

end

function Rule_Spyder_Ambush_3_Attack()

Cmd_AttackMoveMarker( "sg_Spyder_Ambush_3", "mk_Spyder_Ambush_3" )

Rule_Remove( Rule_Spyder_Ambush_3_Attack )

end


--WEBWAY GATE CONTROLLERS

function Rule_WebwayGateControllerTimers()

-- This function sets up timers that alter variables below.  These variables alter what Webway Gates produce, so later in the mission the gates produce more and more nasty units.
Timer_Start(2,750)
Timer_Start(3,1300)
Timer_Start(4,2000)

Rule_AddInterval(Rule_WebwayGateControllerVariable_1,5)
Rule_AddInterval(Rule_WebwayGate_1,100)
Rule_AddInterval(Rule_WebwayGate_2,95)
Rule_AddInterval(Rule_SecondWebwayGates,1)
Rule_AddInterval(Rule_FinalWebwayGates,1)	

Rule_Remove(Rule_WebwayGateControllerTimers)
	

end

function Rule_WebwayGateControllerVariable_1()

-- As each controller variable goes off it changes g_WebwayControl to affect what gates build
if  Timer_GetRemaining(2) == 0	then
			
	g_WebwayControl = g_WebwayControl + 1
	
	Rule_AddInterval(Rule_WebwayGateControllerVariable_2,5)

	Rule_Remove(Rule_WebwayGateControllerVariable_1)
	
end

end

function Rule_WebwayGateControllerVariable_2()

-- As each controller variable goes off it changes g_WebwayControl to affect what gates build
if  Timer_GetRemaining(3) == 0	then
			
	g_WebwayControl = g_WebwayControl + 1
	
	Rule_AddInterval(Rule_WebwayGateControllerVariable_3,5)

	Rule_Remove(Rule_WebwayGateControllerVariable_2)
	
end

end

function Rule_WebwayGateControllerVariable_3()

-- As each controller variable goes off it changes g_WebwayControl to affect what gates build
if  Timer_GetRemaining(4) == 0	then
			
	g_WebwayControl = g_WebwayControl + 1
	
	Rule_Remove(Rule_WebwayGateControllerVariable_3)
	
end

end


--FIRST SET OF WEBWAY GATES

-- This function controls unit creation for the Webway Gate indicated. It does not order the squads to do anything. function Rule_WebwayGate_1()

-- Check to make sure the appropriate webway gate still exists.
if	EGroup_IsEmpty("eg_WebwayGate_1") == true then
	
		Rule_Remove(Rule_WebwayGate_1)
		
end
	
-- This squad is created for the first 10 minutes, not too intimidating.
if	g_WebwayControl == 0 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_1") == true and
	EGroup_IsEmpty("eg_WebwayGate_1") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_1","eldar_guardian_squad","mk_WebwayGate_1",1,10)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_1","eldar_squad_rangers","mk_WebwayGate_1",1,5)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 1 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_1") == true and
	EGroup_IsEmpty("eg_WebwayGate_1") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_1","eldar_guardian_squad","mk_WebwayGate_1",1,15)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_1","eldar_squad_grav_platform","mk_WebwayGate_1",1,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_1","eldar_squad_banshees","mk_WebwayGate_1",1,8)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 2 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_1") == true and
	EGroup_IsEmpty("eg_WebwayGate_1") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_1","eldar_guardian_squad","mk_WebwayGate_1",2,12)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_1","eldar_squad_grav_platform","mk_WebwayGate_1",2,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_1","eldar_squad_banshees","mk_WebwayGate_1",2,8)

        end

end

-- This squad is created for the first the rest of the game, very scary.
if	g_WebwayControl == 3 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_1") == true and
	EGroup_IsEmpty("eg_WebwayGate_1") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_1","eldar_guardian_squad","mk_WebwayGate_1",1,12)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_1","eldar_squad_banshees","mk_WebwayGate_1",1,8)

        end

end

-- Send the units attacking!
if g_PlayerAtSecondPostion == 0 then

Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_1","mk_PlayerAtHQ")

		-- If the player has reached position 2 then Eldar can attack at either location.
		else

				if (World_GetRand(0,1) == 1 ) then
                    Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_1","mk_PlayerAtHQ")

				else

                    Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_1","mk_SecondPosition")

				end

end

end

-- This function controls unit creation for the Webway Gate indicated. It does not order the squads to do anything. function Rule_WebwayGate_2()

-- Check to make sure the appropriate webway gate still exists.
if	EGroup_IsEmpty("eg_WebwayGate_2") == true then
	
		Rule_Remove(Rule_WebwayGate_2)
		
end

-- This squad is created for the first 10 minutes, not too intimidating.
if	g_WebwayControl == 0 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_2") == true and
	EGroup_IsEmpty("eg_WebwayGate_2") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_2","eldar_guardian_squad","mk_WebwayGate_2",1,10)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_2","eldar_squad_rangers","mk_WebwayGate_2",1,5)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 1 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_2") == true and
	EGroup_IsEmpty("eg_WebwayGate_2") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_2","eldar_guardian_squad","mk_WebwayGate_2",1,15)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_2","eldar_squad_grav_platform","mk_WebwayGate_2",1,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_2","eldar_squad_banshees","mk_WebwayGate_2",1,8)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 2 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_2") == true and
	EGroup_IsEmpty("eg_WebwayGate_2") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_2","eldar_guardian_squad","mk_WebwayGate_2",2,12)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_2","eldar_squad_grav_platform","mk_WebwayGate_2",2,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_2","eldar_squad_banshees","mk_WebwayGate_2",2,8)

        end

end

-- This squad is created for the first the rest of the game, very scary.
if	g_WebwayControl == 3 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_2") == true and
	EGroup_IsEmpty("eg_WebwayGate_2") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_2","eldar_guardian_squad","mk_WebwayGate_2",1,15)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_2","eldar_squad_dark_reapers","mk_WebwayGate_2",1,5)

        end

end

-- Send the units attacking!
if g_PlayerAtSecondPostion == 0 then

Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_2","mk_PlayerAtHQ")

		-- If the player has reached position 2 then Eldar can attack at either location.
		else

				if (World_GetRand(0,1) == 1 ) then
                    Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_2","mk_PlayerAtHQ")

				else

                    Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_2","mk_SecondPosition")

				end

end

end


--SECOND SET OF WEBWAY GATES

-- This function activates this set of Webway Gates once the player has reached a certain position. function Rule_SecondWebwayGates()

Player_GetAllSquadsNearMarker(g_Player1,"sg_SquadsAtSecondGateActivateLocation","mk_SecondPosition")

if  SGroup_IsEmpty("sg_SquadsAtSecondGateActivateLocation") == false then
	
	Rule_AddInterval(Rule_WebwayGate_3,90)
	Rule_AddInterval(Rule_WebwayGate_4,85)
	Rule_AddInterval(Rule_WebwayGate_5,95)
	Rule_AddInterval(Rule_WebwayGate_7,100)
	
	--This variable allows webway gate created units to know that the player is in multiple positions, and attack randomly in both.
	g_PlayerAtSecondPostion = g_PlayerAtSecondPostion + 1

	Rule_Remove(Rule_SecondWebwayGates)
	
end

end

-- This function controls unit creation for the Webway Gate indicated. It does not order the squads to do anything. function Rule_WebwayGate_3()

-- Check to make sure the appropriate webway gate still exists.
if	EGroup_IsEmpty("eg_WebwayGate_3") == true then
	
		Rule_Remove(Rule_WebwayGate_3)
		
end
	
-- This squad is created for the first 10 minutes, not too intimidating.
if	g_WebwayControl == 0 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_3") == true and
	EGroup_IsEmpty("eg_WebwayGate_3") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_3","eldar_guardian_squad","mk_WebwayGate_3",1,12)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_3","eldar_squad_banshees","mk_WebwayGate_3",1,10)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 1 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_3") == true and
	EGroup_IsEmpty("eg_WebwayGate_3") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_3","eldar_guardian_squad","mk_WebwayGate_3",1,15)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_3","eldar_squad_grav_platform","mk_WebwayGate_3",1,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_3","eldar_squad_banshees","mk_WebwayGate_3",1,8)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 2 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_3") == true and
	EGroup_IsEmpty("eg_WebwayGate_3") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_3","eldar_guardian_squad","mk_WebwayGate_3",2,12)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_3","eldar_squad_grav_platform","mk_WebwayGate_3",2,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_3","eldar_squad_banshees","mk_WebwayGate_3",2,8)

        end

end

-- This squad is created for the first the rest of the game, very scary.
if	g_WebwayControl == 3 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_3") == true and
	EGroup_IsEmpty("eg_WebwayGate_3") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_3","eldar_squad_dark_reapers","mk_WebwayGate_3",1,8)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_3","eldar_squad_banshees","mk_WebwayGate_3",2,10)

        end

end

-- Send the units attacking!
if g_PlayerAtThirdPosition == 0 then

Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_3","mk_SecondPosition")

		-- If the player has reached position 2 then Eldar can attack at either location.
		else

				if (World_GetRand(0,1) == 1 ) then
                    Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_3","mk_PlayerAtHQ")

				else

                    Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_3","mk_SecondPosition")

				end

end

end

-- This function controls unit creation for the Webway Gate indicated. It does not order the squads to do anything. function Rule_WebwayGate_4()

-- Check to make sure the appropriate webway gate still exists.
if	EGroup_IsEmpty("eg_WebwayGate_4") == true then
	
		Rule_Remove(Rule_WebwayGate_4)
		
end

-- This squad is created for the first 10 minutes, not too intimidating.
if	g_WebwayControl == 0 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_4") == true and
	EGroup_IsEmpty("eg_WebwayGate_4") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_4","eldar_guardian_squad","mk_WebwayGate_4",1,10)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_4","eldar_squad_rangers","mk_WebwayGate_4",1,5)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 1 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_4") == true and
	EGroup_IsEmpty("eg_WebwayGate_4") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_4","eldar_guardian_squad","mk_WebwayGate_4",1,15)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_4","eldar_squad_grav_platform","mk_WebwayGate_4",1,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_4","eldar_squad_banshees","mk_WebwayGate_4",1,8)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 2 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_4") == true and
	EGroup_IsEmpty("eg_WebwayGate_4") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_4","eldar_guardian_squad","mk_WebwayGate_4",2,12)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_4","eldar_squad_grav_platform","mk_WebwayGate_4",2,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_4","eldar_squad_banshees","mk_WebwayGate_4",2,8)

        end

end

-- This squad is created for the first the rest of the game, very scary.
if	g_WebwayControl == 3 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_4") == true and
	EGroup_IsEmpty("eg_WebwayGate_4") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_4","eldar_squad_dark_reapers","mk_WebwayGate_4",2,5)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_4","eldar_squad_banshees","mk_WebwayGate_4",2,10)

        end

end

-- Send the units attacking!
if g_PlayerAtThirdPosition == 0 then

Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_4","mk_SecondPosition")

		-- If the player has reached position 2 then Eldar can attack at either location.
		else

				if (World_GetRand(0,1) == 1 ) then
                    Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_4","mk_PlayerAtHQ")

				else

                    Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_4","mk_SecondPosition")

				end

end

end

-- This function controls unit creation for the Webway Gate indicated. It does not order the squads to do anything. function Rule_WebwayGate_5()

-- Check to make sure the appropriate webway gate still exists.
if	EGroup_IsEmpty("eg_WebwayGate_5") == true and
	EGroup_IsEmpty("eg_WebwayGate_5") == false then
	
		Rule_Remove(Rule_WebwayGate_5)
		
end

-- This squad is created for the first 10 minutes, not too intimidating.
if	g_WebwayControl == 0 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_5") == true and
	EGroup_IsEmpty("eg_WebwayGate_5") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_5","eldar_guardian_squad","mk_WebwayGate_5",1,10)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_5","eldar_squad_rangers","mk_WebwayGate_5",1,5)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 1 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_5") == true and
	EGroup_IsEmpty("eg_WebwayGate_5") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_5","eldar_guardian_squad","mk_WebwayGate_5",1,15)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_5","eldar_squad_grav_platform","mk_WebwayGate_5",1,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_5","eldar_squad_banshees","mk_WebwayGate_5",1,8)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 2 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_5") == true and
	EGroup_IsEmpty("eg_WebwayGate_5") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_5","eldar_guardian_squad","mk_WebwayGate_5",2,12)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_5","eldar_squad_grav_platform","mk_WebwayGate_5",2,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_5","eldar_squad_banshees","mk_WebwayGate_5",2,8)

        end

end

-- This squad is created for the first the rest of the game, very scary.
if	g_WebwayControl == 3 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_5") == true and
	EGroup_IsEmpty("eg_WebwayGate_5") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_5","eldar_squad_dark_reapers","mk_WebwayGate_5",1,8)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_5","eldar_guardian_squad","mk_WebwayGate_5",2,15)

        end

end

-- Send the units attacking!
if g_PlayerAtThirdPosition == 0 then

Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_5","mk_SecondPosition")

		-- If the player has reached position 2 then Eldar can attack at either location.
		else

				if (World_GetRand(0,1) == 1 ) then
                    Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_5","mk_ThirdLocation")

				else

                    Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_5","mk_SecondPosition")

				end

end

end

-- This function controls unit creation for the Webway Gate indicated. It does not order the squads to do anything. function Rule_WebwayGate_7()

-- Check to make sure the appropriate webway gate still exists.
if	EGroup_IsEmpty("eg_WebwayGate_7") == true then
	
		Rule_Remove(Rule_WebwayGate_7)
		
end

-- This squad is created for the first 10 minutes, not too intimidating.
if	g_WebwayControl == 0 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_7") == true and
	EGroup_IsEmpty("eg_WebwayGate_7") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_7","eldar_guardian_squad","mk_WebwayGate_7",1,10)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_7","eldar_squad_rangers","mk_WebwayGate_7",1,5)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 1 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_7") == true and
	EGroup_IsEmpty("eg_WebwayGate_7") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_7","eldar_guardian_squad","mk_WebwayGate_7",1,15)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_7","eldar_squad_grav_platform","mk_WebwayGate_7",1,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_7","eldar_squad_banshees","mk_WebwayGate_7",1,8)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 2 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_7") == true and
	EGroup_IsEmpty("eg_WebwayGate_7") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_7","eldar_guardian_squad","mk_WebwayGate_7",2,12)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_7","eldar_squad_grav_platform","mk_WebwayGate_7",2,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_7","eldar_squad_banshees","mk_WebwayGate_7",2,8)

        end

end

-- This squad is created for the first the rest of the game, very scary.
if	g_WebwayControl == 3 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_7") == true and
	EGroup_IsEmpty("eg_WebwayGate_7") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_7","eldar_squad_dark_reapers","mk_WebwayGate_7",1,8)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_7","eldar_squad_banshees","mk_WebwayGate_7",1,10)

        end

end

-- Send the units attacking!
if g_PlayerAtThirdPosition == 0 then

Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_7","mk_SecondPosition")

		-- If the player has reached position 2 then Eldar can attack at either location.
		else

				if (World_GetRand(0,1) == 1 ) then
                    Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_7","mk_PlayerAtHQ")

				else

                    Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_7","mk_SecondPosition")

				end

end

end


--FINAL SET OF WEBWAY GATES

-- This function activates this set of Webway Gates once the player has reached a certain position. function Rule_FinalWebwayGates()

Player_GetAllSquadsNearMarker(g_Player1,"sg_SquadsAtThirdGateActivateLocation","mk_ThirdLocation")

if  SGroup_IsEmpty("sg_SquadsAtThirdGateActivateLocation") == false then
	
	Rule_AddInterval(Rule_WebwayGate_6,80)
	Rule_AddInterval(Rule_WebwayGate_8,85)
	Rule_AddInterval(Rule_WebwayGate_9,75)
	Rule_AddInterval(Rule_WebwayGate_10,90)
	
	--This variable allows webway gate created units to know that the player is in multiple positions, and attack randomly in both.
	g_PlayerAtThirdPosition = g_PlayerAtThirdPosition + 1

	Rule_Remove(Rule_FinalWebwayGates)
	
end

end

-- This function controls unit creation for the Webway Gate indicated. It does not order the squads to do anything. function Rule_WebwayGate_6()

-- Check to make sure the appropriate webway gate still exists.
if	EGroup_IsEmpty("eg_WebwayGate_6") == true then
	
		Rule_Remove(Rule_WebwayGate_6)
		
end
	
-- This squad is created for the first 10 minutes, not too intimidating.
if	g_WebwayControl == 0 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_6") == true and
	EGroup_IsEmpty("eg_WebwayGate_6") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_6","eldar_guardian_squad","mk_WebwayGate_6",1,12)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_6","eldar_squad_banshees","mk_WebwayGate_6",1,10)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 1 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_6") == true and
	EGroup_IsEmpty("eg_WebwayGate_6") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_6","eldar_guardian_squad","mk_WebwayGate_6",1,15)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_6","eldar_squad_grav_platform","mk_WebwayGate_6",1,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_6","eldar_squad_banshees","mk_WebwayGate_6",1,8)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 2 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_6") == true and
	EGroup_IsEmpty("eg_WebwayGate_6") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_6","eldar_guardian_squad","mk_WebwayGate_6",2,12)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_6","eldar_squad_grav_platform","mk_WebwayGate_6",2,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_6","eldar_squad_banshees","mk_WebwayGate_6",2,8)

        end

end

-- This squad is created for the first the rest of the game, very scary.
if	g_WebwayControl == 3 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_6") == true and
	EGroup_IsEmpty("eg_WebwayGate_6") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_6","eldar_squad_dark_reapers","mk_WebwayGate_6",1,8)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_6","eldar_squad_banshees","mk_WebwayGate_6",2,10)

        end

end

-- Send the units attacking!
if (World_GetRand(0,1) == 1 ) then
		Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_6","mk_ThirdLocation")

		else

        Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_6","mk_DemolitionSquadActivate_1")

end

end

-- This function controls unit creation for the Webway Gate indicated. It does not order the squads to do anything. function Rule_WebwayGate_8()

-- Check to make sure the appropriate webway gate still exists.
if	EGroup_IsEmpty("eg_WebwayGate_8") == true then
	
		Rule_Remove(Rule_WebwayGate_8)
		
end

-- This squad is created for the first 10 minutes, not too intimidating.
if	g_WebwayControl == 0 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_8") == true and
	EGroup_IsEmpty("eg_WebwayGate_8") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_8","eldar_guardian_squad","mk_WebwayGate_8",1,10)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_8","eldar_squad_rangers","mk_WebwayGate_8",1,5)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 1 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_8") == true and
	EGroup_IsEmpty("eg_WebwayGate_8") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_8","eldar_guardian_squad","mk_WebwayGate_8",1,15)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_8","eldar_squad_grav_platform","mk_WebwayGate_8",1,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_8","eldar_squad_banshees","mk_WebwayGate_8",1,8)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 2 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_8") == true and
	EGroup_IsEmpty("eg_WebwayGate_8") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_8","eldar_guardian_squad","mk_WebwayGate_8",2,12)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_8","eldar_squad_grav_platform","mk_WebwayGate_8",2,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_8","eldar_squad_banshees","mk_WebwayGate_8",2,8)

        end

end

-- This squad is created for the first the rest of the game, very scary.
if	g_WebwayControl == 3 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_8") == true and
	EGroup_IsEmpty("eg_WebwayGate_8") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_8","eldar_squad_dark_reapers","mk_WebwayGate_8",2,8)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_8","eldar_squad_banshees","mk_WebwayGate_8",2,10)

        end

end

-- Send the units attacking!
if (World_GetRand(0,1) == 1 ) then
		Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_8","mk_ThirdLocation")

		else

        Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_8","mk_DemolitionSquadActivate_1")

end

end

-- This function controls unit creation for the Webway Gate indicated. It does not order the squads to do anything. function Rule_WebwayGate_9()

-- Check to make sure the appropriate webway gate still exists.
if	EGroup_IsEmpty("eg_WebwayGate_9") == true then
	
		Rule_Remove(Rule_WebwayGate_9)
		
end

-- This squad is created for the first 10 minutes, not too intimidating.
if	g_WebwayControl == 0 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_9") == true and
	EGroup_IsEmpty("eg_WebwayGate_9") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_9","eldar_guardian_squad","mk_WebwayGate_9",1,10)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_9","eldar_squad_rangers","mk_WebwayGate_9",1,5)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 1 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_9") == true and
	EGroup_IsEmpty("eg_WebwayGate_9") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_9","eldar_guardian_squad","mk_WebwayGate_9",1,15)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_9","eldar_squad_grav_platform","mk_WebwayGate_9",1,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_9","eldar_squad_banshees","mk_WebwayGate_9",1,8)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 2 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_9") == true and
	EGroup_IsEmpty("eg_WebwayGate_9") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_9","eldar_guardian_squad","mk_WebwayGate_9",2,12)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_9","eldar_squad_grav_platform","mk_WebwayGate_9",2,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_9","eldar_squad_banshees","mk_WebwayGate_9",2,8)

        end

end

-- This squad is created for the first the rest of the game, very scary.
if	g_WebwayControl == 3 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_9") == true and
	EGroup_IsEmpty("eg_WebwayGate_9") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_9","eldar_squad_dark_reapers","mk_WebwayGate_9",1,8)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_9","eldar_guardian_squad","mk_WebwayGate_9",2,15)

        end

end

-- Send the units attacking!
if (World_GetRand(0,1) == 1 ) then
		Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_9","mk_ThirdLocation")

		else

        Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_9","mk_DemolitionSquadActivate_1")

end

end

-- This function controls unit creation for the Webway Gate indicated. It does not order the squads to do anything. function Rule_WebwayGate_10()

-- Check to make sure the appropriate webway gate still exists.
if	EGroup_IsEmpty("eg_WebwayGate_10") == true then
	
		Rule_Remove(Rule_WebwayGate_10)
		
end

-- This squad is created for the first 10 minutes, not too intimidating.
if	g_WebwayControl == 0 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_10") == true and
	EGroup_IsEmpty("eg_WebwayGate_10") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_10","eldar_guardian_squad","mk_WebwayGate_10",1,10)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_10","eldar_squad_rangers","mk_WebwayGate_10",1,5)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 1 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_10") == true and
	EGroup_IsEmpty("eg_WebwayGate_10") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_10","eldar_guardian_squad","mk_WebwayGate_10",1,15)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_10","eldar_squad_grav_platform","mk_WebwayGate_10",1,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_10","eldar_squad_banshees","mk_WebwayGate_10",1,8)

        end

end

-- This squad is created for the first next 5 minutes, little scarier.
if	g_WebwayControl == 2 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_10") == true and
	EGroup_IsEmpty("eg_WebwayGate_10") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_10","eldar_guardian_squad","mk_WebwayGate_10",2,12)
					Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_10","eldar_squad_grav_platform","mk_WebwayGate_10",2,1)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_10","eldar_squad_banshees","mk_WebwayGate_10",2,8)

        end

end

-- This squad is created for the first the rest of the game, very scary.
if	g_WebwayControl == 3 and
	SGroup_IsEmpty("sg_EldarAtWebwayGate_10") == true and
	EGroup_IsEmpty("eg_WebwayGate_10") == false then
	
		if (World_GetRand(0,1) == 1 ) then
                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_10","eldar_squad_dark_reapers","mk_WebwayGate_10",3,8)

        else

                    Util_CreateSquadsAtMarkerEx(g_Player5,"sg_EldarAtWebwayGate_10","eldar_squad_banshees","mk_WebwayGate_10",3,10)

        end

end

-- Send the units attacking!
if (World_GetRand(0,1) == 1 ) then
		Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_10","mk_ThirdLocation")

		else

        Cmd_AttackMoveMarker("sg_EldarAtWebwayGate_10","mk_DemolitionSquadActivate_1")

end

end


--ELDAR FORCE AT END OF MISSION

function Rule_Player_At_End()

Player_GetAllSquadsNearMarker(g_Player1,"sg_PlayerNearEnd","mk_WebwayGate_10")

if  SGroup_IsEmpty( "sg_PlayerNearEnd" ) == false then	
	
	SGroup_ReSpawn( "sg_Eldar_Final_Attack" )
	
	Rule_AddInterval( Rule_Eldar_Final_Attack, 240 )
	
	Rule_AddInterval( Rule_Eldar_Final_Attack_Command, 45 )
	
	Rule_Remove( Rule_Player_At_End )

end

end

function Rule_Eldar_Final_Attack()

g_Eldar_Final_Attack = g_Eldar_Final_Attack + 1

if SGroup_Exists( "sg_Eldar_Final_Attack_Spawn_1" ) == false then

	SGroup_Create( "sg_Eldar_Final_Attack_Spawn_1" )

end

if SGroup_Exists( "sg_Eldar_Final_Attack_Spawn_2" ) == false then

	SGroup_Create( "sg_Eldar_Final_Attack_Spawn_2" )

end

if g_Eldar_Final_Attack <= 1 then

	if SGroup_IsEmpty( "sg_Eldar_Final_Attack_Spawn_1" ) == true and
		EGroup_IsEmpty( "eg_Last_Gate" ) == false then
	
		Util_CreateSquadsAtMarkerEx(g_Player5,"sg_Eldar_Final_Attack_Spawn_1","eldar_squad_dark_reapers","mk_Eldar_Attack_End_1",2,8)
		Util_CreateSquadsAtMarkerEx(g_Player5,"sg_Eldar_Final_Attack_Spawn_1","eldar_squad_banshees","mk_Eldar_Attack_End_1",2,10)
		Util_CreateSquadsAtMarkerEx(g_Player5,"sg_Eldar_Final_Attack_Spawn_1","eldar_squad_grav_platform_brightlance","mk_Eldar_Attack_End_1",3,1)
		
	end

end
		
if g_Eldar_Final_Attack >= 2 then

	if SGroup_IsEmpty( "sg_Eldar_Final_Attack_Spawn_1" ) == true and
		EGroup_IsEmpty( "eg_Last_Gate" ) == false then
	
		Util_CreateSquadsAtMarkerEx(g_Player5,"sg_Eldar_Final_Attack_Spawn_1","eldar_squad_dark_reapers","mk_Eldar_Attack_End_1",2,8)
		Util_CreateSquadsAtMarkerEx(g_Player5,"sg_Eldar_Final_Attack_Spawn_1","eldar_squad_banshees","mk_Eldar_Attack_End_1",1,10)
		Util_CreateSquadsAtMarkerEx(g_Player5,"sg_Eldar_Final_Attack_Spawn_1","eldar_squad_seer_council","mk_Eldar_Attack_End_1",1,15)
		Util_CreateSquadsAtMarkerEx(g_Player5,"sg_Eldar_Final_Attack_Spawn_1","eldar_squad_grav_platform_brightlance","mk_Eldar_Attack_End_1",3,1)
		
	end

end

if SGroup_IsEmpty( "sg_Eldar_Final_Attack_Spawn_2" ) == true and
	EGroup_IsEmpty( "eg_Last_Portal" ) == false then

	Util_CreateSquadsAtMarkerEx(g_Player5,"sg_Eldar_Final_Attack_Spawn_2","eldar_squad_wraithlord","mk_Eldar_Attack_End_2",2,1)
	
end

end

function Rule_Eldar_Final_Attack_Command()

if SGroup_Exists( "sg_PlayerOnPlateau" ) == false then

	SGroup_Create( "sg_PlayerOnPlateau" )
	
end
	
Player_GetAllSquadsNearMarker(g_Player1,"sg_PlayerOnPlateau","mk_Plateau")

if SGroup_Exists( "sg_Eldar_Final_Attack_Spawn_1" ) == true then

	if  SGroup_IsEmpty( "sg_PlayerOnPlateau" ) == false then	

		Cmd_AttackMoveMarker( "sg_Eldar_Final_Attack_Spawn_1", "mk_Plateau" )
	
	else

		Cmd_AttackMoveMarker( "sg_Eldar_Final_Attack_Spawn_1", "mk_WebwayGate_10" )
	
	end

end

if SGroup_Exists( "sg_Eldar_Final_Attack_Spawn_2" ) == true then

	if  SGroup_IsEmpty( "sg_PlayerOnPlateau" ) == false then	

		Cmd_AttackMoveMarker( "sg_Eldar_Final_Attack_Spawn_2", "mk_Plateau" )
	
	else

		Cmd_AttackMoveMarker( "sg_Eldar_Final_Attack_Spawn_2", "mk_WebwayGate_10" )

	end

end

end

Статистика игры
Подписчики
27
Времена
99
Игроки
12
Последние запуски
Уровень: Into the Maw
Уровень: Unholy Ceremony
Уровень: Planet Fall
Последние темы
Опубликовано 5 years ago
games:thread_reply_count
Опубликовано 5 years ago
games:thread_reply_count
Опубликовано 5 years ago
games:thread_reply_count
Опубликовано 7 years ago
games:thread_reply_count
Модераторы