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

--IMPORTS

import("ScarUtil.scar")

function SetResearchLevel(level)

Restrict_SpaceMarines( g_Player1, level )

Player_RestrictResearch( g_Player1, "marine_librarian_research_1" )
Player_RestrictResearch( g_Player1, "marine_librarian_research_2" )

end


--[[ GAME SETUP ]]

function OnGameSetup()

g_Player1 = Setup_Player(0, "$340002", "space_marine_race", 1)
g_Player2 = Setup_Player(1, "$340004", "chaos_marine_race", 2)
g_Player3 = Setup_Player(2, "$340003", "eldar_race", 1)
g_Player4 = Setup_Player(3, "$340004", "chaos_marine_race", 2)
g_Player5 = Setup_Player(4, "$340004", "chaos_marine_race", 2)

--[[variables]]

t_GenHorrors = {
	sgroup = { "sg_horror1", "sg_horror2", "sg_horror3", "sg_horror4", "sg_horror5", "sg_horror6", "sg_horror7", "sg_horror8", "sg_horror9", "sg_horror10",
					 "sg_horror11", "sg_horror12", "sg_horror13", "sg_horror14", "sg_horror15", "sg_horror16", "sg_horror17", "sg_horror18", "sg_horror19", "sg_horror20"}, 
	marker = {"mkr_horror1", "mkr_horror2", "mkr_horror3", "mkr_horror4", "mkr_horror5", "mkr_horror6", "mkr_horror7", "mkr_horror8", "mkr_horror9", "mkr_horror10",
					 "mkr_horror11", "mkr_horror12", "mkr_horror13", "mkr_horror14", "mkr_horror15", "mkr_horror16", "mkr_horror17", "mkr_horror18", "mkr_horror19", "mkr_horror20"}, 
}

g_invulnerable = false
g_mentioneffect = false

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)

end


--[[ ON INITIALIZATION ]]

function OnInit()

EventCue_Enable(false)

--[[ Manage AI ]]
Cpu_Enable(g_Player1, false)
Cpu_Enable(g_Player2, false)
Cpu_Enable(g_Player3, false)
Cpu_Enable(g_Player4, false)
Cpu_Enable(g_Player5, false)
Cpu_LockSGroupAcrossPlayers( "sg_daemonPrince" )

--[[despawn]]
SGroup_DeSpawn("sg_NIS_heros")
EGroup_ReSpawn("eg_END_smoke")

-- RESEARCH
SetResearchLevel( 11 )

--[[FOW]]
FOW_RevealAll()

--[[ Preset Stage for NIS]]
Fade_Start( 0, false )
W40k_Letterbox( true, 0 )



--[[ Hide Base ]]
EGroup_DeSpawn("eg_base_hq")
EGroup_DeSpawn("eg_base_power1")
EGroup_DeSpawn("eg_base_power2")
EGroup_DeSpawn("eg_base_temple")
EGroup_DeSpawn("eg_base_machine")
EGroup_DeSpawn("eg_base_armoury")

--Rule_AddOneShot(Rule_FadeIn, 3)
Util_StartNIS(EVENTS.NIS_Opening);

--[[Start the Game]]
Rule_Add(Rule_StartGame);

-- player has won
SetDifficultyLevel( Difficulty_Get() )

--[[despawn things]]
EGroup_DeSpawn("eg_END_maledictum")
EGroup_DeSpawn("eg_END_meteors")
EGroup_DeSpawn("eg_END_daemon")

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

end

function Rule_FadeIn()

Fade_Start(2, true)

end

Scar_AddInit(OnInit)


-- DIFFICULTY LEVEL

function SetDifficultyLevel( difficultyLevel )

Difficulty_SetForAll( difficultyLevel )

-- easy
if difficultyLevel == DIFFICULTY_EASY then

	Difficulty_SetForPlayer(g_Player2, 0)
	Cpu_SetDifficultyForDummies(g_Player2, AD_Hard)
	Cpu_SetDifficultyForDummies(g_Player4, AD_Hard)
	Cpu_SetDifficultyForDummies(g_Player3, AD_Standard)
	Cpu_LockSGroupAcrossPlayers( "sg_Chaos_Locked" )
	
-- medium
elseif difficultyLevel == DIFFICULTY_NORMAL then

	Difficulty_SetForPlayer(g_Player2, 1)
	Cpu_SetDifficultyForDummies(g_Player2, AD_Advanced)
	Cpu_SetDifficultyForDummies(g_Player4, AD_Advanced)
	Cpu_SetDifficultyForDummies(g_Player3, AD_Hard)
			
