GoundAttackArrayTop = {Top1,Top2,Top3,Top4} GoundAttackArrayRight= {Right1,Right2,Right3,Right4} GoundAttackArraySouth = {South1,South2,South3,South4} GoundAttackArrayLeft = {Left1,Left2,Left3,Left4} GoundAttackArrayCorner1 = {TopLeft1,TopLeft2,TopLeft3,TopLeft4} GoundAttackArrayCorner2= {TopRight1,TopRight2,TopRight3,TopRight4} GoundAttackArrayCorner3 = {BottomRight1,BottomRight2,BottomRight3,BottomRight4} GoundAttackArrayCorner4 = {BottomLeft1,BottomLeft2,BottomLeft3,BottomLeft4} EndgameUnits = {} Foes = {} Spielerzahl = 0 ActivePlayer = {} Difficulty = 0 remainingTime = 0 Text = "" Delay = 1 -- Delay between waves 1 min SecondsDelay = 30 -- 30 sec Minime = {} Player1 = false Player2 = false Player3 = false Player4 = false StartDelayMin = 2 -- 2 StartDelaySec = 50 -- 50 GetherData = function() for i=1,4 do local Spieler = Player.GetPlayer("Multi" .. tostring(i-1)) if Spieler ~= nil then table.insert(ActivePlayer, Spieler) Media.DisplayMessage("Multi" .. tostring(i-1) .. " is Playing!" ,"") if Spieler == Player.GetPlayer("Multi0") and Spieler ~= nil then Player1 = true if Spieler.IsBot then SecondsDelay = SecondsDelay +10 StartDelaySec = StartDelaySec +25 Difficulty = Difficulty -2 end end if Spieler == Player.GetPlayer("Multi1") and Spieler ~= nil then Player2 = true if Spieler.IsBot then SecondsDelay = SecondsDelay +10 StartDelaySec = StartDelaySec +25 Difficulty = Difficulty -2 end end if Spieler == Player.GetPlayer("Multi2") and Spieler ~= nil then Player3 = true if Spieler.IsBot then SecondsDelay = SecondsDelay +10 StartDelaySec = StartDelaySec +25 Difficulty = Difficulty -2 end end if Spieler == Player.GetPlayer("Multi3") and Spieler ~= nil then Player4 = true if Spieler.IsBot then SecondsDelay = SecondsDelay +10 StartDelaySec = StartDelaySec +25 Difficulty = Difficulty -2 end end end Spielerzahl = #ActivePlayer end Media.DisplayMessage(tostring(Spielerzahl) .. " player ... setting difficulty up ..." ,"") table.insert(Foes, Player.GetPlayer("True Nemesis")) table.insert(Foes, Player.GetPlayer("True Enemy")) table.insert(Foes, Player.GetPlayer("True Opponent")) table.insert(Foes, Player.GetPlayer("True Villian")) end Announce = function() if Spielerzahl == 1 then Difficulty = Difficulty + 9 DisplayDifficulty = "Easy" Delay = 1 SecondsDelay = 30 elseif Spielerzahl == 2 then Difficulty = Difficulty + 8 DisplayDifficulty = "Medium" Delay = 1 SecondsDelay = 15 elseif Spielerzahl == 3 then Difficulty = Difficulty + 9 DisplayDifficulty = "Hard" Delay = 1 SecondsDelay = 10 elseif Spielerzahl == 4 then Difficulty = Difficulty + 11 DisplayDifficulty = "Very Hard" Delay = 1 SecondsDelay = 0 end Media.DisplayMessage("Difficulty set to .... " .. DisplayDifficulty,"") end AttackGroundSingleBoss = function(Type) local stringerony = {Type} for p = 1, 4 do if Player2 then Reinforcements.Reinforce(Foes[p],stringerony, { GoundAttackArrayTop[p].Location, GoundAttackArrayTop[p].Location + CVec.New(0,5) }, 8, function(Units) Units.AttackMove(CPos.New(50,50)) IdleHunt(Units) end) end if Player1 then Reinforcements.Reinforce(Foes[p],stringerony, { GoundAttackArrayRight[p].Location, GoundAttackArrayRight[p].Location + CVec.New(-5,0) }, 8, function(Units) Units.AttackMove(CPos.New(50,50)) IdleHunt(Units) end) end if Player4 then Reinforcements.Reinforce(Foes[p],stringerony, { GoundAttackArraySouth[p].Location, GoundAttackArraySouth[p].Location + CVec.New(0,-5) }, 8, function(Units) Units.AttackMove(CPos.New(50,50)) IdleHunt(Units) end) end if Player3 then Reinforcements.Reinforce(Foes[p],stringerony, { GoundAttackArrayLeft[p].Location, GoundAttackArrayLeft[p].Location + CVec.New(5,0) }, 8, function(Units) Units.AttackMove(CPos.New(50,50)) IdleHunt(Units) end) end end end AttackGround = function(Type, Howmany, T2, T3, T4, T5, T6, T7) local stringerony = {} for i = 1, (Howmany+Difficulty) do table.insert(stringerony,Type) if T2 ~= nil then table.insert(stringerony,T2) end if T3 ~= nil then table.insert(stringerony,T3) end if T4 ~= nil then table.insert(stringerony,T4) end if T5 ~= nil then table.insert(stringerony,T5) end if T6 ~= nil then table.insert(stringerony,T6) end if T7 ~= nil then table.insert(stringerony,T7) end end for p = 1, 4 do if Player2 then Reinforcements.Reinforce(Foes[p],stringerony, { GoundAttackArrayTop[p].Location, GoundAttackArrayTop[p].Location + CVec.New(0,2) }, 8, function(Units) Units.AttackMove(CPos.New(50,50),10) IdleHunt(Units) end) end if Player1 then Reinforcements.Reinforce(Foes[p],stringerony, { GoundAttackArrayRight[p].Location, GoundAttackArrayRight[p].Location + CVec.New(-2,0) }, 8, function(Units) Units.AttackMove(CPos.New(50,50),10) IdleHunt(Units) end) end if Player4 then Reinforcements.Reinforce(Foes[p],stringerony, { GoundAttackArraySouth[p].Location, GoundAttackArraySouth[p].Location + CVec.New(0,-2) }, 8, function(Units) Units.AttackMove(CPos.New(50,50),10) IdleHunt(Units) end) end if Player3 then Reinforcements.Reinforce(Foes[p],stringerony, { GoundAttackArrayLeft[p].Location, GoundAttackArrayLeft[p].Location + CVec.New(2,0) }, 8, function(Units) Units.AttackMove(CPos.New(50,50),10) IdleHunt(Units) end) end end end AttackAir = function(Type, Howmany, T2, T3, T4) local stringerony = {} for i = 1, (Howmany+Difficulty) do table.insert(stringerony,Type) if T2 ~= nil then table.insert(stringerony,T2) end if T3 ~= nil then table.insert(stringerony,T3) end if T4 ~= nil then table.insert(stringerony,T4) end end for p = 1, 4 do if Player2 then Reinforcements.Reinforce(Foes[p],stringerony, { GoundAttackArrayCorner1[p].Location, GoundAttackArrayCorner1[p].Location + CVec.New(5,5) }, 8, function(Units) Units.AttackMove(CPos.New(50,50),10) IdleHunt(Units) end) end if Player1 then Reinforcements.Reinforce(Foes[p],stringerony, { GoundAttackArrayCorner2[p].Location, GoundAttackArrayCorner2[p].Location + CVec.New(-5,5) }, 8, function(Units) Units.AttackMove(CPos.New(50,50),10) IdleHunt(Units) end) end if Player4 then Reinforcements.Reinforce(Foes[p],stringerony, { GoundAttackArrayCorner3[p].Location, GoundAttackArrayCorner3[p].Location + CVec.New(-5,-5) }, 8, function(Units) Units.AttackMove(CPos.New(50,50),10) IdleHunt(Units) end) end if Player3 then Reinforcements.Reinforce(Foes[p],stringerony, { GoundAttackArrayCorner4[p].Location, GoundAttackArrayCorner4[p].Location + CVec.New(5,-5) }, 8, function(Units) Units.AttackMove(CPos.New(50,50),10) IdleHunt(Units) end) end end end BossUnitScriptSpecial1 = function() for p = 1, 4 do if Player2 then Reinforcements.Reinforce(Foes[p],{"strangetank"}, { GoundAttackArrayTop[p].Location, GoundAttackArrayTop[p].Location + CVec.New(0,5) }, 8, function(Units) TriggerProduction(Units) end) Reinforcements.Reinforce(Foes[p],{"minime","minime","minime"}, { GoundAttackArrayTop[p].Location, GoundAttackArrayTop[p].Location + CVec.New(0,5) }, 8, function(Units) Units.AttackMove(CPos.New(50,50)) IdleHunt(Units) end) end if Player1 then Reinforcements.Reinforce(Foes[p],{"strangetank"}, { GoundAttackArrayRight[p].Location, GoundAttackArrayRight[p].Location + CVec.New(-5,0) }, 8, function(Units) TriggerProduction(Units) end) Reinforcements.Reinforce(Foes[p],{"minime","minime","minime"}, { GoundAttackArrayRight[p].Location, GoundAttackArrayRight[p].Location + CVec.New(-5,0) }, 8, function(Units) Units.AttackMove(CPos.New(50,50)) IdleHunt(Units) end) end if Player4 then Reinforcements.Reinforce(Foes[p],{"strangetank"}, { GoundAttackArraySouth[p].Location, GoundAttackArraySouth[p].Location + CVec.New(0,-5) }, 8, function(Units) TriggerProduction(Units) end) Reinforcements.Reinforce(Foes[p],{"minime","minime","minime"}, { GoundAttackArraySouth[p].Location, GoundAttackArraySouth[p].Location + CVec.New(0,-5) }, 8, function(Units) Units.AttackMove(CPos.New(50,50)) IdleHunt(Units) end) end if Player3 then Reinforcements.Reinforce(Foes[p],{"strangetank"}, { GoundAttackArrayLeft[p].Location, GoundAttackArrayLeft[p].Location + CVec.New(5,0) }, 8, function(Units) TriggerProduction(Units) end) Reinforcements.Reinforce(Foes[p],{"minime","minime","minime"}, { GoundAttackArrayLeft[p].Location, GoundAttackArrayLeft[p].Location + CVec.New(5,0) }, 8, function(Units) Units.AttackMove(CPos.New(50,50)) IdleHunt(Units) end) end end Trigger.AfterDelay(DateTime.Seconds(10), function() EndgameUnits = Map.ActorsInBox(Map.TopLeft,Map.BottomRight,function(unit) return unit.Type == "strangetank" end) Trigger.OnAllKilled(EndgameUnits,function() YouDidIt() end) end) end TriggerProduction = function(Units) Units.Build({"minime","minime","minime"},function(Minis) for k,v in ipairs(Minis) do v.AttackMove(CPos.New(50,50)) IdleHunt(v) end end) Trigger.OnIdle(Units, function() Units.Build({"minime","minime","minime"},function(Minis) for k,v in ipairs(Minis) do v.AttackMove(CPos.New(50,50),10) IdleHunt(v) end end) end) end IdleHunt = function(unit) if not unit.IsDead and unit.HasProperty("AttackMove") then Trigger.OnIdle(unit, unit.Hunt) end end YouDidIt = function() UserInterface.SetMissionText("You did it!", Player.GetPlayer("Neutral").Color) Trigger.AfterDelay(DateTime.Seconds(20), function() if Player1 then local P = Player.GetPlayer("Multi0") Media.DisplayMessage(P.Name .. " is victorious!","") end if Player2 then local P = Player.GetPlayer("Multi1") Media.DisplayMessage(P.Name .. " is victorious!","") end if Player3 then local P = Player.GetPlayer("Multi2") Media.DisplayMessage(P.Name .. " is victorious!","") end if Player4 then local P = Player.GetPlayer("Multi3") Media.DisplayMessage(P.Name .. " is victorious!","") end end) XTime=0 XSeconds = 0 Trigger.AfterDelay( DateTime.Seconds(30), function() timerStarted = true remainingTime = DateTime.Seconds(30) Text = "Prepared for a bonus round!!11!oneeleven!" end) XSeconds = XSeconds + 30 Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "Attacking AIR Units: Flying Skulls of Death." end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackAir("fsod",-4) timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "Attacking Units: Moneymaker." end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("gorich",-4) timerStarted = false remainingTime = DateTime.Minutes(0) + DateTime.Seconds(0) Text = "Attacking Units: Halfbuild lowhovering Temple!." end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("flytmpl",-4) timerStarted = false remainingTime = DateTime.Minutes(0) + DateTime.Seconds(0) Text = "Attacking Units: Hand of Nod." end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("purfire",1) timerStarted = false remainingTime = DateTime.Minutes(0) + DateTime.Seconds(0) Text = "End." end) end RegularWaves = function() XTime= StartDelayMin XSeconds = StartDelaySec Trigger.AfterDelay(DateTime.Minutes(StartDelayMin) + DateTime.Seconds(StartDelaySec), function() AttackGround("e1",4) timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "Attacking Units: Buggys." end) XTime = XTime + Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("bggy",1) timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "Attacking Units: Grenadier and Recon Bikes." end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("e2",3,"bike") timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "Attacking Units: Rocket Soldier, Rifle Infantry and Humvees." end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("e3",4,"e1","jeep") timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "Attacking AIR Units: Flying Guardtower." end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackAir("fgtwr",2) timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "Attacking Units: Tanks, APC's and Grenadiers." end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("ltnk",3,"apc","e2") timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "BOSS ROUND Attacking Units: Rock Thrower." end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("e1carry",5) timerStarted = true Delay = Delay + 1 SecondsDelay = SecondsDelay + 15 XTime= Delay XSeconds = SecondsDelay remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) RegularWavesLv2() Text = "Attacking Units: Flamethrowers, Rocket Soldier, Medium Tanks, Humvees" end) end RegularWavesLv2 = function() Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("e4",3,"jeep","e3","mtnk") timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "Attacking Units: Chemicalthrowers, Rocket Infantry, Commandos and Flame Tanks" end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("rmbo",3,"e5","e3","ftnk") timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "Attacking Units: Mounted AH10, and Airdefense" end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("cargoliner",4,"mlrs") timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "Attacking Air Units: Flying Advance Guard Towers" end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackAir("fatwr",2) timerStarted = true remainingTime = DateTime.Minutes(Delay + 1) + DateTime.Seconds(SecondsDelay) Text = "BOSS ROUND Attacking Unit: MLMLRS." end) XTime = XTime +Delay +1 XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGroundSingleBoss("loadmcv") timerStarted = true Delay = Delay + 1 SecondsDelay = SecondsDelay + 15 XTime= Delay XSeconds = SecondsDelay RegularWavesLv3() remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "Attacking Units: Double-Gun Tanks, Sams, Commandos and Buggys" end) end RegularWavesLv3 = function() Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("guntank",2,"mlrs","bggy","rmbo") timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "BOSS ROUND Attacking Units: Angry Aifields, anti Air Defense" end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("mlrs",1, "astnk") timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "Attacking Units: Obelisk" end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("crazyobli",3) timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "Attacking Air Units: Temple Angel." end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackAir("tmplangel",4) timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "Attacking Units: Mammoth Tanks and Artillery" end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("htnk",2,"arty") timerStarted = true remainingTime = DateTime.Minutes(Delay) + DateTime.Seconds(SecondsDelay) Text = "Attacking Units: Mobile ion Cannons and Anti Air." end) XTime = XTime +Delay XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() AttackGround("moico",6,"mlrs") timerStarted = true remainingTime = DateTime.Minutes(Delay+ 1) + DateTime.Seconds(SecondsDelay) Text = "BOSS ROUND Attacking Units: Mama Warfactory." end) XTime = XTime +Delay + 1 XSeconds = XSeconds + SecondsDelay Trigger.AfterDelay(DateTime.Minutes(XTime) + DateTime.Seconds(XSeconds), function() BossUnitScriptSpecial1() timerStarted = false UserInterface.SetMissionText("Beat Him!!!", Player.GetPlayer("Neutral").Color) end) end WorldLoaded = function() Trigger.AfterDelay(DateTime.Seconds(3),GetherData) Trigger.AfterDelay(DateTime.Seconds(6),Announce) Trigger.AfterDelay(DateTime.Seconds(15), function() Media.DisplayMessage("Setting Up Timer!" ,"") XTime = StartDelayMin XSeconds = StartDelaySec timerStarted = true Text = "Attacking Units: Rifle Gunner." remainingTime = DateTime.Minutes(StartDelayMin) + DateTime.Seconds(StartDelaySec) -- 3:50 RegularWaves() end) end Tick = function() if remainingTime > 0 and timerStarted then UserInterface.SetMissionText(Text .. " Time until Attack: " .. Utils.FormatTime(remainingTime), Player.GetPlayer("Neutral").Color) remainingTime = remainingTime - 1 end end