ReinforcementSquads = { {"light_inf","light_inf","light_inf","trooper","trooper"}, {"quad","quad_hmg","light_inf", "light_inf"}, {"trooper","trooper","trooper","trooper", "trooper"}, } ReinforcementLocations={} HarvestAmmout=12000 Annihillated = { ordos=true,atreides=true,mercenaries=true} MissionText={"Commander, our advance in this funeral plain is facing growing ORDOS resistance. Also, the allegiance of the local MERCENARIES is unsure yet.\nAIR REINFORCEMENTS pour in to strengthen our enemies, but we can also call in reinforcements, once the OUTPOST UPGRADE is complete.\nEither DESTROY all opposing forces OR HARVEST ".. tostring(HarvestAmmout) .." solaris worth of spice to complete this mission.\n--Good luck!", "Commander, the ATREIDES are invading our territory!\nDESTROY all attackers threatening this espionage outpost of ours or at least harvest a gain of "..tostring(HarvestAmmout).." solaris for our house.\nAIR REINFORCEMENTS are available after an OUTPOST UPGRADE.\nOur intelligence sources indicate the atreides may have bribed the MERCENARIES in this area. Beware.\n--Transmission End", "Mercenary Captain, I have received the ATREIDES answer to our modest price for military aid against the ORDOS - Those stuck-ups declined!\nI want you to either HARVEST those "..tostring(HarvestAmmout).." solaris from this damned place anyway or to CAST OUT BOTH of those houses from here!\nYou have my permission to use AIR REINFORCEMENTS after an OUTPOST UPGRADE.\nNow go and make money!!"} Warning={ "Atreides have over 9000 resources!!\n" , "The Ordos have over 9000 resources!!\n" , "The Mercs have over 9000 resources!!\n" } Tick = function() --needed for airdrop powers local reinfocelocations = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(act) if act.Type=="waypoint_dummy" and noDuplicate(act, ReinforcementLocations) then dropAirReinforcements(act.Location,act.Owner) table.insert(ReinforcementLocations, act) return act else return nil end end ) --resource victory check if atreides and atreides.Cash+atreides.Resources >= HarvestAmmout and not atreides.HasNoRequiredUnits() then atreides.MarkCompletedObjective(ObjectiveA) if ordos then ordos.MarkFailedObjective(ObjectiveO) end if mercenaries then mercenaries.MarkFailedObjective(ObjectiveM) end end if mercenaries and mercenaries.Cash+mercenaries.Resources >= HarvestAmmout and not mercenaries.HasNoRequiredUnits() then if atreides then atreides.MarkFailedObjective(ObjectiveA) end if ordos then ordos.MarkFailedObjective(ObjectiveO) end mercenaries.MarkCompletedObjective(ObjectiveM) end if ordos and ordos.Cash+ordos.Resources >= HarvestAmmout and not ordos.HasNoRequiredUnits() then if atreides then atreides.MarkFailedObjective(ObjectiveA) end ordos.MarkCompletedObjective(ObjectiveO) if mercenaries then mercenaries.MarkFailedObjective(ObjectiveM) end end --annihilation victory check if Annihillated.atreides and Annihillated.ordos then mercenaries.MarkCompletedObjective(ObjectiveM) end if Annihillated.atreides and Annihillated.mercenaries then ordos.MarkCompletedObjective(ObjectiveO) end if Annihillated.mercenaries and Annihillated.ordos then atreides.MarkCompletedObjective(ObjectiveA) end --defeat check if atreides and atreides.HasNoRequiredUnits() then atreides.MarkFailedObjective(ObjectiveA) for _,act in pairs(atreides.GetActors()) do if act.HasProperty("Kill") then act.Kill() end end Annihillated.atreides=true end if mercenaries and mercenaries.HasNoRequiredUnits() then mercenaries.MarkFailedObjective(ObjectiveM) for _,act in pairs(mercenaries.GetActors()) do if act.HasProperty("Kill") then act.Kill() end end Annihillated.mercenaries=true end if ordos and ordos.HasNoRequiredUnits() then ordos.MarkFailedObjective(ObjectiveO) for _,act in pairs(ordos.GetActors()) do if act.HasProperty("Kill") then act.Kill() end end Annihillated.ordos=true end --spice-meter and victory warnings: local warning = "" local resourcetext = "" local pcolor = HSLColor.Gray if not Annihillated.atreides and not atreides.IsLocalPlayer and atreides.Cash+atreides.Resources>9000 then warning = warning..Warning[1] end if not Annihillated.ordos and not ordos.IsLocalPlayer and ordos.Cash+ordos.Resources>9000 then warning = warning..Warning[2] end if not Annihillated.mercenaries and not mercenaries.IsLocalPlayer and mercenaries.Cash+mercenaries.Resources>9000 then warning = warning..Warning[3] end if not Annihillated.atreides and atreides.IsLocalPlayer then resourcetext = " Stored resources: " ..tostring(atreides.Cash+atreides.Resources) .. " / " .. HarvestAmmout.." \n" pcolor = atreides.Color elseif not Annihillated.ordos and ordos.IsLocalPlayer then resourcetext = " Stored resources: " ..tostring(ordos.Cash+ordos.Resources).. " / " .. HarvestAmmout.." \n" pcolor = ordos.Color elseif not Annihillated.mercenaries and mercenaries.IsLocalPlayer then resourcetext = " Stored resources: " .. tostring(mercenaries.Cash+mercenaries.Resources) .. " / " .. HarvestAmmout.." \n" pcolor = mercenaries.Color end UserInterface.SetMissionText(resourcetext..warning, pcolor) end WorldLoaded = function() --players atreides = Player.GetPlayer("Atreides") ordos = Player.GetPlayer("Ordos") mercenaries = Player.GetPlayer("Mercenaries") if atreides then Annihillated.atreides=false end if ordos then Annihillated.ordos=false end if mercenaries then Annihillated.mercenaries=false end --DEBUG --Actor.Create("mcv", true, { Owner = atreides, Location = CPos.New(67,31) }) --smugglers setup smugglers = Player.GetPlayer("Creeps") Actor.Create("advanced_harvester_o", true, { Owner = smugglers, Location = CPos.New(80,56) }) Actor.Create("advanced_harvester_o", true, { Owner = smugglers, Location = CPos.New(46,5) }) Actor.Create("advanced_harvester_o", true, { Owner = smugglers, Location = CPos.New(9,62) }) Trigger.AfterDelay(DateTime.Seconds(0.1),function() for _,act in pairs(smugglers.GetActors()) do if act.Type=="carryall.reinforce" then act.Kill() end end end) --reinforcements setup ReinforcementBase={Actor210.Location, Actor212.Location,Actor211.Location} --silo upgrade fix, mission text if mercenaries then --Objectives and Mission ObjectiveM = mercenaries.AddPrimaryObjective("Harvest " .. tostring(HarvestAmmout) .. " Solaris worth of Spice or destroy all opposition.") Trigger.OnObjectiveCompleted(mercenaries, function(p,id) if Annihillated.ordos and Annihillated.atreides then Media.DisplayMessage("The Mercenaries have annihilated all opposition!","Mission Success",HSLColor.Gold) else Media.DisplayMessage("The Mercenaries have hoarded 12.000 solaris of spice!","Mission Success",HSLColor.Gold) end end) if mercenaries.IsLocalPlayer then Media.DisplayMessage(MissionText[3],"Your Mission",HSLColor.Gold) end --Silo Trigger.OnProduction(Actor142, function(producer, produced) if produced.Type=="upgrade.silo" then replace_silos(mercenaries) end end ) end if ordos then --Objectives and Mission ObjectiveO = ordos.AddPrimaryObjective("Harvest " .. tostring(HarvestAmmout) .. " Solaris worth of Spice or destroy all opposition.") Trigger.OnObjectiveCompleted(ordos, function(p,id) if Annihillated.mercenaries and Annihillated.atreides then Media.DisplayMessage("The Ordos have annihilated all opposition!","Mission Success",HSLColor.LawnGreen) else Media.DisplayMessage("The Ordos have hoarded 12.000 solaris of spice!","Mission Success",HSLColor.LawnGreen) end end) if ordos.IsLocalPlayer then Media.DisplayMessage(MissionText[2],"Your Mission",HSLColor.LawnGreen) end --Silo Trigger.OnProduction(Actor155, function(producer, produced) if produced.Type=="upgrade.silo" then replace_silos(ordos) end end ) end if atreides then --Objectives and Mission ObjectiveA = atreides.AddPrimaryObjective("Harvest " .. tostring(HarvestAmmout) .. " Solaris worth of Spice or destroy all opposition.") Trigger.OnObjectiveCompleted(atreides, function(p,id) if Annihillated.ordos and Annihillated.mercenaries then Media.DisplayMessage("The Atreides have annihilated all opposition!","Mission Success",HSLColor.Blue) else Media.DisplayMessage("The Atreides have hoarded 12.000 solaris of spice!","Mission Success",HSLColor.Blue) end end) if atreides.IsLocalPlayer then Media.DisplayMessage(MissionText[1],"Your Mission",HSLColor.Blue) end --Silo Trigger.OnProduction(Actor181, function(producer, produced) if produced.Type=="upgrade.silo" then replace_silos(atreides) end end ) end end function noDuplicate(actor, actorlist) for _, value in pairs(actorlist) do if value == actor then return false end end return true end function dropAirReinforcements(location,owner) local squad if owner==atreides then squad=1 end if owner==ordos then squad=3 end if owner==mercenaries then squad=2 end --Carryall reinforcements local path = {ReinforcementBase[squad],location} local units = Reinforcements.ReinforceWithTransport(owner, "carryall.reinforce", ReinforcementSquads[squad], path, {path[2], path[1]}) end function replace_silos(player) local actors = player.GetActors() local res = player.Resources for _, actor in pairs(actors) do if actor.Type == "silo" then local loc=actor.Location actor.Destroy() Actor.Create("advanced_silo", true, { Owner = player, Location = loc }) end end --give the game time to contemplate consequences of rapid player.ResourceCapacity changes, then correct. Trigger.AfterDelay(DateTime.Seconds(0.1), function() player.Resources = res end ) end