Help with Wave Mode [Solved]
Posted: Sun Oct 02, 2016 7:21 pm
by JimmyAngler
I'm trying to implement a wave mode for a mod, and I'm using the tutorial from Mav.
I (think) I have set up the sides correctly, but when I run the mode I do not have any command posts to spawn at, as if the world isn't loaded.
Plus, I am given the option of being one unit for a team or three units for the other team.
There is supposed to be four active cps, with one inactive one (cp5)
I'm terrible at scripting so if someone could point out my mistakes that would be great.
I (think) I have set up the sides correctly, but when I run the mode I do not have any command posts to spawn at, as if the world isn't loaded.
Plus, I am given the option of being one unit for a team or three units for the other team.
There is supposed to be four active cps, with one inactive one (cp5)
I'm terrible at scripting so if someone could point out my mistakes that would be great.
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
-- load the gametype script
ScriptCB_DoFile("ObjectiveTDM")
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ambush")
-- Empire Attacking (attacker is always #1)
ALL = 1
IMP = 2
-- These variables do not change
ATT = 1
DEF = 2
function ScriptPostLoad()
AllowAISpawn(ALL, false)
--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
cp5 = CommandPost:New{name = "cp5"}
ScriptCB_SetGameRules("campaign")
EnableSPHeroRules()
--Kill the capture regions
SetProperty("CP1", "captureregion", " ")
SetProperty("CP2", "captureregion", " ")
SetProperty("CP3", "captureregion", " ")
SetProperty("CP4", "captureregion", " ")
KillObject("CP1")
KillObject("CP2")
KillObject("CP3")
KillObject("CP4")
EnableSPHeroRules()
-- This is the actual objective setup
TDM = ObjectiveTDM:New{teamATT = 1, teamDEF = 2,
multiplayerScoreLimit = 100,
textATT = "game.modes.wave",
textDEF = "game.modes.tdm2", multiplayerRules = true, isCelebrityDeathmatch = true}
TDM:Start()
AddAIGoal(1, "Deathmatch", 100)
AddAIGoal(2, "Deathmatch", 100)
--WAVES
totalkills = 0
yesred = 0
yesblue = 0
athlontally = 0
engred = 0
spawnonce = 0
SetReinforcementCount(DEF, totalkills)
tally = OnObjectKill(
function(object, killer)
if GetEntityClass(object) == FindEntityClass("cov_inf_elite_minor_engineer_red") and engred < 14 then
engred = engred + 1
SetReinforcementCount(DEF, engred)
end
if GetEntityClass(object) == FindEntityClass("athlon_inf_unique_rifleman") then
print("shadowdeath")
athlontally = athlontally + 1
end
if GetEntityClass(object) == FindEntityClass("cov_inf_elite_minor_zealot_red") then
print("vaderdeath")
yesred = 1
end
if GetEntityClass(object) == FindEntityClass("cov_inf_elite_minor_zealot_blue") then
print("empdeath")
yesblue = 1
end
end
)
dying = OnCharacterDeath(
function(character)
if IsCharacterHuman(character) then
MapRemoveClassMarker("athlon_inf_unique_rifleman")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_red")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_blue")
MissionDefeat(ATT)
end
end
)
wavetimer = CreateTimer("waves")
SetTimerValue(wavetimer, 30)
wavetimer0 = CreateTimer("waves0")
SetTimerValue(wavetimer0, 45)
wavetimer1 = CreateTimer("waves1")
SetTimerValue(wavetimer1, 80)
wavetimer2 = CreateTimer("waves2")
SetTimerValue(wavetimer2, 70)
wavetimer3 = CreateTimer("waves3")
SetTimerValue(wavetimer3, 70)
wavetimer4 = CreateTimer("waves4")
SetTimerValue(wavetimer4, 100)
wavetimer5 = CreateTimer("waves5")
SetTimerValue(wavetimer5, 120)
firstspawn = OnCharacterSpawn(
function(player)
if GetCharacterTeam(player) == 1 and spawnonce == 0 then
ShowObjectiveTextPopup("level.dea1.wavemode", ATT)
StartTimer(wavetimer)
ShowTimer(nil)
ShowTimer(wavetimer)
ShowMessageText("level.dea1.wave")
Ambush("CP1Spawn", 1, 2)
Ambush("CP2Spawn", 1, 2)
Ambush("CP3Spawn", 1, 2)
Ambush("CP4Spawn", 1, 2)
SetReinforcementCount(ATT, 1)
spawnonce = 1
end
end
)
wtime0 = OnTimerElapse(
function(timer)
StartTimer(wavetimer0)
ShowTimer(nil)
ShowTimer(wavetimer0)
ShowMessageText("level.dea1.wave")
Ambush("CP1Spawn", 2, 2)
Ambush("CP2Spawn", 2, 2)
Ambush("CP3Spawn", 2, 2)
Ambush("CP4Spawn", 2, 2)
SetReinforcementCount(ATT, 2)
DestroyTimer(timer)
end,
wavetimer
)
wtime1 = OnTimerElapse(
function(timer)
StartTimer(wavetimer1)
ShowTimer(nil)
ShowTimer(wavetimer1)
ShowMessageText("level.dea1.wave")
Ambush("CP1Spawn", 2, 2)
Ambush("CP2Spawn", 2, 2)
Ambush("CP3Spawn", 2, 2)
Ambush("CP4Spawn", 2, 2)
Ambush("CP1Spawn", 1, 3)
Ambush("CP2Spawn", 1, 3)
Ambush("CP3Spawn", 1, 3)
Ambush("CP4Spawn", 1, 3)
SetReinforcementCount(ATT, 3)
DestroyTimer(timer)
end,
wavetimer0
)
wtime2 = OnTimerElapse(
function(timer)
StartTimer(wavetimer2)
ShowTimer(nil)
ShowTimer(wavetimer2)
ShowMessageText("level.dea1.wave")
Ambush("CP1Spawn", 3, 2)
Ambush("CP2Spawn", 2, 2)
Ambush("CP3Spawn", 3, 2)
Ambush("CP4Spawn", 2, 2)
Ambush("CP1Spawn", 2, 3)
Ambush("CP2Spawn", 2, 3)
Ambush("CP3Spawn", 2, 3)
Ambush("CP4Spawn", 2, 3)
Ambush("CP1Spawn", 1, 4)
Ambush("CP2Spawn", 1, 4)
Ambush("CP3Spawn", 1, 4)
Ambush("CP4Spawn", 1, 4)
SetReinforcementCount(ATT, 4)
DestroyTimer(timer)
end,
wavetimer1
)
wtime3 = OnTimerElapse(
function(timer)
StartTimer(wavetimer3)
ShowTimer(nil)
ShowTimer(wavetimer3)
ShowMessageText("level.dea1.wave")
ShowObjectiveTextPopup("level.dea1.shadowwave", ATT)
Ambush("CP1Spawn", 2, 2)
Ambush("CP2Spawn", 2, 2)
Ambush("CP3Spawn", 2, 2)
Ambush("CP4Spawn", 2, 2)
Ambush("CP1Spawn", 2, 3)
Ambush("CP2Spawn", 2, 3)
Ambush("CP3Spawn", 2, 3)
Ambush("CP4Spawn", 2, 3)
Ambush("CP1Spawn", 3, 4)
Ambush("CP2Spawn", 2, 4)
Ambush("CP3Spawn", 3, 4)
Ambush("CP4Spawn", 2, 4)
SetReinforcementCount(ATT, 5)
Ambush("CP1Spawn", 1, 5)
Ambush("CP2Spawn", 1, 5)
Ambush("CP3Spawn", 1, 5)
Ambush("CP4Spawn", 1, 5)
MapAddClassMarker("athlon_inf_unique_rifleman", "hud_objective_icon_circle", 3.5, ATT, "GREEN", true)
DestroyTimer(timer)
end,
wavetimer2
)
wtime4 = OnTimerElapse(
function(timer)
StartTimer(wavetimer4)
ShowTimer(nil)
ShowTimer(wavetimer4)
ShowMessageText("level.dea1.wave")
ShowObjectiveTextPopup("level.dea1.vaderwave", ATT)
Ambush("CP1Spawn", 3, 2)
Ambush("CP2Spawn", 2, 2)
Ambush("CP3Spawn", 3, 2)
Ambush("CP4Spawn", 2, 2)
Ambush("CP1Spawn", 3, 3)
Ambush("CP2Spawn", 2, 3)
Ambush("CP3Spawn", 3, 3)
Ambush("CP4Spawn", 3, 3)
Ambush("CP1Spawn", 3, 4)
Ambush("CP2Spawn", 3, 4)
Ambush("CP3Spawn", 3, 4)
Ambush("CP4Spawn", 3, 4)
SetReinforcementCount(ATT, 6)
vad = math.random(4)
if vad == 1 then
Ambush("CP1Spawn", 1, 6)
elseif vad == 2 then
Ambush("CP2Spawn", 1, 6)
elseif vad == 3 then
Ambush("CP3Spawn", 1, 6)
elseif vad == 4 then
Ambush("CP4Spawn", 1, 6)
end
MapAddClassMarker("cov_inf_elite_minor_zealot_red", "hud_objective_icon_circle", 3.5, ATT, "YELLOW", true)
DestroyTimer(timer)
end,
wavetimer3
)
wtime5 = OnTimerElapse(
function(timer)
if yesred == 1 and athlontally > 2 and engred <= 13 then
MapRemoveClassMarker("athlon_inf_unique_rifleman")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_red")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_blue")
MissionVictory(ATT)
elseif yesred == 1 and athlontally > 2 and athlontally < 5 then
MapRemoveClassMarker("athlon_inf_unique_rifleman")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_red")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_blue")
MissionVictory(ATT)
elseif yesred == 1 and athlontally > 4 and engred > 13 then
StartTimer(wavetimer5)
ShowTimer(nil)
ShowTimer(wavetimer5)
ShowMessageText("level.dea1.wave")
ShowObjectiveTextPopup("level.dea1.empwave", ATT)
Ambush("CP1Spawn", 4, 2)
Ambush("CP2Spawn", 4, 2)
Ambush("CP3Spawn", 4, 2)
Ambush("CP4Spawn", 4, 2)
Ambush("CP1Spawn", 4, 3)
Ambush("CP2Spawn", 4, 3)
Ambush("CP3Spawn", 4, 3)
Ambush("CP4Spawn", 4, 3)
Ambush("CP1Spawn", 4, 4)
Ambush("CP2Spawn", 4, 4)
Ambush("CP3Spawn", 4, 4)
Ambush("CP4Spawn", 4, 4)
SetReinforcementCount(ATT, 7)
Ambush("CP4Spawn", 1, 7)
MapAddClassMarker("cov_inf_elite_minor_zealot_blue", "hud_objective_icon_circle", 3.5, ATT, "RED", true)
DestroyTimer(timer)
elseif yesred == 0 or athlontally <= 2 then
MapRemoveClassMarker("athlon_inf_unique_rifleman")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_red")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_blue")
MissionDefeat(ATT)
end
end,
wavetimer4
)
wtime6 = OnTimerElapse(
function(timer)
if yesblue == 1 then
MapRemoveClassMarker("athlon_inf_unique_rifleman")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_red")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_blue")
MissionVictory(ATT)
elseif yesblue == 0 then
MapRemoveClassMarker("athlon_inf_unique_rifleman")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_red")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_blue")
MissionDefeat(ATT)
end
end,
wavetimer5
)
end
-- CLOSE
function ScriptInit()
-- Designers, these two lines *MUST* be first.
SetPS2ModelMemory(4000000)
ReadDataFile("dc:Load\\load.lvl")
ReadDataFile("dc:SIDE\\spartans.lvl")
ReadDataFile("dc:SIDE\\unscweapons.lvl")
ReadDataFile("dc:SIDE\\covenantweapons.lvl")
ReadDataFile("dc:SIDE\\fpanimset.lvl")
ReadDataFile("dc:SIDE\\HUD.lvl")
ReadDataFile("dc:ingame.lvl")
ReadDataFile("ingame.lvl")
SetMemoryPoolSize ("ClothData",40)
SetMemoryPoolSize ("Combo",170) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",1850) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",1850) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",1850) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",1750) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",14000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",1140) -- should be ~1x #combo -- should be ~1x #combo
SetMaxFlyHeight(72)
SetMaxPlayerFlyHeight (72)
AISnipeSuitabilityDist(30)
ReadDataFile("dc:sound\\hlo.lvl")
ReadDataFile("sound\\yav.lvl;yav1gcw")
ReadDataFile("dc:SIDE\\ARB.lvl",
"ARB_hero_arbiter")
ReadDataFile("dc:SIDE\\covenant.lvl",
"cov_inf_elite_minor_zealot_red",
"cov_inf_elite_minor_zealot_blue",
"cov_inf_elite_minor_blue",
"cov_inf_elite_minor_red",
"cov_inf_elite_minor_ultra_red",
"cov_inf_elite_minor_ultra_blue",
"cov_inf_elite_minor_specops_red",
"cov_inf_elite_minor_specops_blue",
"cov_inf_elite_minor_engineer_blue",
"cov_inf_elite_minor_engineer_red",
"cov_inf_elite_minor_sharpshooter_red",
"cov_inf_elite_minor_sharpshooter_blue")
--loaded for hud icons only
ReadDataFile("dc:SIDE\\spartans.lvl",
"athlon_inf_unique_rifleman")
--end loading hud
SetupTeams{
all={
team = ALL,
units = 1,
reinforcements = -1,
soldier = {"ARB_hero_arbiter",0, 1}
},
imp={
team = IMP,
units = 200,
reinforcements = -1,
soldier = {"cov_inf_elite_minor_blue", 2, 60},
assault = {"cov_inf_elite_minor_sharpshooter_blue", 2, 60},
engineer = {"cov_inf_elite_minor_ultra_blue", 2, 60},
}
}
SetTeamName(3, "imp")
AddUnitClass(3, "cov_inf_elite_minor_engineer_blue",2,60)
AddUnitClass(3, "cov_inf_elite_minor_specops_blue",2,60)
AddUnitClass(3, "cov_inf_elite_minor_sharpshooter_red",2,60)
AddUnitClass(3, "cov_inf_elite_minor_ultra_red",2,60)
SetUnitCount (3, 100)
--first number is numteam, second is numunits
AddAIGoal(3, "Deathmatch", 100)
SetTeamName(4, "imp")
AddUnitClass(4, "cov_inf_elite_minor_engineer_red",2,60)
AddUnitClass(4, "cov_inf_elite_minor_red",2,60)
AddUnitClass(4, "cov_inf_elite_minor_specops_red",2,60)
SetUnitCount (4, 100)
--first number is numteam, second is numunits
AddAIGoal(4, "Deathmatch", 100)
SetTeamName(5, "imp")
AddUnitClass (5, "athlon_inf_unique_rifleman", 1, 6)
SetUnitCount (5, 50)
--first number is numteam, second is numunits
AddAIGoal(5, "Deathmatch", 100)
SetTeamName(6, "imp")
AddUnitClass (6, "cov_inf_elite_minor_zealot_red", 1, 1)
SetUnitCount (6, 50)
--first number is numteam, second is numunits
AddAIGoal(6, "Deathmatch", 100)
SetTeamName(7, "imp")
AddUnitClass (7, "cov_inf_elite_minor_zealot_blue", 1, 1)
SetUnitCount (7, 50)
--first number is numteam, second is numunits
AddAIGoal(7, "Deathmatch", 100)
SetTeamAsEnemy(ATT,3)
SetTeamAsEnemy(3,ATT)
SetTeamAsFriend(DEF,3)
SetTeamAsFriend(3,DEF)
SetTeamAsEnemy(ATT,4)
SetTeamAsEnemy(4,ATT)
SetTeamAsFriend(DEF,4)
SetTeamAsFriend(4,DEF)
SetTeamAsFriend(3,4)
SetTeamAsFriend(4,3)
SetTeamAsEnemy(ATT,5)
SetTeamAsEnemy(5,ATT)
SetTeamAsFriend(DEF,5)
SetTeamAsFriend(5,DEF)
SetTeamAsFriend(4,5)
SetTeamAsFriend(5,4)
SetTeamAsFriend(3,5)
SetTeamAsFriend(5,3)
SetTeamAsEnemy(ATT,6)
SetTeamAsEnemy(6,ATT)
SetTeamAsFriend(DEF,6)
SetTeamAsFriend(6,DEF)
SetTeamAsFriend(5,6)
SetTeamAsFriend(6,5)
SetTeamAsFriend(4,6)
SetTeamAsFriend(6,4)
SetTeamAsFriend(3,6)
SetTeamAsFriend(6,3)
SetTeamAsEnemy(ATT,7)
SetTeamAsEnemy(7,ATT)
SetTeamAsFriend(DEF,7)
SetTeamAsFriend(7,DEF)
SetTeamAsFriend(6,7)
SetTeamAsFriend(7,6)
SetTeamAsFriend(5,7)
SetTeamAsFriend(7,5)
SetTeamAsFriend(4,7)
SetTeamAsFriend(7,4)
SetTeamAsFriend(3,7)
SetTeamAsFriend(7,3)
-- Level Stats
ClearWalkers()
-- AddWalkerType(0, 0) -- 8 droidekas (special case: 0 leg pairs)
-- AddWalkerType(1, 0) -- 8 droidekas (special case: 0 leg pairs)
-- AddWalkerType(2, 0) -- 2 spider walkers with 2 leg pairs each
-- AddWalkerType(3, 0) -- 2 attes with 3 leg pairs each
local weaponCnt = 2000
SetMemoryPoolSize ("Aimer", 50)
SetMemoryPoolSize ("AmmoCounter", weaponCnt)
SetMemoryPoolSize ("BaseHint", 300)
SetMemoryPoolSize ("EnergyBar", weaponCnt)
SetMemoryPoolSize ("EntityCloth", 100)
SetMemoryPoolSize ("EntityLight", 100)
SetMemoryPoolSize ("EntitySoundStatic", 30)
SetMemoryPoolSize ("SoundSpaceRegion", 50)
SetMemoryPoolSize ("MountedTurret", 0)
SetMemoryPoolSize ("Navigator", 300)
SetMemoryPoolSize ("Obstacle", 260)
SetMemoryPoolSize ("PathFollower", 300)
SetMemoryPoolSize ("PathNode", 512)
SetMemoryPoolSize ("RedOmniLight", 130)
SetMemoryPoolSize ("ShieldEffect", 0)
SetMemoryPoolSize ("TreeGridStack", 200)
SetMemoryPoolSize ("UnitAgent", 300)
SetMemoryPoolSize ("UnitController", 300)
SetMemoryPoolSize ("Weapon", weaponCnt)
SetMemoryPoolSize ("EntityFlyer", 6)
SetMemoryPoolSize("SoldierAnimation", 1800)
SetSpawnDelay(10.0, 0.25)
ReadDataFile("HLO\\SSH.lvl", "SSH_wav")
SetDenseEnvironment("true")
-- Sound
voiceSlow = OpenAudioStream("sound\\global.lvl", "all_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)
voiceQuick = OpenAudioStream("sound\\global.lvl", "all_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_quick", voiceQuick)
OpenAudioStream("dc:sound\\hlo.lvl", "hlo_music")
OpenAudioStream("sound\\dea.lvl", "dea1")
--SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
--SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing", 1)
--SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing", 1)
--SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)
--SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
--SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1)
--SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
--SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1)
SetOutOfBoundsVoiceOver(1, "allleaving")
SetOutOfBoundsVoiceOver(2, "impleaving")
SetAmbientMusic(ALL, 1.0, "hlo_halo_amb_sanghelios", 0,1)
--SetAmbientMusic(ALL, 0.8, "hlo_halo_amb_sanghelios", 1,1)
--SetAmbientMusic(ALL, 0.2, "hlo_halo_amb_sanghelios", 2,1)
SetAmbientMusic(IMP, 1.0, "hlo_halo_amb_sanghelios", 0,1)
--SetAmbientMusic(IMP, 0.8, "hlo_halo_amb_sanghelios", 1,1)
--SetAmbientMusic(IMP, 0.2, "hlo_halo_amb_sanghelios", 2,1)
SetVictoryMusic(ALL, "hlo_halo_amb_victory")
SetDefeatMusic (ALL, "hlo_halo_amb_defeat")
SetVictoryMusic(IMP, "hlo_halo_amb_victory")
SetDefeatMusic (IMP, "hlo_halo_amb_defeat")
SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
-- SetSoundEffect("BirdScatter", "birdsFlySeq1")
SetSoundEffect("SpawnDisplayUnitChange", "shell_select_unit")
SetSoundEffect("SpawnDisplayUnitAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change")
SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplayBack", "shell_menu_exit")
SetAttackingTeam(ATT)
AddCameraShot(-0.404895, 0.000992, -0.514360, -0.002240, -121.539894, 62.536297, -257.699493)
--Homestead
AddCameraShot(0.040922, -0.004049, -0.994299, -0.098381, -103.729523, 55.546598, -225.360893)
--Sarlac Pit
AddCameraShot(-1.0, 0.0, -0.514360, 0.0, -55.381485, 50.450953, -96.514324)
end
[/code]
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--
-- load the gametype script
ScriptCB_DoFile("ObjectiveTDM")
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ambush")
-- Empire Attacking (attacker is always #1)
ALL = 1
IMP = 2
-- These variables do not change
ATT = 1
DEF = 2
function ScriptPostLoad()
AllowAISpawn(ALL, false)
--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
cp5 = CommandPost:New{name = "cp5"}
ScriptCB_SetGameRules("campaign")
EnableSPHeroRules()
--Kill the capture regions
SetProperty("CP1", "captureregion", " ")
SetProperty("CP2", "captureregion", " ")
SetProperty("CP3", "captureregion", " ")
SetProperty("CP4", "captureregion", " ")
KillObject("CP1")
KillObject("CP2")
KillObject("CP3")
KillObject("CP4")
EnableSPHeroRules()
-- This is the actual objective setup
TDM = ObjectiveTDM:New{teamATT = 1, teamDEF = 2,
multiplayerScoreLimit = 100,
textATT = "game.modes.wave",
textDEF = "game.modes.tdm2", multiplayerRules = true, isCelebrityDeathmatch = true}
TDM:Start()
AddAIGoal(1, "Deathmatch", 100)
AddAIGoal(2, "Deathmatch", 100)
--WAVES
totalkills = 0
yesred = 0
yesblue = 0
athlontally = 0
engred = 0
spawnonce = 0
SetReinforcementCount(DEF, totalkills)
tally = OnObjectKill(
function(object, killer)
if GetEntityClass(object) == FindEntityClass("cov_inf_elite_minor_engineer_red") and engred < 14 then
engred = engred + 1
SetReinforcementCount(DEF, engred)
end
if GetEntityClass(object) == FindEntityClass("athlon_inf_unique_rifleman") then
print("shadowdeath")
athlontally = athlontally + 1
end
if GetEntityClass(object) == FindEntityClass("cov_inf_elite_minor_zealot_red") then
print("vaderdeath")
yesred = 1
end
if GetEntityClass(object) == FindEntityClass("cov_inf_elite_minor_zealot_blue") then
print("empdeath")
yesblue = 1
end
end
)
dying = OnCharacterDeath(
function(character)
if IsCharacterHuman(character) then
MapRemoveClassMarker("athlon_inf_unique_rifleman")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_red")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_blue")
MissionDefeat(ATT)
end
end
)
wavetimer = CreateTimer("waves")
SetTimerValue(wavetimer, 30)
wavetimer0 = CreateTimer("waves0")
SetTimerValue(wavetimer0, 45)
wavetimer1 = CreateTimer("waves1")
SetTimerValue(wavetimer1, 80)
wavetimer2 = CreateTimer("waves2")
SetTimerValue(wavetimer2, 70)
wavetimer3 = CreateTimer("waves3")
SetTimerValue(wavetimer3, 70)
wavetimer4 = CreateTimer("waves4")
SetTimerValue(wavetimer4, 100)
wavetimer5 = CreateTimer("waves5")
SetTimerValue(wavetimer5, 120)
firstspawn = OnCharacterSpawn(
function(player)
if GetCharacterTeam(player) == 1 and spawnonce == 0 then
ShowObjectiveTextPopup("level.dea1.wavemode", ATT)
StartTimer(wavetimer)
ShowTimer(nil)
ShowTimer(wavetimer)
ShowMessageText("level.dea1.wave")
Ambush("CP1Spawn", 1, 2)
Ambush("CP2Spawn", 1, 2)
Ambush("CP3Spawn", 1, 2)
Ambush("CP4Spawn", 1, 2)
SetReinforcementCount(ATT, 1)
spawnonce = 1
end
end
)
wtime0 = OnTimerElapse(
function(timer)
StartTimer(wavetimer0)
ShowTimer(nil)
ShowTimer(wavetimer0)
ShowMessageText("level.dea1.wave")
Ambush("CP1Spawn", 2, 2)
Ambush("CP2Spawn", 2, 2)
Ambush("CP3Spawn", 2, 2)
Ambush("CP4Spawn", 2, 2)
SetReinforcementCount(ATT, 2)
DestroyTimer(timer)
end,
wavetimer
)
wtime1 = OnTimerElapse(
function(timer)
StartTimer(wavetimer1)
ShowTimer(nil)
ShowTimer(wavetimer1)
ShowMessageText("level.dea1.wave")
Ambush("CP1Spawn", 2, 2)
Ambush("CP2Spawn", 2, 2)
Ambush("CP3Spawn", 2, 2)
Ambush("CP4Spawn", 2, 2)
Ambush("CP1Spawn", 1, 3)
Ambush("CP2Spawn", 1, 3)
Ambush("CP3Spawn", 1, 3)
Ambush("CP4Spawn", 1, 3)
SetReinforcementCount(ATT, 3)
DestroyTimer(timer)
end,
wavetimer0
)
wtime2 = OnTimerElapse(
function(timer)
StartTimer(wavetimer2)
ShowTimer(nil)
ShowTimer(wavetimer2)
ShowMessageText("level.dea1.wave")
Ambush("CP1Spawn", 3, 2)
Ambush("CP2Spawn", 2, 2)
Ambush("CP3Spawn", 3, 2)
Ambush("CP4Spawn", 2, 2)
Ambush("CP1Spawn", 2, 3)
Ambush("CP2Spawn", 2, 3)
Ambush("CP3Spawn", 2, 3)
Ambush("CP4Spawn", 2, 3)
Ambush("CP1Spawn", 1, 4)
Ambush("CP2Spawn", 1, 4)
Ambush("CP3Spawn", 1, 4)
Ambush("CP4Spawn", 1, 4)
SetReinforcementCount(ATT, 4)
DestroyTimer(timer)
end,
wavetimer1
)
wtime3 = OnTimerElapse(
function(timer)
StartTimer(wavetimer3)
ShowTimer(nil)
ShowTimer(wavetimer3)
ShowMessageText("level.dea1.wave")
ShowObjectiveTextPopup("level.dea1.shadowwave", ATT)
Ambush("CP1Spawn", 2, 2)
Ambush("CP2Spawn", 2, 2)
Ambush("CP3Spawn", 2, 2)
Ambush("CP4Spawn", 2, 2)
Ambush("CP1Spawn", 2, 3)
Ambush("CP2Spawn", 2, 3)
Ambush("CP3Spawn", 2, 3)
Ambush("CP4Spawn", 2, 3)
Ambush("CP1Spawn", 3, 4)
Ambush("CP2Spawn", 2, 4)
Ambush("CP3Spawn", 3, 4)
Ambush("CP4Spawn", 2, 4)
SetReinforcementCount(ATT, 5)
Ambush("CP1Spawn", 1, 5)
Ambush("CP2Spawn", 1, 5)
Ambush("CP3Spawn", 1, 5)
Ambush("CP4Spawn", 1, 5)
MapAddClassMarker("athlon_inf_unique_rifleman", "hud_objective_icon_circle", 3.5, ATT, "GREEN", true)
DestroyTimer(timer)
end,
wavetimer2
)
wtime4 = OnTimerElapse(
function(timer)
StartTimer(wavetimer4)
ShowTimer(nil)
ShowTimer(wavetimer4)
ShowMessageText("level.dea1.wave")
ShowObjectiveTextPopup("level.dea1.vaderwave", ATT)
Ambush("CP1Spawn", 3, 2)
Ambush("CP2Spawn", 2, 2)
Ambush("CP3Spawn", 3, 2)
Ambush("CP4Spawn", 2, 2)
Ambush("CP1Spawn", 3, 3)
Ambush("CP2Spawn", 2, 3)
Ambush("CP3Spawn", 3, 3)
Ambush("CP4Spawn", 3, 3)
Ambush("CP1Spawn", 3, 4)
Ambush("CP2Spawn", 3, 4)
Ambush("CP3Spawn", 3, 4)
Ambush("CP4Spawn", 3, 4)
SetReinforcementCount(ATT, 6)
vad = math.random(4)
if vad == 1 then
Ambush("CP1Spawn", 1, 6)
elseif vad == 2 then
Ambush("CP2Spawn", 1, 6)
elseif vad == 3 then
Ambush("CP3Spawn", 1, 6)
elseif vad == 4 then
Ambush("CP4Spawn", 1, 6)
end
MapAddClassMarker("cov_inf_elite_minor_zealot_red", "hud_objective_icon_circle", 3.5, ATT, "YELLOW", true)
DestroyTimer(timer)
end,
wavetimer3
)
wtime5 = OnTimerElapse(
function(timer)
if yesred == 1 and athlontally > 2 and engred <= 13 then
MapRemoveClassMarker("athlon_inf_unique_rifleman")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_red")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_blue")
MissionVictory(ATT)
elseif yesred == 1 and athlontally > 2 and athlontally < 5 then
MapRemoveClassMarker("athlon_inf_unique_rifleman")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_red")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_blue")
MissionVictory(ATT)
elseif yesred == 1 and athlontally > 4 and engred > 13 then
StartTimer(wavetimer5)
ShowTimer(nil)
ShowTimer(wavetimer5)
ShowMessageText("level.dea1.wave")
ShowObjectiveTextPopup("level.dea1.empwave", ATT)
Ambush("CP1Spawn", 4, 2)
Ambush("CP2Spawn", 4, 2)
Ambush("CP3Spawn", 4, 2)
Ambush("CP4Spawn", 4, 2)
Ambush("CP1Spawn", 4, 3)
Ambush("CP2Spawn", 4, 3)
Ambush("CP3Spawn", 4, 3)
Ambush("CP4Spawn", 4, 3)
Ambush("CP1Spawn", 4, 4)
Ambush("CP2Spawn", 4, 4)
Ambush("CP3Spawn", 4, 4)
Ambush("CP4Spawn", 4, 4)
SetReinforcementCount(ATT, 7)
Ambush("CP4Spawn", 1, 7)
MapAddClassMarker("cov_inf_elite_minor_zealot_blue", "hud_objective_icon_circle", 3.5, ATT, "RED", true)
DestroyTimer(timer)
elseif yesred == 0 or athlontally <= 2 then
MapRemoveClassMarker("athlon_inf_unique_rifleman")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_red")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_blue")
MissionDefeat(ATT)
end
end,
wavetimer4
)
wtime6 = OnTimerElapse(
function(timer)
if yesblue == 1 then
MapRemoveClassMarker("athlon_inf_unique_rifleman")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_red")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_blue")
MissionVictory(ATT)
elseif yesblue == 0 then
MapRemoveClassMarker("athlon_inf_unique_rifleman")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_red")
MapRemoveClassMarker("cov_inf_elite_minor_zealot_blue")
MissionDefeat(ATT)
end
end,
wavetimer5
)
end
-- CLOSE
function ScriptInit()
-- Designers, these two lines *MUST* be first.
SetPS2ModelMemory(4000000)
ReadDataFile("dc:Load\\load.lvl")
ReadDataFile("dc:SIDE\\spartans.lvl")
ReadDataFile("dc:SIDE\\unscweapons.lvl")
ReadDataFile("dc:SIDE\\covenantweapons.lvl")
ReadDataFile("dc:SIDE\\fpanimset.lvl")
ReadDataFile("dc:SIDE\\HUD.lvl")
ReadDataFile("dc:ingame.lvl")
ReadDataFile("ingame.lvl")
SetMemoryPoolSize ("ClothData",40)
SetMemoryPoolSize ("Combo",170) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",1850) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",1850) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",1850) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",1750) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",14000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",1140) -- should be ~1x #combo -- should be ~1x #combo
SetMaxFlyHeight(72)
SetMaxPlayerFlyHeight (72)
AISnipeSuitabilityDist(30)
ReadDataFile("dc:sound\\hlo.lvl")
ReadDataFile("sound\\yav.lvl;yav1gcw")
ReadDataFile("dc:SIDE\\ARB.lvl",
"ARB_hero_arbiter")
ReadDataFile("dc:SIDE\\covenant.lvl",
"cov_inf_elite_minor_zealot_red",
"cov_inf_elite_minor_zealot_blue",
"cov_inf_elite_minor_blue",
"cov_inf_elite_minor_red",
"cov_inf_elite_minor_ultra_red",
"cov_inf_elite_minor_ultra_blue",
"cov_inf_elite_minor_specops_red",
"cov_inf_elite_minor_specops_blue",
"cov_inf_elite_minor_engineer_blue",
"cov_inf_elite_minor_engineer_red",
"cov_inf_elite_minor_sharpshooter_red",
"cov_inf_elite_minor_sharpshooter_blue")
--loaded for hud icons only
ReadDataFile("dc:SIDE\\spartans.lvl",
"athlon_inf_unique_rifleman")
--end loading hud
SetupTeams{
all={
team = ALL,
units = 1,
reinforcements = -1,
soldier = {"ARB_hero_arbiter",0, 1}
},
imp={
team = IMP,
units = 200,
reinforcements = -1,
soldier = {"cov_inf_elite_minor_blue", 2, 60},
assault = {"cov_inf_elite_minor_sharpshooter_blue", 2, 60},
engineer = {"cov_inf_elite_minor_ultra_blue", 2, 60},
}
}
SetTeamName(3, "imp")
AddUnitClass(3, "cov_inf_elite_minor_engineer_blue",2,60)
AddUnitClass(3, "cov_inf_elite_minor_specops_blue",2,60)
AddUnitClass(3, "cov_inf_elite_minor_sharpshooter_red",2,60)
AddUnitClass(3, "cov_inf_elite_minor_ultra_red",2,60)
SetUnitCount (3, 100)
--first number is numteam, second is numunits
AddAIGoal(3, "Deathmatch", 100)
SetTeamName(4, "imp")
AddUnitClass(4, "cov_inf_elite_minor_engineer_red",2,60)
AddUnitClass(4, "cov_inf_elite_minor_red",2,60)
AddUnitClass(4, "cov_inf_elite_minor_specops_red",2,60)
SetUnitCount (4, 100)
--first number is numteam, second is numunits
AddAIGoal(4, "Deathmatch", 100)
SetTeamName(5, "imp")
AddUnitClass (5, "athlon_inf_unique_rifleman", 1, 6)
SetUnitCount (5, 50)
--first number is numteam, second is numunits
AddAIGoal(5, "Deathmatch", 100)
SetTeamName(6, "imp")
AddUnitClass (6, "cov_inf_elite_minor_zealot_red", 1, 1)
SetUnitCount (6, 50)
--first number is numteam, second is numunits
AddAIGoal(6, "Deathmatch", 100)
SetTeamName(7, "imp")
AddUnitClass (7, "cov_inf_elite_minor_zealot_blue", 1, 1)
SetUnitCount (7, 50)
--first number is numteam, second is numunits
AddAIGoal(7, "Deathmatch", 100)
SetTeamAsEnemy(ATT,3)
SetTeamAsEnemy(3,ATT)
SetTeamAsFriend(DEF,3)
SetTeamAsFriend(3,DEF)
SetTeamAsEnemy(ATT,4)
SetTeamAsEnemy(4,ATT)
SetTeamAsFriend(DEF,4)
SetTeamAsFriend(4,DEF)
SetTeamAsFriend(3,4)
SetTeamAsFriend(4,3)
SetTeamAsEnemy(ATT,5)
SetTeamAsEnemy(5,ATT)
SetTeamAsFriend(DEF,5)
SetTeamAsFriend(5,DEF)
SetTeamAsFriend(4,5)
SetTeamAsFriend(5,4)
SetTeamAsFriend(3,5)
SetTeamAsFriend(5,3)
SetTeamAsEnemy(ATT,6)
SetTeamAsEnemy(6,ATT)
SetTeamAsFriend(DEF,6)
SetTeamAsFriend(6,DEF)
SetTeamAsFriend(5,6)
SetTeamAsFriend(6,5)
SetTeamAsFriend(4,6)
SetTeamAsFriend(6,4)
SetTeamAsFriend(3,6)
SetTeamAsFriend(6,3)
SetTeamAsEnemy(ATT,7)
SetTeamAsEnemy(7,ATT)
SetTeamAsFriend(DEF,7)
SetTeamAsFriend(7,DEF)
SetTeamAsFriend(6,7)
SetTeamAsFriend(7,6)
SetTeamAsFriend(5,7)
SetTeamAsFriend(7,5)
SetTeamAsFriend(4,7)
SetTeamAsFriend(7,4)
SetTeamAsFriend(3,7)
SetTeamAsFriend(7,3)
-- Level Stats
ClearWalkers()
-- AddWalkerType(0, 0) -- 8 droidekas (special case: 0 leg pairs)
-- AddWalkerType(1, 0) -- 8 droidekas (special case: 0 leg pairs)
-- AddWalkerType(2, 0) -- 2 spider walkers with 2 leg pairs each
-- AddWalkerType(3, 0) -- 2 attes with 3 leg pairs each
local weaponCnt = 2000
SetMemoryPoolSize ("Aimer", 50)
SetMemoryPoolSize ("AmmoCounter", weaponCnt)
SetMemoryPoolSize ("BaseHint", 300)
SetMemoryPoolSize ("EnergyBar", weaponCnt)
SetMemoryPoolSize ("EntityCloth", 100)
SetMemoryPoolSize ("EntityLight", 100)
SetMemoryPoolSize ("EntitySoundStatic", 30)
SetMemoryPoolSize ("SoundSpaceRegion", 50)
SetMemoryPoolSize ("MountedTurret", 0)
SetMemoryPoolSize ("Navigator", 300)
SetMemoryPoolSize ("Obstacle", 260)
SetMemoryPoolSize ("PathFollower", 300)
SetMemoryPoolSize ("PathNode", 512)
SetMemoryPoolSize ("RedOmniLight", 130)
SetMemoryPoolSize ("ShieldEffect", 0)
SetMemoryPoolSize ("TreeGridStack", 200)
SetMemoryPoolSize ("UnitAgent", 300)
SetMemoryPoolSize ("UnitController", 300)
SetMemoryPoolSize ("Weapon", weaponCnt)
SetMemoryPoolSize ("EntityFlyer", 6)
SetMemoryPoolSize("SoldierAnimation", 1800)
SetSpawnDelay(10.0, 0.25)
ReadDataFile("HLO\\SSH.lvl", "SSH_wav")
SetDenseEnvironment("true")
-- Sound
voiceSlow = OpenAudioStream("sound\\global.lvl", "all_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)
voiceQuick = OpenAudioStream("sound\\global.lvl", "all_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_quick", voiceQuick)
OpenAudioStream("dc:sound\\hlo.lvl", "hlo_music")
OpenAudioStream("sound\\dea.lvl", "dea1")
--SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
--SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing", 1)
--SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing", 1)
--SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)
--SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
--SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1)
--SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
--SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1)
SetOutOfBoundsVoiceOver(1, "allleaving")
SetOutOfBoundsVoiceOver(2, "impleaving")
SetAmbientMusic(ALL, 1.0, "hlo_halo_amb_sanghelios", 0,1)
--SetAmbientMusic(ALL, 0.8, "hlo_halo_amb_sanghelios", 1,1)
--SetAmbientMusic(ALL, 0.2, "hlo_halo_amb_sanghelios", 2,1)
SetAmbientMusic(IMP, 1.0, "hlo_halo_amb_sanghelios", 0,1)
--SetAmbientMusic(IMP, 0.8, "hlo_halo_amb_sanghelios", 1,1)
--SetAmbientMusic(IMP, 0.2, "hlo_halo_amb_sanghelios", 2,1)
SetVictoryMusic(ALL, "hlo_halo_amb_victory")
SetDefeatMusic (ALL, "hlo_halo_amb_defeat")
SetVictoryMusic(IMP, "hlo_halo_amb_victory")
SetDefeatMusic (IMP, "hlo_halo_amb_defeat")
SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
-- SetSoundEffect("BirdScatter", "birdsFlySeq1")
SetSoundEffect("SpawnDisplayUnitChange", "shell_select_unit")
SetSoundEffect("SpawnDisplayUnitAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change")
SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplayBack", "shell_menu_exit")
SetAttackingTeam(ATT)
AddCameraShot(-0.404895, 0.000992, -0.514360, -0.002240, -121.539894, 62.536297, -257.699493)
--Homestead
AddCameraShot(0.040922, -0.004049, -0.994299, -0.098381, -103.729523, 55.546598, -225.360893)
--Sarlac Pit
AddCameraShot(-1.0, 0.0, -0.514360, 0.0, -55.381485, 50.450953, -96.514324)
end
[/code]