diff --git a/mods/ra/maps/soviet-08a/map.yaml b/mods/ra/maps/soviet-08a/map.yaml index 726afd2f78..908b3e77f6 100644 --- a/mods/ra/maps/soviet-08a/map.yaml +++ b/mods/ra/maps/soviet-08a/map.yaml @@ -921,31 +921,31 @@ Actors: Location: 100,97 Owner: USSR Facing: 127 - Actor258: pt + Boat1: pt Location: 19,26 Owner: Greece Facing: 191 - Actor259: pt + Boat2: pt Location: 19,58 Owner: Greece Facing: 159 - Actor260: pt + Boat3: pt Location: 49,109 Owner: Greece Facing: 223 - Actor261: pt + Boat4: pt Location: 109,75 Owner: Greece Facing: 31 - Actor262: pt + Boat5: pt Location: 109,31 Owner: Greece Facing: 63 - Actor263: pt + Boat6: pt Location: 69,18 Owner: Greece Facing: 63 - Actor264: dd + Boat7: dd Location: 48,23 Owner: Greece Facing: 159 @@ -1063,5 +1063,8 @@ Actors: DDPatrol2Point7: waypoint Location: 97,78 Owner: Neutral + BoatRally: waypoint + Location: 97,93 + Owner: Neutral Rules: ra|rules/campaign-rules.yaml, ra|rules/campaign-tooltips.yaml, ra|rules/campaign-palettes.yaml, rules.yaml diff --git a/mods/ra/maps/soviet-08a/rules.yaml b/mods/ra/maps/soviet-08a/rules.yaml index 521354735e..2e35849361 100644 --- a/mods/ra/maps/soviet-08a/rules.yaml +++ b/mods/ra/maps/soviet-08a/rules.yaml @@ -33,6 +33,11 @@ LST.Reinforcement: Image: lst Interactable: +V01: + -SpawnActorOnDeath@1: + -SpawnActorOnDeath@2: + -SpawnActorOnDeath@3: + SCRIPTEDDROP: ParatroopersPower: DisplayBeacon: False diff --git a/mods/ra/maps/soviet-08a/soviet08a-AI.lua b/mods/ra/maps/soviet-08a/soviet08a-AI.lua index da48a1a74b..cd592de771 100644 --- a/mods/ra/maps/soviet-08a/soviet08a-AI.lua +++ b/mods/ra/maps/soviet-08a/soviet08a-AI.lua @@ -8,8 +8,7 @@ ]] IdlingUnits = { } -DDPatrol1 = { "dd", "dd" } -DDPatrol2 = { "dd", "dd" } +DDPatrol = { "dd", "dd" } DDPatrol1Path = { DDPatrol1Point1.Location, DDPatrol1Point2.Location, DDPatrol1Point3.Location, DDPatrol1Point4.Location, DDPatrol1Point5.Location, DDPatrol1Point6.Location } DDPatrol2Path = { DDPatrol2Point1.Location, DDPatrol2Point2.Location, DDPatrol2Point3.Location, DDPatrol2Point4.Location, DDPatrol2Point5.Location, DDPatrol2Point6.Location, DDPatrol2Point7.Location } ShipArrivePath = { DDEntry.Location, DDEntryStop.Location } @@ -33,9 +32,9 @@ WTransUnits = WTransDelays = { - easy = 5, - normal = 3, - hard = 2 + easy = DateTime.Minutes(5), + normal = DateTime.Minutes(3), + hard = DateTime.Minutes(2) } AttackGroup = { } @@ -62,7 +61,7 @@ IdleHunt = function(unit) if not unit.IsDead then Trigger.OnIdle(unit, unit.Hunt WTransWaves = function() local way = Utils.Random(WTransWays) local units = Utils.Random(WTransUnits) - local attackUnits = Reinforcements.ReinforceWithTransport(greece, "lst", units , way, { way[2], way[1] })[2] + local attackUnits = Reinforcements.ReinforceWithTransport(Greece, "lst", units , way, { way[2], way[1] })[2] Utils.Do(attackUnits, function(a) Trigger.OnAddedToWorld(a, function() a.AttackMove(SovietStart.Location) @@ -70,7 +69,7 @@ WTransWaves = function() end) end) - Trigger.AfterDelay(DateTime.Minutes(WTransDelays), WTransWaves) + Trigger.AfterDelay(WTransDelays, WTransWaves) end SendAttackGroup = function() @@ -88,11 +87,11 @@ SendAttackGroup = function() end ProduceInfantry = function() - if (GreeceTent1.IsDead or GreeceTent1.Owner ~= greece) and (GreeceTent2.IsDead or GreeceTent2.Owner ~= greece) then + if (GreeceTent1.IsDead or GreeceTent1.Owner ~= Greece) and (GreeceTent2.IsDead or GreeceTent2.Owner ~= Greece) then return end - greece.Build({ Utils.Random(AlliedInfantry) }, function(units) + Greece.Build({ Utils.Random(AlliedInfantry) }, function(units) table.insert(AttackGroup, units[1]) SendAttackGroup() Trigger.AfterDelay(ProductionInterval[Map.LobbyOption("difficulty")], ProduceInfantry) @@ -100,55 +99,36 @@ ProduceInfantry = function() end ProduceVehicles = function() - if GreeceWarFactory.IsDead or GreeceWarFactory.Owner ~= greece then + if GreeceWarFactory.IsDead or GreeceWarFactory.Owner ~= Greece then return end - greece.Build({ Utils.Random(AlliedVehicles[AlliedVehicleType]) }, function(units) + Greece.Build({ Utils.Random(AlliedVehicles[AlliedVehicleType]) }, function(units) table.insert(AttackGroup, units[1]) SendAttackGroup() Trigger.AfterDelay(ProductionInterval[Map.LobbyOption("difficulty")], ProduceVehicles) end) end -BringDDPatrol1 = function() - local units = Reinforcements.Reinforce(greece, DDPatrol1, ShipArrivePath, 0) +BringDDPatrol = function(patrolPath) + local units = Reinforcements.Reinforce(Greece, DDPatrol, ShipArrivePath) Utils.Do(units, function(unit) Trigger.OnIdle(unit, function(patrols) - patrols.Patrol(DDPatrol1Path, true, 200) + patrols.Patrol(patrolPath, true, 200) end) end) - if GreeceNavalYard.IsDead then - return - else - Trigger.OnAllKilled(units, function() - if Map.LobbyOption("difficulty") == "easy" then - Trigger.AfterDelay(DateTime.Minutes(7), BringDDPatrol1) - else - Trigger.AfterDelay(DateTime.Minutes(4), BringDDPatrol1) - end - end) - end -end -BringDDPatrol2 = function() - local units = Reinforcements.Reinforce(greece, DDPatrol2, ShipArrivePath, 0) - Utils.Do(units, function(unit) - Trigger.OnIdle(unit, function(patrols) - patrols.Patrol(DDPatrol2Path, true, 200) - end) - end) - if GreeceNavalYard.IsDead then - return - else - Trigger.OnAllKilled(units, function() + Trigger.OnAllKilled(units, function() + if GreeceNavalYard.IsDead then + return + else if Map.LobbyOption("difficulty") == "easy" then - Trigger.AfterDelay(DateTime.Minutes(7), BringDDPatrol2) + Trigger.AfterDelay(DateTime.Minutes(7), function() BringDDPatrol(patrolPath) end) else - Trigger.AfterDelay(DateTime.Minutes(4), BringDDPatrol2) + Trigger.AfterDelay(DateTime.Minutes(4), function() BringDDPatrol(patrolPath) end) end - end) - end + end + end) end ActivateAI = function() @@ -156,10 +136,10 @@ ActivateAI = function() WTransUnits = WTransUnits[difficulty] WTransDelays = WTransDelays[difficulty] - local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == greece and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == Greece and self.HasProperty("StartBuildingRepairs") end) Utils.Do(buildings, function(actor) Trigger.OnDamaged(actor, function(building) - if building.Owner == greece and building.Health < building.MaxHealth * 3/4 then + if building.Owner == Greece and building.Health < building.MaxHealth * 3/4 then building.StartBuildingRepairs() end end) @@ -171,6 +151,6 @@ ActivateAI = function() ProduceInfantry() ProduceVehicles() - BringDDPatrol1() - Trigger.AfterDelay(DateTime.Minutes(1), BringDDPatrol2) + BringDDPatrol(DDPatrol1Path) + Trigger.AfterDelay(DateTime.Minutes(1), function() BringDDPatrol(DDPatrol2Path) end) end diff --git a/mods/ra/maps/soviet-08a/soviet08a.lua b/mods/ra/maps/soviet-08a/soviet08a.lua index 277e3d20da..5096d40b69 100644 --- a/mods/ra/maps/soviet-08a/soviet08a.lua +++ b/mods/ra/maps/soviet-08a/soviet08a.lua @@ -6,9 +6,9 @@ the License, or (at your option) any later version. For more information, see COPYING. ]] -alliedScouts = { Actor189, Actor216, Actor217, Actor218, Actor219 } +AlliedScouts = { Actor189, Actor216, Actor217, Actor218, Actor219 } -ussrReinforcements = +SovReinforcements = { east = { @@ -30,66 +30,58 @@ ussrReinforcements = } } -Obj2ActorTriggerActivator = { Church, Actor147, Actor148, Actor149, Actor150, Actor151, Actor152, Actor153 } +Village = { Church, Actor147, Actor148, Actor149, Actor150, Actor151, Actor152, Actor153 } ActivateAIDelay = DateTime.Seconds(45) AddEastReinforcementTrigger = function() Trigger.AfterDelay(DateTime.Seconds(30), function() - Media.PlaySpeechNotification(ussr, "ReinforcementsArrived") - local reinforcement = ussrReinforcements.east - Reinforcements.ReinforceWithTransport(ussr, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") + local reinforcement = SovReinforcements.east + Reinforcements.ReinforceWithTransport(USSR, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) end) end AddSouthReinforcementTrigger = function() Trigger.AfterDelay(DateTime.Seconds(60), function() - Media.PlaySpeechNotification(ussr, "ReinforcementsArrived") - local reinforcement = ussrReinforcements.south - Reinforcements.ReinforceWithTransport(ussr, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") + local reinforcement = SovReinforcements.south + Reinforcements.ReinforceWithTransport(USSR, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) end) end AddParadropReinforcementTrigger = function() Trigger.AfterDelay(DateTime.Seconds(90), function() - Media.PlaySpeechNotification(ussr, "ReinforcementsArrived") - scripteddrop.TargetParatroopers(ScriptedParadrop.CenterPosition, Angle.New(40)) + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") + ScriptedDrop.TargetParatroopers(ScriptedParadrop.CenterPosition, Angle.New(40)) end) end ChurchAmbushTrigger = function() if not AmbushSwitch then - local hiding = Reinforcements.Reinforce(germany, { 'e1', 'e1', 'e1', 'e1', 'e1', 'e1', 'e1', 'e3', 'e3', 'e3' }, { ChurchAmbush.Location, AmbushMove.Location }) - Utils.Do(hiding, function(actor) - IdleHunt(actor) - end) + local hiding = Reinforcements.Reinforce(Germany, { 'e1', 'e1', 'e1', 'e1', 'e1', 'e1', 'e1', 'e3', 'e3', 'e3' }, { ChurchAmbush.Location, AmbushMove.Location }, 0) + Utils.Do(hiding, IdleHunt) end AmbushSwitch = true end Trigger.OnKilled(Church, function() - Actor.Create("moneycrate", true, { Owner = ussr, Location = ChurchAmbush.Location }) + Actor.Create("moneycrate", true, { Owner = USSR, Location = ChurchAmbush.Location }) end) -Obj2TriggerFunction = function() - ussr.MarkCompletedObjective(DestroyVillageObjective) - Media.PlaySpeechNotification(ussr, "ReinforcementsArrived") - local reinforcement = ussrReinforcements.mammoth - Reinforcements.ReinforceWithTransport(ussr, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) -end - -AddReinforcmentTriggers = function() - AddEastReinforcementTrigger() - AddSouthReinforcementTrigger() - AddParadropReinforcementTrigger() +DestroyVillage = function() + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") + USSR.MarkCompletedObjective(DestroyVillageObjective) + local reinforcement = SovReinforcements.mammoth + Reinforcements.ReinforceWithTransport(USSR, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) end AddRetreatTrigger = function() Trigger.OnEnteredProximityTrigger(Actor222.CenterPosition, WDist.FromCells(12), function(actor, id) - if actor.Owner == ussr and actor.Type == "barr" then - alliedScouts = Utils.Where(alliedScouts, function(scout) return not scout.IsDead end) + if actor.Owner == USSR and actor.Type == "barr" then + AlliedScouts = Utils.Where(AlliedScouts, function(scout) return not scout.IsDead end) local removed - Utils.Do(alliedScouts, function(scout) + Utils.Do(AlliedScouts, function(scout) if scout.Type == "e1" and not removed then removed = true else @@ -102,61 +94,78 @@ AddRetreatTrigger = function() end) end -Tick = function() - greece.Cash = 1000 +BoatAttack = function(boat) + if boat.IsDead then + return + else + boat.AttackMove(BoatRally.Location) + end +end - if greece.HasNoRequiredUnits() and germany.HasNoRequiredUnits() then - ussr.MarkCompletedObjective(KillAll) +Tick = function() + Greece.Cash = 1000 + + if Greece.HasNoRequiredUnits() and Germany.HasNoRequiredUnits() then + USSR.MarkCompletedObjective(KillAll) end - if ussr.HasNoRequiredUnits() then - greece.MarkCompletedObjective(BeatUSSR) + if USSR.HasNoRequiredUnits() then + Greece.MarkCompletedObjective(BeatUSSR) end end WorldLoaded = function() - ussr = Player.GetPlayer("USSR") - germany = Player.GetPlayer("Germany") - greece = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") + Germany = Player.GetPlayer("Germany") + Greece = Player.GetPlayer("Greece") - Trigger.OnObjectiveAdded(ussr, function(p, id) + Trigger.OnObjectiveAdded(USSR, function(p, id) Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") end) - KillAll = ussr.AddPrimaryObjective("Destroy all Allied units and structures.") - DestroyVillageObjective = ussr.AddSecondaryObjective("Destroy the village of Allied sympathizers.") - BeatUSSR = greece.AddPrimaryObjective("Defeat the Soviet forces.") + KillAll = USSR.AddObjective("Destroy all Allied units and structures.") + DestroyVillageObjective = USSR.AddObjective("Destroy the village of Allied sympathizers.", "Secondary", false) + BeatUSSR = Greece.AddObjective("Defeat the Soviet forces.") - Trigger.OnObjectiveCompleted(ussr, function(p, id) + Trigger.OnObjectiveCompleted(USSR, function(p, id) Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") end) - Trigger.OnObjectiveFailed(ussr, function(p, id) + Trigger.OnObjectiveFailed(USSR, function(p, id) Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") end) - Trigger.OnPlayerLost(ussr, function() + Trigger.OnPlayerLost(USSR, function() Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(ussr, "MissionFailed") + Media.PlaySpeechNotification(USSR, "MissionFailed") end) end) - Trigger.OnPlayerWon(ussr, function() + Trigger.OnPlayerWon(USSR, function() Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(ussr, "MissionAccomplished") + Media.PlaySpeechNotification(USSR, "MissionAccomplished") end) end) - AddReinforcmentTriggers() + AddEastReinforcementTrigger() + AddSouthReinforcementTrigger() + AddParadropReinforcementTrigger() AddRetreatTrigger() - scripteddrop = Actor.Create("scripteddrop", false, { Owner = ussr }) + ScriptedDrop = Actor.Create("scripteddrop", false, { Owner = USSR }) - OnAnyDamaged(Obj2ActorTriggerActivator, ChurchAmbushTrigger) + OnAnyDamaged(Village, ChurchAmbushTrigger) - Trigger.OnAllRemovedFromWorld(Obj2ActorTriggerActivator, Obj2TriggerFunction) + Trigger.OnAllRemovedFromWorld(Village, DestroyVillage) Camera.Position = SovietBase.CenterPosition Trigger.AfterDelay(ActivateAIDelay, ActivateAI) + Trigger.AfterDelay(DateTime.Minutes(2), function() BoatAttack(Boat1) end) + Trigger.AfterDelay(DateTime.Minutes(5), function() BoatAttack(Boat2) end) + Trigger.AfterDelay(DateTime.Minutes(7), function() BoatAttack(Boat3) end) + Trigger.AfterDelay(DateTime.Minutes(10), function() BoatAttack(Boat4) end) + Trigger.AfterDelay(DateTime.Minutes(12), function() BoatAttack(Boat5) end) + Trigger.AfterDelay(DateTime.Minutes(14), function() BoatAttack(Boat6) end) + Trigger.AfterDelay(DateTime.Minutes(15), function() BoatAttack(Boat7) end) end OnAnyDamaged = function(actors, func)