-- hard
elseif difficultyLevel == DIFFICUTLY_HARD then

	Difficulty_SetForPlayer(g_Player2, 2)
	Cpu_SetDifficultyForDummies(g_Player2, AD_Insane)
	Cpu_SetDifficultyForDummies(g_Player4, AD_Insane)
	Cpu_SetDifficultyForDummies(g_Player3, AD_Advanced)
			
end

end


-- MUSIC AND AUDIO function SetupMusicPlaylist() -- clear the current playlist Sound_PlaylistClear( PC_Music ) -- add tracks to the playlist Sound_PlaylistAddTrack( PC_Music, "music_theme_chaos_01" ) Sound_PlaylistAddTrack( PC_Music, "dawn_of_war_theme" ) Sound_PlaylistAddTrack( PC_Music, "music_EldarThemev2" ) Sound_PlaylistAddTrack( PC_Music, "battle_ingame_01" ) Sound_PlaylistAddTrack( PC_Music, "music_theme_spacemarines_01" ) -- 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, "theme_chaos_01" )

Sound_PlaylistClear( PC_Ambient )
-- add tracks to the playlist    
Sound_PlaylistAddTrack( PC_Ambient, "ambient_space" )
-- mark these tracks to play randomly
Sound_PlaylistSetorder( PC_Ambient, false )
-- add 5 to 10 seconds silence between tracks
Sound_PlaylistSetSilence( PC_Ambient, 5, 10 )	

end


-- START THE GAME CHECKS TO SEE IF NIS"S ARE PLAYING function Rule_StartGame()

if not Event_IsAnyRunning() then

	--[[FOW]]
	FOW_UnRevealAll()
	
	--[[ Manage AI ]]
	Cpu_Enable(g_Player2, true)
	Cpu_Enable(g_Player3, true)
	Cpu_Enable(g_Player4, true)
	Cpu_Enable(g_Player5, true)
	Cpu_LockSGroupAcrossPlayers( "sg_Chaos_Locked" )
	Cmd_SetStance( "sg_Chaos_Locked", STANCE_Attack )
	Cpu_LockSGroupAcrossPlayers( "sg_daemonPrince" )
	Cpu_SetClassPreference( g_Player4, UC_LightInfantryLow, 10 )
	Cpu_SetClassPreference( g_Player4, UC_HeavyInfantryMed, 20 )
	Cpu_SetClassPreference( g_Player4, UC_LightInfantryHigh, 20 )
	Cpu_SetClassPreference( g_Player4, UC_VehicleMed, 5 )
	Cpu_SetClassPreference( g_Player4, UC_VehicleHigh, 5 )
	Cpu_SetClassPreference( g_Player4, UC_MonsterHigh, 20 )
	Cpu_SetClassPreference( g_Player4, UC_MonsterMed, 20 )
	Cpu_SetClassPreference( g_Player4, UC_HeavyInfantryHigh, 25 )
	Cpu_SetClassPreference( g_Player4, UC_HeavyInfantryMed, 20 )

	Cpu_SetClassPreference( g_Player2, UC_LightInfantryLow, 10 )
	Cpu_SetClassPreference( g_Player2, UC_HeavyInfantryMed, 20 )
	Cpu_SetClassPreference( g_Player2, UC_LightInfantryHigh, 20 )
	Cpu_SetClassPreference( g_Player2, UC_VehicleMed, 5 )
	Cpu_SetClassPreference( g_Player2, UC_VehicleHigh, 5 )
	Cpu_SetClassPreference( g_Player2, UC_MonsterHigh, 20 )
	Cpu_SetClassPreference( g_Player2, UC_MonsterMed, 20 )
	Cpu_SetClassPreference( g_Player2, UC_HeavyInfantryHigh, 25 )
	Cpu_SetClassPreference( g_Player2, UC_HeavyInfantryMed, 20 )

	if (Player_GetRelationship(g_Player1, g_Player3) == R_ALLY) then

