--Copyright Melons 2022, ask permission before use. a = 500 --nuke timer NuclearStrikes = Map.LobbyOption("NuclearStrikes") --check option selected if (NuclearStrikes ~= "entry_1") then if (NuclearStrikes == "entry_2") then a = 5 else if (NuclearStrikes == "entry_3") then a = 8 else if (NuclearStrikes == "entry_4") then a = 12 else a = 15 end end end end rules = function() Trigger.AfterDelay(DateTime.Seconds(3), function() if (Cappoints ~= "entry_off") then if (Cappoints == "entry_1") then Media.DisplayMessage ("OBJECTIVE: Capture the Communications Centre with an engineer and hold for timer amount ", "Mission", HSLColor.Red) else Media.DisplayMessage ("OBJECTIVE: Capture all the Communications Centres with an engineer and hold for timer amount ", "Mission", HSLColor.Red) end end if (NuclearStrikes ~= "entry_1") then Beaconmiddle() if (Cappoints ~= "entry_off") then Trigger.AfterDelay(DateTime.Seconds(5), function() Media.DisplayMessage ("WARNING: Nuclear strike mode enabled, middle area will be nuked every 5-15 minutes", "Mission", HSLColor.Red) end) else Media.DisplayMessage ("WARNING: Nuclear strike mode enabled, middle area will be nuked every 5-15 minutes", "Mission", HSLColor.Red) end Trigger.AfterDelay(DateTime.Seconds(5), function() nukemid() end) end end) end prepandfire = function() if (Nuker.HasProperty("ActivateNukePower")) then Media.DisplayMessage ("WARNING: Abomb preparing to launch in the middle", "Mission", HSLColor.Red) Media.PlaySpeechNotification(USSR, "AbombPrepping") Trigger.AfterDelay(DateTime.Seconds(30), function() nukemid() end) end end delayedlaunch = function() Trigger.AfterDelay(DateTime.Minutes(a), function() prepandfire() end) end nukemid = function() Media.PlaySpeechNotification(USSR, "AbombLaunchDetected") --Middle Area Nuker.ActivateNukePower(CPos.New(54,60)) --6 in centre Nuker.ActivateNukePower(CPos.New(63,60)) Nuker.ActivateNukePower(CPos.New(72,60)) Nuker.ActivateNukePower(CPos.New(54,68)) Nuker.ActivateNukePower(CPos.New(63,68)) Nuker.ActivateNukePower(CPos.New(72,68)) Nuker.ActivateNukePower(CPos.New(15,64)) -- Left Nuker.ActivateNukePower(CPos.New(112,64)) -- Right --[[] Nuker.ActivateNukePower(CPos.New(57,55)) Nuker.ActivateNukePower(CPos.New(65,55)) Nuker.ActivateNukePower(CPos.New(73,55)) Nuker.ActivateNukePower(CPos.New(57,73)) Nuker.ActivateNukePower(CPos.New(65,73)) Nuker.ActivateNukePower(CPos.New(73,73)) Nuker.ActivateNukePower(CPos.New(48,60)) Nuker.ActivateNukePower(CPos.New(48,68)) Nuker.ActivateNukePower(CPos.New(80,60)) Nuker.ActivateNukePower(CPos.New(80,68)) Nuker.ActivateNukePower(CPos.New(12,64)) -- Left Nuker.ActivateNukePower(CPos.New(115,64)) -- Right ]] --delayedparabombs() delayedlaunch() end delayedtroopers = function() Trigger.AfterDelay(DateTime.Seconds(15), function() -- Media.DisplayMessage ("Troops incoming", "Mission", HSLColor.Red) ShockDrop.TargetParatroopers(SHOCKER1.CenterPosition, Angle.New(300)) ShockDrop2.TargetParatroopers(SHOCKER2.CenterPosition, Angle.New(300)) ShockDrop3.TargetParatroopers(SHOCKER3.CenterPosition, Angle.New(800)) ShockDrop4.TargetParatroopers(SHOCKER4.CenterPosition, Angle.New(800)) end) end function tablelength(T) local count = 0 for _ in pairs(T) do count = count + 1 end return count end WorldLoaded = function() Neutral = Player.GetPlayer("Neutral") Creeps = Player.GetPlayer("Creeps") Cappoints = Map.LobbyOption("Cappoints") NuclearStrikes = Map.LobbyOption("NuclearStrikes") toxic_enabled = 0 enablechecking = 0 bioenabled = 0 playersingame = {"Multi0","Multi1","Multi2","Multi3","Multi4","Multi5","Multi6","Multi7"} -- Table of Potential Players actorstoupdate = {"fact","weap","tent","barr","hpad","afld","kenn","spen","syrd"} playersingamecount = tablelength(playersingame) actorstoupdatecount = tablelength(actorstoupdate) --Media.DisplayMessage ("Total Players is " .. playersingame2, "Mission", HSLColor.Red) activeplayers = {} -- Table for Active Players activeplayername = {} -- Table for Active Players z = 1 for i = playersingamecount,1,-1 do playername = playersingame[i] if (Player.GetPlayer(playername) ~= nil) then playerinfo = Player.GetPlayer(playername) activeplayers[z] = Player.GetPlayer(playername) --Media.DisplayMessage (playerinfo.InternalName, "Mission", HSLColor.Red) --activeplayername[i] = playername z = z + 1 if playerinfo.HasPrerequisites({"toxic_enabled"}) then toxic_enabled = 1 end i = i + 1 --message = playername .. " is here" end --Media.DisplayMessage ("Player " .. message, "Mission", HSLColor.Red) end --activeplayerscount = tablelength(activeplayers) --Table of players currently in the game activeplayerscount = function() return tablelength(activeplayers) end --Media.DisplayMessage ("Active Players " .. activeplayerscount(), "Mission", HSLColor.Red) --display total of players Beaconmiddle = function() Trigger.AfterDelay(DateTime.Seconds(5), function() Media.PlaySoundNotification(USSR, "Beacon") for i = activeplayerscount(),1,-1 do playeractive = activeplayers[i] playername = playeractive.InternalName Beacon.New(playeractive, spymiddle.CenterPosition, 500) Radar.Ping(playeractive, spymiddle.CenterPosition, HSLColor.Aqua, 500) end end) end Spawnspyplanemiddle = function() for i = activeplayerscount(),1,-1 do playeractive = activeplayers[i] playername = playeractive.InternalName test = Actor.Create(unittocreatespyplane1, true, { Owner = playeractive, Location = spymiddle.Location}) end end Nuker = Actor.Create("nuker", false, { Owner = Creeps }) ShockDrop = Actor.Create("shockdrop", false, { Owner = Creeps }) ShockDrop2 = Actor.Create("shockdrop", false, { Owner = Creeps }) ShockDrop3 = Actor.Create("shockdrop", false, { Owner = Creeps }) ShockDrop4 = Actor.Create("shockdrop", false, { Owner = Creeps }) --Spawn Units unittocreate = "miss" unittocreate2 = "gmine" unittocreate3 = "POWR" unittocreatebio = "bio" unittocreatetree1 = "tc05" unittocreatetree2 = "tc02" unittocreatespyplane1 = "camera.spyplane" createwarriorant = "warriorant" createfireant = "fireant" creategiantant = "ant" -- 2 x Middle Spawncom1 = function() comtopmid = Actor.Create(unittocreate, true, { Owner = Neutral, Location = ComMiddleUp.Location}) combotmid = Actor.Create(unittocreate, true, { Owner = Neutral, Location = ComMiddleBottom.Location}) end -- Sides Spawncom2 = function() comcentre1 = Actor.Create(unittocreate, true, { Owner = Neutral, Location = ComLeft.Location}) comcentre2 = Actor.Create(unittocreate, true, { Owner = Neutral, Location = ComRight.Location}) end -- 1 x Middle + Sides Spawncom3 = function() comcentre1 = Actor.Create(unittocreate, true, { Owner = Neutral, Location = ComLeft.Location}) comcentre1 = Actor.Create(unittocreate, true, { Owner = Neutral, Location = ComMiddleCenter.Location}) comcentre2 = Actor.Create(unittocreate, true, { Owner = Neutral, Location = ComRight.Location}) end --trees for middle Spawntrees = function() tree1 = Actor.Create(unittocreatetree1, true, { Owner = Neutral, Location = tc05left.Location}) tree2 = Actor.Create(unittocreatetree1, true, { Owner = Neutral, Location = tc05right.Location}) tree3 = Actor.Create(unittocreatetree2, true, { Owner = Neutral, Location = tc02middle.Location}) end --trees for middle Biolabs = function() biolab1 = Actor.Create(unittocreatebio, true, { Owner = Neutral, Location = BioUp.Location}) biolab2 = Actor.Create(unittocreatebio, true, { Owner = Neutral, Location = BioDown.Location}) Trigger.AfterDelay(DateTime.Seconds(4), function() Media.DisplayMessage ("WARNING: Bio Labs Enabled", "Mission", HSLColor.Red) end) end Spawnmines = function() extramine = {} for i = 217,183,-1 do minename = "Tmine" .. i if _G[minename] then extramine[i] = Actor.Create(unittocreate2, true, { Owner = Neutral, Location = _G[minename].Location}) --Media.DisplayMessage (minename, "Mission", HSLColor.Red) end end end Spawnants = function() extramine = {} for i = 26,1,-1 do antname = "Ant" .. i if i < 18 then if i < 6 then extramine[i] = Actor.Create(createwarriorant, true, { Owner = Creeps, Stance = AttackAnything, Location = _G[antname].Location}) else extramine[i] = Actor.Create(creategiantant, true, { Owner = Creeps, Stance = AttackAnything, Location = _G[antname].Location}) end else extramine[i] = Actor.Create(createfireant, true, { Owner = Creeps, Stance = AttackAnything, Location = _G[antname].Location}) end --Media.DisplayMessage (minename, "Mission", HSLColor.Red) end Trigger.AfterDelay(DateTime.Seconds(8), function() Media.DisplayMessage ("Ants have escaped from the Bio Labs!", "Mission", HSLColor.Red) end) end if activeplayers[1].HasPrerequisites({"bio_enabled"}) then bioenabled = 1 Biolabs() if (NuclearStrikes == "entry_1") then --Spawnants() end end if (Cappoints == "entry_off") then --Spawntrees() else if (Cappoints == "entry_1") then -- Middle Spawncom1() Spawnspyplanemiddle() end if (Cappoints == "entry_2") then -- Sides Spawncom2() Spawnspyplanemiddle() end if (Cappoints == "entry_3") then -- Middle + Sides Spawncom3() Spawnspyplanemiddle() --Spawntrees() end end --count buildings countbuildings = function(buildingtype, theplayer) local sams = theplayer.GetActorsByType(buildingtype) return #sams end checkbuildings = function() for i = activeplayerscount(),1,-1 do playeractive = activeplayers[i] playername = playeractive.InternalName for y = actorstoupdatecount,1,-1 do buildingtype = actorstoupdate[y] --Media.DisplayMessage (playername, "Mission", HSLColor.Red) factorycount = countbuildings(buildingtype, playeractive) --factorycount = 11 conditonname = buildingtype .. factorycount if (factorycount > 1) then if (factorycount < 8) then playeractive.GrantCondition(conditonname,1) else if (factorycount <= 9) then conditonname = buildingtype .. "8" playeractive.GrantCondition(conditonname,1) else if (factorycount <= 12) then conditonname = buildingtype .. "10" playeractive.GrantCondition(conditonname,1) else if (factorycount <= 15) then conditonname = buildingtype .. "13" playeractive.GrantCondition(conditonname,1) else if (factorycount <= 16) then conditonname = buildingtype .. "17" playeractive.GrantCondition(conditonname,1) else if (factorycount <= 24) then conditonname = buildingtype .. "21" playeractive.GrantCondition(conditonname,1) else conditonname = buildingtype .. "25" playeractive.GrantCondition(conditonname,1) end end end end end end end --Media.DisplayMessage ("Granted!" .. playername, "Mission", HSLColor.Red) -- Media.DisplayMessage (" Condition Name2 : " .. conditonname, "Mission", HSLColor.Red) end end end --toxicrules = Player.HasPrerequisites("toxic_enabled") --toxicrules = Map.LobbyOption("toxicrules") if toxic_enabled == 1 then Trigger.AfterDelay(DateTime.Seconds(2), function() Media.DisplayMessage ("Toxic Rules Enabled. 25 buildings of each for max speed", "Mission", HSLColor.Red) end) enablechecking = 1 Spawnmines() else Trigger.AfterDelay(DateTime.Seconds(2), function() Media.DisplayMessage ("Standard Rules apply for maximum build speed (4 War/7 other buildings)", "Mission", HSLColor.Red) end) end if (NuclearStrikes ~= "entry_1") then delayedtroopers() if bioenabled == 1 then Trigger.AfterDelay(DateTime.Seconds(30), function() -- Spawnants() end) end else if (Cappoints ~= "entry_off") then delayedtroopers() end end Tick = function() if enablechecking > 0 then checkbuildings() end end --end war fact check rules() end