delayTrigger0=true delayTrigger1=true foundop0=false foundop1=false SmugglersSouthDead={false,false,false,false} SmugglersNorthDead={false,false,false,false} IsleBuildings={ {{},{},{},{},{},{},{},{},{},{},{},{},{},{}}, {{},{},{},{},{},{},{},{},{},{},{},{},{},{}}, {{},{},{},{},{},{},{},{},{},{},{},{},{},{}}, {{},{},{},{},{},{},{},{},{},{},{},{},{},{}} } IsleOwner={false,false,false,false,false,false,false,false,false,false,false,false,false,false} IsleClock={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1} IsleReinforcementTime=DateTime.Minutes(4) CHOAMReinforcementTime=DateTime.Minutes(10) MentatShort={} GernericSoldier={"We arrived in the region, Sir. Next we should make contact with the main base to the North-West.","We arrived in the region, Sir. Next we should make contact with the main base to the South-East.","Smugger scum! Such a nuisance on Arrakis...","We arrived, but our job is not done yet. We must protect the "," units until they arrive in the base to the North-West!"," units until they arrive in the base to the South-East!","un..bebieveable..?!..duped..by..... ..Smugg..lers....Huhhhuhhhh...."} MentatIntroMain={"Ah Commander! Nice to have the Lords most proficient troop commander here. I will transfer the controls of the base in a moment. But first, let me give you a briefing on the Situation:","Our spies in the North tell us the base of the "," is as well developed as our own. It will be a hard fight for supremacy in the region.","Your first steps should be to find enemy spies in our own base and contact our troop reserves in the North.","I'm transfering controls now, Commander. Remove the "," threat. Good Luck!","Our spies in the South tell us the base of the ","Your first steps should be to find enemy spies in our own base and contact our troop reserves in the East."} MentatIntroSupport={"You have done your job well, so far. Your new job is to protect and support your ally.\nTake these reinforcements...","Start by establishing a forward base and then remove those pesky Smuggers all around this base!"} MentatRockIsles={"Now go on and establish more outposts on the rock islands. For each isle you fortify with buildings the smaller Houses will provide you with regular levy reinforcements!","We have occupied a rock isle. Hold it for 4 minutes to get some reinforcements!","Sire, one of our rock isles is beeing contested!","Sire, we have lost all our presence on one of the rock isles!","The minor houses have just sent their first group of tribute levies to reinforce your troops! Conquer more rock isles to get reinforcements more often.","A group of levy reinforcements has arrived."} MentatHarvest={"The CHOAM report shows that we are currently RICHER than our enemies. Because of this, some minor house offered their troop reinforcements to us!","Unfortunately, the latest CHOAM report shows we have LESS monetary reserves than our enemies. This means the minor houses will likely support them instead of us!","In 10 minutes there will be a new report."} MentatSmugglers={"A smuggler hideout has been found! Capture their valuable resources or destroy them. Your choice.","Angry Smugglers attack us! Deal with them!","Well done, here are some funds for reward. We can finally send our harvesters in safely.","Our ally has cleaned up all Smugglers. Advanced Harvester reinforcements inbound!"} function soldierSays(player, message) if message then if player.IsLocalPlayer then Media.DisplayMessage(message,"Soldier",HSLColor.DarkGray) end end end function sayTo(player, message) if message then local color=HSLColor.Gray if player.Faction=="atreides" then color=HSLColor.Blue elseif player.Faction=="harkonnen" then color=HSLColor.Red elseif player.Faction=="ordos" then color=HSLColor.LawnGreen end if player.IsLocalPlayer then Media.DisplayMessage(message,"Mentat",color) end end end function spawnStartingBuildings(player) --MAP DEPENDENT HACK!!!!!!!!!!!!!!!!!!!!!!! local palace, pal_loc, ref_loc if player.Faction=="atreides" then palace="palace.atreides" elseif player.Faction=="harkonnen" then palace="palace.harkonnen" elseif player.Faction=="ordos" then palace="palace.ordos" end if player==mp1 then pal_loc=CPos.New(29,28) ref_loc=CPos.New(33,9) elseif player==mp0 then pal_loc=CPos.New(61,95) ref_loc=CPos.New(55,100) end Actor.Create(palace, true, { Owner = player, Location = pal_loc }) Actor.Create("refinery", true, { Owner = player, Location = ref_loc }) end function spawnOutpostUnits(player,outpostplayer) local set=0 if player==mp1 then set = 1 end local t,tk,st,m local q="quad" if player.Faction=="atreides" then tk= "combat_tank_a" t="trike_a" st="siege_tank_a" m="missile_tank_a" elseif player.Faction=="harkonnen" then tk= "combat_tank_h" t="quad_hmg" st="siege_tank_h" m="missile_tank_h" elseif player.Faction=="ordos" then tk="combat_tank_o" t="raider" st="siege_tank_o" m="missile_tank_o" end local Formation, facing if set==0 then facing=64 Formation={{tk,tk,nil,nil,tk,tk,tk,tk},{st,st,m,nil,q,t,t,q}} end if set==1 then facing=128 Formation={{q,tk,tk},{t,tk,tk},{t,tk,tk},{q,nil,nil},{nil,nil,nil},{nil,nil,nil},{st,m,st}} end local startx,starty,lenx,leny --MAP DEPENDENT HACK!!!!!!!!!!!!!!!!!!!!!!! if set==0 then startx=69 starty=71 lenx=2 leny=8 elseif set==1 then startx=55 starty=29 lenx=7 leny=3 end for i= 1,lenx do for j= 1,leny do if Formation[i][j] then Actor.Create(Formation[i][j], true, {Owner=outpostplayer, Location=CPos.New(startx-1+i,starty-1+j), Facing=facing}) end end end end function initiateDiscoverableBasesSouth(mentat1,mentat2) Trigger.OnPlayerDiscovered(mentat1, function(pdiscovered,pdiscoverer) if pdiscoverer==mp0 then sayTo(mp0,MentatIntroMain[1]) initializeDelayedObjective(mp0) baseReachedBy(mp0) Trigger.AfterDelay(DateTime.Seconds(8),function() positionPlayerCamera(mp0,CPos.New(39,26)) --MAP DEPENDENT HACK!!!!!!!!! sayTo(mp0,MentatIntroMain[2]..mp1.Faction..MentatIntroMain[3]) end) Trigger.AfterDelay(DateTime.Seconds(16),function() positionPlayerCamera(mp0,CPos.New(62,72)) --MAP DEPENDENT HACK!!!!!!!!! sayTo(mp0,MentatIntroMain[4]) killspy1 = mp0.AddSecondaryObjective("Find and kill all spies in your base.") end) Trigger.AfterDelay(DateTime.Seconds(22),function() positionPlayerCamera(mp0,CPos.New(68,101)) --MAP DEPENDENT HACK!!!!!!!!! handBaseFromTo(pdiscovered, pdiscoverer) delayTrigger0=false sayTo(mp0,MentatIntroMain[5]..mp1.Faction..MentatIntroMain[6]) spawnStartingBuildings(mp0) Actor267.Deploy() Media.PlaySpeechNotification(mp0,"NewOptions") end) end end ) Trigger.OnPlayerDiscovered(mentat2, function(pdiscovered, pdiscoverer) if pdiscoverer==mp0 then handBaseFromTo(pdiscovered, pdiscoverer) if mp0findOutpost then mp0.MarkCompletedObjective(mp0findOutpost) else foundop0=true end end end ) end function initiateDiscoverableBasesNorth(mentat3,mentat4) Trigger.OnPlayerDiscovered(mentat3, function(pdiscovered, pdiscoverer) if pdiscoverer==mp1 then sayTo(mp1,MentatIntroMain[1]) initializeDelayedObjective(mp1) baseReachedBy(mp1) Trigger.AfterDelay(DateTime.Seconds(8),function() positionPlayerCamera(mp1,CPos.New(68,101)) --MAP DEPENDENT HACK!!!!!!!!! sayTo(mp1,MentatIntroMain[7]..mp0.Faction..MentatIntroMain[3]) end) Trigger.AfterDelay(DateTime.Seconds(16),function() positionPlayerCamera(mp1,CPos.New(59,25)) --MAP DEPENDENT HACK!!!!!!!!! sayTo(mp1,MentatIntroMain[8]) killspy0 = mp1.AddSecondaryObjective("Find and kill all spies in your base.") end) Trigger.AfterDelay(DateTime.Seconds(22),function() positionPlayerCamera(mp1,CPos.New(39,26)) --MAP DEPENDENT HACK!!!!!!!!! handBaseFromTo(pdiscovered, pdiscoverer) delayTrigger1=false sayTo(mp1,MentatIntroMain[5]..mp0.Faction..MentatIntroMain[6]) spawnStartingBuildings(mp1) Actor234.Deploy() Media.PlaySpeechNotification(mp1,"NewOptions") end) end end ) Trigger.OnPlayerDiscovered(mentat4, function(pdiscovered, pdiscoverer) if pdiscoverer==mp1 then handBaseFromTo(pdiscovered, pdiscoverer) if mp1findOutpost then mp1.MarkCompletedObjective(mp1findOutpost) else foundop1=true end end end ) end function positionPlayerCamera(player,cpos) local pos if player.IsLocalPlayer then pos=Map.CenterOfCell(cpos) else pos=Camera.Position end Camera.Position=pos end function glimpseAtCameraTo(camera,player) camera.Owner=player Trigger.AfterDelay(DateTime.Seconds(3), function() camera.Owner=neut end) end function initializeObjectives() mp0reachmain= mp0.AddPrimaryObjective("Reach the base in the North-West.") mp1reachmain= mp1.AddPrimaryObjective("Reach the base in the South-East.") Trigger.OnObjectiveCompleted(mp0,function(player,_)Media.PlaySpeechNotification(player,"Win") end) Trigger.OnObjectiveCompleted(mp1,function(player,_)Media.PlaySpeechNotification(player,"Win") end) if mp2 then mp2protectInitialUnits = mp2.AddPrimaryObjective("At least one unit of your ally must reach\nthe base in the North-West.") Trigger.OnObjectiveCompleted(mp2,function(player,_)Media.PlaySpeechNotification(player,"Win") end) end if mp3 then mp3protectInitialUnits = mp3.AddPrimaryObjective("At least one unit of your ally must reach\nthe base in the South-East.") Trigger.OnObjectiveCompleted(mp3,function(player,_)Media.PlaySpeechNotification(player,"Win") end) end end function initializeDelayedObjective(player) if player==mp0 then mp0survive = mp0.AddPrimaryObjective("Destroy all enemy "..mp1.Faction.." buildings in the area.") mp0findOutpost=mp0.AddSecondaryObjective("Contact the outpost in the North.") if foundop0 then mp0.MarkCompletedObjective(mp0findOutpost) end startCHOAMreportObective() end if player==mp1 then mp1survive = mp1.AddPrimaryObjective("Destroy all enemy "..mp0.Faction.." buildings in the area.") mp1findOutpost=mp1.AddSecondaryObjective("Contact the outpost in the East.") if foundop1 then mp1.MarkCompletedObjective(mp1findOutpost) end startCHOAMreportObective() end if mp2 and player==mp0 then mp2protect = mp2.AddPrimaryObjective("Protect our "..mp0.Faction.." allies base at all cost!") mp2cleanSmugglers= mp2.AddSecondaryObjective("Remove all four smuggler bands\naround the "..mp0.Faction.." base.") initializeSmugglerCleanupMission2() Trigger.OnObjectiveCompleted(mp2,function(p,ID) if ID==mp2cleanSmugglers then initializefurtherDelayedObjective(p) end end) end if mp3 and player==mp1 then mp3protect = mp3.AddPrimaryObjective("Protect our "..mp1.Faction.." allies base at all cost!") mp3cleanSmugglers= mp3.AddSecondaryObjective("Remove all four smuggler bands\naround the "..mp1.Faction.." base.") initializeSmugglerCleanupMission3() Trigger.OnObjectiveCompleted(mp3,function(p,ID) if ID==mp3cleanSmugglers then smugglersCleanedReward(p) initializefurtherDelayedObjective(p) end end) end end function startCHOAMreportObective() --Map DEPENDENT!!!!!!!!! if mp0survive~=nil and mp1survive~=nil then Trigger.AfterDelay(CHOAMReinforcementTime,function() CHOAMreport() mp0.AddSecondaryObjective("There will be CHOAM reports every 10 minutes.\nStore more spice than the opponent to get\nreinforcements.") mp1.AddSecondaryObjective("There will be CHOAM reports every 10 minutes.\nStore more spice than the opponent to get\nreinforcements.") end) end end function CHOAMreport() local units, path units = {"siege_tank.starport","missile_tank.starport","light_inf","light_inf","trooper"} if mp0.Cash+mp0.Resources <= mp1.Cash+mp1.Resources and mp0.Cash+mp0.Resources ~=0 then sayTo(mp1,MentatHarvest[1]) sayTo(mp1,MentatHarvest[3]) sayTo(mp0,MentatHarvest[2]) sayTo(mp0,MentatHarvest[3]) path = {CPos.New(2,2),CPos.New(34,26)} ReinforceWithControllableCarryall(mp1, units, path) ReinforceWithControllableCarryall(mp1, units, path) else sayTo(mp0,MentatHarvest[1]) sayTo(mp0,MentatHarvest[3]) sayTo(mp1,MentatHarvest[2]) sayTo(mp1,MentatHarvest[3]) path = {CPos.New(101,121),CPos.New(53,95)} ReinforceWithControllableCarryall(mp0, units, path) ReinforceWithControllableCarryall(mp0, units, path) end Trigger.AfterDelay(CHOAMReinforcementTime,function() CHOAMreport() end) end function smugglersCleanedReward(player) local ally, unit, path sayTo(player,MentatSmugglers[3]) player.Cash=player.Cash+5000 if mp2 and player==mp2 then ally=mp0 path = {CPos.New(101,121),CPos.New(53,95)} elseif mp3 and player==mp3 then ally=mp1 path = {CPos.New(2,2),CPos.New(34,26)} end sayTo(ally,MentatSmugglers[4]) if ally.Faction=="atreides" then unit="advanced_harvester_a" elseif ally.Faction=="harkonnen" then unit="advanced_harvester_h" elseif ally.Faction=="ordos" then unit="advanced_harvester_o" end ReinforceWithControllableCarryall(ally, {unit}, path) ReinforceWithControllableCarryall(ally, {unit}, path) ReinforceWithControllableCarryall(ally, {unit}, path) end function ReinforceWithControllableCarryall(player,squad,path) local units = Reinforcements.ReinforceWithTransport(player, "carryall.controllable", squad, path, {path[2], path[1]}) local carryall = units[1] Trigger.OnPassengerExited(carryall, function(carry, pass) if not carry.HasPassengers then carry.Move(path[1]) carry.Destroy() end end ) end function initializefurtherDelayedObjective(player) if mp2 and player==mp2 then sayTo(mp2,MentatRockIsles[1]) mp2.AddSecondaryObjective("Occupy rock isles to receive reinforcements every 4 minutes.") end if mp3 and player==mp3 then sayTo(mp3,MentatRockIsles[1]) mp3.AddSecondaryObjective("Occupy rock isles to receive reinforcements every 4 minutes.") end end function initializeSmugglerCleanupMission2() sayTo(mp2,MentatIntroSupport[1]) Trigger.AfterDelay(DateTime.Seconds(3),function() positionPlayerCamera(mp2,CPos.New(98,117)) --MAP DEPENDENT HACK!!!!!!!!! Media.PlaySpeechNotification(mp2,"Reinforce") local team={"trike.starport", "trike.starport","mobile_crane.starport"} local path={CPos.New(101,121),CPos.New(97,117)} Reinforcements.Reinforce(mp2, team, path) team={"light_inf","light_inf","light_inf"} path={CPos.New(101,119),CPos.New(97,115)} Reinforcements.Reinforce(mp2, team, path, 12) path={CPos.New(99,121),CPos.New(95,117)} Reinforcements.Reinforce(mp2, team, path, 12) end) Trigger.AfterDelay(DateTime.Seconds(10),function() sayTo(mp2,MentatIntroSupport[2]) positionPlayerCamera(mp2,Actor415.Location) glimpseAtCameraTo(Actor415,mp2) end) Trigger.AfterDelay(DateTime.Seconds(15),function() positionPlayerCamera(mp2,Actor416.Location) glimpseAtCameraTo(Actor416,mp2) end) Trigger.AfterDelay(DateTime.Seconds(18),function() positionPlayerCamera(mp2,Actor417.Location) glimpseAtCameraTo(Actor417,mp2) end) Trigger.AfterDelay(DateTime.Seconds(21),function() positionPlayerCamera(mp2,Actor418.Location) glimpseAtCameraTo(Actor418,mp2) end) Trigger.AfterDelay(DateTime.Seconds(24),function() positionPlayerCamera(mp2,CPos.New(98,117)) end) end function initializeSmugglerCleanupMission3() sayTo(mp3,MentatIntroSupport[1]) Trigger.AfterDelay(DateTime.Seconds(3),function() positionPlayerCamera(mp3,CPos.New(4,4)) --MAP DEPENDENT HACK!!!!!!!!! Media.PlaySpeechNotification(mp3,"Reinforce") local team={"trike.starport", "trike.starport","mobile_crane.starport"} local path={CPos.New(2,2),CPos.New(6,6)} Reinforcements.Reinforce(mp3, team, path) team={"light_inf","light_inf","light_inf"} Media.PlaySpeechNotification(mp3,"Reinforce") path={CPos.New(2,4),CPos.New(6,8)} Reinforcements.Reinforce(mp3, team, path, 12) path={CPos.New(4,2),CPos.New(8,6)} Reinforcements.Reinforce(mp3, team, path, 12) end) Trigger.AfterDelay(DateTime.Seconds(10),function() sayTo(mp3,MentatIntroSupport[2]) positionPlayerCamera(mp3,Actor421.Location) glimpseAtCameraTo(Actor421,mp3) end) Trigger.AfterDelay(DateTime.Seconds(15),function() positionPlayerCamera(mp3,Actor420.Location) glimpseAtCameraTo(Actor420,mp3) end) Trigger.AfterDelay(DateTime.Seconds(18),function() positionPlayerCamera(mp3,Actor422.Location) glimpseAtCameraTo(Actor422,mp3) end) Trigger.AfterDelay(DateTime.Seconds(21),function() positionPlayerCamera(mp3,Actor419.Location) glimpseAtCameraTo(Actor419,mp3) end) Trigger.AfterDelay(DateTime.Seconds(24),function() positionPlayerCamera(mp3,CPos.New(4,4)) end) end function baseReachedBy(player) if player==mp0 then mp0.MarkCompletedObjective(mp0reachmain) if mp2 then mp2.MarkCompletedObjective(mp2protectInitialUnits) end end if player==mp1 then mp1.MarkCompletedObjective(mp1reachmain) if mp3 then mp3.MarkCompletedObjective(mp3protectInitialUnits) end end end function initializeDefeatTriggers() --more custom defeat conditions in "Tick" function Trigger.OnAllKilled({Actor405,Actor406,Actor407,Actor408,Actor409},function() Media.DisplayMessage("All Spies of the northern alliance have been vanquished!","Mission Info",HSLColor.DarkGray) mp0.MarkCompletedObjective(killspy1) end) Trigger.OnAllKilled({Actor410,Actor411,Actor412,Actor413,Actor414},function() Media.DisplayMessage("All Spies of the southern alliance have been vanquished!","Mission Info",HSLColor.DarkGray) mp1.MarkCompletedObjective(killspy0) end) Trigger.OnPlayerLost(mp0,function(p) victoryTeam2() Media.PlaySpeechNotification(p,"Lose") if mp2 then Media.PlaySpeechNotification(mp2,"Lose") if mp2protect then mp2.MarkFailedObjective(mp2protect) else mp2.MarkFailedObjective(mp2protectInitialUnits) end end Media.DisplayMessage("The southern "..mp0.Faction.." coalition has been defeated!","Mission Failed",HSLColor.Red) Media.DisplayMessage("The northern "..mp1.Faction.." and their allies win!","Mission Completed",HSLColor.Green) end) Trigger.OnPlayerLost(mp1,function(p) victoryTeam1() Media.PlaySpeechNotification(p,"Lose") if mp3 then Media.PlaySpeechNotification(mp3,"Lose") if mp3protect then mp3.MarkFailedObjective(mp3protect) else mp3.MarkFailedObjective(mp3protectInitialUnits) end end Media.DisplayMessage("The northern "..mp1.Faction.." coalition has been defeated!","Mission Failed",HSLColor.Red) Media.DisplayMessage("The southern "..mp0.Faction.." and their allies win!","Mission Completed",HSLColor.Green) end) if mp2 then Trigger.OnPlayerLost(mp2,function(p) Media.PlaySpeechNotification(p,"Lose") Media.DisplayMessage(tostring(mp2).." has been defeated.","Mission Info",HSLColor.DarkGray) handBaseFromTo(mp2,neut) end) end if mp3 then Trigger.OnPlayerLost(mp3,function(p) Media.PlaySpeechNotification(p,"Lose") Media.DisplayMessage(tostring(mp3).." has been defeated.","Mission Info",HSLColor.DarkGray) handBaseFromTo(mp3,neut) end) end end function humiliatingDefeatTeam1() Media.DisplayMessage(GernericSoldier[7],"Soldier", HSLColor.DarkGray) mp0.MarkFailedObjective(mp0reachmain)--mp2 lost handled in OnPlayerLost end function humiliatingDefeatTeam2() Media.DisplayMessage(GernericSoldier[7],"Soldier", HSLColor.DarkGray) mp1.MarkFailedObjective(mp1reachmain)--mp3 lost handled in OnPlayerLost end function defeatTeam1() mp0.MarkFailedObjective(mp0survive)--mp2 lost handled in OnPlayerLost end function defeatTeam2() mp1.MarkFailedObjective(mp1survive)--mp3 lost handled in OnPlayerLost end function victoryTeam2() if mp1survive then mp1.MarkCompletedObjective(mp1survive) else mp1.MarkCompletedObjective(mp1reachmain) end if mp3protect then mp3.MarkCompletedObjective(mp3protect) elseif mp3protectInitialUnits then mp3.MarkCompletedObjective(mp3protectInitialUnits) end end function victoryTeam1() if mp0survive then mp0.MarkCompletedObjective(mp0survive) else mp0.MarkCompletedObjective(mp0reachmain) end if mp2protect then mp2.MarkCompletedObjective(mp2protect) elseif mp2protectInitialUnits then mp2.MarkCompletedObjective(mp2protectInitialUnits) end end function handBaseFromTo(donator,donee) for _,act in pairs(donator.GetActors()) do if act.Type~="player" then act.Owner=donee end end end function handBuildingsToNorthOutpost(outpostplayer) --MAP DEPENDENT HACK!!!!!!!!! Trigger.AfterDelay(1,function() --the game takes 1 tick to fill the map with all actors from the map file, which arent there yet in the zeroth tick local topleft=Map.CenterOfCell(CPos.New(53,22)) local bottomright=Map.CenterOfCell(CPos.New(63,33)) for _,act in pairs(Map.ActorsInBox(topleft, bottomright)) do act.Owner=outpostplayer end end) end function handBuildingsToSouthOutpost(outpostplayer) --MAP DEPENDENT HACK!!!!!!!!! Trigger.AfterDelay(1,function() --the game takes 1 tick to fill the map with all actors from the map file, which arent there yet in the zeroth tick local topleft=Map.CenterOfCell(CPos.New(59,69)) local bottomright=Map.CenterOfCell(CPos.New(72,80)) for _,act in pairs(Map.ActorsInBox(topleft,bottomright)) do act.Owner=outpostplayer end end) end function SendInitialReinforcements4p(mp0,mp1,mp2,mp3) SendInitialReinforcements2p(mp0,mp1) local team={"light_inf","light_inf","light_inf","light_inf","light_inf"} local path if mp2 then Media.PlaySpeechNotification(mp2,"Reinforce") path={CPos.New(101,119),CPos.New(97,115)} Reinforcements.Reinforce(mp2, team, path, 12) path={CPos.New(99,121),CPos.New(95,117)} Reinforcements.Reinforce(mp2, team, path, 12) end if mp3 then Media.PlaySpeechNotification(mp3,"Reinforce") path={CPos.New(2,4),CPos.New(6,8)} Reinforcements.Reinforce(mp3, team, path, 12) path={CPos.New(4,2),CPos.New(8,6)} Reinforcements.Reinforce(mp3, team, path, 12) end end function SendInitialReinforcements2p(mp0,mp1) Media.PlaySpeechNotification(mp0,"Reinforce") Media.PlaySpeechNotification(mp1,"Reinforce") local t1,t0,team,path if mp0.Faction=="atreides" then t0="combat_tank_a" elseif mp0.Faction=="harkonnen" then t0="combat_tank_h" elseif mp0.Faction=="ordos" then t0="combat_tank_o" end if mp1.Faction=="atreides" then t1="combat_tank_a" elseif mp1.Faction=="harkonnen" then t1="combat_tank_h" elseif mp1.Faction=="ordos" then t1="combat_tank_o" end team={t0,"trooper", "trooper"} path={CPos.New(101,121),CPos.New(97,117)} InitialU0 = Reinforcements.Reinforce(mp0, team, path) Trigger.OnAllKilled(InitialU0, function() if delayTrigger0 then humiliatingDefeatTeam1() end end) team={t1,"trooper", "trooper"} path={CPos.New(2,2),CPos.New(6,6)} InitialU1 = Reinforcements.Reinforce(mp1, team, path) Trigger.OnAllKilled(InitialU1, function() if delayTrigger1 then humiliatingDefeatTeam2() end end) end function initiateSmugglerTriggers() Trigger.OnPlayerDiscovered(smug, function(pdiscovered,pdiscoverer) soldierSays(pdiscoverer,GernericSoldier[3]) end) Trigger.OnDiscovered(Actor225, function(discovered,discoverer) Beacon.New(discoverer,Map.CenterOfCell(Actor225.Location)) sayTo(discoverer,MentatSmugglers[1]) Trigger.ClearAll( Actor225 ) end) Trigger.OnDiscovered(Actor227, function(discovered,discoverer) Beacon.New(discoverer,Map.CenterOfCell(Actor227.Location)) sayTo(discoverer,MentatSmugglers[1]) Trigger.ClearAll( Actor227 ) end) Trigger.AfterDelay(1,function() --the game takes 1 tick to fill the map with all actors from the map file, which arent there yet in the zeroth tick --MAP DEPENDENT HACK !!!!!!! local s1,s2,s3,s4,n1,n2,n3,n4 s1=getSmugglerActorsInBox(87,109,90,110) s2=getSmugglerActorsInBox(38,100,41,103) s3=getSmugglerActorsInBox(20,88,23,91) s4=getSmugglerActorsInBox(80,82,83,84) n1=getSmugglerActorsInBox(35,44,40,46) n2=getSmugglerActorsInBox(3,42,6,46) n3=getSmugglerActorsInBox(12,6,15,8) n4=getSmugglerActorsInBox(44,6,48,10) Trigger.OnAllRemovedFromWorld(s1,function() smugglersCleaned(1) end) Trigger.OnAllRemovedFromWorld(s2,function() smugglersCleaned(2) end) Trigger.OnAllRemovedFromWorld(s3,function() smugglersCleaned(3) end) Trigger.OnAllRemovedFromWorld(s4,function() smugglersCleaned(4) end) Trigger.OnAllRemovedFromWorld(n1,function() smugglersCleaned(5) end) Trigger.OnAllRemovedFromWorld(n2,function() smugglersCleaned(6) end) Trigger.OnAllRemovedFromWorld(n3,function() smugglersCleaned(7) end) Trigger.OnAllRemovedFromWorld(n4,function() smugglersCleaned(8) end) end) Trigger.AfterDelay(DateTime.Minutes(7),smugglerAttack) end function smugglersCleaned(team) if team>4 then team=team-4 SmugglersNorthDead[team]=true else SmugglersSouthDead[team]=true end if Utils.All(SmugglersSouthDead,function(e) return e end) then if mp2 and mp2cleanSmugglers then mp2.MarkCompletedObjective(mp2cleanSmugglers) end end if Utils.All(SmugglersNorthDead,function(e) return e end) then if mp3 and mp3cleanSmugglers then mp3.MarkCompletedObjective(mp3cleanSmugglers) end end end function getSmugglerActorsInBox(x0,y0,x1,y1) local topleft =Map.CenterOfCell(CPos.New(x0,y0)) local bottomright =Map.CenterOfCell(CPos.New(x1,y1)) local actors=Map.ActorsInBox(topleft,bottomright, function(act) if act.Type=="light_inf.smuggler" or act.Type=="trooper" or act.Type=="quad" then return act else return nil end end ) return actors end function removeSmugglerSurplusMoney() if smug.Resources >(smug.ResourceCapacity - 1000) then smug.Resources = smug.Resources-300 end end function smugglerAttack() --Map DEPENDENT !!!!! local units,squad,path Trigger.AfterDelay(DateTime.Seconds(15), function() sayTo(mp0,MentatSmugglers[2]) sayTo(mp1,MentatSmugglers[2]) end) path = {CPos.New(2,109),CPos.New(54,109)} squad = {"light_inf","light_inf","light_inf","quad","quad","trooper","trooper"} units = Reinforcements.ReinforceWithTransport(smug, "carryall.reinforce", squad, path, {path[2], path[1]}) onIdleAttack(units[2],CPos.New(70,96)) path = {CPos.New(101,6),CPos.New(32,6)} units = Reinforcements.ReinforceWithTransport(smug, "carryall.reinforce", squad, path, {path[2], path[1]}) onIdleAttack(units[2],CPos.New(37,26)) Trigger.AfterDelay(DateTime.Minutes(15),smugglerAttack) end function onIdleAttack(units,targetpos) for _,act in pairs(units) do Trigger.OnIdle(act, function(u) u.AttackMove(targetpos) end) end end function checkRockIsleLocations(act) --MAP DEPENDENT!!!! local xa = act.Location.X local ya = act.Location.Y if xa>=82 and 101>=xa and ya>=106 and 121>=ya then buildingPlacedOnIsle(act,5) end if xa>=84 and 101>=xa and ya>=63 and 85>=ya then buildingPlacedOnIsle(act,4) end if xa>=79 and 95>=xa and ya>=28 and 54>=ya then buildingPlacedOnIsle(act,3) end if xa>=87 and 99>=xa and ya>=2 and 13>=ya then buildingPlacedOnIsle(act,2) end if xa>=54 and 70>=xa and ya>=43 and 57>=ya then buildingPlacedOnIsle(act,13) end if xa>=2 and 21>=xa and ya>=49 and 69>=ya then buildingPlacedOnIsle(act,9) end if xa>=5 and 15>=xa and ya>=78 and 88>=ya then buildingPlacedOnIsle(act,8) end if xa>=2 and 15>=xa and ya>=95 and 110>=ya then buildingPlacedOnIsle(act,7) end if xa>=58 and 75>=xa and ya>=69 and 81>=ya then buildingPlacedOnIsle(act,14) end if xa>=9 and 49>=xa and ya>=7 and 40>=ya then buildingPlacedOnIsle(act,11) end if xa>=54 and 68>=xa and ya>=23 and 36>=ya then buildingPlacedOnIsle(act,12) end if (xa>=31 and 53>=xa and ya>=80 and 99>=ya) or (xa>=52 and 83>=xa and ya>=86 and 108>=ya) then buildingPlacedOnIsle(act,6) end if (xa>=48 and 82>=xa and ya>=2 and 19>=ya) or (xa>=65 and 81>=xa and ya>=20 and 27>=ya) then buildingPlacedOnIsle(act,1) end end function buildingPlacedOnIsle(actor,isle) local p if actor.Owner==mp0 then p=1 elseif actor.Owner==mp1 then p=2 elseif actor.Owner==mp2 then p=3 elseif actor.Owner==mp3 then p=4 end IsleBuildings[p][isle][tostring(actor)]=true checkIsleOwnership(isle) Trigger.OnCapture(actor,function(act,_,oldowner,newowner) local oo,no if oldowner==mp0 then oo=1 elseif oldowner==mp1 then oo=2 elseif oldowner==mp2 then oo=3 elseif oldowner==mp3 then oo=4 end if newowner==mp0 then no=1 elseif newowner==mp1 then no=2 elseif newowner==mp2 then no=3 elseif newowner==mp3 then no=4 end IsleBuildings[oo][isle][tostring(actor)]=nil IsleBuildings[no][isle][tostring(actor)]=true checkIsleOwnership(isle) end) Trigger.OnRemovedFromWorld(actor,function(act) local o if act.Owner==mp0 then o=1 elseif act.Owner==mp1 then o=2 elseif act.Owner==mp2 then o=3 elseif act.Owner==mp3 then o=4 end --removing " (not in world))" from actor description before nillifying entry IsleBuildings[o][isle][string.sub(tostring(act),1,-17)..")"]=nil checkIsleOwnership(isle) end) end function checkIsleOwnership(isle) local mp0claim =true local mp1claim =true local mp2claim =true local mp3claim =true if entryCount(IsleBuildings[1][isle])==0 then mp0claim =false end if entryCount(IsleBuildings[2][isle])==0 then mp1claim =false end if entryCount(IsleBuildings[3][isle])==0 then mp2claim =false end if entryCount(IsleBuildings[4][isle])==0 then mp3claim =false end if mp2claim and mp3claim==false and mp1claim==false then isleCaptured(mp2,isle) elseif mp3claim and mp2claim==false and mp0claim==false then isleCaptured(mp3,isle) elseif mp0claim==false and mp1claim==false and mp2claim==false and mp3claim==false then isleLost(isle) else isleContested(isle) end end function entryCount(list) local i=0 for a,e in pairs(list) do if e then i=i+1 end end return i end function isleCaptured(player,isle) if IsleOwner[isle]==false then IsleOwner[isle]=player IsleClock[isle]=IsleReinforcementTime sayTo(player,MentatRockIsles[2]) end end function isleLost(isle) if IsleOwner[isle]~=false then sayTo(IsleOwner[isle],MentatRockIsles[4]) IsleOwner[isle]=false IsleClock[isle]= -1 end end function isleContested(isle) if IsleOwner[isle]~=false then sayTo(IsleOwner[isle],MentatRockIsles[3]) IsleOwner[isle]=false IsleClock[isle]= -1 end end function rockIslandClockTick() for isle=1,14 do if IsleClock[isle]==0 then sendIsleReinforcements(isle) IsleClock[isle]=IsleReinforcementTime+1 end IsleClock[isle]=IsleClock[isle]-1 end end function sendIsleReinforcements(isle) if IsleOwner[isle]~=false then --MAP DEPENDENT!!!!!!!!!!!! local path,c,c2,squad if isle==1 then c=CPos.New(67,9) c2=c elseif isle==2 then c=CPos.New(91,11) c2=c elseif isle==3 then c=CPos.New(88,50) c2=c elseif isle==4 then c=CPos.New(96,74) c2=c elseif isle==5 then c=CPos.New(97,117) c2=c elseif isle==6 then c=CPos.New(44,88) c2=c elseif isle==7 then c=CPos.New(12,105) c2=c elseif isle==8 then c=CPos.New(6,82) c2=c elseif isle==9 then c=CPos.New(6,57) c2=c elseif isle==11 then c=CPos.New(23,23) c2=c elseif isle==12 then c=CPos.New(58,28) c2=c elseif isle==13 --oddball center isle special treatment then c=CPos.New(64,51) if IsleOwner[isle]==mp2 then c2=CPos.New(64,121) else c2=CPos.New(64,1) end elseif isle==14 then c=CPos.New(67,75) c2=c end path = {Map.ClosestEdgeCell(c2),c} squad = {"combat_tank_m.starport","quad","quad","light_inf","light_inf","light_inf","light_inf"} ReinforceWithControllableCarryall(IsleOwner[isle], squad , path) if MentatShort[IsleOwner[isle]] then sayTo(IsleOwner[isle],MentatRockIsles[6]) else sayTo(IsleOwner[isle],MentatRockIsles[5]) MentatShort[IsleOwner[isle]]=true end end end