diff --git a/mods/ra/maps/survival01/survival01.lua b/mods/ra/maps/survival01/survival01.lua index 3bf4fc7a89..4206d6ec9d 100644 --- a/mods/ra/maps/survival01/survival01.lua +++ b/mods/ra/maps/survival01/survival01.lua @@ -66,6 +66,7 @@ SovietBuildings = { Barrack1, SubPen, RadarDome, AdvancedPowerPlant1, AdvancedPo IdleTrigger = function(units, dest) Utils.Do(units, function(unit) + Trigger.OnIdle(unit, function() local bool = Utils.All(units, function(unit) return unit.IsIdle end) if bool then @@ -76,22 +77,35 @@ IdleTrigger = function(units, dest) if not unit.IsDead then if dest then unit.AttackMove(dest, 3) end Trigger.OnIdle(unit, unit.Hunt) + Trigger.OnCapture(unit, function() + Trigger.ClearAll(unit) + end) end end) end end) end end) + Trigger.OnDamaged(unit, function() Utils.Do(units, function(unit) if not unit.IsDead then Trigger.ClearAll(unit) Trigger.AfterDelay(0, function() - if not unit.IsDead then Trigger.OnIdle(unit, unit.Hunt) end + if not unit.IsDead then + Trigger.OnIdle(unit, unit.Hunt) + Trigger.OnCapture(unit, function() + Trigger.ClearAll(unit) + end) + end end) end end) end) + + Trigger.OnCapture(unit, function() + Trigger.ClearAll(unit) + end) end) end diff --git a/mods/ra/maps/survival02/survival02.lua b/mods/ra/maps/survival02/survival02.lua index ed2f438afa..7e6ec0260b 100644 --- a/mods/ra/maps/survival02/survival02.lua +++ b/mods/ra/maps/survival02/survival02.lua @@ -55,6 +55,10 @@ GuardHarvester = function(unit, harvester) unit.AttackMove(start) end end) + + Trigger.OnCapture(unit, function() + Trigger.ClearAll(unit) + end) end end @@ -118,12 +122,20 @@ SpawnSovietVehicle = function(spawnpoints, rallypoints) local rally = Utils.RandomInteger(1, #rallypoints + 1) local unit = Reinforcements.Reinforce(soviets, { Utils.Random(SovietVehicles) }, { spawnpoints[route].Location, rallypoints[rally].Location })[1] IdleHunt(unit) + + Trigger.OnCapture(unit, function() + Trigger.ClearAll(unit) + end) end SpawnAndAttack = function(types, entry) local units = Reinforcements.Reinforce(soviets, types, { entry }) Utils.Do(units, function(unit) IdleHunt(unit) + + Trigger.OnCapture(unit, function() + Trigger.ClearAll(unit) + end) end) return units end @@ -174,7 +186,7 @@ FinalAttack = function() insert(units4) insert(units5) - Trigger.OnAllKilled(units, function() + Trigger.OnAllKilledOrCaptured(units, function() if not DestroyObj then Media.DisplayMessage("Excellent work Commander! We have reinforced our position enough to initiate a counter-attack.", "Incoming Report") DestroyObj = allies.AddPrimaryObjective("Destroy the remaining Soviet forces in the area!") @@ -310,6 +322,9 @@ SetupSoviets = function() GuardHarvester(unit, Harvester1) end) end) + Trigger.OnCapture(Harvester1, function() + Trigger.ClearAll(Harvester1) + end) Harvester2.FindResources() Trigger.OnDamaged(Harvester2, function() @@ -327,6 +342,9 @@ SetupSoviets = function() end) end) end) + Trigger.OnCapture(Harvester2, function() + Trigger.ClearAll(Harvester2) + end) Trigger.AfterDelay(0, function() local buildings = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Owner == soviets and self.HasProperty("StartBuildingRepairs") end)