-- print("Allies") else -- print("something wrong") end

	--[[Marine Stuff]]
	--Rule_AddInterval(Rule_Player1GetAll, 1)
	--Rule_AddInterval(Rule_GetForceCommander, 2)
	
	--[[ Give Player Resources ]]
	Player_SetResource(g_Player1, RT_Requisition, 1000)
	Player_SetResource(g_Player1, RT_Power, 500)
	
	--[[Lock Stuff]]
	Player_RestrictSquad(g_Player1, "space_marine_squad_librarian")
	Player_RestrictSquad(g_Player2, "chaos_squad_lord")
	Player_RestrictSquad(g_Player2, "chaos_squad_sorcerer")
	Player_RestrictSquad(g_Player4, "chaos_squad_lord")
	Player_RestrictSquad(g_Player4, "chaos_squad_sorcerer")
	Player_RestrictSquad(g_Player5, "chaos_squad_lord")
	Player_RestrictSquad(g_Player5, "chaos_squad_sorcerer")
	--Player_RestrictSquad(g_Player4, "ork_squad_warboss")
	
	--[[Grant Stuff]]
	--Rule_AddOneShot(Rule_DeliverBase, 4)
	
	--[[Mid Game ]]
	--Rule_AddOneShot(Rule_OrksArrive, 900)
	
	--[[ Chaos Stuff ]]
	Rule_AddOneShot(Rule_StartHorrors, 60)
	--Rule_AddInterval(Rule_HandleDaemonPrince, 10)
	--Rule_AddInterval(Rule_MentionEffect, 10)
	Rule_AddInterval(Rule_Let_Prince_Loose, 2 )
	
	--[[ Win Condition things ]]
	obj_table_P1 = { title_id = 340020, short_desc_id = 340021, help_tip_id = 340022 }	-- Kill the Daemon Prince
	obj_table_P2 = { title_id = 340025, short_desc_id = 340026, help_tip_id = 340027 }	-- Gabriel is the Key
	obj_table_S1 = { title_id = 340030, short_desc_id = 340031, help_tip_id = 340032 }	-- Kill the Orks
	
	Rule_AddOneShot(Rule_Objective_P1, 3)
	
	Rule_AddInterval( Rule_PlayerLoses, 1 )
	
	Rule_AddInterval( Rule_Prince_Dead, 1 )
	
	Rule_AddInterval(Rule_TheReturners, 5)	
	--Rule_AddInterval(Rule_TOTHDead, 5)	
	
	Cpu_ForceAttack( g_Player5, g_Player1 )
	
	-- save now
	Util_Autosave( "$340150" ) 

	
	Rule_Remove(Rule_StartGame)
end

end


--[[OBJECTIVES ]] function Rule_Objective_P1() Util_ObjectiveCreate(obj_table_P1, true) Rule_AddOneShot(Rule_IE_OpeningWarning, 0.5) end

function Rule_Objective_P2() Util_ObjectiveCreate(obj_table_P2, true) Rule_AddOneShot(Rule_IE_CaptainImmune, 0.5) end

function Rule_Objective_S1() Util_ObjectiveCreate(obj_table_S1, false) Rule_AddOneShot(Rule_IE_OrksArrive, 0.5) end


--[[INTEL EVENTS & Closing NIS ]] function Rule_NIS_Closing() Util_StartNIS(EVENTS.NIS_Closing) end

function Rule_IE_OpeningWarning() Util_StartIntel(EVENTS.IE_OpeningWarning) end

function Rule_IE_CaptainImmune() Util_StartIntel(EVENTS.IE_CaptainImmune) end

function Rule_IE_OrksArrive() Util_StartIntel(EVENTS.IE_OrksArrive) end


--[[Main Functions ]] function Rule_Player1GetAll()

SGroup_AddGroup(SGroup_CreateIfNotFound("sg_Player1All"), Player_GetSquads(g_Player1))

end

function Rule_GetForceCommander() local blueprinttable = { { name = "space_marine_squad_force_commander", count = 1 } } Rule_GetFC = function( sgroupid, itemindex, squadID ) if Squad_GetBlueprintName(squadID) == "space_marine_squad_force_commander" then SGroup_Add(SGroup_CreateIfNotFound("sg_player1FC"), squadID) end end

if SGroup_ContainsBlueprints("sg_Player1All", blueprinttable, true) == true then
	SGroup_ForEach(SGroup_FromName("sg_Player1All"), Rule_GetFC)
	if not Rule_Exists(Rule_ForceCommanderCheck) then
		Rule_AddInterval(Rule_ForceCommanderCheck, 1)
	end
	Rule_Remove(Rule_GetForceCommander)
end

end

function Rule_ForceCommanderCheck()

if SGroup_IsEmpty("sg_player1FC") then
	if not Rule_Exists(Rule_GetForceCommander) then
		Rule_AddInterval(Rule_GetForceCommander, 1)
	end
end

end

function Rule_PlayerLoses()

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

