--IMPORTS
import("ScarUtil.scar")
--GAME SETUP
function OnGameSetup()
-- setup players. you only need to do this for players that have a starting point
g_Player1 = Setup_Player(0, "$209531", "space_marine_race", 1)
g_Player2 = Setup_Player(1, "$209532", "ork_race", 2)
g_Player3 = Setup_Player(2, "$209533", "npc_race", 1)
g_Player4 = Setup_Player(3, "$209534", "space_marine_race", TEAM_NEUTRAL)
--[[variables]]
g_givebaseIE = 0
g_harassing = 0
g_harassflee = 0
g_underattack = 6
g_reinforcepause = 0
g_conflict1guardalive = 0
g_conflict02Health = 0
g_conflict02Healthlast = 2
g_conflict01Health = 0
g_conflict01Healthlast = 2
g_conflict03Health = 0
g_conflict03Healthlast = 2
g_conflict04Health = 0
g_conflict04Healthlast = 2
g_conflict5guardalive = 0
g_conflict05Health = 0
g_conflict05Healthlast = 2
g_conflict5iter = 0
g_conflict06Health = 0
g_conflict06Healthlast = 2
g_rand_delay = 0
g_base_delay = 1
g_sourceuncovered = 0
g_camp1save = 0
g_camp2save = 0
g_camp3save = 0
g_DoesitExist_Barracks = 0
g_DoesitExist_Armoury = 0
g_DoesitExist_Generator = 0
g_objS2saved = 0
g_firstpoint = 0
g_capturegiven = 0
g_endNIS = 0
g_eventisrunning = 0
t_diff_normal = {hqarmour = 0.65, banneraccuracy = 0.1, postaccuracy = 0.1, turretaccuracy = 0.1, guardarmour = 1.4}
t_diff_hard = {hqarmour = 0.75, banneraccuracy = 0.2, postaccuracy = 0.2, turretaccuracy = 0.2, guardarmour = 1.35}
t_diff_advance = {hqarmour = 0.85, banneraccuracy = 0.3, postaccuracy = 0.3, turretaccuracy = 0.3, guardarmour = 1.3}
t_objS2_sguard = {
sgroup = { "sg_guard01_01", "sg_guard01_02", "sg_guard02_01", "sg_guard03_01", "sg_guard04_01", "sg_guard05_01", "sg_guard05_02"},
safe = { "underattack", "underattack", "underattack", "underattack", "underattack", "underattack", "underattack" }
}
end
function OnGameRestore()
g_Player1 = World_GetPlayerAt(0)
g_Player2 = World_GetPlayerAt(1)
g_Player3 = World_GetPlayerAt(2)
g_Player4 = World_GetPlayerAt(3)
end
--ON INITIALIZATION
function OnInit()
EventCue_Enable(false)
--[[playlist]]
Rule_AddOneShot(SetupMusicPlaylist, 0.0)
--[[FOW]]
FOW_RevealAll()
World_EnablePlayerToPlayerFOW(g_Player1, g_Player3, 1);
World_EnablePlayerToPlayerFOW(g_Player1, g_Player4, 0);
Player_SetResource(g_Player4, RT_Requisition, 1000)
Player_SetResource(g_Player4, RT_Power, 500)
--[[Set Cpu]]
Cpu_Enable(g_Player1, 0)
Cpu_Enable(g_Player2, 0)
Cpu_Enable(g_Player3, 0)
Cpu_Enable(g_Player4, 0)
--[[ Preset Stage for NIS]] Fade_Start( 0, false ) W40k_Letterbox( true, 0 )
SetCommanderPowerSword(g_Player1)
Util_StartNIS(EVENTS.NIS_Opening);
Rule_AddOneShot(Rule_FadeIn, 5)
--[[Get the Game Ready to Run]]
Rule_Add(Rule_MissionStart);
--[[Mod the Build Speed of Servitors]]
local modifier_hqconstructionspeed = Modifier_Create(
MAT_EntityType, -- This modifier will be applied to a weapon type
"construction_speed_modifier", -- Modify the max range of the weapon
MUT_Multiplication, -- use multiplication
false,
2,
"servitor" -- Do this to the sniper rifle
)
g_modifier_hqconstructionspeed = Modifier_ApplyToPlayer( modifier_hqconstructionspeed, g_Player4 )
--[[Mod the accuracy of the Colonel's Gun]]
local modifier_weaponaccuracyincrease1 = Modifier_Create(
MAT_WeaponType, -- This modifier will be applied to a weapon type
"accuracy_weapon_modifier", -- Modify the max range of the weapon
MUT_Multiplication, -- use multiplication
false,
50,
"guard_bolt_pistol" -- Do this to the sniper rifle
)
g_modifier_weaponaccuracyincrease1 = Modifier_ApplyToPlayer( modifier_weaponaccuracyincrease1, g_Player3 )
--[[Mod the accuracy of the Colonel's Gun]]
local modifier_weapondamageincrease1 = Modifier_Create(
MAT_WeaponType, -- This modifier will be applied to a weapon type
"max_damage_weapon_modifier", -- Modify the max range of the weapon
MUT_Multiplication, -- use multiplication
false,
50,
"guard_bolt_pistol" -- Do this to the sniper rifle
)
g_modifier_weapondamageincrease1 = Modifier_ApplyToPlayer( modifier_weapondamageincrease1, g_Player3 )
end
Scar_AddInit(OnInit)
function Rule_FadeIn()
Fade_Start(2, true)
end
-- MUSIC/SOUND
function SetupMusicPlaylist()
-- clear the current playlist Sound_PlaylistClear( PC_Music )
-- add tracks to the playlist
Sound_PlaylistAddTrack( PC_Music, "music_theme_spacemarines_01" )
Sound_PlaylistAddTrack( PC_Music, "music_ork_theme" )
Sound_PlaylistAddTrack( PC_Music, "battle_ingame_01" )
Sound_PlaylistAddTrack( PC_Music, "stinger_pressure_stinger" )
Sound_PlaylistAddTrack( PC_Music, "music_force_commander_theme" )
-- mark these tracks to play randomly
Sound_PlaylistSetorder( PC_Music, false )
-- add 5 to 10 seconds silence between tracks
Sound_PlaylistSetSilence( PC_Music, 5, 10 )
Sound_PlaylistClear( PC_Ambient )
-- add tracks to the playlist
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, 5, 10 )
-- don't play yet
Sound_PlaylistStart(PC_Ambient)
Sound_PlaylistStart(PC_Music)
Sound_PlaylistPlayNow(PC_Music, "music_warhammer40ktheme")
end
-- DIFFICULTY LEVEL
-- the functions here set the difficulty level for the mission. Should be called from OnGameSetup function SetDifficultyLevel()
local difficultyLevel = Difficulty_Get()
-- easy
if difficultyLevel == DIFFICULTY_EASY then
Difficulty_SetForPlayer(g_Player2, 0)
t_difficulty = t_diff_normal
-- medium
elseif difficultyLevel == DIFFICULTY_NORMAL then
Difficulty_SetForPlayer(g_Player2, 1)
t_difficulty = t_diff_hard
-- hard
elseif difficultyLevel == DIFFICULTY_HARD then
Difficulty_SetForPlayer(g_Player2, 2)
t_difficulty = t_diff_advance
end
Rule_AddOneShot(Rule_OrkDifficultyModifiers, 0.0)
end
function Rule_OrkDifficultyModifiers()
--[[Mod the armourclass of the Ork HQ]] local modifier_buildingarmourdecrease = Modifier_Create( MAT_EntityType, -- This modifier will be applied to a weapon type "armour_modifier", -- Modify the max range of the weapon MUT_Multiplication, -- use multiplication false, t_difficulty.hqarmour, "ork_hq" -- Do this to the sniper rifle )
g_modifier_buildingarmourdecrease = Modifier_ApplyToPlayer( modifier_buildingarmourdecrease, g_Player2 )
--[[Mod the armourclass of the Guard]] local modifier_guardarmourincrease = Modifier_Create( MAT_EntityType, -- This modifier will be applied to a weapon type "armour_modifier", -- Modify the max range of the weapon MUT_Multiplication, -- use multiplication false, t_difficulty.guardarmour, "guard_soldier" -- Do this to the sniper rifle )
g_modifier_guardarmourincrease = Modifier_ApplyToPlayer( modifier_guardarmourincrease, g_Player3 )
--[[Mod the accuracy of the Waaagh Banners]]
local modifier_weaponaccuracydecrease1 = Modifier_Create(
MAT_WeaponType, -- This modifier will be applied to a weapon type
"accuracy_weapon_modifier", -- Modify the max range of the weapon
MUT_Multiplication, -- use multiplication
false,
t_difficulty.banneraccuracy,
"ork_shoota_turret_waaaghbanner" -- Do this to the sniper rifle
)
g_modifier_weaponaccuracydecrease1 = Modifier_ApplyToPlayer( modifier_weaponaccuracydecrease1, g_Player2 )
--[[Mod the accuracy of the Ork Listening Posts]]
local modifier_weaponaccuracydecrease2 = Modifier_Create(
MAT_WeaponType, -- This modifier will be applied to a weapon type
"accuracy_weapon_modifier", -- Modify the max range of the weapon
MUT_Multiplication, -- use multiplication
false,
t_difficulty.postaccuracy,
"ork_shoota_turret_listeningpost" -- Do this to the sniper rifle
)
g_modifier_weaponaccuracydecrease2 = Modifier_ApplyToPlayer( modifier_weaponaccuracydecrease2, g_Player2 )
--[[Mod the accuracy of the Ork Boy Hutz]]
local modifier_weaponaccuracydecrease3 = Modifier_Create(
MAT_WeaponType, -- This modifier will be applied to a weapon type
"accuracy_weapon_modifier", -- Modify the max range of the weapon
MUT_Multiplication, -- use multiplication
false,
t_difficulty.turretaccuracy,
"ork_shoota_turret" -- Do this to the sniper rifle
)
g_modifier_weaponaccuracydecrease2 = Modifier_ApplyToPlayer( modifier_weaponaccuracydecrease3, g_Player2 )
end
--MAIN SCRIPT function Rule_MissionStart()
if not Event_IsAnyRunning() then
--[[FOW]]
FOW_Reset()
Sound_PlaylistPlayNow(PC_Music, "music_force_commander_theme")
Rule_AddOneShot(SetDifficultyLevel, 0.0)
--[[ fix the camera ]]
FOW_RevealMarker("mkr_marinehq", 20)
Util_Ping_LoopingMkr("pg_startping", "mkr_marinehq")
Rule_AddOneShot(Rule_PingStop, 20)
--[[Cheat for Squad Cap]]
--[[ Player_SetSquadCap(g_Player1, 12) Player_GrantResearch(g_Player1, "squad_cap_research") Player_GrantResearch(g_Player1, "squad_cap_research_1")]]
--[[Lock Stuff]]
Restrict_SpaceMarines( g_Player1, 1 )
--Player_UnRestrictResearch(g_Player1, "squad_cap_research")
Player_UnRestrictResearch(g_Player1, "marine_max_weapons_research")
Player_UnRestrictBuilding(g_Player1, "space_marine_hq")
Player_UnRestrictSquad(g_Player1, "space_marine_squad_servitor")
Player_UnRestrictSquad(g_Player1, "space_marine_squad_tactical")
-- Player_UnRestrictSquad(g_Player1, "space_marine_squad_skull_probe")
--[[Grant Stuff]]
Player_SetResource(g_Player1, RT_Requisition, 1000)
Player_SetResource(g_Player1, RT_Power, 500)
--[[Make Marine Base]]
Rule_AddInterval(Rule_GoBuildBase, 4)
Rule_AddInterval(Rule_GrabHQ, 2)
--[[Start Conflicts]]
g_Guard_iter = 1
g_Ork_iter = 1
Rule_Add(Rule_SetupConflicts)
--[[Safety Nets]]
Rule_AddInterval(Rule_FCDead, 1)
Rule_AddInterval(Rule_MarinesDead, 5)
--[[ Check on Guard ]]
--[[Spawn Orks]]
g_Ambush_iter = 1
Rule_AddInterval(Rule_AmbushSetup, 1)
Rule_AddInterval(Rule_BaseDefense, 2)
Rule_AddInterval(Rule_CampClearCheck, 5)
Rule_Add(Rule_GrabHutz)
Rule_AddOneShot(Rule_SourceoftheLootedTank, 1)
--[[harassing orks]]
-- Rule_AddOneShot(Rule_HarassingOrksTrigger, 5)
--[[HQ headsup]]
Rule_AddOneShot(Rule_IE_NoHq, 3)
--[[Set Objectives]]
Rule_AddOneShot(Rule_Objective_P_Point_Trigger, 10)
obj_table_P_source = { title_id = 208000, short_desc_id = 208001, help_tip_id = 208002 }
obj_table_P_base = { title_id = 208005, short_desc_id = 208006, help_tip_id = 208007 }
obj_table_S_secure = { title_id = 208010, short_desc_id = 208011, help_tip_id = 208012 }
obj_table_S_guard = { title_id = 208015, short_desc_id = 208016, help_tip_id = 208017 }
obj_table_P_killbase = { title_id = 208020, short_desc_id = 208021, help_tip_id = 208022 }
obj_table_S_cleanse = { title_id = 208025, short_desc_id = 208026, help_tip_id = 208027 }
obj_table_P_barracks = { title_id = 208030, short_desc_id = 208031, help_tip_id = 208032 }
obj_table_P_armoury = { title_id = 208035, short_desc_id = 208036, help_tip_id = 208037 }
obj_table_P_addon = { title_id = 208040, short_desc_id = 208041, help_tip_id = 208042 }
obj_table_P_generator = { title_id = 208045, short_desc_id = 208046, help_tip_id = 208047 }
obj_table_P_capture = { title_id = 208110, short_desc_id = 208111, help_tip_id = 208112 }
obj_table_P_post = { title_id = 208055, short_desc_id = 208056, help_tip_id = 208057 }
obj_table_P_wait = { title_id = 208060, short_desc_id = 208061, help_tip_id = 208062 }
Rule_AddInterval(Rule_GameOver, 1)
Rule_Remove(Rule_MissionStart)
--[[Autosave]]
Rule_AddInterval(Rule_Autosave_209550, 1)
end
end
function Rule_Autosave_209550() if not Event_IsAnyRunning() then Rule_Remove(Rule_Autosave_209550) Util_Autosave("$209550") end end
function Rule_PingStop() Util_Ping_Stop("pg_startping") end
--SAFETY NET --[[ Safety FC ]] function Rule_FCDead() Util_TrackCharacterAndDropPodIn( g_Player1, "sg_nisAmarinecom", "space_marine_squad_force_commander", "mkr_marinehq" ) end
--[[ Safety Marines ]] function Rule_MarinesDead()
sg_ALL = Player_GetSquads(g_Player1)
local blueprinttable = Util_MakeBlueprintTable("space_marine_squad_tactical")
if not SGroup_ContainsBlueprints(sg_ALL, blueprinttable, false) then
Rule_AddOneShot(Rule_MarineResurrect, 1)
Rule_Remove(Rule_MarinesDead)
end
end
function Rule_MarineResurrect() Util_CreateSquadsAndDropPodIn(g_Player1, "sg_marines", "space_marine_squad_tactical", Marker_GetPosition(Marker_FromName("mkr_marinehq", "basic_marker")), 1, 8) Rule_AddInterval(Rule_MarinesDead, 5) end
--[[ Safety Servitor ]] function Rule_ServitorDead()
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
end
function Rule_ServitorResurrect()
Util_CreateSquadsAndDropPodIn(g_Player1, "sg_servitor", "space_marine_squad_servitor", Marker_GetPosition(Marker_FromName("mkr_marinehq", "basic_marker")), 1, 1)
Rule_AddInterval(Rule_ServitorDead, 5)
end
--MARINES --[[ function Rule_MarineBaseStart()
Util_CreateSquadsAndDropPodIn(g_Player4, "sg_baseservitor", "space_marine_squad_servitor", Marker_GetPosition(Marker_FromName("mkr_marineservitor", "basic_marker")), 1, 1)
Rule_AddOneShot(Rule_GoBuildBase, 5)
end ]] function Rule_GoBuildBase()
Player_GetAllEntitiesNearMarker(g_Player4, "eg_marinehq", "mkr_marinehq")
if EGroup_IsEmpty("eg_marinehq") and SGroup_Exists("sg_baseservitor") then
Cmd_ConstructBlueprintMarker("sg_baseservitor", "space_marine_hq", "mkr_marinehq")
Cmd_MoveToMarker("sg_nisAmarine2", "mkr_start1")
Cmd_MoveToMarker("sg_nisAmarine3", "mkr_start2")
Cmd_MoveToMarker("sg_nisAmarinecom", "mkr_start3")
else
Rule_Remove(Rule_GoBuildBase)
end
end
function Rule_GrabHQ()
Player_GetAllEntitiesNearMarker(g_Player4, "eg_marinehq", "mkr_marinehq")
if not EGroup_IsEmpty("eg_marinehq") then
if Entity_GetBuildingProgress(EGroup_GetSpawnedEntityAt(EGroup_FromName("eg_marinehq"), 1)) == 1.0 then
EGroup_SetPlayerOwner("eg_marinehq", g_Player1)
SGroup_SetPlayerOwner("sg_baseservitor", g_Player1)
--[[remove the build modifier]]
Modifier_Remove( g_modifier_hqconstructionspeed )
--[[Complete the waiting for the Base Obj]]
-- Util_ObjectiveComplete(obj_table_P_wait.title_id)
--[[check for servitors existance]]
Rule_AddInterval(Rule_ServitorDead, 2)
--[[Cue the Establish Base Obj]]
Rule_AddInterval(Rule_Objective_P_Base, 1)
Rule_Remove(Rule_GrabHQ)
else
Command_SquadEntity(g_Player4, SGroup_FromName("sg_baseservitor"), SCMD_BuildStructure, EGroup_FromName("eg_marinehq"))
end
end
end
function Rule_GrabHutz()
for i = 1,3 do
Player_GetAllEntitiesNearMarker(g_Player2, "eg_orkspawn0"..i, "mkr_gethut0"..i)
EGroup_AddGroup(EGroup_CreateIfNotFound("eg_temphutz"), EGroup_FromName("eg_orkspawn0"..i))
end
local num = EGroup_Count(EGroup_FromName("eg_temphutz"))
-- print("the number of huts caught is "..num)
Rule_Remove(Rule_GrabHutz)
end
--[[ Harassing Orks ]]
function Rule_HarassingOrksTrigger() Rule_AddInterval(Rule_HarassingOrks, 2) end
function Rule_HarassingOrks()
local rand = World_GetRand(7, 9)
if SGroup_Exists("sg_harassingOrks") == false then
Util_CreateSquadsAtMarkerEx(g_Player2, "sg_harassingOrks", "ork_squad_slugga", "mkr_nisA_orkstart", 1, rand)
elseif SGroup_IsEmpty("sg_harassingOrks") then
if Player_CanSeePosition(g_Player1, Marker_GetPosition(Marker_FromName("mkr_nisA_orkstart", "basic_marker"))) == false then
Util_CreateSquadsAtMarkerEx(g_Player2, "sg_harassingOrks", "ork_squad_slugga", "mkr_nisA_orkstart", 1, rand)
else
Rule_Remove(Rule_HarassingOrks)
end
elseif Squad_Count(SGroup_GetSpawnedSquadAt(SGroup_FromName("sg_harassingOrks"), 1)) > 5 then
if SGroup_IsUnderAttack("sg_harassingOrks", false) == true then
g_underattack = g_underattack+1
if g_underattack < 2 then
Cmd_StopSquads("sg_harassingOrks")
else
Cmd_SetStance("sg_harassingOrks", STANCE_Attack)
end
elseif g_underattack > 5 then
g_underattack = 0
Cmd_MoveToMarker("sg_harassingOrks", "mkr_marinehq")
end
elseif Squad_Count(SGroup_GetSpawnedSquadAt(SGroup_FromName("sg_harassingOrks"), 1)) < 6 then
g_underattack = g_underattack+1
Cmd_MoveToMarker("sg_harassingOrks", "mkr_nisA_orkstart")
Cmd_SetStance("sg_harassingOrks", STANCE_StandGround)
--[[fire of Intel Event]]
if g_harassflee == 0 then
if not Event_IsAnyRunning() then
Rule_AddOneShot(Rule_IE_HarassFlee, 1)
end
g_harassflee = 1
end
--[[reinforce the squad]]
if SGroup_IsUnderAttack("sg_harassingOrks", false) == false
and Squad_IsReinforcing(SGroup_GetSpawnedSquadAt(SGroup_FromName("sg_harassingOrks"), 1)) == false
and Squad_Count(SGroup_GetSpawnedSquadAt(SGroup_FromName("sg_harassingOrks"), 1)) < 6 then
Cmd_ReinforceTrooper("sg_harassingOrks", 1)
end
end
--[[Message to contact the Player on first contact]]
if g_harassing == 0 then
SGroup_AddGroup(SGroup_CreateIfNotFound("sg_Player1All"), Player_GetSquads(g_Player1))
if SGroup_IsEmpty("sg_Player1All") == false and SGroup_IsEmpty("sg_harassingOrks") == false then
local pos = Squad_GetPosition(SGroup_GetSpawnedSquadAt(SGroup_FromName("sg_harassingOrks"), 1))
if World_DistanceSGroupToPoint("sg_Player1All", pos, true) <= 30 then
if not Event_IsAnyRunning() then
Rule_AddOneShot(Rule_IE_HarassWarning, 1)
end
g_harassing = 1
end
end
end
end
--[[ CONFLICTS ]] function Rule_SetupConflicts()
--[[Create Guard]]
t_Guard = {
sgroup = { "sg_guard01_01", "sg_guard01_02", "sg_guard02_01", "sg_guard03_01", "sg_guard04_01", "sg_guard05_01", "sg_guard05_02", "sg_guard06_01"},
blueprint = {"guard_squad_soldier", "guard_squad_soldier", "guard_squad_soldier", "guard_squad_soldier", "guard_squad_soldier", "guard_squad_soldier", "guard_squad_soldier","guard_squad_lemun_russ"},
marker = {"mkr_guard01_01", "mkr_guard01_02", "mkr_guard02_01", "mkr_guard03_01", "mkr_guard04_01", "mkr_guard05_01", "mkr_guard05_02", "mkr_guard06_01"},
num = {1, 1, 1, 1, 2, 1, 1, 1},
size = {9, 8, 7, 10, 8, 10, 9, 11},
upgrade = {0, 0, 0, 0, 0, 0, 0, 0},
load = {1},
weapon = {"weapon"}
}
if g_Guard_iter <= table.getn(t_Guard.sgroup)then
for i = g_Guard_iter, table.getn(t_Guard.sgroup) do
SGroup_CreateIfNotFound(t_Guard.sgroup[i])
if SGroup_IsEmpty(t_Guard.sgroup[i]) then
Util_CreateSquadsAtMarkerEx(g_Player3, t_Guard.sgroup[i], t_Guard.blueprint[i], t_Guard.marker[i], t_Guard.num[i], t_Guard.size[i])
if t_Guard.upgrade[i] == 1 then
for y = 1, t_Guard.load[i] do
SGroup_ForEach( t_Guard.sgroup[i], function( sgroupid, itemindex, squadID ) Squad_UpgradeWeapon( squadID, t_Guard.weapon[i]) end )
end
end
if t_Guard.blueprint[i] == "guard_squad_lemun_russ" then
SGroup_SetAvgHealth(t_Guard.sgroup[i], 0.61)
end
if t_Guard.blueprint[i] ~= "guard_squad_lemun_russ" then
SGroup_SetMoraleInvulnerable(t_Guard.sgroup[i], true)
end
Cmd_SetStance(t_Guard.sgroup[i], STANCE_Hold)
-- SGroup_SetHealthInvulnerable(t_Guard.sgroup[i], 1) end break end
end
--[[Create Orks]]
t_Ork = {
sgroup = { "sg_ork01_01", "sg_ork01_02", "sg_ork01_03", "sg_ork02_01", "sg_ork03_01", "sg_ork04_01", "sg_ork04_02", "sg_ork04_03", "sg_ork05_01", "sg_ork05_02", "sg_ork05_03", "sg_ork06_01"},
blueprint = {"ork_squad_slugga"},
marker = {"mkr_ork01_01", "mkr_ork01_02", "mkr_ork01_03", "mkr_ork02_01", "mkr_ork03_01", "mkr_ork04_01", "mkr_ork04_02", "mkr_ork04_03", "mkr_ork05_01", "mkr_ork05_02", "mkr_ork05_03", "mkr_ork06_01"},
num = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3},
size = {7, 9, 5, 9, 9, 10, 9, 8, 9, 7, 6, 7, 7},
upgrade = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
load = {1},
weapon = {"weapon"}
}
if g_Ork_iter <= table.getn(t_Ork.sgroup)then
for i = g_Ork_iter, table.getn(t_Ork.sgroup) do
SGroup_CreateIfNotFound(t_Ork.sgroup[i])
if SGroup_IsEmpty(t_Ork.sgroup[i]) then
Util_CreateSquadsAtMarkerEx(g_Player2, t_Ork.sgroup[i], t_Ork.blueprint[1], t_Ork.marker[i], t_Ork.num[i], t_Ork.size[i])
if t_Ork.upgrade[i] == 1 then
for y = 1, t_Ork.load[i] do
SGroup_ForEach( t_Ork.sgroup[i], function( sgroupid, itemindex, squadID ) Squad_UpgradeWeapon( squadID, t_Ork.weapon[i]) end )
end
end
-- if t_Ork.sgroup[i] == "sg_ork01_02" or t_Ork.sgroup[i] == "sg_ork04_02" or t_Ork.sgroup[i] == "sg_ork05_02" or t_Ork.sgroup[i] == "sg_ork06_01" then
Cmd_SetMeleeStance(t_Ork.sgroup[i], MSTANCE_Assault)
-- else
Cmd_SetStance(t_Ork.sgroup[i], STANCE_Hold)
-- end
-- SGroup_SetHealthInvulnerable(t_Ork.sgroup[i], 1) end break end
else
g_addpings = 1
Rule_AddInterval(Rule_Conflict01Check, 1)
Rule_AddInterval(Rule_Conflict02Check, 1)
Rule_AddInterval(Rule_Conflict03Check, 1)
Rule_AddInterval(Rule_Conflict04Check, 1)
Rule_AddInterval(Rule_Conflict05Check, 1)
Rule_AddInterval(Rule_Conflict06Check, 1)
Rule_AddInterval(Rule_Conflict06_UnderAttack, 1)
Rule_AddInterval(Rule_Conflict05_UnderAttack, 1)
Rule_AddInterval(Rule_Conflict04_UnderAttack, 1)
Rule_AddInterval(Rule_Conflict03_UnderAttack, 1)
Rule_AddInterval(Rule_Conflict02_UnderAttack, 1)
Rule_AddInterval(Rule_Conflict01_UnderAttack, 1)
Rule_Remove(Rule_SetupConflicts)
end
g_Guard_iter = g_Guard_iter+1
g_Ork_iter = g_Ork_iter+1
end
function Rule_Conflict01_UnderAttack()
if SGroup_IsUnderAttackByPlayer("sg_ork01_01", false, g_Player1)
or SGroup_IsUnderAttackByPlayer("sg_ork01_02", false, g_Player1)
or SGroup_IsUnderAttackByPlayer("sg_ork01_03", false, g_Player1) then
SGroup_SetMoraleInvulnerable("sg_guard01_01", false)
Cmd_SetStance("sg_guard01_01", STANCE_StandGround)
SGroup_SetMoraleInvulnerable("sg_guard01_02", false)
Cmd_SetStance("sg_guard01_02", STANCE_StandGround)
Rule_Remove(Rule_Conflict01_UnderAttack)
else
SGroup_SetAvgHealth("sg_ork01_01", 1)
SGroup_SetAvgHealth("sg_ork01_02", 1)
SGroup_SetAvgHealth("sg_ork01_03", 1)
SGroup_SetAvgHealth("sg_guard01_01", 1)
SGroup_SetAvgHealth("sg_guard01_02", 1)
end
end
function Rule_Conflict02_UnderAttack()
if SGroup_IsUnderAttackByPlayer("sg_ork02_01", false, g_Player1) then
SGroup_SetMoraleInvulnerable("sg_guard02_01", false)
Cmd_SetStance("sg_guard02_01", STANCE_StandGround)
Rule_Remove(Rule_Conflict02_UnderAttack)
else
SGroup_SetAvgHealth("sg_ork02_01", 1)
SGroup_SetAvgHealth("sg_guard02_01", 1)
end
end
function Rule_Conflict03_UnderAttack()
if SGroup_IsUnderAttackByPlayer("sg_ork03_01", false, g_Player1) then
SGroup_SetMoraleInvulnerable("sg_guard03_01", false)
Cmd_SetStance("sg_guard03_01", STANCE_StandGround)
Rule_Remove(Rule_Conflict03_UnderAttack)
else
SGroup_SetAvgHealth("sg_ork03_01", 1)
SGroup_SetAvgHealth("sg_guard03_01", 1)
end
end
function Rule_Conflict04_UnderAttack()
if SGroup_IsUnderAttackByPlayer("sg_ork04_01", false, g_Player1)
or SGroup_IsUnderAttackByPlayer("sg_ork04_02", false, g_Player1)
or SGroup_IsUnderAttackByPlayer("sg_ork04_03", false, g_Player1) then
SGroup_SetMoraleInvulnerable("sg_guard04_01", false)
Cmd_SetStance("sg_guard04_01", STANCE_StandGround)
Rule_Remove(Rule_Conflict04_UnderAttack)
else
SGroup_SetAvgHealth("sg_ork04_01", 1)
SGroup_SetAvgHealth("sg_ork04_02", 1)
SGroup_SetAvgHealth("sg_ork04_03", 1)
SGroup_SetAvgHealth("sg_guard04_01", 1)
end
end
function Rule_Conflict05_UnderAttack()
if SGroup_IsUnderAttackByPlayer("sg_ork05_01", false, g_Player1)
or SGroup_IsUnderAttackByPlayer("sg_ork05_02", false, g_Player1)
or SGroup_IsUnderAttackByPlayer("sg_ork05_03", false, g_Player1) then
SGroup_SetMoraleInvulnerable("sg_guard05_01", false)
Cmd_SetStance("sg_guard05_01", STANCE_StandGround)
SGroup_SetMoraleInvulnerable("sg_guard05_02", false)
Cmd_SetStance("sg_guard05_02", STANCE_StandGround)
Rule_Remove(Rule_Conflict05_UnderAttack)
else
SGroup_SetAvgHealth("sg_ork05_01", 1)
SGroup_SetAvgHealth("sg_ork05_02", 1)
SGroup_SetAvgHealth("sg_ork05_03", 1)
SGroup_SetAvgHealth("sg_guard05_01", 1)
SGroup_SetAvgHealth("sg_guard05_02", 1)
end
end
function Rule_Conflict06_UnderAttack()
if SGroup_IsUnderAttackByPlayer("sg_ork06_01", false, g_Player1) then
Rule_Remove(Rule_Conflict06_UnderAttack)
else
SGroup_SetAvgHealth("sg_ork06_01", 1)
SGroup_SetAvgHealth("sg_guard06_01", 1)
end
end
--CONFLICT 01
function Rule_Conflict01Check()
t_Orkgroup01 = {
sgroup1 = { "sg_ork01_01", "sg_ork01_02", "sg_ork01_03"},
sgroup2 = { "sg_guard01_01", "sg_guard01_02"},
blueprint = {"ork_squad_slugga"},
marker = {"mkr_ork01_01", "mkr_ork01_02", "mkr_ork01_03"},
num = {1, 1, 1}, size = {6, 5, 7}, upgrade = {0, 0, 0}, load = {1}, weapon = {"weapon"}
}
g_Conflict01dead = 0
SGroup_CreateIfNotFound("sg_nearConflict01")
SGroup_Clear(SGroup_FromName("sg_nearConflict01"))
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_nearConflict01", "mkr_ork01_03")
if not SGroup_IsEmpty("sg_nearConflict01") then
if not Rule_Exists(Rule_Objective_S_Guard) and g_addpings == 1 then
g_addpings = 0
--[[ Util_Ping_LoopingMkr("pg_conflict01a", "mkr_guard01_01") Util_Ping_LoopingMkr("pg_conflict01b", "mkr_guard01_02") Util_Ping_LoopingMkr("pg_conflict02", "mkr_guard02_01") Util_Ping_LoopingMkr("pg_conflict03", "mkr_guard03_01") ]] Rule_AddInterval(Rule_Objective_S_Guard, 1) end
--[[ Util_Ping_Stop("pg_conflict01a") Util_Ping_Stop("pg_conflict01b") ]] if g_conflict01Healthlast ~= 1 then g_conflict01Health = 1 end if not Rule_Exists(Rule_Conflict01Health) then Rule_AddInterval(Rule_Conflict01Health, 1) end
for i = 1, table.getn(t_Orkgroup01.sgroup1) do
if SGroup_IsEmpty(t_Orkgroup01.sgroup1[i]) then
g_Conflict01dead = g_Conflict01dead+1
if g_Conflict01dead == 3 then
if not SGroup_IsEmpty(t_Orkgroup01.sgroup2[1]) then
--[[ this is where it used to run
Cmd_MoveToMarker(t_Orkgroup01.sgroup2[1], "mkr_nisA_civ")]]
g_conflict1guardalive = 1
for i = 1, table.getn(t_objS2_sguard.sgroup) do
if t_Orkgroup01.sgroup2[1] == t_objS2_sguard.sgroup[i] then
t_objS2_sguard.safe[i] = "safe"
end
end
--[[now it stays]]
g_objS2saved = g_objS2saved+1
SGroup_Clear(SGroup_FromName(t_Orkgroup01.sgroup2[1]))
end
if not SGroup_IsEmpty(t_Orkgroup01.sgroup2[2]) then
--[[this is where it used to run
Cmd_MoveToMarker(t_Orkgroup01.sgroup2[2], "mkr_nisA_civ")]]
g_conflict1guardalive = 1
for i = 1, table.getn(t_objS2_sguard.sgroup) do
if t_Orkgroup01.sgroup2[2] == t_objS2_sguard.sgroup[i] then
t_objS2_sguard.safe[i] = "safe"
end
end
--[[now it stays]]
g_objS2saved = g_objS2saved+1
SGroup_Clear(SGroup_FromName(t_Orkgroup01.sgroup2[2]))
end
if g_conflict1guardalive == 1 then
Util_StartIntel(EVENTS.IE_GuardSaved2)
end
if not Rule_Exists(Rule_Conflict01Reset) then
Rule_AddInterval(Rule_Conflict01Reset, 5)
end
Rule_Remove(Rule_Conflict01Check)
break
end
end
end
else
if g_conflict01Healthlast ~= 2 then
g_conflict01Health = 2
end
if not Rule_Exists(Rule_Conflict01Health) then
Rule_AddInterval(Rule_Conflict01Health, 1)
end
end
end
function Rule_Conflict01Health()
if g_conflict01Health == 1 then
if not SGroup_IsEmpty(t_Orkgroup01.sgroup2[1]) then
Cmd_ReinforceTrooper(t_Orkgroup01.sgroup2[1], 1)
end
if not SGroup_IsEmpty(t_Orkgroup01.sgroup2[2]) then
Cmd_ReinforceTrooper(t_Orkgroup01.sgroup2[2], 1)
end
for i = 1, table.getn(t_Orkgroup01.sgroup1) do
if not SGroup_IsEmpty(t_Orkgroup01.sgroup1[i]) then
Cmd_ReinforceTrooper(t_Orkgroup01.sgroup1[i], 1)
Cmd_SetMeleeStance(t_Orkgroup01.sgroup1[i], MSTANCE_Assault)
Cmd_SetStance(t_Orkgroup01.sgroup1[i], STANCE_Attack)
end
end
g_conflict01Healthlast = g_conflict01Health
g_conflict01Health = 0
elseif g_conflict01Health == 2 then
if not SGroup_IsEmpty(t_Orkgroup01.sgroup2[1]) then
Cmd_ReinforceTrooper(t_Orkgroup01.sgroup2[1], 1)
end
if not SGroup_IsEmpty(t_Orkgroup01.sgroup2[2]) then
Cmd_ReinforceTrooper(t_Orkgroup01.sgroup2[2], 1)
end
for i = 1, table.getn(t_Orkgroup01.sgroup1) do
if not SGroup_IsEmpty(t_Orkgroup01.sgroup1[i]) then
Cmd_ReinforceTrooper(t_Orkgroup01.sgroup1[i], 1)
end
end
g_conflict01Healthlast = g_conflict01Health
g_conflict01Health = 0
end
end
function Rule_Conflict01Reset()
t_Orkgroup01 = {
sgroup1 = { "sg_ork01_01", "sg_ork01_02", "sg_ork01_03"},
sgroup2 = { "sg_guard01_01", "sg_guard01_02"},
blueprint = {"ork_squad_slugga"},
marker = {"mkr_ork01_01b", "mkr_ork01_02b", "mkr_ork01_03b"},
num = {1, 1, 1}, size = {3, 4, 2}, upgrade = {0, 0, 0}, load = {1}, weapon = {"weapon"}
}
SGroup_CreateIfNotFound("sg_nearConflict01v2")
SGroup_Clear(SGroup_FromName("sg_nearConflict01v2"))
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_nearConflict01v2", "mkr_orkspawn02")
if EGroup_Count(EGroup_FromName("eg_orkspawn02")) > 0 and SGroup_IsEmpty("sg_nearConflict01v2") then
for i = 1, table.getn(t_Orkgroup01.sgroup1) do
if SGroup_IsEmpty(t_Orkgroup01.sgroup1[i]) then
Util_CreateSquadsAtMarkerEx(g_Player2, t_Orkgroup01.sgroup1[i], t_Orkgroup01.blueprint[1], "mkr_orkspawn02",t_Orkgroup01.num[i], t_Orkgroup01.size[i])
if t_Orkgroup01.upgrade[i] == 1 then
for y = 1, t_Orkgroup01.load[i] do
SGroup_ForEach( t_Orkgroup01.sgroup1[i], function( sgroupid, itemindex, squadID ) Squad_UpgradeWeapon( squadID, t_Orkgroup01.weapon[i]) end )
end
end
Cmd_AttackMoveMarker(t_Orkgroup01.sgroup1[i], t_Orkgroup01.marker[i])
Cmd_SetStance(t_Orkgroup01.sgroup1[i], STANCE_Hold)
end
end
else
-- print("it thinks eg_orkspawn01 is empty") Rule_Remove(Rule_Conflict01Reset) end
end
--CONFLICT 02 function Rule_Conflict02Check()
t_Orkgroup02 = {
sgroup1 = { "sg_ork02_01"},
sgroup2 = { "sg_guard02_01"},
blueprint = {"ork_squad_slugga"},
marker = {"mkr_ork02_01"},
num = {1}, size = {6}, upgrade = {0}, load = {1}, weapon = {"weapon"}
}
g_Conflict02dead = 0
SGroup_CreateIfNotFound("sg_nearConflict02")
SGroup_Clear(SGroup_FromName("sg_nearConflict02"))
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_nearConflict02", "mkr_guard02_01")
if not SGroup_IsEmpty("sg_nearConflict02") then
if not Rule_Exists(Rule_Objective_S_Guard) and g_addpings == 1 then
g_addpings = 0
--[[ Util_Ping_LoopingMkr("pg_conflict01a", "mkr_guard01_01") Util_Ping_LoopingMkr("pg_conflict01b", "mkr_guard01_02") Util_Ping_LoopingMkr("pg_conflict02", "mkr_guard02_01") Util_Ping_LoopingMkr("pg_conflict03", "mkr_guard03_01") ]] Rule_AddInterval(Rule_Objective_S_Guard, 1) end
-- Util_Ping_Stop("pg_conflict02")
if g_conflict02Healthlast ~= 1 then
g_conflict02Health = 1
end
if not Rule_Exists(Rule_Conflict02Health) then
Rule_AddInterval(Rule_Conflict02Health, 1)
end
for i = 1, table.getn(t_Orkgroup02.sgroup1) do
if SGroup_IsEmpty(t_Orkgroup02.sgroup1[i]) then
g_Conflict02dead = g_Conflict02dead+1
if g_Conflict02dead == 1 then
if not SGroup_IsEmpty(t_Orkgroup02.sgroup2[1]) then
--[[this is where it used to run
Cmd_MoveToMarker(t_Orkgroup02.sgroup2[1], "mkr_nisA_civ")]]
Util_StartIntel(EVENTS.IE_GuardSaved3)
for i = 1, table.getn(t_objS2_sguard.sgroup) do
if t_Orkgroup02.sgroup2[1] == t_objS2_sguard.sgroup[i] then
t_objS2_sguard.safe[i] = "safe"
end
end
--[[now it stays]]
g_objS2saved = g_objS2saved+1
SGroup_Clear(SGroup_FromName(t_Orkgroup02.sgroup2[1]))
end
if not Rule_Exists(Rule_Conflict02Reset) then
Rule_AddInterval(Rule_Conflict02Reset, 5)
end
Rule_Remove(Rule_Conflict02Check)
break
end
end
end
else
if g_conflict02Healthlast ~= 2 then
g_conflict02Health = 2
end
if not Rule_Exists(Rule_Conflict02Health) then
Rule_AddInterval(Rule_Conflict02Health, 1)
end
end
end
function Rule_Conflict02Health()
if g_conflict02Health == 1 then
if not SGroup_IsEmpty(t_Orkgroup02.sgroup2[1]) then
Cmd_ReinforceTrooper(t_Orkgroup02.sgroup2[1], 1)
end
for i = 1, table.getn(t_Orkgroup02.sgroup1) do
if not SGroup_IsEmpty(t_Orkgroup02.sgroup1[i]) then
Cmd_SetMeleeStance(t_Orkgroup02.sgroup1[i], MSTANCE_Assault)
Cmd_SetStance(t_Orkgroup02.sgroup1[i], STANCE_Attack)
Cmd_ReinforceTrooper(t_Orkgroup02.sgroup1[i], 1)
end
end
g_conflict02Healthlast = g_conflict02Health
g_conflict02Health = 0
elseif g_conflict02Health == 2 then
if not SGroup_IsEmpty(t_Orkgroup02.sgroup2[1]) then
Cmd_ReinforceTrooper(t_Orkgroup02.sgroup2[1], 1)
end
for i = 1, table.getn(t_Orkgroup02.sgroup1) do
if not SGroup_IsEmpty(t_Orkgroup02.sgroup1[i]) then
Cmd_ReinforceTrooper(t_Orkgroup02.sgroup1[i], 1)
end
end
g_conflict02Healthlast = g_conflict02Health
g_conflict02Health = 0
end
end
function Rule_Conflict02Reset()
SGroup_CreateIfNotFound("sg_nearConflict02v2")
SGroup_Clear(SGroup_FromName("sg_nearConflict02v2"))
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_nearConflict02v2", "mkr_orkspawn02")
if EGroup_Count(EGroup_FromName("eg_orkspawn02")) > 0 and SGroup_IsEmpty("sg_nearConflict02v2") then
for i = 1, table.getn(t_Orkgroup02.sgroup1) do
if SGroup_IsEmpty(t_Orkgroup02.sgroup1[i]) then
Util_CreateSquadsAtMarkerEx(g_Player2, t_Orkgroup02.sgroup1[i], t_Orkgroup02.blueprint[1], "mkr_orkspawn02",t_Orkgroup02.num[i], t_Orkgroup02.size[i])
if t_Orkgroup02.upgrade[i] == 1 then
for y = 1, t_Orkgroup02.load[i] do
SGroup_ForEach( t_Orkgroup02.sgroup1[i], function( sgroupid, itemindex, squadID ) Squad_UpgradeWeapon( squadID, t_Orkgroup02.weapon[i]) end )
end
end
Cmd_AttackMoveMarker(t_Orkgroup02.sgroup1[i], t_Orkgroup02.marker[i])
Cmd_SetStance(t_Orkgroup02.sgroup1[i], STANCE_Hold)
end
end
else
-- print("it thinks eg_orkspawn02 is empty") Rule_Remove(Rule_Conflict02Reset) end
end
--CONFLICT 03 function Rule_Conflict03Check()
t_Orkgroup03 = {
sgroup1 = { "sg_ork03_01"},
sgroup2 = { "sg_guard03_01"},
blueprint = {"ork_squad_slugga"},
marker = {"mkr_ork03_01"},
num = {1}, size = {6}, upgrade = {0}, load = {1}, weapon = {"weapon"}
}
g_Conflict03dead = 0
SGroup_CreateIfNotFound("sg_nearConflict03")
SGroup_Clear(SGroup_FromName("sg_nearConflict03"))
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_nearConflict03", "mkr_guard03_01")
if not SGroup_IsEmpty("sg_nearConflict03") then
if not Rule_Exists(Rule_Objective_S_Guard) and g_addpings == 1 then
g_addpings = 0
--[[ Util_Ping_LoopingMkr("pg_conflict01a", "mkr_guard01_01") Util_Ping_LoopingMkr("pg_conflict01b", "mkr_guard01_02") Util_Ping_LoopingMkr("pg_conflict02", "mkr_guard02_01") Util_Ping_LoopingMkr("pg_conflict03", "mkr_guard03_01") ]] Rule_AddInterval(Rule_Objective_S_Guard, 1) end
-- Util_Ping_Stop("pg_conflict03")
if g_conflict03Healthlast ~= 1 then
g_conflict03Health = 1
end
if not Rule_Exists(Rule_Conflict03Health) then
Rule_AddInterval(Rule_Conflict03Health, 1)
end
for i = 1, table.getn(t_Orkgroup03.sgroup1) do
if SGroup_IsEmpty(t_Orkgroup03.sgroup1[i]) then
g_Conflict03dead = g_Conflict03dead+1
if g_Conflict03dead == 1 then
if not SGroup_IsEmpty(t_Orkgroup03.sgroup2[1]) then
--[[this is where it used to run
Cmd_MoveToMarker(t_Orkgroup03.sgroup2[1], "mkr_nisA_civ")]]
Util_StartIntel(EVENTS.IE_GuardSaved1)
for i = 1, table.getn(t_objS2_sguard.sgroup) do
if t_Orkgroup03.sgroup2[1] == t_objS2_sguard.sgroup[i] then
t_objS2_sguard.safe[i] = "safe"
end
end
--[[now it stays]]
g_objS2saved = g_objS2saved+1
SGroup_Clear(SGroup_FromName(t_Orkgroup03.sgroup2[1]))
end
if not Rule_Exists(Rule_Conflict03Reset) then
Rule_AddInterval(Rule_Conflict03Reset, 5)
end
Rule_Remove(Rule_Conflict03Check)
break
end
end
end
else
if g_conflict03Healthlast ~= 2 then
g_conflict03Health = 2
end
if not Rule_Exists(Rule_Conflict03Health) then
Rule_AddInterval(Rule_Conflict03Health, 1)
end
end
end
function Rule_Conflict03Health()
if g_conflict03Health == 1 then
if not SGroup_IsEmpty(t_Orkgroup03.sgroup2[1]) then
Cmd_ReinforceTrooper(t_Orkgroup03.sgroup2[1], 1)
end
for i = 1, table.getn(t_Orkgroup03.sgroup1) do
if not SGroup_IsEmpty(t_Orkgroup03.sgroup1[i]) then
Cmd_ReinforceTrooper(t_Orkgroup03.sgroup1[i], 1)
end
end
g_conflict03Healthlast = g_conflict03Health
g_conflict03Health = 0
elseif g_conflict03Health == 2 then
if not SGroup_IsEmpty(t_Orkgroup03.sgroup2[1]) then
Cmd_ReinforceTrooper(t_Orkgroup03.sgroup2[1], 1)
for i = 1, table.getn(t_Orkgroup03.sgroup1) do
if not SGroup_IsEmpty(t_Orkgroup03.sgroup1[i]) then
Cmd_ReinforceTrooper(t_Orkgroup03.sgroup1[i], 1)
Cmd_SetStance(t_Orkgroup03.sgroup1[i], STANCE_Hold)
end
end
end
g_conflict03Healthlast = g_conflict03Health
g_conflict03Health = 0
end
end
function Rule_Conflict03Reset()
SGroup_CreateIfNotFound("sg_nearConflict03v2")
SGroup_Clear(SGroup_FromName("sg_nearConflict03v2"))
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_nearConflict03v2", "mkr_orkspawn02")
if EGroup_Count(EGroup_FromName("eg_orkspawn02")) > 0 and SGroup_IsEmpty("sg_nearConflict03v2") then
for i = 1, table.getn(t_Orkgroup03.sgroup1) do
if SGroup_IsEmpty(t_Orkgroup03.sgroup1[i]) then
Util_CreateSquadsAtMarkerEx(g_Player2, t_Orkgroup03.sgroup1[i], t_Orkgroup03.blueprint[1], "mkr_orkspawn02",t_Orkgroup03.num[i], t_Orkgroup03.size[i])
if t_Orkgroup03.upgrade[i] == 1 then
for y = 1, t_Orkgroup03.load[i] do
SGroup_ForEach( t_Orkgroup03.sgroup1[i], function( sgroupid, itemindex, squadID ) Squad_UpgradeWeapon( squadID, t_Orkgroup03.weapon[i]) end )
end
end
Cmd_AttackMoveMarker(t_Orkgroup03.sgroup1[i], t_Orkgroup03.marker[i])
Cmd_SetStance(t_Orkgroup03.sgroup1[i], STANCE_Hold)
end
end
else
-- print("it thinks eg_orkspawn03 is empty") Rule_Remove(Rule_Conflict03Reset) end
end
--CONFLICT 04 function Rule_Conflict04Check()
t_Orkgroup04 = {
sgroup1 = { "sg_ork04_01", "sg_ork04_02", "sg_ork04_03"},
sgroup2 = { "sg_guard04_01"},
blueprint = {"ork_squad_slugga"},
marker = {"mkr_ork04_01", "mkr_ork04_02", "mkr_ork04_03"},
num = {1, 2, 2}, size = {6, 5, 7}, upgrade = {0, 0, 0}, load = {1}, weapon = {"weapon"}
}
g_Conflict04dead = 0
SGroup_CreateIfNotFound("sg_nearConflict04")
SGroup_Clear(SGroup_FromName("sg_nearConflict04"))
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_nearConflict04", "mkr_guard04_01")
if not SGroup_IsEmpty("sg_nearConflict04") then
if not Rule_Exists(Rule_Objective_S_Guard) then
Rule_AddInterval(Rule_Objective_S_Guard, 1)
end
if g_conflict04Healthlast ~= 1 then
g_conflict04Health = 1
end
if not Rule_Exists(Rule_Conflict04Health) then
Rule_AddInterval(Rule_Conflict04Health, 1)
end
for i = 1, table.getn(t_Orkgroup04.sgroup1) do
if SGroup_IsEmpty(t_Orkgroup04.sgroup1[i]) then
g_Conflict04dead = g_Conflict04dead+1
if g_Conflict04dead == 3 then
if not SGroup_IsEmpty(t_Orkgroup04.sgroup2[1]) then
--[[this is where it used to run
Cmd_MoveToMarker(t_Orkgroup04.sgroup2[1], "mkr_nisA_civ")]]
Util_StartIntel(EVENTS.IE_GuardSaved3)
for i = 1, table.getn(t_objS2_sguard.sgroup) do
if t_Orkgroup04.sgroup2[1] == t_objS2_sguard.sgroup[i] then
t_objS2_sguard.safe[i] = "safe"
end
end
--[[now it stays]]
g_objS2saved = g_objS2saved+1
SGroup_Clear(SGroup_FromName(t_Orkgroup04.sgroup2[1]))
end
if not Rule_Exists(Rule_Conflict04Reset) then
Rule_AddInterval(Rule_Conflict04Reset, 5)
end
Rule_Remove(Rule_Conflict04Check)
break
end
end
end
else
if g_conflict04Healthlast ~= 2 then
g_conflict04Health = 2
end
if not Rule_Exists(Rule_Conflict04Health) then
Rule_AddInterval(Rule_Conflict04Health, 1)
end
end
end
function Rule_Conflict04Health()
if g_conflict04Health == 1 then
if not SGroup_IsEmpty(t_Orkgroup04.sgroup2[1]) then
Cmd_ReinforceTrooper(t_Orkgroup04.sgroup2[1], 1)
end
for i = 1, table.getn(t_Orkgroup04.sgroup1) do
if not SGroup_IsEmpty(t_Orkgroup04.sgroup1[i]) then
Cmd_SetMeleeStance(t_Orkgroup04.sgroup1[i], MSTANCE_Assault)
Cmd_SetStance(t_Orkgroup04.sgroup1[i], STANCE_Attack)
Cmd_ReinforceTrooper(t_Orkgroup04.sgroup1[i], 1)
end
end
g_conflict04Healthlast = g_conflict04Health
g_conflict04Health = 0
elseif g_conflict04Health == 2 then
if not SGroup_IsEmpty(t_Orkgroup04.sgroup2[1]) then
Cmd_ReinforceTrooper(t_Orkgroup04.sgroup2[1], 1)
for i = 1, table.getn(t_Orkgroup04.sgroup1) do
if not SGroup_IsEmpty(t_Orkgroup04.sgroup1[i]) then
Cmd_ReinforceTrooper(t_Orkgroup04.sgroup1[i], 1)
Cmd_SetStance(t_Orkgroup04.sgroup1[i], STANCE_Hold)
end
end
end
g_conflict04Healthlast = g_conflict04Health
g_conflict04Health = 0
end
end
function Rule_Conflict04Reset()
SGroup_CreateIfNotFound("sg_nearConflict04v2")
SGroup_Clear(SGroup_FromName("sg_nearConflict04v2"))
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_nearConflict04v2", "mkr_orkspawn01")
if EGroup_Count(EGroup_FromName("eg_orkspawn02")) > 0 and SGroup_IsEmpty("sg_nearConflict04v2") then
for i = 1, table.getn(t_Orkgroup04.sgroup1) do
if SGroup_IsEmpty(t_Orkgroup04.sgroup1[i]) then
Util_CreateSquadsAtMarkerEx(g_Player2, t_Orkgroup04.sgroup1[i], t_Orkgroup04.blueprint[1], "mkr_orkspawn02",t_Orkgroup04.num[i], t_Orkgroup04.size[i])
if t_Orkgroup04.upgrade[i] == 1 then
for y = 1, t_Orkgroup04.load[i] do
SGroup_ForEach( t_Orkgroup04.sgroup1[i], function( sgroupid, itemindex, squadID ) Squad_UpgradeWeapon( squadID, t_Orkgroup04.weapon[i]) end )
end
end
Cmd_AttackMoveMarker(t_Orkgroup04.sgroup1[i], t_Orkgroup04.marker[i])
Cmd_SetStance(t_Orkgroup04.sgroup1[i], STANCE_Hold)
end
end
else
-- print("it thinks eg_orkspawn04 is empty") Rule_Remove(Rule_Conflict04Reset) end
end
--CONFLICT 05
function Rule_Conflict05Check()
t_Orkgroup05 = {
sgroup1 = { "sg_ork05_01", "sg_ork05_02", "sg_ork05_03"},
sgroup2 = { "sg_guard05_01", "sg_guard05_02"},
blueprint = {"ork_squad_slugga"},
marker = {"mkr_ork05_01", "mkr_ork05_02", "mkr_ork05_03"},
num = {1, 2, 2}, size = {5, 4, 5}, upgrade = {0, 0, 0}, load = {1}, weapon = {"weapon"}
}
g_Conflict05dead = 0
SGroup_CreateIfNotFound("sg_nearConflict05")
SGroup_Clear(SGroup_FromName("sg_nearConflict05"))
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_nearConflict05", "mkr_ork05_03")
if not SGroup_IsEmpty("sg_nearConflict05") then
if not Rule_Exists(Rule_Objective_S_Guard) then
Rule_AddInterval(Rule_Objective_S_Guard, 1)
end
if g_conflict05Healthlast ~= 1 then
g_conflict05Health = 1
end
if not Rule_Exists(Rule_Conflict05Health) then
Rule_AddInterval(Rule_Conflict05Health, 1)
end
for i = 1, table.getn(t_Orkgroup05.sgroup1) do
if SGroup_IsEmpty(t_Orkgroup05.sgroup1[i]) then
g_Conflict05dead = g_Conflict05dead+1
if g_Conflict05dead == 3 then
if not SGroup_IsEmpty(t_Orkgroup05.sgroup2[1]) then
--[[this is where it used to run
Cmd_MoveToMarker(t_Orkgroup05.sgroup2[1], "mkr_nisA_civ")]]
g_conflict5guardalive = 1
for i = 1, table.getn(t_objS2_sguard.sgroup) do
if t_Orkgroup05.sgroup2[1] == t_objS2_sguard.sgroup[i] then
t_objS2_sguard.safe[i] = "safe"
end
end
--[[now it stays]]
g_objS2saved = g_objS2saved+1
SGroup_Clear(SGroup_FromName(t_Orkgroup05.sgroup2[1]))
end
if not SGroup_IsEmpty(t_Orkgroup05.sgroup2[2]) then
--[[this is where it used to run
Cmd_MoveToMarker(t_Orkgroup05.sgroup2[2], "mkr_nisA_civ")]]
g_conflict5guardalive = 1
for i = 1, table.getn(t_objS2_sguard.sgroup) do
if t_Orkgroup05.sgroup2[2] == t_objS2_sguard.sgroup[i] then
t_objS2_sguard.safe[i] = "safe"
end
end
--[[now it stays]]
g_objS2saved = g_objS2saved+1
SGroup_Clear(SGroup_FromName(t_Orkgroup05.sgroup2[2]))
end
if g_conflict5guardalive == 1 then
Util_StartIntel(EVENTS.IE_GuardSaved1)
end
if not Rule_Exists(Rule_Conflict05Reset) then
Rule_AddInterval(Rule_Conflict05Reset, 5)
end
Rule_Remove(Rule_Conflict05Check)
break
end
end
end
else
if g_conflict05Healthlast ~= 2 then
g_conflict05Health = 2
end
if not Rule_Exists(Rule_Conflict05Health) then
Rule_AddInterval(Rule_Conflict05Health, 1)
end
end
end
function Rule_Conflict05Health()
if g_conflict05Health == 1 then
if not SGroup_IsEmpty(t_Orkgroup05.sgroup2[1]) then
Cmd_ReinforceTrooper(t_Orkgroup05.sgroup2[1], 1)
end
if not SGroup_IsEmpty(t_Orkgroup05.sgroup2[2]) then
Cmd_ReinforceTrooper(t_Orkgroup05.sgroup2[2], 1)
end
for i = 1, table.getn(t_Orkgroup05.sgroup1) do
if not SGroup_IsEmpty(t_Orkgroup05.sgroup1[i]) then
Cmd_SetMeleeStance(t_Orkgroup05.sgroup1[i], MSTANCE_Assault)
Cmd_SetStance(t_Orkgroup05.sgroup1[i], STANCE_Attack)
Cmd_ReinforceTrooper(t_Orkgroup05.sgroup1[i], 1)
end
end
g_conflict05Healthlast = g_conflict05Health
g_conflict05Health = 0
elseif g_conflict05Health == 2 then
if not SGroup_IsEmpty(t_Orkgroup05.sgroup2[1]) then
Cmd_ReinforceTrooper(t_Orkgroup05.sgroup2[1], 1)
end
if not SGroup_IsEmpty(t_Orkgroup05.sgroup2[2]) then
Cmd_ReinforceTrooper(t_Orkgroup05.sgroup2[2], 1)
end
if SGroup_IsEmpty(t_Orkgroup05.sgroup2[1]) ~= true and SGroup_IsEmpty(t_Orkgroup05.sgroup2[2]) ~= true then
for i = 1, table.getn(t_Orkgroup05.sgroup1) do
if not SGroup_IsEmpty(t_Orkgroup05.sgroup1[i]) then
Cmd_ReinforceTrooper(t_Orkgroup05.sgroup1[i], 1)
Cmd_SetStance(t_Orkgroup05.sgroup1[i], STANCE_Hold)
end
end
end
g_conflict05Healthlast = g_conflict05Health
g_conflict05Health = 0
end
end
function Rule_Conflict05Reset()
t_Orkgroup05 = {
sgroup1 = { "sg_ork05_01", "sg_ork05_02", "sg_ork05_03"},
sgroup2 = { "sg_guard05_01"},
blueprint = {"ork_squad_slugga"},
marker = {"mkr_objS1point2", "mkr_guard04_01", "mkr_ork05_01"},
num = {1, 1, 1}, size = {3, 5, 4}, upgrade = {0, 0, 0}, load = {1}, weapon = {"weapon"}
}
SGroup_CreateIfNotFound("sg_nearConflict05v2")
SGroup_Clear(SGroup_FromName("sg_nearConflict05v2"))
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_nearConflict05v2", "mkr_orkspawn03")
if EGroup_Count(EGroup_FromName("eg_orkspawn03")) > 0 and SGroup_IsEmpty("sg_nearConflict05v2") then
local rand = World_GetRand(2, 3)
for i = 1, table.getn(t_Orkgroup05.sgroup1) do
if SGroup_IsEmpty(t_Orkgroup05.sgroup1[i]) and g_conflict5iter >= rand then
Util_CreateSquadsAtMarkerEx(g_Player2, t_Orkgroup05.sgroup1[i], t_Orkgroup05.blueprint[1], "mkr_orkspawn03",t_Orkgroup05.num[i], t_Orkgroup05.size[i])
if t_Orkgroup05.upgrade[i] == 1 then
for y = 1, t_Orkgroup05.load[i] do
SGroup_ForEach( t_Orkgroup05.sgroup1[i], function( sgroupid, itemindex, squadID ) Squad_UpgradeWeapon( squadID, t_Orkgroup05.weapon[i]) end )
end
end
Cmd_AttackMoveMarker(t_Orkgroup05.sgroup1[i], t_Orkgroup05.marker[i])
Cmd_SetStance(t_Orkgroup05.sgroup1[i], STANCE_Hold)
g_conflict5iter = 0
end
break
end
g_conflict5iter = g_conflict5iter+1
else
-- print("it thinks eg_orkspawn05 is empty") Rule_Remove(Rule_Conflict05Reset) end
end
--CONFLICT 06 function Rule_Conflict06Check()
t_Orkgroup06 = {
sgroup1 = { "sg_ork06_01"},
sgroup2 = { "sg_guard06_01"},
blueprint = {"ork_squad_slugga"},
marker = {"mkr_ork06_01"},
num = {1}, size = {6}, upgrade = {0}, load = {1}, weapon = {"weapon"}
}
g_Conflict06dead = 0
SGroup_CreateIfNotFound("sg_nearConflict06")
SGroup_Clear(SGroup_FromName("sg_nearConflict06"))
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_nearConflict06", "mkr_guard06_01")
if not SGroup_IsEmpty("sg_nearConflict06") then
if not Rule_Exists(Rule_Objective_S_Guard) then
Rule_AddInterval(Rule_Objective_S_Guard, 1)
end
if g_conflict06Healthlast ~= 1 then
g_conflict06Health = 1
end
if not Rule_Exists(Rule_Conflict06Health) then
Rule_AddInterval(Rule_Conflict06Health, 1)
end
for i = 1, table.getn(t_Orkgroup06.sgroup1) do
if SGroup_IsEmpty(t_Orkgroup06.sgroup1[i]) then
g_Conflict06dead = g_Conflict06dead+1
if g_Conflict06dead == 1 then
if not SGroup_IsEmpty(t_Orkgroup06.sgroup2[1]) then
SGroup_SetPlayerOwner(t_Orkgroup06.sgroup2[1], g_Player1)
Ping_Position(Squad_GetPosition(SGroup_GetSpawnedSquadAt(SGroup_FromName(t_Orkgroup06.sgroup2[1]), 1)), false)
SGroup_SetAvgHealth(t_Orkgroup06.sgroup2[1], .07)
Util_StartIntel(EVENTS.IE_GuardJoin)
--[[now it stays]]
g_objS2saved = g_objS2saved+1
end
if not Rule_Exists(Rule_Conflict06Reset) then
Rule_AddInterval(Rule_Conflict06Reset, 5)
end
Rule_Remove(Rule_Conflict06Check)
break
end
end
end
else
if g_conflict06Healthlast ~= 2 then
g_conflict06Health = 2
end
if not Rule_Exists(Rule_Conflict06Health) then
Rule_AddInterval(Rule_Conflict06Health, 1)
end
end
end
function Rule_Conflict06Health()
if g_conflict06Health == 1 then
if not SGroup_IsEmpty(t_Orkgroup06.sgroup2[1]) then
--Cmd_ReinforceTrooper(t_Orkgroup06.sgroup2[1], 1)
end
for i = 1, table.getn(t_Orkgroup06.sgroup1) do
if not SGroup_IsEmpty(t_Orkgroup06.sgroup1[i]) then
Cmd_ReinforceTrooper(t_Orkgroup06.sgroup1[i], 1)
end
end
g_conflict06Healthlast = g_conflict06Health
g_conflict06Health = 0
elseif g_conflict06Health == 2 then
if not SGroup_IsEmpty(t_Orkgroup06.sgroup2[1]) then
--Cmd_ReinforceTrooper(t_Orkgroup06.sgroup2[1], 1)
for i = 1, table.getn(t_Orkgroup06.sgroup1) do
if not SGroup_IsEmpty(t_Orkgroup06.sgroup1[i]) then
Cmd_ReinforceTrooper(t_Orkgroup06.sgroup1[i], 1)
Cmd_SetStance(t_Orkgroup06.sgroup1[i], STANCE_Hold)
end
end
end
g_conflict06Healthlast = g_conflict06Health
g_conflict06Health = 0
end
end
function Rule_Conflict06Reset()
SGroup_CreateIfNotFound("sg_nearConflict06v2")
SGroup_Clear(SGroup_FromName("sg_nearConflict06v2"))
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_nearConflict06v2", "mkr_orkspawn03")
if EGroup_Count(EGroup_FromName("eg_orkspawn03")) > 0 and SGroup_IsEmpty("sg_nearConflict06v2") then
for i = 1, table.getn(t_Orkgroup06.sgroup1) do
if SGroup_IsEmpty(t_Orkgroup06.sgroup1[i]) then
Util_CreateSquadsAtMarkerEx(g_Player2, t_Orkgroup06.sgroup1[i], t_Orkgroup06.blueprint[1], "mkr_orkspawn03",t_Orkgroup06.num[i], t_Orkgroup06.size[i])
if t_Orkgroup06.upgrade[i] == 1 then
for y = 1, t_Orkgroup06.load[i] do
SGroup_ForEach( t_Orkgroup06.sgroup1[i], function( sgroupid, itemindex, squadID ) Squad_UpgradeWeapon( squadID, t_Orkgroup06.weapon[i]) end )
end
end
Cmd_AttackMoveMarker(t_Orkgroup06.sgroup1[i], t_Orkgroup06.marker[i])
Cmd_SetStance(t_Orkgroup06.sgroup1[i], STANCE_Hold)
end
end
else
-- print("it thinks eg_orkspawn06 is empty") Rule_Remove(Rule_Conflict06Reset) end
end
--AMBUSHES function Rule_AmbushSetup()
t_Ambush = {
sgroup = { "sg_ambush01", "sg_ambush02", "sg_ambush03", "sg_ambush04", "sg_ambush05", "sg_ambush06", "sg_ambush07"},
blueprint = {"ork_squad_shoota_boy", "ork_squad_shoota_boy", "ork_squad_shoota_boy", "ork_squad_shoota_boy", "ork_squad_shoota_boy", "ork_squad_shoota_boy", "ork_squad_grot"},
marker = {"mkr_ambush01", "mkr_ambush02", "mkr_ambush03", "mkr_ambush04", "mkr_ambush05", "mkr_ork07_01", "mkr_ambush06"},
num = {1, 2, 2, 3, 2, 3, 3},
size = {6, 4, 7, 6, 8, 9, 9},
upgrade = {0, 0, 0, 0, 0, 0},
load = {1},
weapon = {"weapon"}
}
if g_Ambush_iter <= table.getn(t_Ambush.sgroup)then
for i = g_Ambush_iter, table.getn(t_Ambush.sgroup) do
SGroup_CreateIfNotFound(t_Ambush.sgroup[i])
if SGroup_IsEmpty(t_Ambush.sgroup[i]) then
Util_CreateSquadsAtMarkerEx(g_Player2, t_Ambush.sgroup[i], t_Ambush.blueprint[i], t_Ambush.marker[i], t_Ambush.num[i], t_Ambush.size[i])
if t_Ambush.upgrade[i] == 1 then
for y = 1, t_Ambush.load[i] do
SGroup_ForEach( t_Ambush.sgroup[i], function( sgroupid, itemindex, squadID ) Squad_UpgradeWeapon( squadID, t_Ambush.weapon[i]) end )
end
end
Cmd_SetStance(t_Ambush.sgroup[i], STANCE_Hold)
end
break
end
else
if not Rule_Exists(Rule_AmbushDetect) then
Rule_AddInterval(Rule_AmbushDetect, 1)
end
Rule_Remove(Rule_AmbushSetup)
end
g_Ambush_iter = g_Ambush_iter+1
end
function Rule_AmbushDetect()
if table.getn(t_Ambush.sgroup) < 1 then
Rule_Remove(Rule_AmbushDetect)
else
SGroup_CreateIfNotFound("sg_nearAmbush")
for i = table.getn(t_Ambush.sgroup), 1, -1 do
if not SGroup_IsEmpty(t_Ambush.sgroup[i]) then
SGroup_Clear(SGroup_FromName("sg_nearAmbush"))
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_nearAmbush", t_Ambush.marker[i])
if not SGroup_IsEmpty("sg_nearAmbush") then
if not Rule_Exists(Rule_AmbushMessage) then
Rule_AmbushMessage(t_Ambush.marker[i])
end
Cmd_SetStance(t_Ambush.sgroup[i], STANCE_Attack)
Cmd_AttackSGroup(t_Ambush.sgroup[i], "sg_nearAmbush")
table.remove(t_Ambush.sgroup, i)
table.remove(t_Ambush.marker, i)
end
else
table.remove(t_Ambush.sgroup, i)
table.remove(t_Ambush.marker, i)
end
end
end
end
function Rule_AmbushMessage(marker)
if g_ambush == 0 then
Rule_AddOneShot(Rule_Ambush, 0)
Ping_Marker(marker, false)
elseif g_ambush == 1 then
Rule_Remove(Rule_AmbushMessage)
g_ambush = 0
end
--[[ if not Rule_Exists(Rule_AmbushMessage) then g_ambush = 1 Rule_AddOneShot(Rule_AmbushMessage, 30) end ]] end
--BASE DEFENSE
function Rule_BaseDefense()
t_BaseDefense = {
sgroup = { "sg_orkspawn01", "sg_orkspawn02", "sg_orkspawn03"},
egroup = { "eg_orkspawn01", "eg_orkspawn02", "eg_orkspawn03"},
blueprint = {"ork_squad_grot", "ork_squad_shoota_boy", "ork_squad_slugga"},
marker = {"mkr_orkspawn01", "mkr_orkspawn02", "mkr_orkspawn03"},
num = {1,1, 1},
size = {6, 7, 8},
upgrade = {0, 0, 0},
load = {1},
weapon = {"weapon"}
}
if table.getn(t_BaseDefense.egroup) < 1 then
Rule_Remove(Rule_BaseDefense)
else
SGroup_CreateIfNotFound("sg_nearbase")
for i = table.getn(t_BaseDefense.egroup), 1, -1 do
SGroup_CreateIfNotFound(t_BaseDefense.sgroup[i])
if not EGroup_IsEmpty(t_BaseDefense.egroup[i]) then
SGroup_Clear(SGroup_FromName("sg_nearbase"))
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "sg_nearbase", t_BaseDefense.marker[i])
if SGroup_IsEmpty("sg_nearbase") ~= true then
--[[add the Find Source Objective if its not added already]]
if i == 1 and g_sourceuncovered == 0 then
if not Rule_Exists(Rule_Objective_P_Source) then
Rule_AddInterval(Rule_Objective_P_Source, 2)
end
end
--[[the regular base defense stuff]]
if SGroup_IsEmpty( t_BaseDefense.sgroup[i]) == true and g_base_delay > g_rand_delay then
g_rand_delay = World_GetRand(7, 15)
g_base_delay = 0
Util_CreateSquadsAtMarkerEx(g_Player2, t_BaseDefense.sgroup[i],t_BaseDefense.blueprint[i],t_BaseDefense.marker[i], t_BaseDefense.num[i], t_BaseDefense.size[i])
if t_BaseDefense.upgrade[i] == 1 then
for y = 1,t_BaseDefense.load[i] do
SGroup_ForEach( t_BaseDefense.sgroup[i], function( sgroupid, itemindex, squadID ) Squad_UpgradeWeapon( squadID, t_BaseDefense.weapon[i]) end )
end
end
Cmd_SetStance(t_BaseDefense.sgroup[i], STANCE_Attack)
Cmd_AttackSGroup(t_BaseDefense.sgroup[i], "sg_nearbase")
end
end
else
table.remove(t_BaseDefense.egroup, i)
table.remove(t_BaseDefense.sgroup, i)
table.remove(t_BaseDefense.marker, i)
end
end
g_base_delay = g_base_delay+1
end
end
function Rule_CampClearCheck()
t_CampClear = {
marker = {"mkr_orkspawn01", "mkr_orkspawn02", "mkr_orkspawn03"},
}
if table.getn(t_BaseDefense.marker) == nil then
Rule_Remove(Rule_CampClearCheck)
end
EGroup_CreateIfNotFound("eg_CampClear")
for i = table.getn(t_CampClear.marker), 1, -1 do
EGroup_Clear(EGroup_FromName("eg_CampClear"))
local egroupID = Player_GetAllEntitiesNearMarker(g_Player2, "eg_CampClear", t_CampClear.marker[i])
if EGroup_IsEmpty("eg_CampClear") == false then
--[[reserve this for doing something if the base isn't destroyed]]
--[[ local num = EGroup_Count(EGroup_FromName("eg_CampClear")) print("number of buildings near "..t_CampClear.marker[i].." = "..num) ]] else
if t_CampClear.marker[i] == "mkr_orkspawn01" and g_camp1save == 0 then
g_camp1save = 1
Rule_AddOneShot(Rule_IE_CampClear, 0.0)
Rule_AddInterval(Rule_Autosave_209554, 1)
end
if t_CampClear.marker[i] == "mkr_orkspawn02" and g_camp2save == 0 then
g_camp2save = 1
Rule_AddOneShot(Rule_IE_CampClear, 0.0)
Util_Ping_Stop("p_base2")
Rule_AddInterval(Rule_Autosave_209558, 1)
end
if t_CampClear.marker[i] == "mkr_orkspawn03" and g_camp3save == 0 then
g_camp3save = 1
Rule_AddOneShot(Rule_IE_CampClear, 0.0)
Util_Ping_Stop("p_base3")
end
table.remove(t_CampClear.marker, i)
break
end
end
end
function Rule_Autosave_209554() if not Event_IsAnyRunning() then Rule_Remove(Rule_Autosave_209554) Util_Autosave("$209554") end end
function Rule_Autosave_209558() if not Event_IsAnyRunning() then Rule_Remove(Rule_Autosave_209558) Util_Autosave("$209558") end end
--[[the repair the tank vignette]] function Rule_SourceoftheLootedTank()
Util_CreateSquadsAtMarker(g_Player2, "sg_repair_arty", "ork_squad_looted_tank", "mkr_lootedrepair", 1)
Util_CreateSquadsAtMarkerEx(g_Player2, "sg_repair_grotz", "ork_squad_grot", "mkr_lootedrepair", 1, 5)
SGroup_SetAvgHealth("sg_repair_arty", 0.1)
Cmd_SetStance("sg_repair_arty", STANCE_CeaseFire)
Rule_AddInterval(Rule_RepairLootedTank, 1)
end
function Rule_RepairLootedTank()
if SGroup_IsEmpty("sg_repair_arty") == false then
if SGroup_IsUnderAttack("sg_repair_arty", false) == false then
SGroup_SetAvgHealth("sg_repair_arty", 0.1)
end
if SGroup_IsEmpty("sg_repair_grotz") == false then
Command_Squad( g_Player2, SGroup_FromName("sg_repair_grotz"), SCMD_Repair )
end
else
Rule_Remove(Rule_RepairLootedTank)
end
end
--[[ OBJECTIVES]]
--[[ Find Source]]------------------------------------------------------------------------ --[[ This Objective is about finding the first Ork encampment in the bottom right corner of the map This Objective is triggered from 2 places The first is when the player finishes the Establish Base Objective The second is if the player enters the base area early ]] function Rule_Objective_P_SourceTrigger() if not Rule_Exists(Rule_Objective_P_Source) and g_sourceuncovered == 0 then g_sourceuncovered = 1 Rule_AddInterval(Rule_Objective_P_Source, 2) end end
function Rule_Objective_P_Source()
if not Objective_Exists(obj_table_P_source.title_id) then
Util_StartIntel(EVENTS.IE_Obj_Source_Create)
Util_ObjectiveCreate(obj_table_P_source, 1)
g_objP1 = 0
Util_Ping_LoopingMkr("p_source", "mkr_orkspawn01")
Rule_AddInterval(Rule_Objective_P_SourceCheck, 2)
elseif Objective_Exists(obj_table_P_source.title_id) and g_objP1 == 1 then
Rule_AddOneShot(Rule_IE_BaseDestroy, 0)
Util_ObjectiveComplete(obj_table_P_source.title_id)
--[[reveal the spot]]
FOW_RevealMarker("mkr_objP1com", 20)
Util_Ping_Stop("p_source")
g_objP1 = 4
Ping_Marker("mkr_objP1com", false)
Ping_Marker("mkr_ork07_01", false)
Rule_AddOneShot(Rule_Objective_P_KillBaseTrigger, 10)
Rule_Remove(Rule_Objective_P_Source)
elseif Objective_Exists(obj_table_P_source.title_id) and g_objP1 == 2 then
Util_ObjectiveFail(obj_table_P_source.title_id)
Util_Ping_Stop("p_source")
g_objP1 = 4
Rule_Remove(Rule_Objective_P_Source)
end
end
function Rule_Objective_P_SourceCheck()
SGroup_CreateIfNotFound("sg_objP1_nearbreach")
SGroup_Clear(SGroup_FromName("sg_objP1_nearbreach"))
--[[ check base breach ]]
Player_GetAllSquadsNearMarker(g_Player1, "sg_objP1_nearbreach", "mkr_objP1com")
--[[ check second breach, just in case ]]
Player_GetAllSquadsNearMarker(g_Player1, "sg_objP1_nearbreach", "mkr_ork07_01")
if not SGroup_IsEmpty("sg_objP1_nearbreach") then
g_objP1 = 1
Rule_Remove(Rule_Objective_P_SourceCheck)
end
end
--[[ Start Base ]]------------------------------------------------------------------------ --[[ The Start the Base objective is a redundant Objective that gives the player the premise for the other set The others being; Build Barracks, Armoury, and Generator ]] function Rule_Objective_P_Base()
if g_givebaseIE == 0 then
Rule_AddOneShot(Rule_IE_BaseBuild, 0)
Ping_Marker("mkr_marinehq", false)
g_givebaseIE = 1
-- Util_ObjectiveCreate(obj_table_P_base, 1)
g_objP2 = 0
--[[ Unrestrict Barracks]]
Unrestrict_BuildingWithAlerts( g_Player1, "space_marine_barracks", "$42946", "none"--[[408042]] )
Rule_AddInterval(Rule_Rule_Objective_P_BaseCheck, 3)
--[[Start the First of the Building Objectives]]
Rule_AddInterval(Rule_DoesitExist_Barracks, 1)
elseif Objective_Exists(obj_table_P_base.title_id) and g_objP2 == 1 then
Util_ObjectiveComplete(obj_table_P_base.title_id)
--[[base is done, now on to the capturing]]
if g_capturegiven == 0 and Rule_Exists(Rule_Objective_P_Capture) == false then
Rule_AddOneShot(Rule_Objective_P_Capture, 20)
end
--[[this used to be next, but now its been pushed on
Rule_AddOneShot(Rule_Objective_P_SourceTrigger, 15)
]]
Rule_Remove(Rule_Objective_P_Base)
g_objP2 = 4
--[[Autosave]]
Rule_AddInterval(Rule_Autosave_209552, 1)
elseif Objective_Exists(obj_table_P_base.title_id) and g_objP2 == 2 then
Util_ObjectiveFail(obj_table_P_base.title_id)
g_objP2 = 4
Rule_Remove(Rule_Objective_P_Base)
end
end
function Rule_Autosave_209552() if not Event_IsAnyRunning() then Rule_Remove(Rule_Autosave_209552) Util_Autosave("$209552") end end
--[[ See if the player has all the things they need for their base]] function Rule_Rule_Objective_P_BaseCheck()
local blueprinttable = {
{ name = "space_marine_hq", count = 1 },
{ name = "space_marine_generator", count = 1 },
{ name = "space_marine_barracks", count = 1 },
{ name = "space_marine_armoury", count = 1 }
}
eg_Player1All = Player_GetEntities(g_Player1)
local Rule_AllBuilt1 = function( egroupid, itemindex, entityID )
if Entity_GetBlueprintName(entityID) == "space_marine_barracks" and Entity_GetBuildingProgress(entityID) == 1.0 then
return true
else return false end
end
local Rule_AllBuilt3 = function( egroupid, itemindex, entityID )
if Entity_GetBlueprintName(entityID) == "space_marine_generator" and Entity_GetBuildingProgress(entityID) == 1.0 then
return true
else return false end
end
local Rule_AllBuilt2 = function( egroupid, itemindex, entityID )
if Entity_GetBlueprintName(entityID) == "space_marine_armoury" and Entity_GetBuildingProgress(entityID) == 1.0 then
return true
else return false end
end
local egroup_name = EGroup_GetName( eg_Player1All )
if EGroup_ContainsBlueprints(egroup_name, blueprinttable, true) == true then
if EGroup_ForEach(eg_Player1All, Rule_AllBuilt1) == true
and EGroup_ForEach(eg_Player1All, Rule_AllBuilt2) == true
and EGroup_ForEach(eg_Player1All, Rule_AllBuilt3) == true then
g_objP2 = 1
Rule_Remove(Rule_Rule_Objective_P_BaseCheck)
end
end
end
--[[ Barracks ]]------------------------------------------------------------------------ --[[ Here the player is asked to make a barracks. The barracks is the first in a linear set of things to build ]]
function Rule_DoesitExist_Barracks()
if Player_HasBuildingType( g_Player1, "space_marine_barracks" ) then
Rule_AddOneShot(Rule_Objective_P_Barracks, 1)
Rule_Remove(Rule_DoesitExist_Barracks)
else
g_DoesitExist_Barracks = g_DoesitExist_Barracks+1
if g_DoesitExist_Barracks > 20 then
Rule_AddOneShot(Rule_Objective_P_Barracks, 1)
Rule_Remove(Rule_DoesitExist_Barracks)
end
end
end
function Rule_Objective_P_Barracks() local blueprinttable = {{ name = "space_marine_barracks", count = 1 }} EGroup_AddGroup(EGroup_CreateIfNotFound("eg_Player1All"), Player_GetEntities(g_Player1))
if EGroup_ContainsBlueprints("eg_Player1All", blueprinttable, true) == false then
Util_ObjectiveCreate(obj_table_P_barracks , true)
Util_StartIntel(EVENTS.IE_Obj_Barracks_Create)
Rule_AddInterval(Rule_Objective_P_BarracksCheck, 2)
elseif EGroup_ContainsBlueprints("eg_Player1All", blueprinttable, true) == true then
if Player_HasBuildingType( g_Player1, "space_marine_barracks" ) == false then
Util_ObjectiveCreate(obj_table_P_barracks , true)
Util_StartIntel(EVENTS.IE_Obj_Barracks_Create)
Rule_AddInterval(Rule_Objective_P_BarracksCheck, 2)
--[[If it's built already, they win the objective and move on]]
elseif Player_HasBuildingType( g_Player1, "space_marine_barracks" ) then
Util_ObjectiveCreate(obj_table_P_barracks , true)
Util_ObjectiveComplete(obj_table_P_barracks.title_id)
Util_StartIntel(EVENTS.IE_Obj_Barracks_Complete)
--[[unrestrict armoury]]
Unrestrict_BuildingWithAlerts( g_Player1, "space_marine_armoury", "$42948", "none"--[[408044]] )
--[[Triggers the NExt Rule]]
Rule_AddInterval(Rule_DoesitExist_Armoury, 1)
end
end
end --[[ Obj is complete when a Barracks is constructed ]] function Rule_Objective_P_BarracksCheck() local blueprinttable = {{ name = "space_marine_barracks", count = 1 }} EGroup_AddGroup(EGroup_CreateIfNotFound("eg_Player1All"), Player_GetEntities(g_Player1))
if Player_HasBuildingType( g_Player1, "space_marine_barracks" ) then
Util_ObjectiveComplete(obj_table_P_barracks.title_id)
Util_StartIntel(EVENTS.IE_Obj_Barracks_Complete)
--[[unrestrict armoury]]
Unrestrict_BuildingWithAlerts( g_Player1, "space_marine_armoury", "$42948", "none"--[[408044]] )
--[[Triggers the NExt Rule]]
Rule_AddInterval(Rule_DoesitExist_Armoury, 1)
Rule_Remove(Rule_Objective_P_BarracksCheck)
end
end
--[[ Armoury ]]------------------------------------------------------------------------
function Rule_DoesitExist_Armoury()
if Player_HasBuildingType( g_Player1, "space_marine_armoury" ) then
Rule_AddOneShot(Rule_Objective_P_Armoury, 1)
Rule_Remove(Rule_DoesitExist_Armoury)
else
g_DoesitExist_Armoury = g_DoesitExist_Armoury+1
if g_DoesitExist_Armoury > 20 then
Rule_AddOneShot(Rule_Objective_P_Armoury, 1)
Rule_Remove(Rule_DoesitExist_Armoury)
end
end
end
function Rule_Objective_P_Armoury() local blueprinttable = {{ name = "space_marine_armoury", count = 1 }} EGroup_AddGroup(EGroup_CreateIfNotFound("eg_Player1All"), Player_GetEntities(g_Player1))
if EGroup_ContainsBlueprints("eg_Player1All", blueprinttable, true) == false then
Util_ObjectiveCreate(obj_table_P_armoury , true)
Util_StartIntel(EVENTS.IE_Obj_Armoury_Create)
Rule_AddInterval(Rule_Objective_P_ArmouryCheck, 2)
elseif EGroup_ContainsBlueprints("eg_Player1All", blueprinttable, true) == true then
if Player_HasBuildingType( g_Player1, "space_marine_armoury" ) == false then
Util_ObjectiveCreate(obj_table_P_armoury , true)
Util_StartIntel(EVENTS.IE_Obj_Armoury_Create)
Rule_AddInterval(Rule_Objective_P_ArmouryCheck, 2)
--[[If it's built already, they win the objective and move on]]
elseif Player_HasBuildingType( g_Player1, "space_marine_armoury" ) then
Util_ObjectiveCreate(obj_table_P_armoury , true)
Util_ObjectiveComplete(obj_table_P_armoury.title_id)
Util_StartIntel(EVENTS.IE_Obj_Armoury_Complete)
--[[unrestrict the Generator]]
Unrestrict_BuildingWithAlerts( g_Player1, "space_marine_generator", "$42962", "none"--[[408058]] )
--[[Triggers the NExt Rule]]
Rule_AddInterval(Rule_DoesitExist_Generator, 1)
end
end
end --[[ Obj is complete when a Armoury is constructed ]] function Rule_Objective_P_ArmouryCheck() local blueprinttable = {{ name = "space_marine_armoury", count = 1 }} EGroup_AddGroup(EGroup_CreateIfNotFound("eg_Player1All"), Player_GetEntities(g_Player1))
if Player_HasBuildingType( g_Player1, "space_marine_armoury" ) then
Util_ObjectiveComplete(obj_table_P_armoury.title_id)
Util_StartIntel(EVENTS.IE_Obj_Armoury_Complete)
--[[unrestrict the Generator]]
Unrestrict_BuildingWithAlerts( g_Player1, "space_marine_generator", "$42962", "none"--[[408058]] )
--[[Triggers the NExt Rule]]
Rule_AddInterval(Rule_DoesitExist_Generator, 1)
Rule_Remove(Rule_Objective_P_ArmouryCheck)
end
end
--[[ Generator ]]------------------------------------------------------------------------
function Rule_DoesitExist_Generator()
if Player_HasBuildingType( g_Player1, "space_marine_generator" ) then
Rule_AddOneShot(Rule_Objective_P_Generator, 0.0)
Rule_Remove(Rule_DoesitExist_Generator)
else
g_DoesitExist_Generator = g_DoesitExist_Generator+1
if g_DoesitExist_Generator > 20 then
Rule_AddOneShot(Rule_Objective_P_Generator, 0.0)
Rule_Remove(Rule_DoesitExist_Generator)
end
end
end
function Rule_Objective_P_Generator() local blueprinttable = {{ name = "space_marine_generator", count = 1 }} EGroup_AddGroup(EGroup_CreateIfNotFound("eg_Player1All"), Player_GetEntities(g_Player1))
if EGroup_ContainsBlueprints("eg_Player1All", blueprinttable, true) == false then
Util_ObjectiveCreate(obj_table_P_generator , true)
Util_StartIntel(EVENTS.IE_Obj_Generator_Create)
Rule_AddInterval(Rule_Objective_P_GeneratorCheck, 2)
elseif EGroup_ContainsBlueprints("eg_Player1All", blueprinttable, true) == true then
if Player_HasBuildingType( g_Player1, "space_marine_generator" ) == false then
Util_ObjectiveCreate(obj_table_P_generator , true)
Util_StartIntel(EVENTS.IE_Obj_Generator_Create)
Rule_AddInterval(Rule_Objective_P_GeneratorCheck, 2)
--[[If it's built already, they win the objective and move on]]
elseif Player_HasBuildingType( g_Player1, "space_marine_generator" ) then
Util_ObjectiveCreate(obj_table_P_generator , true)
Util_ObjectiveComplete(obj_table_P_generator.title_id)
Util_StartIntel(EVENTS.IE_Obj_Generator_Complete)
--[[Triggers the NExt Rule]]
-- Rule_AddOneShot(Rule_Objective_P_Addon, 45) end end end --[[ Obj is complete when a Generator is constructed ]] function Rule_Objective_P_GeneratorCheck() local blueprinttable = {{ name = "space_marine_generator", count = 1 }} EGroup_AddGroup(EGroup_CreateIfNotFound("eg_Player1All"), Player_GetEntities(g_Player1))
if Player_HasBuildingType( g_Player1, "space_marine_generator" ) then
Util_ObjectiveComplete(obj_table_P_generator.title_id)
Util_StartIntel(EVENTS.IE_Obj_Generator_Complete)
--[[Triggers the NExt Rule]]
-- Rule_AddOneShot(Rule_Objective_P_Addon, 45) Rule_Remove(Rule_Objective_P_GeneratorCheck) end
end
--[[ --[[ The Addon for the Stronghold ]]------------------------------------------------------------------------ function Rule_Objective_P_Addon() EGroup_AddGroup(EGroup_CreateIfNotFound("eg_Player1All"), Player_GetEntities(g_Player1)) if not EGroup_IsEmpty("eg_Player1All") then if EGroup_ContainsAddOn("eg_Player1All", "space_marine_hq_addon_1", false) == false then Util_ObjectiveCreate(obj_table_P_addon, false)
Util_StartIntel(EVENTS.IE_Obj_Addon_Create)
Rule_AddInterval(Rule_Objective_P_AddonCheck, 2)
elseif EGroup_ContainsAddOn("eg_Player1All", "space_marine_hq_addon_1", false) == true then
Util_ObjectiveCreate(obj_table_P_addon, false)
Util_ObjectiveComplete(obj_table_P_addon.title_id)
Util_StartIntel(EVENTS.IE_Obj_Addon_Complete)
Rule_Remove(Rule_Objective_P_AddonCheck)
end
end
end --[[ Obj is complete when a Generator is constructed ]] function Rule_Objective_P_AddonCheck() EGroup_AddGroup(EGroup_CreateIfNotFound("eg_Player1All"), Player_GetEntities(g_Player1)) if not EGroup_IsEmpty("eg_Player1All") then if EGroup_ContainsAddOn("eg_Player1All", "space_marine_hq_addon_1", false) == true then Util_ObjectiveComplete(obj_table_P_addon.title_id)
Util_StartIntel(EVENTS.IE_Obj_Addon_Complete)
Rule_Remove(Rule_Objective_P_AddonCheck)
end
end
end
]]
--[[ Capture Strategic Points ]]------------------------------------------------------------------------ function Rule_Objective_P_Point_Trigger() Rule_AddInterval(Rule_Objective_P_Point_Start, 1) end
function Rule_Objective_P_Point_Start()
t_capturePoints = {"mkr_objS1point1", "mkr_objS1point2", "mkr_objS1point3"}
SGroup_CreateIfNotFound("sg_objS1_nearpoint")
for i = table.getn(t_capturePoints), 1, -1 do
SGroup_Clear(SGroup_FromName("sg_objS1_nearpoint"))
--[[ check base point ]]
Player_GetAllSquadsNearMarker(g_Player1, "sg_objS1_nearpoint", t_capturePoints[i])
if not SGroup_IsEmpty("sg_objS1_nearpoint") then
if g_capturegiven == 0 and Rule_Exists(Rule_Objective_P_Capture) == false then
Rule_AddOneShot(Rule_Objective_P_Capture, 0)
end
g_objS1 = 1
Rule_Remove(Rule_Objective_P_Point_Start)
break
end
end
end
--[[ Capture Objective ]]------------------------------------------------------------------------
function Rule_Objective_P_Capture()
if g_capturegiven == 0 and Player_GetNumStrategicPoints(g_Player1) < 3 then
Util_ObjectiveCreate(obj_table_P_capture , true)
Util_Ping_LoopingMkr("p_captureping1", t_capturePoints[1])
Util_Ping_LoopingMkr("p_captureping2", t_capturePoints[2])
Util_Ping_LoopingMkr("p_captureping3", t_capturePoints[3])
Util_StartIntel(EVENTS.IE_Obj_Capture_Create)
--[[add the checker]]
Rule_AddInterval(Rule_Objective_P_CaptureCheck, 2)
--[[if we hit here they already have 3 and somehow did it without triggering one of the first 3 :) ]]
elseif g_capturegiven == 0 and Player_GetNumStrategicPoints(g_Player1) > 2 then
Util_ObjectiveCreate(obj_table_P_capture , true)
Util_ObjectiveComplete(obj_table_P_capture.title_id)
Util_StartIntel(EVENTS.IE_Obj_Capture_Complete)
--[[copied from above to make things more linear]]
Rule_AddInterval(Rule_Objective_P_ListeningPost_Trigger, 1)
end
g_capturegiven = 1
end --[[ Obj is complete when a point is captured]]
function Rule_Objective_P_CaptureCheck() if Player_GetNumStrategicPoints(g_Player1) == 1 and g_firstpoint == 0 then
--[[unrestrict listening posts]]
Unrestrict_BuildingWithAlerts( g_Player1, "space_marine_listening_post", "none", "none" )
g_firstpoint = 1
--[[ --[[Preparations to get a Servitor over to help the player build a post]] if Squad_GetPlayerOwner(SGroup_GetSpawnedSquadAt(SGroup_FromName("sg_baseservitor"), 1)) ~= g_Player1 then Player_GetStrategicPoints(g_Player1, EGroup_CreateIfNotFound("eg_Player1FirstPoint"))
if SGroup_Exists("sg_firstServitor") == false then
SGroup_Add(SGroup_CreateIfNotFound("sg_firstServitor"), SGroup_GetSpawnedSquadAt(SGroup_FromName("sg_baseservitor"), 1))
end
if SGroup_IsEmpty("sg_firstServitor") == false then
SGroup_SetPlayerOwner("sg_firstServitor", g_Player1)
Cmd_MoveToEGroup("sg_firstServitor", "eg_Player1FirstPoint")
end
--[[ If the player already owns the Servitors, It will see if #1 is Idle and if so, send it over]]
else
Player_GetStrategicPoints(g_Player1, EGroup_CreateIfNotFound("eg_Player1FirstPoint"))
if SGroup_Exists("sg_firstServitor") == false then
SGroup_Add(SGroup_CreateIfNotFound("sg_firstServitor"), SGroup_GetSpawnedSquadAt(SGroup_FromName("sg_baseservitor"), 1))
end
if SGroup_IsEmpty("sg_firstServitor") == false and Squad_GetActiveCommand(SGroup_GetSpawnedSquadAt(SGroup_FromName("sg_firstServitor"), 1)) == SQUADSTATEID_Idle then
SGroup_SetPlayerOwner("sg_firstServitor", g_Player1)
Cmd_MoveToEGroup("sg_firstServitor", "eg_Player1FirstPoint")
end
end
Rule_AddOneShot(Rule_Objective_P_ListeningPost, 4.5)
]] elseif Player_GetNumStrategicPoints(g_Player1) == 3 then
--[[copied from above to make things more linear]]
Rule_AddInterval(Rule_Objective_P_ListeningPost_Trigger, 1)
Util_Ping_Stop("p_captureping1")
Util_Ping_Stop("p_captureping2")
Util_Ping_Stop("p_captureping3")
Util_ObjectiveComplete(obj_table_P_capture.title_id)
Util_StartIntel(EVENTS.IE_Obj_Capture_Complete)
Rule_Remove(Rule_Objective_P_CaptureCheck)
end
end
--[[ Listening Post Objective ]]------------------------------------------------------------------------
function Rule_Objective_P_ListeningPost_Trigger() if Event_IsAnyRunning() then g_eventisrunning = 0 else g_eventisrunning = g_eventisrunning+1 if g_eventisrunning == 20 and g_triggerpost == nil then g_triggerpost = 1 Rule_AddOneShot(Rule_Objective_P_ListeningPost, 0.0) Rule_Remove(Rule_Objective_P_ListeningPost_Trigger) end end if g_triggerpost == 1 then Rule_Remove(Rule_Objective_P_ListeningPost_Trigger) end end
function Rule_Objective_P_ListeningPost()
if Player_HasBuildingType( g_Player1, "space_marine_listening_post" ) == false then
Util_ObjectiveCreate(obj_table_P_post , true)
Util_StartIntel(EVENTS.IE_Obj_LPost_Create)
Rule_AddInterval(Rule_Objective_P_ListeningPostCheck, 2)
elseif Player_HasBuildingType( g_Player1, "space_marine_listening_post" ) then
Util_ObjectiveCreate(obj_table_P_post , true)
Util_ObjectiveComplete(obj_table_P_post.title_id)
Util_StartIntel(EVENTS.IE_Obj_LPost_Complete)
--[[This is added in here to go on to the main mission]]
Rule_AddOneShot(Rule_Objective_P_SourceTrigger, 15)
Rule_AddOneShot(Rule_Objective_S_SecureTrigger, 60)
end
end
--[[ Obj is complete when a Listening Post is constructed ]] function Rule_Objective_P_ListeningPostCheck()
if Player_HasBuildingType( g_Player1, "space_marine_listening_post" ) then
Util_ObjectiveComplete(obj_table_P_post.title_id)
Util_StartIntel(EVENTS.IE_Obj_LPost_Complete)
--[[This is added in here to go on to the main mission]]
Rule_AddOneShot(Rule_Objective_P_SourceTrigger, 15)
Rule_AddOneShot(Rule_Objective_S_SecureTrigger, 60)
Rule_Remove(Rule_Objective_P_ListeningPostCheck)
end
end
--[[Secure All Points Objective]]------------------------------------------------------------------------ function Rule_Objective_S_SecureTrigger() Rule_AddInterval(Rule_Objective_S_Secure, 1) end
function Rule_Objective_S_Secure()
if not Objective_Exists(obj_table_S_secure.title_id) then
Util_ObjectiveCreate(obj_table_S_secure, false)
g_objS1 = 0
Rule_AddInterval(Rule_Objective_S_SecureChecker, 5)
elseif Objective_Exists(obj_table_S_secure.title_id) and g_objS1 == 1 then
Util_ObjectiveComplete(obj_table_S_secure.title_id)
Rule_Remove(Rule_Objective_S_Secure)
elseif Objective_Exists(obj_table_S_secure.title_id) and g_objS1 == 2 then
Util_ObjectiveFail(obj_table_S_secure.title_id)
Rule_Remove(Rule_Objective_S_Secure)
end
end
function Rule_Objective_S_SecureChecker() local pointnum = World_GetNumStrategicPoints() local playernum = Player_GetNumStrategicPoints(g_Player1) if pointnum == playernum then g_objS1 = 1
Rule_Remove(Rule_Objective_S_SecureChecker)
end
end
--[[ Save Guard ]]------------------------------------------------------------------------ function Rule_Objective_S_Guard()
if not Objective_Exists(obj_table_S_guard.title_id) then
Rule_AddOneShot(Rule_GuardSave00, 0)
Util_ObjectiveCreate(obj_table_S_guard, 0)
g_objS2 = 0
Rule_AddInterval(Rule_Objective_S_GuardChecker, 2)
elseif Objective_Exists(obj_table_S_guard.title_id) and g_objS2 == 1 then
Util_ObjectiveComplete(obj_table_S_guard.title_id)
Rule_Remove(Rule_Objective_S_Guard)
elseif Objective_Exists(obj_table_S_guard.title_id) and g_objS2 == 2 then
Util_ObjectiveFail(obj_table_S_guard.title_id)
Rule_Remove(Rule_Objective_S_Guard)
end
end
function Rule_Objective_S_GuardChecker()
dif_saved = 3
local num = table.getn(t_objS2_sguard.sgroup)
-- print("the table of guardsmen hass "..num.." groups, and g_objsS2 = "..g_objS2)
if num == 0 and g_objS2saved >= dif_saved then
g_objS2 = 1
Rule_Remove(Rule_Objective_S_GuardChecker)
elseif num == 0 and g_objS2saved < dif_saved then
g_objS2 = 2
Rule_Remove(Rule_Objective_S_GuardChecker)
end
for i = table.getn(t_objS2_sguard.sgroup), 1, -1 do
if not SGroup_IsEmpty(t_objS2_sguard.sgroup[i]) then
--[[ if t_objS2_sguard.safe[i] == "safe" then Cmd_MoveToMarker(t_objS2_sguard.sgroup[i], "mkr_nisA_civ") end
if Prox_AllSquadsNearMarker(t_objS2_sguard.sgroup[i], "mkr_nisA_civ") and Player_CanSeeSGroup(g_Player1, t_objS2_sguard.sgroup[i], false) == false then
SGroup_DeSpawn(t_objS2_sguard.sgroup[i])
g_objS2saved = g_objS2saved+1
print("guard saved = "..g_objS2saved)
table.remove(t_objS2_sguard.sgroup, i)
table.remove(t_objS2_sguard.safe, i)
end
]] else
table.remove(t_objS2_sguard.sgroup, i)
table.remove(t_objS2_sguard.safe, i)
end
end
end
--[[ Kill Bases ]]------------------------------------------------------------------------ function Rule_Objective_P_KillBaseTrigger() Rule_AddInterval(Rule_Objective_P_KillBase, 1) end
function Rule_Objective_P_KillBase()
if not Objective_Exists(obj_table_P_killbase.title_id) then
Util_ObjectiveCreate(obj_table_P_killbase, 1)
g_objP3 = 0
Util_Ping_LoopingMkr("p_base2", "mkr_orkspawn02")
Util_Ping_LoopingMkr("p_base3", "mkr_orkspawn03")
Rule_AddInterval(Rule_Objective_P_KillBaseChecker, 3)
--[[ Rule_AddInterval(Rule_Objective_S_Cleanse, 1) ]]
elseif Objective_Exists(obj_table_P_killbase.title_id) and g_objP3 == 1 then
Rule_AddOneShot(Rule_Victory, 0)
Util_ObjectiveComplete(obj_table_P_killbase.title_id)
Rule_Remove(Rule_Objective_P_KillBase)
elseif Objective_Exists(obj_table_P_killbase.title_id) and g_objP3 == 2 then
Util_ObjectiveFail(obj_table_P_killbase.title_id)
Rule_Remove(Rule_Objective_P_KillBase)
end
end
function Rule_Objective_P_KillBaseChecker()
-- EGroup_AddGroup(EGroup_CreateIfNotFound("eg_objP3_allorkbuildings"), Player_GetEntities(g_Player2)) eg_Player2All = Player_GetEntities(g_Player2)
local blueprinttable = {
{ name = "ork_boy_hut", count = 1 },
{ name = "ork_generator", count = 1 },
{ name = "ork_hq", count = 1 },
{ name = "ork_mek_shop", count = 1 },
{ name = "ork_pile_o_guns", count = 1 }
}
Rule_AddBuildings = function( egroupid, itemindex, entityID )
if Entity_GetBlueprintName(entityID) == "ork_boy_hut"
or Entity_GetBlueprintName(entityID) == "ork_generator"
or Entity_GetBlueprintName(entityID) == "ork_hq"
or Entity_GetBlueprintName(entityID) == "ork_mek_shop"
or Entity_GetBlueprintName(entityID) == "ork_pile_o_guns"
then
EGroup_Add(EGroup_CreateIfNotFound("eg_Orkendbase"), entityID)
end
end
local egroup_name = EGroup_GetName( eg_Player2All )
if EGroup_ContainsBlueprints(egroup_name, blueprinttable, false) == false then
print("Player 2's bases have been Anihilated")
g_objP3 = 1
Rule_Remove(Rule_Objective_P_KillBaseChecker)
else
EGroup_ForEach(eg_Player2All, Rule_AddBuildings)
g_baseisdead = 0
-- print("Player 2's base complex has "..EGroup_Count(EGroup_FromName("eg_Orkendbase")).." entities") end
end
--[[ --[[ Cleanse Orks ]]------------------------------------------------------------------------ function Rule_Objective_S_Cleanse()
if not Objective_Exists(obj_table_S_cleanse.title_id) then
Util_ObjectiveCreate(obj_table_S_cleanse, 0)
g_objS3 = 0
Rule_AddInterval(Rule_Objective_S_CleanseChecker, 5)
elseif Objective_Exists(obj_table_S_cleanse.title_id) and g_objS3 == 1 then
Util_ObjectiveComplete(obj_table_S_cleanse.title_id)
Rule_Remove(Rule_Objective_S_Cleanse)
elseif Objective_Exists(obj_table_S_cleanse.title_id) and g_objS3 == 2 then
Util_ObjectiveFail(obj_table_S_cleanse.title_id)
Rule_Remove(Rule_Objective_S_Cleanse)
end
end
function Rule_Objective_S_CleanseChecker()
SGroup_AddGroup(SGroup_CreateIfNotFound("sg_objP3_allorkbuildings"), Player_GetSquads(g_Player2))
if SGroup_IsEmpty("sg_objP3_allorkbuildings") then
g_objS3 = 1
Rule_Remove(Rule_Objective_S_CleanseChecker)
end
end ]]
--[[ Game OVer ]]------------------------------------------------------------------------ function Rule_GameOver()
local primary_count = 0
if Objective_Exists(obj_table_P_source.title_id) then
if Objective_GetState(obj_table_P_source.title_id) == OS_Complete then
primary_count = primary_count+1
elseif Objective_GetState(obj_table_P_source.title_id) == OS_Failed then
World_SetPlayerLose(g_Player1, "You've Lost")
end
end
if Objective_Exists(obj_table_P_base.title_id) then
if Objective_GetState(obj_table_P_base.title_id) == OS_Complete then
primary_count = primary_count+1
elseif Objective_GetState(obj_table_P_base.title_id) == OS_Failed then
World_SetPlayerLose(g_Player1, "You've Lost")
end
end
if Objective_Exists(obj_table_P_killbase.title_id) then
if Objective_GetState(obj_table_P_killbase.title_id) == OS_Complete then
primary_count = primary_count+1
elseif Objective_GetState(obj_table_P_killbase.title_id) == OS_Failed then
World_SetPlayerLose(g_Player1, "You've Lost")
end
end
if primary_count == 3 then
if Objective_Exists(obj_table_S_secure.title_id) then
if Objective_GetState(obj_table_S_secure.title_id) == OS_Complete then
elseif Objective_GetState(obj_table_S_secure.title_id) == OS_Incomplete then
Util_ObjectiveFail(obj_table_S_secure.title_id)
end
end
if Objective_Exists(obj_table_S_guard.title_id) then
if Objective_GetState(obj_table_S_guard.title_id) == OS_Complete then
elseif Objective_GetState(obj_table_S_guard.title_id) == OS_Incomplete then
Util_ObjectiveFail(obj_table_S_guard.title_id)
end
end
if Objective_Exists(obj_table_S_cleanse.title_id) then
if Objective_GetState(obj_table_S_cleanse.title_id) == OS_Complete then
elseif Objective_GetState(obj_table_S_cleanse.title_id) == OS_Incomplete then
Util_ObjectiveFail(obj_table_S_cleanse.title_id)
end
end
if not Rule_Exists(Rule_EndGame) then
Rule_AddOneShot(Rule_EndGame, 5)
end
Rule_Remove(Rule_GameOver)
end
end
function Rule_EndGame() if g_endNIS == 0 then Rule_RemoveAll() Util_StartNIS(EVENTS.NIS_Closing) g_endNIS = 1 else SGroup_AddGroup(SGroup_CreateIfNotFound("sg_allcleanup"), Player_GetSquads(g_Player2)) SGroup_DestroyAllSquads("sg_allcleanup") end end
function Rule_GameOver_NIS() World_SetGameOver() end
--[[ INTEL EVENTS ]] --[[HQ Not Ready]]----------------- function Rule_IE_NoHq()
Util_StartIntel(EVENTS.IE_NoHq)
--[[add first objective]]
--Util_ObjectiveCreate(obj_table_P_wait, true)
Rule_AddInterval(Rule_GiveFirstObjective, 1)
end
function Rule_GiveFirstObjective()
if not Event_IsAnyRunning() then
Util_ObjectiveCreate(obj_table_P_base, true)
Rule_Remove(Rule_GiveFirstObjective)
end
end
--[[Harassing Orks]]----------------- function Rule_IE_HarassWarning()
Util_StartIntel(EVENTS.IE_HarassWarning)
end --[[Harassing Orks Run]]----------------- function Rule_IE_HarassFlee()
Util_StartIntel(EVENTS.IE_HarassFlee)
end
function Rule_IE_BaseBuild()
Util_StartIntel(EVENTS.IE_BaseBuild)
end
function Rule_IE_Secure()
Util_StartIntel(EVENTS.IE_Secure)
end
function Rule_GuardSave00()
Util_StartIntel(EVENTS.IE_GuardSave00)
end
function Rule_Ambush()
Util_StartIntel(EVENTS.IE_Ambush)
end
function Rule_IE_BaseDestroy()
Util_StartIntel(EVENTS.IE_BaseDestroy)
end
function Rule_Victory()
Util_StartIntel(EVENTS.IE_Victory)
end
function Rule_IE_CampClear()
Util_StartIntel(EVENTS.IE_CampClear)
end
--[[ Cheat ]]
function CheatClosing() SGroup_AddGroup(SGroup_CreateIfNotFound("sg_allcleanup"), Player_GetSquads(g_Player2)) SGroup_DestroyAllSquads("sg_allcleanup") Rule_RemoveAll() Util_StartNIS(EVENTS.NIS_Closing) end