--[[ IMPORTS ]]
import("ScarUtil.scar") import("WXPScarUtil.scar")
--[[ GAME SETUP ]]
--[[ the OnGameSetup() function is mandatory! ]] function OnGameSetup()
g_Player1 = Setup_Player(0, "$690083", "eldar_race", 1)
Misc_PlayerTeamColor(g_Player1,"default_5")
Player_DoNotPrecache(g_Player1, _t_MSO5E_Player1)
g_Player2 = Setup_Player(1, "$690082", "guard_race", 2)
Player_DoNotPrecache(g_Player2, _t_MSO5E_Player2)
g_Player3 = Setup_Player(2, "$690088", "chaos_marine_race", 3)
Misc_PlayerTeamColor(g_Player3,"default_6")
Player_DoNotPrecache(g_Player3, _t_MSO5E_Player3)
g_Player4 = Setup_Player(3, "$690087", "ork_race", 4)
Misc_PlayerTeamColor(g_Player4,"default_4")
Player_DoNotPrecache(g_Player4, _t_MSO5E_Player4)
g_Player5 = Setup_Player(4, "$690082", "guard_race", 2)
Player_DoNotPrecache(g_Player5, _t_MSO5E_Player5)
g_Player6 = Setup_Player(5, "$850014", "npc_race", 6)
Player_DoNotPrecache(g_Player6, _t_MSO5E_Player6)
--[[ g_Player7 = Setup_Player(6, "$850016", "npc_race", 7)]]
g_Player8 = Setup_Player(7, "$850017", "npc_race", TEAM_NEUTRAL)
Player_DoNotPrecache(g_Player8, _t_MSO5E_Player8)
--[[ DEFINE VARIABLES AND TABLES - define any preset values here for later use]]
g_firstrun = true
--[[ define the "enemy" who will win if the player 'loses' ]]
g_enemy = g_Player6
t_dif_low = {nstance = 1, brrkarmr = 1.2, brrkhlth = 2, gunreload = 2, phase = 0.4}
t_dif_med = {nstance = 2, brrkarmr = 1, brrkhlth = 1.5, gunreload = 3, phase = 0.6}
t_dif_high = {nstance = 3, brrkarmr = 1, brrkhlth = 1, gunreload = 4, phase = 0.7}
end
--[[ the OnGameRestore() function is mandatory!, this will only get called after loading a game ]] function OnGameRestore()
--[[ nothing at the moment ]]
end
--[[ ON INITIALIZATION ]]
function OnInit()
--[[ RESEARCH LEVEL ]]
-- sets the research level of the mission, locks researches, squads, and buildings
Rule_SetResearchLevel( 4 )
--[[ SET FOW ]]
-- doing shit
World_EnablePlayerToPlayerFOW(g_Player1, g_Player6, false)
World_EnablePlayerToPlayerFOW(g_Player1, g_Player8, true)
--[[ NIS PRESETS ]]
-- turn off event cues, set the viewable space to black (faded out) and preset letterboxing ]]
WXP_OpeningNISPreset()
--[[ START THE MUSIC ]]
-- call the function to load the jukebox with tunes]]
Rule_SetupMusicPlaylist()
--[[ SET AI ]]
-- call the function to set the pregame state of the AI ]]
Rule_PresetAI()
--[[ START NIS ]]
-- calls the NIS function located in the MissionName.nis file ]]
Util_StartNIS( EVENTS.NIS_Opening )
--[[ GET THE START PLAY MISSION READY TO ROLL ]]
Rule_Add( Rule_GameStart )
end
--[[ the Scar_AddInit(OnInit) function is mandatory! This registers your init function with scar. ]] Scar_AddInit(OnInit)
function OnLoad()
Rule_AddOneShot(Rule_FOW_Reset, 1)
end
Scar_AddLoad(OnLoad)
--[[ GAME RESTRICTIONS ]]
--[[ Disables, enables, and grants research items ]] function Rule_SetResearchLevel( resLevel )
Player_RestrictBuilding(g_Player1, "eldar_hq")
Player_RestrictSquad(g_Player1, "eldar_squad_farseer")
Player_RestrictResearch(g_Player1, "eldar_webway_gate_relocation_research")
Player_RestrictResearch(g_Player1, "eldar_fleet_of_foot_research")
Player_GrantResearch(g_Player1, "eldar_plasma_grenade_research")
--[[ WXP Specific ]]
WXP_Restrict( resLevel )
end
--[[ MUSIC ]]
function Rule_SetupMusicPlaylist()
t_ambient = {"Snowy_wind_1", "Warhammer_XP_battle_BG" }
Playlist_Manager( PC_Ambient, t_ambient, true , true , {5, 10})
end
--[[ PRESET AI ]]
function Rule_PresetAI()
Cpu_EnableAll(false)
end
--[[ START PLAY ]]
--[[ NOW TO KICK OFF THE ACTUAL MISSION ONCE THE OPENING NIS IS DONE ]]
function Rule_GameStart()
if g_firstrun then
--[[ SET RESOURCES ]]
Player_SetAllResources(g_Player1, 10000, 10000)
--[[ PREACTION ]]
-- Use this space to add core mission functions that should be in place during the opening NIS
Rule_AddOneShot(Rule_WorldEvents_Kickoff, 0)
--[[ DIFFICULTY LEVEL ]]
-- gets the difficulty level from the UI and passes it into the function
Rule_SetDifficultyLevel( Difficulty_Get() )
g_firstrun = false
elseif Event_IsAnyRunning() == false then
--[[ Get the AI doing whatever after the NIS is over ]]
Rule_StartAI()
--[[ FOW ]]
-- World_EnablePlayerToPlayerFOW(g_Player2, g_Player1, true)
--[[ WIN CHECK ]]
Rule_AddInterval(Rule_EndGameWin, 1)
--[[ LOSE CHECK ]]
Rule_AddInterval(Rule_EndGameLose, 1)
--[[ ASSIGN OBJECTIVES ]]
Rule_AddInterval(Rule_Objective_BanishNecrons, 1)
--[[ AUTOSAVE AFTER NIS ]]
Rule_AddIntervalDelay(Rule_Autosave_MissionStart, 1, 5)
--[[ GENERATE ACTION ]]
-- Use this space to add all core mission functions
Rule_AddOneShot(Rule_Necron_Kickoff, 10)
--[[ Clean up ]]
Rule_Remove(Rule_GameStart)
end
end
--[[ DIFFICULTY ]]
function Rule_SetDifficultyLevel( difficultyLevel )
--[[ STATIC MODIFIERS ]]
-- Use this space to set any Static Modifiers. Modifiers that will not change with the difficulty setting.
Difficulty_SetForPlayer( g_Player3, difficultyLevel )
Difficulty_SetForPlayer( g_Player4, difficultyLevel )
Difficulty_SetForPlayer( g_Player5, difficultyLevel )
Difficulty_SetForPlayer( g_Player6, difficultyLevel )
--[[ DIFFICULTY GENERAL RULES ]]
--[[ Types of things that can me done include:
a) adding resource values
b) changing variables for the number of starting units a player recieves
b) or even activating new objectives (although we refrained from this in DoW as the increased testing requirements it dictates)
]]
-- easy
if difficultyLevel == DIFFICULTY_EASY then
--Cpu_SetDifficulty( g_Player2, AD_Standard )
t_difficulty = t_dif_low
-- medium
elseif difficultyLevel == DIFFICULTY_NORMAL then
t_difficulty = t_dif_med
-- hard
elseif difficultyLevel == DIFFICULTY_HARD then
t_difficulty = t_dif_high
end
--[[ toughen up Guard Barracks ]]
local mod_barrackarmour = Modifier_Create(MAT_EntityType, "armour_modifier", MUT_Multiplication, false, t_difficulty.brrkarmr, "guard_infantry")
Modifier_ApplyToPlayer( mod_barrackarmour, g_Player2)
local mod_barrackhealth = Modifier_Create(MAT_EntityType, "health_maximum_modifier", MUT_Multiplication, false, t_difficulty.brrkhlth, "guard_infantry")
Modifier_ApplyToPlayer( mod_barrackhealth, g_Player2)
--[[ Slow Down the Necrons ]]
local mod_monolithspeed = Modifier_Create(MAT_EntityType, "speed_maximum_modifier", MUT_Multiplication, false, .7, "necron_monolith")
Modifier_ApplyToPlayer( mod_monolithspeed, g_Player6)
local mod_monolithhealth = Modifier_Create(MAT_EntityType, "health_maximum_modifier", MUT_Multiplication, false, 2.5, "necron_monolith")
Modifier_ApplyToPlayer( mod_monolithhealth, g_Player6)
local mod_necronhealth = Modifier_Create(MAT_EntityType, "health_maximum_modifier", MUT_Multiplication, false, 1.5, "necron_warrior")
Modifier_ApplyToPlayer( mod_necronhealth, g_Player6)
--[[ Titan weapon recharge ]]
local mod_rechargerate = Modifier_Create(MAT_EntityType, "ability_recharge_modifier", MUT_Multiplication, false, 15, "spo_05_titan_target_weapon_01")
Modifier_ApplyToPlayer( mod_rechargerate, g_Player1)
for i = 1, 6 do
local mod_cannonrange = Modifier_Create(MAT_WeaponType, "max_range_weapon_modifier", MUT_Multiplication, false, 3, "npc_titan_maincannon_"..i)
Modifier_ApplyToPlayer( mod_cannonrange, g_Player1)
local mod_cannonreload = Modifier_Create(MAT_WeaponType, "reload_time_weapon_modifier", MUT_Multiplication, false, t_difficulty.gunreload, "npc_titan_maincannon_"..i)
Modifier_ApplyToPlayer( mod_cannonreload, g_Player1)
end
--[[ toughen up Farseer ]]
local mod_farseerhealth = Modifier_Create(MAT_EntityType, "health_maximum_modifier", MUT_Multiplication, false, 4, "eldar_farseer")
Modifier_ApplyToPlayer( mod_farseerhealth, g_Player1)
--[[ toughen up Seer Council ]]
local mod_seerhealth = Modifier_Create(MAT_EntityType, "health_maximum_modifier", MUT_Multiplication, false, 4, "eldar_warlock_seer")
Modifier_ApplyToPlayer( mod_seerhealth, g_Player1)
local mod_seermorale = Modifier_Create(MAT_SquadType, "morale_rate_squad_modifier", MUT_Multiplication, false, 2, "eldar_squad_seer_council")
Modifier_ApplyToPlayer( mod_seermorale, g_Player1)
--[[Mod the Build Speed of Heretics]]
local mod_constructspeed = Modifier_Create(MAT_EntityType, "construction_speed_modifier", MUT_Multiplication, false, 5, "chaos_slave")
Modifier_ApplyToPlayer( mod_constructspeed, g_Player3 )
--[[Mod the Build Speed of Grotz]]
local mod_constructspeed = Modifier_Create(MAT_EntityType, "construction_speed_modifier", MUT_Multiplication, false, 5, "ork_grot")
Modifier_ApplyToPlayer( mod_constructspeed, g_Player4 )
end
--[[ AI ]]
function Rule_StartAI()
-- Cpu_EnableAll(false)
end
--[[ CORE GAME ]]
function Rule_Timer() g_time = g_time+1 end
function Rule_FOW_Reset() FOW_Reset() end
--[[ WORLD EVENTS ]]
function Rule_WorldEvents_Kickoff()
Rule_AddOneShot(Rule_Eldar_Kickoff, 0)
Rule_AddOneShot(Rule_Guard_Kickoff, 0)
Rule_AddInterval(Rule_Disorder_Kickoff, 1)
end
--[[ ELDAR START ]]
-- here we set about making the Eldar function Rule_Eldar_Kickoff()
Player_RestrictAbility(g_Player1, "sp_dxp_abilities_titanmaincannon_slowrecharge")
for i = 7, 8 do
EGroup_DeSpawn("eg_titan_"..i)
end
t_titantakeover = {
active = {false},
pieceIsOwned = {false, false, false, false, false, false, false, false},
counterStart = {false, false, false, false, false, false, false, false},
beaconID = {false, false, false, false, false, false, false, false},
ping = {"png_1", "png_2", "png_3", "png_4", "png_5", "png_6", "png_7", "png_8"},
counterID = {851100, 851101, 851102, 851103, 851104, 851105, 851106, 851107},
height = {15, 5, 8, 15, 5, 8, 0, 0},
}
end
--[[ BABY SIT THE LEADER ]] function Rule_Eldar_FarseerLost()
local blueprinttable = Util_MakeBlueprintTable("eldar_squad_farseer")
if SGroup_Exists("sg_eldar1") and SGroup_CountDeSpawned(SGroup_FromName("sg_eldar1")) == 0
and ( SGroup_IsEmpty("sg_eldar1") or SGroup_ContainsBlueprints( "sg_eldar1", blueprinttable, false) == false ) then
Rule_AddOneShot(Rule_Eldar_FarseerReturns, 7)
Rule_Remove(Rule_Eldar_FarseerLost)
end
end
--[[ TALDEER RETURNS ]] function Rule_Eldar_FarseerReturns()
if EGroup_Exists("eg_eldar_hq") and EGroup_IsEmpty("eg_eldar_hq") ==false then
local sgroupID = Util_CreateSquadsAtMarkerEx(g_Player1, "sg_eldar1", "eldar_squad_farseer", "mkr_eldar_start", 1, 4)
SGroup_AddGroup(SGroup_CreateIfNotFound("sg_eldar"), sgroupID)
World_FXEventSquad("data:Art/Events/Unit_Upgrade_Morale_FX/Reinforce_Trooper", sgroupID)
if Event_TimeSinceLast() > 10 then
Util_StartIntel(EVENTS.IE_Eldar_ImBack )
end
EventCue_DoEvent( "recruit_commander", "/Races/Shared/Upgrade_weapon", "$42890", "$42892" )
Rule_AddInterval(Rule_Eldar_FarseerLost, 1)
end
end
--[[ PROTECT THE SOUL STONE ]] function Rule_Eldar_SoulStonePeril()
if EGroup_Exists("eg_eldar_hq") and EGroup_IsEmpty("eg_eldar_hq") ==false and EGroup_GetAvgHealth("eg_eldar_hq") < 0.5 then
Util_StartIntel(EVENTS.IE_SoulStoneInPeril)
Rule_AddInterval(Rule_Eldar_SoulStoneLost, 1)
Rule_Remove(Rule_Eldar_SoulStonePeril)
end
end
--[[ Dumb bastards lost the HQ ]] function Rule_Eldar_SoulStoneLost()
if EGroup_Exists("eg_eldar_hq") and EGroup_IsEmpty("eg_eldar_hq") then
Util_StartIntel(EVENTS.IE_SoulStoneLost)
g_obj_websurvive = false
Rule_Remove(Rule_Eldar_SoulStoneLost)
end
end
--[[ ORDERS TO TAKE THE TITAN ]] function Rule_Eldar_PillageTitan()
if g_eldarneedtitan == true then
--[[ NEED INTEL EVENT ]]
Util_StartIntel(EVENTS.IE_UseTitan)
Rule_AddInterval(Rule_Objective_EntombPieces, 1)
-- TRIGGER TIMED REMINDER TO CAPTURE TITAN PIECES
g_notensnareyet = true
Rule_AddIntervalDelay(Rule_Eldar_BonesingerNudge, 1, 40)
-- ANNOUNCING THE ENSNARING HAS BEGUN
g_ensnaringbegun = false
Rule_AddInterval(Rule_Eldar_EnsnareBegun, 1)
-- FIRST PIECE TAKEN
g_firstcaptured = false
g_countcaptured = 0
Rule_AddInterval(Rule_Eldar_PieceCaptured, 1)
Rule_AddInterval(Rule_Eldar_TitanPiecesAllCaptured, 1)
--[[ get that titan]]
g_capturecount = 60 -- THIS IS THE COUNT FOR HOW LONG IT TAKES TO CAPTURE A PIECE
Rule_AddInterval(Rule_Eldar_CaptureTitanPieces, 1)
Rule_AddOneShot(Rule_Eldar_TitanPieceMarkers_Create, 0)
Rule_Remove(Rule_Eldar_PillageTitan)
end
end
--[[ this is triggered if the player doesn't start capturing the titan pieces ]] function Rule_Eldar_BonesingerNudge()
if g_notensnareyet == true and Event_IsAnyRunning() == false then
Util_StartIntel(EVENTS.IE_BonesingerNudge)
Rule_Remove(Rule_Eldar_BonesingerNudge)
end
end
--[[ this is to make them take note of the counter ]] function Rule_Eldar_EnsnareBegun()
if g_ensnaringbegun == true then
--[[ PLAY MUSIC ]]
Sound_PlayStinger("stinger_mso5e_titanentombed")
Util_StartIntel(EVENTS.IE_EnsnareBegun )
Rule_Remove(Rule_Eldar_EnsnareBegun)
end
end
--[[ letting the player know to start the next piece ]] function Rule_Eldar_PieceCaptured()
if g_firstcaptured == true then
Util_StartIntel(EVENTS.IE_TitanCaptured)
--[[ PLAY MUSIC ]]
Util_Music_CreateSingleLoop( {"music_mso5e"}, {"music_mso5e_perc"}, delay )
Rule_AddIntervalDelay(Rule_FindSturnn, 1, 20)
Rule_AddOneShot(Rule_Eldar_SoulStoneRejuvenate, 15)
Rule_Remove(Rule_Eldar_PieceCaptured)
end
end
--[[ replacing the Obj ]] function Rule_FindSturnn()
if Event_TimeSinceLast() > 10 then
Util_StartIntel(EVENTS.IE_GuardTuantFindSturnn)
g_findsturnndelay = World_GetRand(50, 80)
g_guardcountdown = 0
Rule_Check_AddInterval(Rule_Eldar_FindGeneral, 1)
Rule_Remove(Rule_FindSturnn)
end
end
--[[ letting the player know about the bonus to recharge time their weapon gets ]] function Rule_Eldar_SoulStoneRejuvenate()
Util_StartIntel(EVENTS.IE_SoulStoneRejuvenate)
end
--[[ CAPTURE THE TITAN ]] -- THIS FUNCTION MANAGES DETECTING A BONESINGER NEAR THE TITAN PIECES function Rule_Eldar_CaptureTitanPieces()
--proximity group
SGroup_Clear(SGroup_CreateIfNotFound("_sg_bonesingers"))
--check all pieces
for i = 1, 6 do
--is it owned?
if t_titantakeover.pieceIsOwned[i] ~= true and EGroup_IsEmpty("eg_titan_"..i) == false then
-- if not get any squads near it
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "_sg_bonesingers", "mkr_titan"..i)
-- only one timer at a time
-- are they bonesingers?
if t_titantakeover.active[1] == false and SGroup_IsEmpty("_sg_bonesingers") == false and SGroup_ContainsBlueprints(SGroup_FromName("_sg_bonesingers"), {{ name = "eldar_squad_bonesinger", count = 1 }}, false) then
-- if so is the counter already started?
if t_titantakeover.active[1] ~= true then
-- start counter, there's only one which is why we check above
UI_ShowCountdown(t_titantakeover.counterID[i], g_capturecount)
Rule_Check_AddIntervalEx(Rule_Eldar_TitanCaptured, 1, g_capturecount+5)
Rule_AddOneShot(Rule_Eldar_TitanPieceMarkers_Remove, 0)
g_notensnareyet = false
g_ensnaringbegun = true
g_titancount = 1
g_titanpiece = i
t_titantakeover.active[1] = true
Rule_Remove(Rule_Eldar_CaptureTitanPieces)
break
end
end
end
end
end
--[[ Adds the markers to the uncaptured titan pieces ]] function Rule_Eldar_TitanPieceMarkers_Create()
for i = 1, 6 do
--is it owned?
if t_titantakeover.pieceIsOwned[i] ~= true then
Util_Ping_LoopingMkr(t_titantakeover.ping[i], "mkr_titan"..i)
t_titantakeover.beaconID[i] = Util_CreateBeaconMarker_Blue("mkr_titan"..i)
end
end
end
--[[ removes the markers from the titan pieces ]] function Rule_Eldar_TitanPieceMarkers_Remove()
for i = 1, 6 do
--is it owned?
if t_titantakeover.beaconID[i] ~= false then
Util_Ping_Stop(t_titantakeover.ping[i])
Util_RemoveBeaconMarker(t_titantakeover.beaconID[i])
t_titantakeover.beaconID[i] = false
end
end
end
--[[ MONITORS THE EXISTENCE AND CAPTURE PROGRESS OF THE TITAN PIECES ]] function Rule_Eldar_TitanCaptured()
local i = g_titanpiece
SGroup_Clear(SGroup_CreateIfNotFound("_sg_bonesingers"))
local sgroupID = Player_GetAllSquadsNearMarker(g_Player1, "_sg_bonesingers", "mkr_titan"..i)
if SGroup_IsEmpty("_sg_bonesingers") == false and SGroup_ContainsBlueprints(SGroup_FromName("_sg_bonesingers"), {{ name = "eldar_squad_bonesinger", count = 1 }}, false) then
Anim_PlaySGroupAnim(SGroup_FromName("_sg_bonesingers"), "build_sp")
end
if t_titantakeover.active[1] == true
and ( SGroup_IsEmpty("_sg_bonesingers")
or SGroup_ContainsBlueprints(SGroup_FromName("_sg_bonesingers"), {{ name = "eldar_squad_bonesinger", count = 1 }}, false) == false
or EGroup_IsEmpty("eg_titan_"..g_titanpiece) ) then
UI_HideCountdown()
t_titantakeover.active[1] = false
Rule_Remove(Rule_Eldar_TitanCaptured)
Rule_AddOneShot(Rule_Eldar_TitanPieceMarkers_Create, 0)
Rule_AddOneShot(Rule_Eldar_WebwayWeapon_Recharge, 0)
Rule_AddInterval(Rule_Eldar_CaptureTitanPieces, 1)
elseif g_titancount == g_capturecount then
t_titantakeover.pieceIsOwned[g_titanpiece] = true
EGroup_SetPlayerOwner("eg_titan_"..g_titanpiece, g_Player1)
Objective_PingRemove(Objective_EntombPieces.title_id, t_objpiecesping[i])
--[[ play the entombing fx's ]]
local pos = EGroup_GetPosition(EGroup_FromName("eg_titan_"..g_titanpiece))
pos.y = pos.y+t_titantakeover.height[g_titanpiece]
local int = World_FXEventLooping("data:Art/Events/Eldar/entomb_cannon", pos)
g_firstcaptured = true
-- UI_HideCountdown() t_titantakeover.active[1] = false g_countcaptured = g_countcaptured+1
Rule_AddOneShot(Rule_Eldar_TitanPieceMarkers_Create, 0)
Rule_Remove(Rule_Eldar_TitanCaptured)
Rule_AddInterval(Rule_Eldar_CaptureTitanPieces, 1)
end
g_titancount = g_titancount+1
end
--[[ the actual application of the Eldar's weapon recharge rate increase ]] function Rule_Eldar_WebwayWeapon_Recharge()
--[[ Eldar Titan weapon recharge ]]
local mod_eldarrechargerate = Modifier_Create(MAT_EntityType, "ability_recharge_modifier", MUT_Multiplication, true, .75, "eldar_hq")
--[[ Titan weapon recharge ]]
Modifier_ApplyToPlayer( mod_eldarrechargerate, g_Player1)
end
function Rule_Eldar_TitanPiecesAllCaptured()
if g_countcaptured == 6 then
g_obj_entombpieces = true
Rule_Remove(Rule_Eldar_TitanPiecesAllCaptured)
elseif g_countcaptured < 6 then
for i = 1, 6 do
if EGroup_Exists("eg_titan_"..i) and EGroup_IsEmpty("eg_titan_"..i) then
g_obj_entombpieces = false
Rule_Remove(Rule_Eldar_TitanPiecesAllCaptured)
break
end
end
end
end
--[[ NECRONS!!! ]]
-- here we set about making the evil ones function Rule_Necron_Kickoff()
Util_StartIntel(EVENTS.IE_NecronsHereSoon)
Playlist_Manager( PC_Music, {"stinger_mso5e_stonewithoutpower"}, true, false , {0, 0})
local delay = World_GetRand(45, 60)
Rule_AddOneShot(Rule_Necron_Monolith1_Create, delay)
Rule_AddOneShot(Rule_Eldar_UseWeapon, 240)
end
--[[ the announcement to the player to use the Eldar Super Weapon ]] function Rule_Eldar_UseWeapon()
Player_GrantResearch(g_Player1, "eldar_research_sp_soulstone")
Player_UnRestrictAbility(g_Player1, "sp_dxp_abilities_titanmaincannon_slowrecharge")
Util_StartIntel(EVENTS.IE_UseSoulStone)
--[[ add the objective ]]
Rule_AddInterval(Rule_Objective_KillFirstMonolith, 1)
end
function MSO5E_SetMonolithStance(sgroupname)
if t_difficulty.nstance == 1 then
Cmd_SetStance(sgroupname, STANCE_CeaseFire)
elseif t_difficulty.nstance == 2 then
Cmd_SetStance(sgroupname, STANCE_StandGround)
elseif t_difficulty.nstance == 3 then
Cmd_SetStance(sgroupname, STANCE_Attack)
end
end
--[[ First Monolith shows up ]] function Rule_Necron_Monolith1_Create()
g_monolith1_target = "mkr_necron_junct1"
Util_StartNIS(EVENTS.NIS_MonoltihArrives)
end
--[[ Generic Warrior Spawn ]] function Rule_Necron_Warriors_Generate()
for i = 1, 5 do
if SGroup_Exists("sg_monolith"..i) and SGroup_IsEmpty("sg_monolith"..i) == false and SGroup_CountDeSpawned(SGroup_FromName("sg_monolith"..i)) == 0 then
for y = 1, 6 do
local rand = World_GetRand(1, 3)
if rand < 3 then
if SGroup_Exists("sg_warriors"..i..y) == false or SGroup_IsEmpty("sg_warriors"..i..y) then
local pos = SGroup_GetPosition(SGroup_FromName("sg_monolith"..i))
if pos.x == 0 and pos.z == 0 then
--the monolith is despawned
else
local sgroupID = Util_CreateSquadsAtPositionEx(g_Player6, "sg_warriors"..i..y, "npc_necron_warrior", pos, 1, 5)
World_FXEventSquad("data:Art/Events/Necron/appear_fx", sgroupID)
SGroup_AddGroup(SGroup_CreateIfNotFound("sg_warriors"), sgroupID)
Cmd_AttackMoveMarker("sg_warriors", "mkr_eldar_start")
break
end
end
end
end
end
end
local removerule = 0
for i = 1, 5 do
if SGroup_Exists("sg_monolith"..i) and SGroup_IsEmpty("sg_monolith"..i) then
removerule = removerule+1
end
end
if removerule == 5 then Rule_Remove(Rule_Necron_Warriors_Generate) end
end
function Rule_Necron_Monolith1_Move()
if SGroup_Exists("sg_monolith1") and SGroup_IsEmpty("sg_monolith1") == false then
Cmd_AttackMoveMarker("sg_monolith1", g_monolith1_target)
else
Rule_Remove(Rule_Necron_Monolith1_Move)
end
end
function Rule_Necron_Monolith1_DeathCheck()
if SGroup_Exists("sg_monolith1") and SGroup_IsEmpty("sg_monolith1") then
--[[ FALSE VICTORY ]]
Util_StartIntel(EVENTS.IE_FalseVictory)
g_obj_killfirst = true
--[[ trigger stuff ]]
Rule_AddInterval(Rule_Eldar_AllWarriorsDead, 1)
Rule_Remove(Rule_Necron_Monolith1_DeathCheck)
elseif SGroup_Exists("sg_monolith1") and SGroup_GetAvgHealth("sg_monolith1") < 0.3 then
local pos = SGroup_GetPosition(SGroup_FromName("sg_monolith1"))
World_FXEvent( "data:Art/Events/Guard/Weapons/Baneblade_Cannon_hit_rock", pos )
SGroup_SelfDestroy("sg_monolith1", true)
end
end
--[[ warn the poor eldar that the bastard is coming back ]] function Rule_Eldar_PhaseWarning()
if g_eldarphasewarning ~= true then
Util_StartIntel(EVENTS.IE_MonolithPhases)
g_eldarphasewarning = true
end
end
--[[ Hold the other monoliths off until the warriors are gone! ]] function Rule_Eldar_AllWarriorsDead()
if SGroup_IsEmpty("sg_warriors") then
--[[ trigger stuff ]]
g_monolithdead = 0
Rule_AddInterval(Rule_Necron_MonolithDeadCount, 1)
--[[ PLAY MUSIC ]]
Sound_PlayStinger("stinger_mso5e_stonewithoutpower")
g_phaselimit = t_difficulty.phase
Rule_AddOneShot(Rule_Necron_Monolith2_Create, 10)
local delay = World_GetRand(60, 90)
Rule_AddOneShot(Rule_Necron_Monolith3_Create, delay)
Rule_Remove(Rule_Eldar_AllWarriorsDead)
end
end
--[[ MONOLITH UTILITY FUNCTIONS ]]
function MSO5E_Necron_PhaseOut(sgroupname)
Cmd_StopSquads(sgroupname)
Cmd_SetStance(sgroupname, STANCE_CeaseFire)
-- SGroup_SetHealthInvulnerable(sgroupname, true) SGroup_SetPlayerOwner(sgroupname, g_Player8) Anim_PlaySGroupAnim(SGroup_FromName(sgroupname), "jump_setup")
end
function MSO5E_Necron_PhaseIn(sgroupname, markername)
SGroup_DeSpawn(sgroupname)
local newx = World_GetRand(-15, 15)
local newz = World_GetRand(-15, 15)
local pos = Marker_GetPosition(Marker_FromName(markername, "basic_marker"))
pos.x = pos.x + newx
pos.z = pos.z + newz
SGroup_ReSpawnPosition(sgroupname, pos)
Anim_PlaySGroupAnim(SGroup_FromName(sgroupname), "jump_breakdown")
SGroup_SetPlayerOwner(sgroupname, g_Player6)
-- SGroup_SetHealthInvulnerable(sgroupname, false)
local rand = World_GetRand(5, 8)*0.1
SGroup_SetAvgHealth(sgroupname, rand)
Cmd_SetStance(sgroupname, STANCE_StandGround)
end
--[[ THE SECOND MONOLITH ]] -- here it comes -- it is joined by the third moments later function Rule_Necron_Monolith2_Create()
--[[ ELDAR DOOMED ]]
Util_StartIntel(EVENTS.IE_WereDoomed)
Util_Music_CreateSingleLoop( {"music_necron_theme"}, {"music_necron_theme_perc"}, 140 )
Rule_AddIntervalDelay(Rule_Autosave_NotOverYet, 1, 5)
g_eldarneedtitan = true
g_monolith2_target = "mkr_necron_junct1"
local sgroupID = Util_CreateSquadsAtMarkerEx(g_Player6, "sg_monolith2", "npc_necron_monolith", "mkr_necron_start2", 1, 1)
SGroup_AddGroup(SGroup_CreateIfNotFound("sg_monoliths"), sgroupID)
Cmd_MoveToMarker("sg_monolith2", g_monolith2_target)
MSO5E_SetMonolithStance("sg_monolith2")
Anim_PlaySGroupAnim(sgroupID, "land")
Rule_AddInterval(Rule_Necron_Monolith2_Move, 30)
Rule_AddInterval(Rule_Necron_Monolith2_DeathCheck, 1)
end
function Rule_Necron_Monolith2_Move()
if SGroup_Exists("sg_monolith2") and SGroup_IsEmpty("sg_monolith2") == false then
Cmd_AttackMoveMarker("sg_monolith2", g_monolith2_target)
end
end
function Rule_Necron_Monolith2_DeathCheck()
if SGroup_Exists("sg_monolith2") and SGroup_IsEmpty("sg_monolith2") then
--[[ trigger stuff ]]
g_monolithdead = g_monolithdead+1
Rule_Remove(Rule_Necron_Monolith2_Move)
Rule_Remove(Rule_Necron_Monolith2_DeathCheck)
elseif SGroup_Exists("sg_monolith2") and SGroup_GetAvgHealth("sg_monolith2") < g_phaselimit then
g_phaselimit = g_phaselimit-0.1
MSO5E_Necron_PhaseOut("sg_monolith2")
Rule_Check_AddOneShot(Rule_Eldar_PhaseWarning, 0)
Rule_Check_AddOneShot(Rule_Necron_Monolith2_Respawn, 10)
end
end
function Rule_Necron_Monolith2_Respawn()
MSO5E_Necron_PhaseIn("sg_monolith2", "mkr_necron_start2")
-- Cmd_MoveToMarker("sg_monolith2", g_monolith2_target)
end
--[[ THE THIRD MONOLITH ]] -- comes into play shortly after the second monolith -- kicks some ass function Rule_Necron_Monolith3_Create()
g_monolith3_target = "mkr_necron_junct3"
local sgroupID = Util_CreateSquadsAtMarkerEx(g_Player6, "sg_monolith3", "npc_necron_monolith", "mkr_necron_start3", 1, 1)
SGroup_AddGroup(SGroup_CreateIfNotFound("sg_monoliths"), sgroupID)
Cmd_MoveToMarker("sg_monolith3", g_monolith3_target)
MSO5E_SetMonolithStance("sg_monolith3")
Anim_PlaySGroupAnim(sgroupID, "land")
Rule_AddInterval(Rule_Necron_Monolith3_Move, 30)
Rule_AddInterval(Rule_Necron_Monolith3_DeathCheck, 1)
Rule_AddInterval(Rule_TriggerLaterStuff, 1)
end
function Rule_Necron_Monolith3_Move()
if SGroup_Exists("sg_monolith3") and SGroup_IsEmpty("sg_monolith3") == false then
Cmd_AttackMoveMarker("sg_monolith3", g_monolith3_target)
end
end
function Rule_Necron_Monolith3_DeathCheck()
if SGroup_Exists("sg_monolith3") and SGroup_IsEmpty("sg_monolith3") then
--[[ trigger stuff ]]
g_monolithdead = g_monolithdead+1
Rule_Remove(Rule_Necron_Monolith3_Move)
Rule_Remove(Rule_Necron_Monolith3_DeathCheck)
elseif SGroup_Exists("sg_monolith3") and SGroup_GetAvgHealth("sg_monolith3") < g_phaselimit then
g_phaselimit = g_phaselimit-0.1
MSO5E_Necron_PhaseOut("sg_monolith3")
Rule_Check_AddOneShot(Rule_Eldar_PhaseWarning, 0)
Rule_Check_AddOneShot(Rule_Necron_Monolith3_Respawn, 10)
end
end
function Rule_Necron_Monolith3_Respawn()
MSO5E_Necron_PhaseIn("sg_monolith3", "mkr_necron_start3")
-- Cmd_MoveToMarker("sg_monolith3", g_monolith3_target)
end
--[[ DISORDER ARRIVES w/ MONOLITH 4 and 5 ]] function Rule_TriggerLaterStuff()
if SGroup_Exists("sg_monoliths") and SGroup_IsEmpty("sg_monoliths") == false and SGroup_Count(SGroup_FromName("sg_monoliths")) < 2 then
g_disorderarrives = true
Rule_AddOneShot(Rule_Necron_Monolith4_Create, 5)
Rule_AddOneShot(Rule_Necron_Monolith5_Create, 10)
Rule_AddIntervalDelay(Rule_Autosave_MoreMonoliths, 1, 15)
Rule_Remove(Rule_TriggerLaterStuff)
end
end
--[[ THE FOURTH MONOLITH ]] -- number 4 and 5 attack together when at least 1 of the 2/3 set are still active --bwuahahahaha function Rule_Necron_Monolith4_Create()
g_monolith4_target = "mkr_necron_junct2"
local sgroupID = Util_CreateSquadsAtMarkerEx(g_Player6, "sg_monolith4", "npc_necron_monolith", "mkr_necron_start4", 1, 1)
SGroup_AddGroup(SGroup_CreateIfNotFound("sg_monoliths"), sgroupID)
Cmd_MoveToMarker("sg_monolith4", g_monolith4_target)
MSO5E_SetMonolithStance("sg_monolith4")
Anim_PlaySGroupAnim(sgroupID, "land")
Rule_AddInterval(Rule_Necron_Monolith4_Move, 30)
Rule_AddInterval(Rule_Necron_Monolith4_DeathCheck, 1)
end
function Rule_Necron_Monolith4_Move()
if SGroup_Exists("sg_monolith4") and SGroup_IsEmpty("sg_monolith4") == false then
Cmd_AttackMoveMarker("sg_monolith4", g_monolith4_target)
end
end
function Rule_Necron_Monolith4_DeathCheck()
if SGroup_Exists("sg_monolith4") and SGroup_IsEmpty("sg_monolith4") then
--[[ trigger stuff ]]
g_monolithdead = g_monolithdead+1
Rule_Remove(Rule_Necron_Monolith4_Move)
Rule_Remove(Rule_Necron_Monolith4_DeathCheck)
elseif SGroup_Exists("sg_monolith4") and SGroup_GetAvgHealth("sg_monolith4") < g_phaselimit then
g_phaselimit = g_phaselimit-0.1
MSO5E_Necron_PhaseOut("sg_monolith4")
Rule_Check_AddOneShot(Rule_Eldar_PhaseWarning, 0)
Rule_Check_AddOneShot(Rule_Necron_Monolith4_Respawn, 10)
end
end
function Rule_Necron_Monolith4_Respawn()
MSO5E_Necron_PhaseIn("sg_monolith4", "mkr_necron_start4")
Cmd_MoveToMarker("sg_monolith4", g_monolith4_target)
end
--[[ THE FIFTH MONOLITH ]] --last of the mighty monoliths --be scared function Rule_Necron_Monolith5_Create()
g_monolith5_target = "mkr_necron_junct1"
local sgroupID = Util_CreateSquadsAtMarkerEx(g_Player6, "sg_monolith5", "npc_necron_monolith", "mkr_necron_start5", 1, 1)
SGroup_AddGroup(SGroup_CreateIfNotFound("sg_monoliths"), sgroupID)
Cmd_MoveToMarker("sg_monolith5", g_monolith4_target)
MSO5E_SetMonolithStance("sg_monolith5")
Anim_PlaySGroupAnim(sgroupID, "land")
Rule_AddInterval(Rule_Necron_Monolith5_Move, 30)
Rule_AddInterval(Rule_Necron_Monolith5_DeathCheck, 1)
end
function Rule_Necron_Monolith5_Move()
if SGroup_Exists("sg_monolith5") and SGroup_IsEmpty("sg_monolith5") == false then
Cmd_AttackMoveMarker("sg_monolith5", g_monolith5_target)
end
end
function Rule_Necron_Monolith5_DeathCheck()
if SGroup_Exists("sg_monolith5") and SGroup_IsEmpty("sg_monolith5") then
--[[ trigger stuff ]]
g_monolithdead = g_monolithdead+1
Rule_Remove(Rule_Necron_Monolith5_Move)
Rule_Remove(Rule_Necron_Monolith5_DeathCheck)
elseif SGroup_Exists("sg_monolith5") and SGroup_GetAvgHealth("sg_monolith5") < g_phaselimit then
g_phaselimit = g_phaselimit-0.1
MSO5E_Necron_PhaseOut("sg_monolith5")
Rule_Check_AddOneShot(Rule_Eldar_PhaseWarning, 0)
Rule_Check_AddOneShot(Rule_Necron_Monolith5_Respawn, 10)
end
end
function Rule_Necron_Monolith5_Respawn()
MSO5E_Necron_PhaseIn("sg_monolith5", "mkr_necron_start5")
Cmd_MoveToMarker("sg_monolith5", g_monolith5_target)
end
function Rule_Necron_MonolithDeadCount()
--[[ 4 is the number of monolith's that show up after the first one which is a 'gimme' ]]
if g_monolithdead == 4 then
g_obj_banish = true
Rule_Remove(Rule_Necron_MonolithDeadCount)
end
if g_monolithdead == 3 and g_autosave == nil then
for i = 2, 5 do
if SGroup_Exists("sg_monolith"..i) and SGroup_IsEmpty("sg_monolith"..i) == false then
g_lastmonolith = "sg_monolith"..i
g_lastmonolithID = SGroup_FromName(g_lastmonolith)
break
end
end
Rule_AddInterval(Rule_TrackLastMonolith1, 1)
g_autosave = true
Rule_AddIntervalDelay(Rule_Autosave_OneLeft, 1, 5)
end
end
function Rule_TrackLastMonolith1()
if SGroup_Exists(g_lastmonolith) then
if SGroup_IsEmpty(g_lastmonolith) == false and SGroup_CountDeSpawned(g_lastmonolithID) == 0 then
g_lastmonolithpos = SGroup_GetPosition(g_lastmonolithID)
elseif SGroup_IsEmpty(g_lastmonolith) then
Sound_PlayStinger("stinger_mso5e_monolithsbanished")
Player_GetAllSquadsNearPos(g_Player2, "sg_end", g_lastmonolithpos, 50)
Player_GetAllEntitiesNearPos(g_Player2, "eg_end", g_lastmonolithpos, 50)
Player_GetAllSquadsNearPos(g_Player3, "sg_end", g_lastmonolithpos, 50)
Player_GetAllEntitiesNearPos(g_Player3, "eg_end", g_lastmonolithpos, 50)
Player_GetAllSquadsNearPos(g_Player4, "sg_end", g_lastmonolithpos, 50)
Player_GetAllEntitiesNearPos(g_Player4, "eg_end", g_lastmonolithpos, 50)
Rule_Remove(Rule_TrackLastMonolith1)
end
end
end
--[[ GUARD OUTPOSTS ]]
-- here we set about making the evil ones function Rule_Guard_Kickoff()
g_egguardpostsID = EGroup_CreateIfNotFound("eg_guard_posts")
for i = 1, 8 do
Entity_CreateBuildingMarker(g_Player2, "eg_guard_post"..i, "guard_infantry", "mkr_guard_post"..i, 1)
EGroup_AddGroup(g_egguardpostsID, EGroup_FromName("eg_guard_post"..i))
end
local blue = {
"guard_hq",
"guard_mechanized",
"guard_mechanized",
"guard_infantry",
"guard_infantry",
"guard_tactica",
"guard_plasma_generator",
"guard_plasma_generator",
"guard_plasma_generator",
"guard_turret_heavy_bolter",
"guard_turret_heavy_bolter",
"guard_turret_heavy_bolter",
"guard_turret_heavy_bolter",
}
for i = 1, 13 do
Entity_CreateBuildingMarker(g_Player2, "eg_guard_base"..i, blue[i], "mkr_ig_base"..i, 1)
EGroup_AddGroup(EGroup_CreateIfNotFound("eg_guard_base"), EGroup_FromName("eg_guard_base"..i))
end
for i = 2, 5 do
local sgroupID = Util_CreateSquadsAtMarkerEx(g_Player2, "sg_guard_base"..i, "guard_squad_kasrkin", "mkr_ig_base1", 2, 4)
SGroup_AddGroup(SGroup_CreateIfNotFound("sg_guard_base"), sgroupID)
Cpu_LockSGroupAcrossPlayers("sg_guard_base"..i)
Cmd_SetStance("sg_guard_base"..i, STANCE_StandGround)
Cmd_EnterBuilding("sg_guard_base"..i, "eg_guard_base"..i)
end
--[[ relocated from the NIS ]]
local blue = {"guard_squad_command_squad", "guard_squad_commissar"}
local name = {"general", "commissar"}
for i = 1, 2 do
local sgroupID = Util_CreateSquadsAtMarkerEx(g_Player2, "sg_guard_"..name[i], blue[i], "mkr_ig_"..name[i], 1, 1)
-- SGroup_AddGroup(SGroup_CreateIfNotFound("sg_guard_base"), sgroupID) Cpu_LockSGroupAcrossPlayers("sg_guard_"..name[i]) Cmd_SetStance("sg_guard_"..name[i], STANCE_StandGround) end
SGroup_CreateIfNotFound("sg_guard_posts")
Rule_AddIntervalEx(Rule_Eldar_LeaveGuardAlone, 1, 100)
Rule_AddInterval(Rule_Guard_PostReSupply, 2)
Rule_AddInterval(Rule_Guard_PostReOutfit, 5)
end
--[[ tell the player to lay off the humans ]] function Rule_Eldar_LeaveGuardAlone()
if EGroup_IsUnderAttackByPlayer("eg_guard_posts", false, g_Player1) or SGroup_IsUnderAttackByPlayer("sg_guard_posts", false, g_Player1) then
Util_StartIntel(EVENTS.IE_LeaveHumansAlone)
Rule_Remove(Rule_Eldar_LeaveGuardAlone)
end
end
--[[ Find the General ]] function Rule_Eldar_FindGeneral()
if EGroup_IsEmpty("eg_guard_base") or SGroup_IsEmpty("sg_guard_general") then
Rule_Remove(Rule_Eldar_FindGeneral)
elseif g_guardcountdown >= g_findsturnndelay then
if SGroup_Exists("sg_guard_general") and SGroup_IsEmpty("sg_guard_general") == false then
Util_StartNIS(EVENTS.NIS_FoundGeneral)
Util_StartIntel(EVENTS.IE_SturnnRelents)
Rule_AddIntervalDelay(Rule_Autosave_FindGeneral, 1, 5)
Rule_AddOneShot(Rule_Eldar_GuardCommandButton, 1)
Rule_Remove(Rule_Eldar_FindGeneral)
end
end
g_guardcountdown = g_guardcountdown+1
end
--[[ called from the NIS ]] function Rule_Guard_ActivateAI()
--[[ The IG Player is now active
Cpu_Enable(g_Player2, true)
Player_SetMaxSquadCap( g_Player2, 99 )
Player_SetSquadCap( g_Player2, 99 )
Player_SetAllResources(g_Player2, 100000, 100000)
Cpu_EnableComponent(g_Player2, false, CT_Attacking)
Cpu_SetDifficulty(g_Player2, AD_Advanced)
]] Rule_AddInterval(Rule_Guard_BaseDefenseGenerator, 1) end
--[[ Eldar Command the Guard ]] -- the idea behind this is to allow the player to order the Guard to attack move to specific locations
--[[ Guard Base Generator ]]
function MS05E_Generate_Guard(playerID, sgroupname, marker, infantry, vehicle) if infantry == true then local blue = { "guard_squad_guardsmen", "guard_squad_kasrkin", "guard_squad_ogryns", "guard_squad_guardsmen", "guard_squad_kasrkin", "guard_squad_ogryns", } local num = {8, 5, 6, 9, 4, 3} local rand1 = World_GetRand(1, table.getn(blue)) Util_CreateSquadsAtMarkerEx(playerID, sgroupname, blue[rand1], marker, 2, num[rand1]) end if vehicle == true then local blue = { "guard_squad_chimera", "guard_squad_hellhound", "guard_squad_lemanruss", "guard_squad_sentinel", "guard_squad_basilisk", "guard_squad_psyker", } local num = {1, 2, 1, 3, 2, 3} local rand1 = World_GetRand(1, table.getn(blue)) Util_CreateSquadsAtMarker(playerID, sgroupname, blue[rand1], marker, num[rand1]) end
return SGroup_FromName(sgroupname)
end
function Rule_Guard_BaseDefenseGenerator()
if EGroup_IsEmpty("eg_guard_base1") == false and (SGroup_IsEmpty("sg_guard_base") or SGroup_CountSpawned(SGroup_FromName("sg_guard_base")) < 5) then
MS05E_Generate_Guard(g_Player2, "sg_guard_base", "mkr_ig_base1", true, false)
Cpu_LockSGroupAcrossPlayers("sg_guard_base")
end
end
function Rule_Eldar_GuardCommandButton()
--[[ restrict this to make room ]]
Player_RestrictAbility(g_Player1, "eldar_mind_war")
Player_RestrictAbility(g_Player1, "eldar_guide")
--[[ CREATE THE REINFORCING BUTTONs ]]
-- Guardsmen
local textable = {"Scar_buttons/guards_rally", "Scar_buttons/guards_rally", "Scar_buttons/guards_rally"}
local tiptable = { "$851052", "$851053"}
g_cmdbtnID = Util_AbilityButton_CreateModal(textable, tiptable, true)
Util_SGroupAbilityButton_Add2Manager(g_cmdbtnID, "sg_eldar1")
Rule_AddInterval(Rule_Eldar_GuardCommand, 1)
Rule_AddInterval(Rule_Objective_CommandGuard, 1)
end
function Rule_Eldar_GuardCommand()
if Button_GetPressed(g_cmdbtnID) then
g_obj_commandguard = true
local pos = Button_GetPressedPosition(g_cmdbtnID)
if EGroup_Exists("eg_command_flare") == false or EGroup_IsEmpty("eg_command_flare") then
Entity_CreateBuildingPosition(g_Player1, "eg_command_flare", "flare_01", pos, 1)
elseif EGroup_IsEmpty("eg_command_flare") == false then
--[[ clean up ]]
EGroup_DestroyAllEntities("eg_command_flare")
--[[ create new ]]
Entity_CreateBuildingPosition(g_Player1, "eg_command_flare", "flare_01", pos, 1)
end
if g_pingactive == true then
Util_Ping_Stop("png_command")
Util_Ping_LoopingPos("png_command", pos)
g_pingactive = true
else
Util_Ping_LoopingPos("png_command", pos)
g_pingactive = true
end
if SGroup_IsEmpty("sg_guard_base") == false then
Cmd_AttackMovePos("sg_guard_base", pos)
end
g_pingactivecount = 30
if Rule_Exists(Rule_Eldar_RemoveCommandPing) == false then
Rule_AddInterval(Rule_Eldar_RemoveCommandPing, 1)
end
end
end
function Rule_Eldar_RemoveCommandPing()
if g_pingactivecount == 0 then
if EGroup_Exists("eg_command_flare") and EGroup_IsEmpty("eg_command_flare") then
--[[ clean up ]]
EGroup_DestroyAllEntities("eg_command_flare")
end
if g_pingactive == true then
Util_Ping_Stop("png_command")
g_pingactive = false
end
Rule_Remove(Rule_Eldar_RemoveCommandPing)
else
g_pingactivecount = g_pingactivecount-1
end
end
--[[ once the guard join the Eldar again and disorder shows up, they start attacking Orks and Chaos ]] function Rule_Guard_RandomAttacks()
local sgroupID0 = SGroup_CreateIfNotFound("_sg_guard_all")
SGroup_Clear(sgroupID0)
--get all orks squads
SGroup_AddGroup(sgroupID0, Player_GetSquads(g_Player2))
--if the group is not empty
if SGroup_IsEmpty("_sg_guard_all") == false then
--get the count
local count = SGroup_CountSpawned(sgroupID0)
--if the count is greater than the number of times I have to split the group
if count > 4 then
--for each of the breach points
for i = 1, 3 do
local sgroupID1 = SGroup_CreateIfNotFound("_sg_guard_random")
if SGroup_IsEmpty("_sg_guard_random") then
local rand = World_GetRand(1, count)
SGroup_Add(sgroupID1, SGroup_GetSpawnedSquadAt(sgroupID0, rand))
end
end
--send it in an attack move to the point
Cpu_LockSGroupAcrossPlayers("_sg_guard_random")
Cmd_SetStance("_sg_guard_random", STANCE_Hold)
local rand2 = World_GetRand(1, 5)
local marker = {"chaos_start1", "chaos_start2", "ork_start1", "ork_start2", "ork_start3"}
Cmd_AttackMoveMarker("_sg_guard_random", "mkr_"..marker[rand2])
end
end
end
--[[ Maintain the Outposts ]] -- this one recreates the troops function Rule_Guard_PostReSupply() --[[ the is to throw some randomness into how often the reinforcments spawn ]] local randomturn = World_GetRand(1, 5)
if randomturn < 4 then
for i = 1, 8 do
if EGroup_IsEmpty("eg_guard_post"..i) == false then
for y = 1, 3 do
local rand = World_GetRand(4, 6)
if SGroup_Exists("sg_guard_post"..i..y) == false or SGroup_IsEmpty("sg_guard_post"..i..y) then
local sgroupID = Util_CreateSquadsAtMarkerEx(g_Player2, "sg_guard_post"..i..y, "guard_squad_guardsmen", "mkr_guard_post"..i, 1, rand)
SGroup_AddGroup(SGroup_CreateIfNotFound("sg_guard_posts"), sgroupID)
Cpu_LockSGroupAcrossPlayers("sg_guard_post"..i..y)
Cmd_SetStance("sg_guard_post"..i..y, STANCE_StandGround)
Cmd_MoveToMarker("sg_guard_post"..i..y, "mkr_guard_postrally"..i)
break
end
end
end
end
end
if EGroup_IsEmpty("eg_guard_posts") then
Rule_Check_Remove(Rule_Guard_PostReSupply)
end
end
function Rule_Guard_PostReOutfit() --make a utility group local sgroupID_outfit = SGroup_CreateIfNotFound("_sg_outfit") SGroup_Clear(sgroupID_outfit) --check the outpost group local sgroupID = SGroup_FromName("sg_guard_posts") local count = SGroup_CountSpawned(sgroupID) -- if the outpost group is not empty if count > 0 then for i = 1, count do -- we want a random squad out of the group local randsquad = World_GetRand(1, count) -- there is a chance this will crash local squadID = SGroup_GetSpawnedSquadAt(sgroupID, randsquad) -- add it to the group cause somethings are easier to do to a sgroup SGroup_Add(sgroupID_outfit, squadID) --check to see if there is a sergeant if SGroup_HasLeader("_sg_outfit", false) == false then SGroup_AddLeaders("_sg_outfit") SGroup_Clear(sgroupID_outfit) break end --check to see if they have any weapons if Squad_WeaponCount(squadID, "guard_grenade_launcher_guardsmen") == 0 and Squad_WeaponCount(squadID, "guard_plasma_gun_guardsmen") == 0 then local weapons = {"guard_grenade_launcher_guardsmen", "guard_plasma_gun_guardsmen", "guard_grenade_launcher_guardsmen"} local randweapon = World_GetRand(1, 2) Squad_ForceUpgradeWeapons(squadID, weapons[randweapon], randweapon) SGroup_Clear(sgroupID_outfit) break end --reinforce Cmd_ReinforceTrooper("_sg_outfit", 1) end end
if SGroup_IsEmpty("sg_guard_posts") then
Rule_Check_Remove(Rule_Guard_PostReOutfit)
end
end
--[[ FORCES OF DISORDER ]]
-- here we set about making the evil ones function Rule_Disorder_Kickoff()
if g_disorderarrives == true then
Rule_AddOneShot(Rule_Eldar_DisorderArrive, 50)
Rule_AddIntervalDelay(Rule_Autosave_DisorderArrive, 1, 55)
Rule_AddOneShot(Rule_Disorder_CreateBases, 0)
Rule_AddIntervalDelay(Rule_Guard_RandomAttacks, 45, 50)
Rule_Remove(Rule_Disorder_Kickoff)
end
end
--[[ make the player pee their pants, more enemies! ]] function Rule_Eldar_DisorderArrive()
Util_StartIntel(EVENTS.IE_DisorderArrive)
--[[ PLAY MUSIC ]]
Playlist_Manager( PC_Music, {"music_msd1"}, true, false , {0, 0})
end
function Rule_Disorder_CreateBases()
--[[ SET UP CHAOS ]]
t_chaosbuild = {
"chaos_temple",
"chaos_sacrificial_circle",
"chaos_armoury",
"chaos_plasma_generator",
"chaos_machine_pit",
}
Player_SetAllResources(g_Player3, 100000, 100000)
Cpu_Enable(g_Player3, true)
Cpu_EnableComponent(g_Player3, false, CT_Attacking)
Cpu_SetDifficulty(g_Player3, AD_Advanced)
Player_SetMaxSquadCap( g_Player3, 100 )
Player_SetSquadCap( g_Player3, 100 )
for j = 1, 2 do
--[[ clear the landing zone ]]
for p = 0, (World_GetPlayerCount() -1 ) do
local player = World_GetPlayerAt( p )
Player_GetAllSquadsNearMarker(player, "_sg_killzone", "mkr_chaos_start"..j)
end
--yeah i know it's mean, better fix maybe later
SGroup_SelfDestroy("_sg_killzone", true)
--[[ create the HQ ]]
Entity_CreateBuildingMarker(g_Player3, "eg_chaos_hq"..j, "chaos_hq", "mkr_chaos_start"..j, .01)
Util_CreateSquadsAtMarkerEx(g_Player3, "sg_chaos_builder"..j, "chaos_squad_slave", "mkr_chaos_start"..j, 3, 1)
for i = 1, 5 do
local num = World_GetRand(2, 4)
for y = 1, num do
local newx = World_GetRand(-30, 30)
local newz = World_GetRand(-30, 30)
local pos = Marker_GetPosition(Marker_FromName("mkr_chaos_start"..j, "basic_marker"))
pos.x = pos.x + newx
pos.z = pos.z + newz
Entity_CreateBuildingPosition(g_Player3, "eg_chaos_base"..i, t_chaosbuild[i], pos, .01)
end
end
end
--[[ SET UP ORKS ]]
t_orkbuild = {
"ork_boy_hut",
"ork_generator",
"ork_mek_shop",
"ork_pile_o_guns",
"ork_waagh_banner",
}
Player_SetAllResources(g_Player4, 100000, 100000, 100)
Cpu_Enable(g_Player4, true)
Cpu_EnableComponent(g_Player4, false, CT_Attacking)
Cpu_SetDifficulty(g_Player4, AD_Advanced)
Player_SetMaxSquadCap( g_Player4, 100 )
Player_SetSquadCap( g_Player4, 100 )
for j = 1, 3 do
--[[ clear the landing zone ]]
for p = 0, (World_GetPlayerCount() -1 ) do
local player = World_GetPlayerAt( p )
Player_GetAllSquadsNearMarker(player, "_sg_killzone", "mkr_ork_start"..j)
end
--yeah i know it's mean, better fix maybe later
SGroup_SelfDestroy("_sg_killzone", true)
--[[ create the HQ ]]
Entity_CreateBuildingMarker(g_Player4, "eg_ork_hq"..j, "ork_hq", "mkr_ork_start"..j, .01)
Util_CreateSquadsAtMarkerEx(g_Player4, "sg_ork_builder"..j, "ork_squad_grot", "mkr_ork_start"..j, 3, 1)
for i = 1, 5 do
local num = World_GetRand(2, 4)
for y = 1, num do
local newx = World_GetRand(-30, 30)
local newz = World_GetRand(-30, 30)
local pos = Marker_GetPosition(Marker_FromName("mkr_ork_start"..j, "basic_marker"))
pos.x = pos.x + newx
pos.z = pos.z + newz
Entity_CreateBuildingPosition(g_Player4, "eg_ork_base"..i, t_orkbuild[i], pos, .01)
end
end
end
Rule_AddIntervalDelay(Rule_Disorder_Generate, 2, 45)
end
function MS05E_Generate_Chaos(playerID, sgroupname, marker, infantry, vehicle) if infantry == true then local blue = { "chaos_squad_raptor", "chaos_marine_squad", "chaos_squad_khorne_berserker", "chaos_squad_cultist", "chaos_squad_obliterator", "chaos_squad_possessed_marine", "chaos_squad_raptor" } local num = {8, 9, 6, 12, 4, 6, 8} local rand1 = World_GetRand(1, table.getn(blue)) Util_CreateSquadsAtMarkerEx(playerID, sgroupname, blue[rand1], marker, 1, num[rand1]) end if vehicle == true then local blue = { "chaos_squad_defiler", "chaos_squad_predator", "chaos_squad_defiler", "chaos_squad_predator", } local num = {1, 1, 2, 2} local rand1 = World_GetRand(1, table.getn(blue)) Util_CreateSquadsAtMarker(playerID, sgroupname, blue[rand1], marker, num[rand1]) end
return SGroup_FromName(sgroupname)
end
function MS05E_Generate_Orks(playerID, sgroupname, marker, infantry, vehicle) if infantry == true then local blue = { "ork_squad_shoota_boy", "ork_squad_slugga", "ork_squad_stormboy", "ork_squad_slugga", "ork_squad_armored_nob", "ork_squad_nob", "ork_squad_tankbusta" } local num = {8, 9, 6, 12, 3, 5, 8} local rand1 = World_GetRand(1, table.getn(blue)) Util_CreateSquadsAtMarkerEx(playerID, sgroupname, blue[rand1], marker, 1, num[rand1]) end if vehicle == true then local blue = { "ork_squad_killa_kan", "ork_squad_killa_kan", "ork_squad_looted_tank", "ork_squad_looted_tank", "ork_squad_squiggoth", "ork_squad_trukk", "ork_squad_wartrak", "ork_squad_wartrak", } local num = {1, 2, 2, 1, 1, 1, 1, 2} local rand1 = World_GetRand(1, table.getn(blue)) Util_CreateSquadsAtMarker(playerID, sgroupname, blue[rand1], marker, num[rand1]) end
return SGroup_FromName(sgroupname)
end
function Rule_Disorder_Generate()
--[[ the is to throw some randomness into how often the reinforcments spawn ]]
local randomturn = World_GetRand(1, 5)
if randomturn > 2 then
for i = 1, 2 do
if EGroup_Exists("eg_chaos_hq"..i) and EGroup_IsEmpty("eg_chaos_hq"..i) == false then
for y = 1, 2 do
local rand = World_GetRand(4, 7)
if SGroup_Exists("sg_disorder_chaos"..i..y) == false or SGroup_IsEmpty("sg_disorder_chaos"..i..y) then
local sgroupID = MS05E_Generate_Chaos(g_Player3, "sg_disorder_chaos"..i..y, "mkr_chaos_start"..i, true, true)
SGroup_AddGroup(SGroup_CreateIfNotFound("sg_disorder"), sgroupID)
Cpu_LockSGroupAcrossPlayers("sg_disorder_chaos"..i..y)
Cmd_SetStance("sg_disorder_chaos"..i..y, STANCE_Attack)
Cmd_AttackMoveMarker("sg_disorder_chaos"..i..y, "mkr_disorder_rally")
break
end
end
end
end
end
if randomturn < 4 then
for i = 1, 3 do
if EGroup_Exists("eg_ork_hq"..i) and EGroup_IsEmpty("eg_ork_hq"..i) == false then
for y = 1, 3 do
local rand = World_GetRand(4, 7)
if SGroup_Exists("sg_disorder_ork"..i..y) == false or SGroup_IsEmpty("sg_disorder_ork"..i..y) then
local sgroupID = MS05E_Generate_Orks(g_Player4, "sg_disorder_ork"..i..y, "mkr_ork_start"..i, true, true)
SGroup_AddGroup(SGroup_CreateIfNotFound("sg_disorder"), sgroupID)
Cpu_LockSGroupAcrossPlayers("sg_disorder_ork"..i..y)
Cmd_SetStance("sg_disorder_ork"..i..y, STANCE_Attack)
Cmd_AttackMoveMarker("sg_disorder_ork"..i..y, "mkr_disorder_rally")
break
end
end
end
end
end
end
--[[ GAME OVER - Player Wins ]]
function Rule_EndGameWin()
if g_playerHasWon then
Rule_RemoveAll()
Util_StartNIS(EVENTS.NIS_Closing)
end
end
--[[ GAME OVER - Player Loses ]]
--[[ The Player Loses condition will be mission specific this version of the function detects if the player has lost their base and has no servitors left ]]
function Rule_EndGameLose()
g_building_exceptions =
{
"eldar_webway_gate",
"space_marine_listening_post",
"space_marine_turret_bolter"
}
g_unit_exceptions =
{
"space_marine_squad_terminator",
"space_marine_squad_assault",
"space_marine_squad_tactical",
"space_marine_squad_rhino",
}
--[[ Lose because of Annihilation
if( Player_HasBuildingsExcept(g_Player1, g_building_exceptions) == false ) then
if( Player_HasSquadsExcept(g_Player1, g_unit_exceptions ) == false ) and SGroup_CountDeSpawned(g_sgroupID0) == 0 then
Rule_RemoveAll()
Fade_Start(4, false)
World_SetTeamWin( g_enemy, "" )
Rule_AddIntervalEx( Rule_GameOver,5,1 )
Rule_Remove( Rule_EndGameLose )
end
end
]] --[[ Lose because of the Objectives Failed ]] if g_playerHasWon == false then Rule_RemoveAll() Fade_Start(4, false) World_SetTeamWin( g_enemy, "" ) Rule_AddIntervalEx( Rule_GameOver,5,1 ) Rule_Remove( Rule_EndGameLose ) end
end
--[[ call this with an interval to ensure the mission ends ]] function Rule_GameOver() World_SetGameOver() end
--[[ OBJECTIVES ]]
--[[ PRIMARY MASTER - Banish the Necrons ]] function Rule_Objective_BanishNecrons()
Objective_BanishNecrons = { title_id = 851000, short_desc_id = 851001, help_tip_id = 000000 }
if Event_IsAnyRunning() == false and Objective_Exists(Objective_BanishNecrons.title_id) == false then
Util_WXP_ObjectiveCreate(Objective_BanishNecrons, true, g_Player1)
Rule_AddIntervalDelay(Rule_Objective_WebwaySurvive, 1, 3)
elseif Event_IsAnyRunning() == false and g_obj_banish == true then
for i = 1, 6 do
--is it owned?
if t_titantakeover.beaconID[i] ~= false then
Util_Ping_Stop(t_titantakeover.ping[i])
Util_RemoveBeaconMarker(t_titantakeover.beaconID[i])
t_titantakeover.beaconID[i] = false
end
end
Util_ObjectiveComplete(Objective_BanishNecrons.title_id)
g_obj_websurvive = true
--[[ IF THIS IS THE FINAL WIN CONDITION - uncomment out the following]]
g_playerHasWon = true
Rule_Remove(Rule_Objective_BanishNecrons)
elseif Event_IsAnyRunning() == false and g_obj_banish == false then
Util_ObjectiveFail(Objective_BanishNecrons.title_id)
--[[ IF THIS IS A FAILURE/LOSE CONDITION - uncomment out the following]]
g_playerHasWon = false
Rule_Remove(Rule_Objective_BanishNecrons)
end
end
--[[ BANISH SUB - Motivation to get Ass in Gear ]] function Rule_Objective_SummonAvatar()
Objective_SummonAvatar = { title_id = 851060, short_desc_id = 851061, help_tip_id = 000000 }
if Event_IsAnyRunning() == false and Objective_Exists(Objective_SummonAvatar.title_id) == false then
Util_WXP_ObjectiveSubCreate(Objective_SummonAvatar, Objective_BanishNecrons.title_id)
Rule_AddInterval(Rule_Eldar_HasAvatar, 2)
elseif Event_IsAnyRunning() == false and g_obj_summonavatar == true then
Util_ObjectiveComplete(Objective_SummonAvatar.title_id)
Rule_Remove(Rule_Objective_SummonAvatar)
elseif Event_IsAnyRunning() == false and g_obj_summonavatar == false then
Util_ObjectiveFail(Objective_SummonAvatar.title_id)
Rule_Remove(Rule_Objective_SummonAvatar)
end
end
function Rule_Eldar_HasAvatar()
local sgroupID = Player_GetSquads(g_Player1)
local blue = {{ name = "eldar_squad_avatar", count = 1 }}
if SGroup_ContainsBlueprints(sgroupID, blue, false) then
g_obj_summonavatar = true
Rule_Remove(Rule_Eldar_HasAvatar)
end
end
--[[ BANISH SUB - Webway Assembly must Survive ]] function Rule_Objective_WebwaySurvive()
Objective_WebwaySurvive = { title_id = 851040, short_desc_id = 851041, help_tip_id = 000000 }
if Event_IsAnyRunning() == false and Objective_Exists(Objective_WebwaySurvive.title_id) == false then
Util_WXP_ObjectiveCreate(Objective_WebwaySurvive, true, g_Player1)
Rule_AddIntervalDelay(Rule_Objective_SummonAvatar, 1, 3)
if EGroup_Exists("eg_eldar_hq") and EGroup_IsEmpty("eg_eldar_hq") == false then
local pos = EGroup_GetPosition(EGroup_FromName("eg_eldar_hq"))
g_objwebping = Objective_PingPosition(Objective_WebwaySurvive.title_id, pos, true, "default")
end
elseif Event_IsAnyRunning() == false and g_obj_websurvive == true then
Util_ObjectiveComplete(Objective_WebwaySurvive.title_id)
if g_objwebping ~= nil then
Objective_PingRemove(Objective_WebwaySurvive.title_id, g_objwebping)
end
--[[ IF THIS IS THE FINAL WIN CONDITION - uncomment out the following
g_playerHasWon = true
]]
Rule_Remove(Rule_Objective_WebwaySurvive)
elseif Event_IsAnyRunning() == false and g_obj_websurvive == false then
Util_ObjectiveFail(Objective_WebwaySurvive.title_id)
if g_objwebping ~= nil then
Objective_PingRemove(Objective_WebwaySurvive.title_id, g_objwebping)
end
--[[ IF THIS IS A FAILURE/LOSE CONDITION - uncomment out the following]]
g_playerHasWon = false
Rule_Remove(Rule_Objective_WebwaySurvive)
end
end
--[[ BANISH SUB - Kill the First Monolith ]] function Rule_Objective_KillFirstMonolith()
Objective_KillFirstMonolith = { title_id = 851010, short_desc_id = 851011, help_tip_id = 000000 }
if Event_IsAnyRunning() == false and Objective_Exists(Objective_KillFirstMonolith.title_id) == false then
Util_WXP_ObjectiveSubCreate(Objective_KillFirstMonolith, Objective_BanishNecrons.title_id)
elseif Event_IsAnyRunning() == false and g_obj_killfirst == true then
Util_ObjectiveComplete(Objective_KillFirstMonolith.title_id)
Rule_Remove(Rule_Objective_KillFirstMonolith)
elseif Event_IsAnyRunning() == false and g_obj_killfirst == false then
Util_ObjectiveFail(Objective_KillFirstMonolith.title_id)
Rule_Remove(Rule_Objective_KillFirstMonolith)
end
end
--[[ BANISH SUB - Entomb Titan Pieces ]] function Rule_Objective_EntombPieces()
Objective_EntombPieces = { title_id = 851020, short_desc_id = 851021, help_tip_id = 000000 }
if Event_IsAnyRunning() == false and Objective_Exists(Objective_EntombPieces.title_id) == false then
Util_WXP_ObjectiveSubCreate(Objective_EntombPieces, Objective_BanishNecrons.title_id)
t_objpiecesping = {}
for i = 1, 6 do
t_objpiecesping[i] = Objective_PingMarker(Objective_EntombPieces.title_id, "mkr_titan"..i, true, "default")
end
elseif Event_IsAnyRunning() == false and g_obj_entombpieces == true then
Util_ObjectiveComplete(Objective_EntombPieces.title_id)
Rule_Remove(Rule_Objective_EntombPieces)
elseif Event_IsAnyRunning() == false and g_obj_entombpieces == false then
Util_ObjectiveFail(Objective_EntombPieces.title_id)
Rule_Remove(Rule_Objective_EntombPieces)
end
end
--[[ SECONDARY - Command the Guard ]] function Rule_Objective_CommandGuard()
Objective_CommandGuard = { title_id = 851050, short_desc_id = 851051, help_tip_id = 000000 }
if Event_IsAnyRunning() == false and Objective_Exists(Objective_CommandGuard.title_id) == false then
Util_WXP_ObjectiveCreate(Objective_CommandGuard, false, g_Player1)
elseif Event_IsAnyRunning() == false and g_obj_commandguard == true then
Util_ObjectiveComplete(Objective_CommandGuard.title_id)
Rule_Remove(Rule_Objective_CommandGuard)
elseif Event_IsAnyRunning() == false and g_obj_commandguard == false then
Util_ObjectiveFail(Objective_CommandGuard.title_id)
Rule_Remove(Rule_Objective_CommandGuard)
end
end
--[[ AUTOSAVES ]]
function Rule_Autosave_MissionStart() if not Event_IsAnyRunning() then Util_Autosave( "$850200" ) Rule_Remove(Rule_Autosave_MissionStart) end end
function Rule_Autosave_NotOverYet() if not Event_IsAnyRunning() then Util_Autosave( "$850201" ) Rule_Remove(Rule_Autosave_NotOverYet) end end
function Rule_Autosave_FindGeneral() if not Event_IsAnyRunning() then Util_Autosave( "$850202" ) Rule_Remove(Rule_Autosave_FindGeneral) end end
function Rule_Autosave_MoreMonoliths() if not Event_IsAnyRunning() then Util_Autosave( "$850203" ) Rule_Remove(Rule_Autosave_MoreMonoliths) end end
function Rule_Autosave_DisorderArrive() if not Event_IsAnyRunning() then Util_Autosave( "$850204" ) Rule_Remove(Rule_Autosave_DisorderArrive) end end
function Rule_Autosave_OneLeft() if not Event_IsAnyRunning() then Util_Autosave( "$850205" ) Rule_Remove(Rule_Autosave_OneLeft) end end
--[[ INTEL EVENTS ]]
--[[ CHEATS ]]
--~ function CheatClosing()
--~ Rule_RemoveAll() --~ --~ g_lastmonolithpos = Marker_GetPosition(Marker_FromName("mkr_necron_start5", "basic_marker")) --~ --~ Player_GetAllSquadsNearPos(g_Player2, "sg_end", g_lastmonolithpos, 50) --~ Player_GetAllEntitiesNearPos(g_Player2, "eg_end", g_lastmonolithpos, 50) --~ Player_GetAllSquadsNearPos(g_Player3, "sg_end", g_lastmonolithpos, 50) --~ Player_GetAllEntitiesNearPos(g_Player3, "eg_end", g_lastmonolithpos, 50) --~ Player_GetAllSquadsNearPos(g_Player4, "sg_end", g_lastmonolithpos, 50) --~ Player_GetAllEntitiesNearPos(g_Player4, "eg_end", g_lastmonolithpos, 50)
--~ Util_StartNIS(EVENTS.NIS_Closing)
--~ end
--~ function CheatMonolith1()
--~ Util_StartNIS(EVENTS.NIS_MonoltihArrives)
--~ end
--~ function CheatMissionTwist()
--~ Rule_RemoveAll() --~ Util_StartNIS(EVENTS.NIS_Twist)
--~ end
--~ function CheatMidMissionName()
--~ Rule_RemoveAll() --~ Util_StartNIS(EVENTS.NIS_MidName)
--~ end