g_unit_exceptions = 
{
	"guard_squad_inquisitor",
	"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

function Rule_GameOver() World_SetGameOver() end

--SAFETY NET

function Rule_TheReturners()

Util_TrackCharacterAndDropPodIn( g_Player1, "sg_NIS_gabe", "space_marine_squad_force_commander", "mk_FC_Rez" )
Util_TrackCharacterAndDropPodIn( g_Player1, "sg_NIS_inquis", "guard_squad_inquisitor", "mk_Toth_Rez" )

end

--[[ Safety FC 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 TOTH ]] function Rule_TOTHDead()

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

if not SGroup_ContainsBlueprints("sg_ALL", blueprinttable, false) then
	Rule_AddOneShot(Rule_TOTHResurrect, 1)
	Rule_Remove(Rule_TOTHDead)
end

SGroup_Clear( SGroup_CreateIfNotFound("sg_TOTH") )

end

function Rule_TOTHResurrect() Util_CreateSquadsAndDropPodIn(g_Player1, "sg_TOTH", "guard_squad_inquisitor", Marker_GetPosition(Marker_FromName("mk_Toth_Rez", "basic_marker")), 1, 1) Rule_AddInterval(Rule_TOTHDead, 5) end]]


-- Deliver Base

function Rule_DeliverBase()

Rule_AddOneShot(Rule_DeliverHQ, 2)
Rule_AddOneShot(Rule_DeliverPower1, 3)
Rule_AddOneShot(Rule_DeliverPower2, 3.5)
Rule_AddOneShot(Rule_DeliverTemple, 5)
Rule_AddOneShot(Rule_DeliverArmoury, 5.5)
Rule_AddOneShot(Rule_DeliverMachine, 6.5)

end

function Rule_DeliverHQ() EGroup_ReSpawn("eg_base_hq") Util_ResetAndRebuild( "eg_base_hq", "sg_serv1" ) end

function Rule_DeliverPower1() EGroup_ReSpawn("eg_base_power1") Util_ResetAndRebuild( "eg_base_power1", "sg_serv2" ) end

function Rule_DeliverPower2() EGroup_ReSpawn("eg_base_power2") Util_ResetAndRebuild( "eg_base_power2", "sg_serv3" ) end

function Rule_DeliverTemple() EGroup_ReSpawn("eg_base_temple") Util_ResetAndRebuild( "eg_base_temple", "sg_serv4" ) end

function Rule_DeliverArmoury() EGroup_ReSpawn("eg_base_armoury") Util_ResetAndRebuild( "eg_base_armoury", "sg_serv5" ) end

function Rule_DeliverMachine() EGroup_ReSpawn("eg_base_machine") Util_ResetAndRebuild( "eg_base_machine", "sg_serv6" ) end


--[[Player Stuff ]] function Rule_PlayerMissionSettings()

end


-- Daemon Prince Stuff

-- -- Function to make Daemon Prince vulnerable / invulnerable as appropriate, and watch for his death

function Rule_HandleDaemonPrince()

-- first check to see if the Daemon Prince is around
if SGroup_IsEmpty("sg_daemonPrince") then
	Util_ObjectiveComplete(obj_table_P1.title_id)
	Util_ObjectiveComplete(obj_table_P2.title_id)
	
	Rule_Remove(Rule_HandleDaemonPrince)
	Rule_Remove( Rule_GenHorrors )		
	
	Rule_AddOneShot(Rule_NIS_Closing, 7)
	
-- he is still around, check him against gabriel
else
	
	-- if the daemon is currently set to invulnerable, check to see if Gabriel is nearby to turn him vulnerable
	if (g_invulnerable == true) then
		
		if not SGroup_IsEmpty("sg_gabriel") then
		-- Check the relative positions of Gabriel and the Daemon
			if (Prox_SGroupSGroup("sg_gabriel", "sg_daemonPrince", PROX_CENTER) < 20) then
				MakeDaemonPrinceVulnerable()
			end
		end
		
	-- else the daemon is currently vulnerable and we need to check to see if he should be becoming invulnerable again
	else
		
		if SGroup_IsEmpty("sg_gabriel") then
			MakeDaemonPrinceInvulnerable()
		else
		-- Check the relative positions of Gabriel and the Daemon
			if (Prox_SGroupSGroup("sg_gabriel", "sg_daemonPrince", PROX_CENTER) > 20) then
				MakeDaemonPrinceInvulnerable()
			end
		end
	end
	
end

end

-- The functions below actually turn on and off the daemons invulnerable power. -- At the moment it is true invulnerability, would be better is you could make it only -- take 10 - 20 percent damage instead

-- Possible method: perhaps by scaling his health up by a factor of five or ten when -- he's "invulnerable", and scaling it back down after. If you increas his max health -- at the same time the health bar shouldn't change?

-- -- Turn on the Daemon's invulnerability

function MakeDaemonPrinceInvulnerable() SGroup_SetHealthInvulnerable("sg_daemonPrince", true) g_invulnerable = true end

-- -- Turn off the Daemon's invulnerability

function MakeDaemonPrinceVulnerable() SGroup_SetHealthInvulnerable("sg_daemonPrince", false) g_invulnerable = false g_mentioneffect = true end

-- -- Mention the effect Gabriel has on the Daemon

function Rule_MentionEffect() if (g_mentioneffect == true) then Rule_AddOneShot(Rule_IE_CaptainImmune, 1) Rule_Remove(Rule_MentionEffect) end end

function Rule_Let_Prince_Loose()

if SGroup_IsUnderAttack( "sg_daemonPrince", 0 ) == true and 
	SGroup_GetAvgHealth( "sg_daemonPrince" ) <= 0.8 then

	Cpu_UnlockSGroupAcrossPlayers( "sg_daemonPrince" )
	Cpu_ForceAttack( g_Player5, g_Player3 )
	
	-- save now
	Util_Autosave( "$340154" ) 

	
	Rule_Remove( Rule_Let_Prince_Loose )

end

end

function Rule_Prince_Dead()

if SGroup_IsEmpty( "sg_daemonPrince" ) == true then

	Rule_AddOneShot( Rule_EndGame, 10 )

	Rule_Remove( Rule_Prince_Dead )

end

end


-- Horrors Stuff

function Rule_StartHorrors() Rule_AddInterval(Rule_GenHorrors, 5) end

--[[ Generate Horrors ]] function Rule_GenHorrors()

if table.getn(t_GenHorrors.sgroup) < 1 then
	Rule_Remove(Rule_GenHorrors)
else
	
	for i = table.getn(t_GenHorrors.sgroup), 1, -1 do
	
		SGroup_CreateIfNotFound(t_GenHorrors.sgroup[i])
		
		SGroup_Clear(SGroup_CreateIfNotFound("sg_horrormarker"))
		local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_horrormarker", t_GenHorrors.marker[i])
			
		if SGroup_IsEmpty("sg_horrormarker") == false then
			
			-- Util_CreateSquadsAtMarkerEx(g_Player5, t_GenHorrors.sgroup[i], "chaos_squad_horror", t_GenHorrors.marker[i], 1, 9)
			Util_CreateHorrorsAndSummon(g_Player5, t_GenHorrors.sgroup[i], Marker_GetPosition(Marker_FromName(t_GenHorrors.marker[i], "basic_marker")), 2, 9)
			
			--Deg_AddtoCpuLockGroup(g_Player5, t_GenHorrors.sgroup[i])
			
			--Cmd_SetStance(t_GenHorrors.sgroup[i], STANCE_Attack)
			--Cmd_AttackSGroup(t_GenHorrors.sgroup[i], "sg_Player1All")
			
			table.remove(t_GenHorrors.sgroup, i)
			table.remove(t_GenHorrors.marker, i)
			break
		end
	end
	
	SGroup_CreateIfNotFound("sg_horrorAttack")
	if SGroup_IsEmpty("sg_horrorAttack") then
		
		local rand1 = World_GetRand(1, table.getn(t_GenHorrors.marker))
		local rand2 = World_GetRand(5, 8)
		
		--Util_CreateSquadsAtMarkerEx(g_Player5, "sg_horrorAttack", "chaos_squad_horror", t_GenHorrors.marker[rand1], 1, rand2)
		Util_CreateHorrorsAndSummon(g_Player5, "sg_horrorAttack", Marker_GetPosition(Marker_FromName(t_GenHorrors.marker[rand1], "basic_marker")), 1, rand2)
		
		--Deg_AddtoCpuLockGroup(g_Player5, "sg_horrorAttack")
		
		--Cmd_SetStance("sg_horrorAttack", STANCE_Attack)
		--Cmd_AttackSGroup("sg_horrorAttack", "sg_Player1All")
		
	end
end

end

--[[Lock Group ]] function Deg_AddtoCpuLockGroup(playerID, sgroupname)

SGroup_CreateIfNotFound("sg_cpulock")
Cpu_UnlockSGroup(playerID, "sg_cpulock")
SGroup_AddGroup(SGroup_FromName("sg_cpulock"), SGroup_FromName(sgroupname))
Cpu_LockSGroup(playerID, "sg_cpulock")

end


--[[Ork Stuff ]] function Rule_OrksArrive()

t_GenOrks = {
	sgroup =    {"sg_orkForce1",   "sg_orkForce2",      "sg_orkForce3",        "sg_orkForce4",         "sg_orkForce5",     "sg_orkForce6",        "sg_orkForce7",  "sg_orkForce8"}, 
	blueprint = {"ork_squad_grot", "ork_squad_mek_boy", "ork_squad_squiggoth", "ork_squad_shoota_boy", "ork_squad_slugga", "ork_squad_killa_kan", "ork_squad_nob", "ork_squad_killa_kan"}, 
	num =       {3, 1, 1, 2, 2, 1, 1, 1}
}

Rule_AddInterval(Rule_GenOrkForce, 6)

Rule_Remove(Rule_OrksArrive)

end

function Rule_GenOrkForce()

if table.getn(t_GenOrks.sgroup) < 1 then
	Rule_Remove(Rule_GenOrkForce)
	Rule_AddOneShot(Rule_Objective_S1, 0.0)
else
	
	for i = 1, table.getn(t_GenOrks.sgroup) do
	
		SGroup_CreateIfNotFound(t_GenOrks.sgroup[i])
		
		SGroup_Clear(SGroup_CreateIfNotFound("sg_orkmarker"))
		local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_orkmarker", "mkr_ork")
		
		if SGroup_IsEmpty("sg_orkmarker") == true then
			Util_CreateSquadsAtMarker(g_Player4, t_GenOrks.sgroup[i], t_GenOrks.blueprint[i], "mkr_ork", t_GenOrks.num[i])
			
			table.remove(t_GenOrks.sgroup, i)
			table.remove(t_GenOrks.blueprint, i)
			table.remove(t_GenOrks.num, i)
			
		end
		break
	end

end

end

function Rule_EndGame()

Cpu_Enable(g_Player1, false)
Cpu_Enable(g_Player2, false)
Cpu_Enable(g_Player3, false)
Cpu_Enable(g_Player4, false)
Cpu_Enable(g_Player5, false)

Rule_RemoveAll()
Util_StartNIS(EVENTS.NIS_Closing)

Objective_SetState( obj_table_P1.title_id, OS_Complete )

Rule_Remove( Rule_EndGame )

end

--[[ Call this function before the gabriel shows up in the nis ]] function Util_GiveGabrielPowerSword( player ) -- -- inc the force commanders weapon up to the power sword local modifier = Modifier_Create( MAT_EntityType, "default_weapon_modifier_hardpoint2", MUT_Addition, false, 1, "force_commander" )

-- apply it to the player
g_modID_FC_sword = Modifier_ApplyToPlayer( modifier, player )

end

-- [[ Call this function right after you trigger the hand-off animation to give gabriel the daemon hammer and give toth the power sword ]] function Util_GabrielGiveTothPowerSword( player ) Modifier_Remove(g_modID_FC_sword)

-- When the modifier is removed from the force commander, he will still have the power sword
--  so we need to force his weapon to change.  We must do this after the modifier is removed though;
-- otherwise, the weapon will just get upgraded again

-- force downgrade all of the players force commanders
local bptable = Util_MakeBlueprintTable("space_marine_squad_force_commander")
local sgtemp = SGroup_CreateIfNotFound("sg_gabrielgivetothpowersword")
local ForceDowngrade = function ( groupid, itemidx, itemid )
	SGroup_Clear( sgtemp )
	SGroup_Add( sgtemp, itemid )
	if SGroup_ContainsBlueprints( sgtemp, bptable, false ) then
		-- ok, this is a FC, force downgrade his weapon
		Squad_ForceResetWeapons( itemid )
	end
end
SGroup_ForEachEx( Player_GetSquads( player ), ForceDowngrade, true, true )

-- cleanup temp sgroup
SGroup_Destroy( sgtemp )

--
--	now give toth the power sword
local modifier1 = Modifier_Create(
		 MAT_EntityType,      
		 "default_weapon_modifier_hardpoint2",
		 MUT_Addition, 
		 false,
		 1, 
		"guard_inquisitor" 
	)
	
-- apply it to the player
local modID_IQ = Modifier_ApplyToPlayer( modifier1, player )

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
Модераторы