diff --git a/mods/ra/maps/allies-02/allies02.lua b/mods/ra/maps/allies-02/allies02.lua index 3a9ecc2607..cf6af42e3b 100644 --- a/mods/ra/maps/allies-02/allies02.lua +++ b/mods/ra/maps/allies-02/allies02.lua @@ -7,10 +7,62 @@ JeepPath = { ReinforcementsEntryPoint.Location, ReinforcementsRallyPoint.Locatio TruckReinforcements = { "truk", "truk", "truk" } TruckPath = { TruckEntryPoint.Location, TruckRallyPoint.Location } -TimerTicks = DateTime.Minutes(10) +PathGuards = { PathGuard1, PathGuard2, PathGuard3, PathGuard4, PathGuard5, PathGuard6, PathGuard7, PathGuard8, PathGuard9, PathGuard10, PathGuard11, PathGuard12, PathGuard13, PathGuard14, PathGuard15 } -SendConstructionVehicleReinforcements = function() - local mcv = Reinforcements.Reinforce(player, ConstructionVehicleReinforcements, ConstructionVehiclePath)[1] +IdlingUnits = { } + +if Map.Difficulty == "Easy" then + TimerTicks = DateTime.Minutes(10) + Announcements = + { + { "TenMinutesRemaining", DateTime.Seconds(3) }, + { "WarningFiveMinutesRemaining", DateTime.Minutes(5) }, + { "WarningFourMinutesRemaining", DateTime.Minutes(6) }, + { "WarningThreeMinutesRemaining", DateTime.Minutes(7) }, + { "WarningTwoMinutesRemaining", DateTime.Minutes(8) }, + { "WarningOneMinuteRemaining", DateTime.Minutes(9) } + } + +elseif Map.Difficulty == "Normal" then + TimerTicks = DateTime.Minutes(5) + Announcements = + { + { "WarningFiveMinutesRemaining", DateTime.Seconds(3) }, + { "WarningFourMinutesRemaining", DateTime.Minutes(6) }, + { "WarningThreeMinutesRemaining", DateTime.Minutes(7) }, + { "WarningTwoMinutesRemaining", DateTime.Minutes(8) }, + { "WarningOneMinuteRemaining", DateTime.Minutes(9) } + } + + InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "e1" } + InfantryDelay = DateTime.Seconds(18) + AttackGroupSize = 5 + +elseif Map.Difficulty == "Hard" then + TimerTicks = DateTime.Minutes(3) + Announcements = + { + { "WarningThreeMinutesRemaining", DateTime.Seconds(3) }, + { "WarningTwoMinutesRemaining", DateTime.Minutes(1) }, + { "WarningOneMinuteRemaining", DateTime.Minutes(2) }, + } + + InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "e1" } + InfantryDelay = DateTime.Seconds(10) + VehicleTypes = { "ftrk" } + VehicleDelay = DateTime.Seconds(30) + AttackGroupSize = 7 + +else + TimerTicks = DateTime.Minutes(1) + Announcements = { { "WarningOneMinuteRemaining", DateTime.Seconds(3) } } + ConstructionVehicleReinforcements = { "jeep" } + + InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "dog", "dog" } + InfantryDelay = DateTime.Seconds(10) + VehicleTypes = { "ftrk" } + VehicleDelay = DateTime.Minutes(1) + DateTime.Seconds(10) + AttackGroupSize = 5 end SendJeepReinforcements = function() @@ -20,27 +72,97 @@ end RunInitialActivities = function() Harvester.FindResources() + Trigger.OnKilled(Harvester, function() HarvesterKilled = true end) + + Trigger.OnAllKilled(PathGuards, SendTrucks) + + if InfantryTypes then + Trigger.AfterDelay(InfantryDelay, InfantryProduction) + end + + if VehicleTypes then + Trigger.AfterDelay(VehicleDelay, VehicleProduction) + end end -MissionAccomplished = function() - Media.PlaySpeechNotification(player, "MissionAccomplished") +InfantryProduction = function() + if SovietBarracks.IsDead then + return + end + + local toBuild = { Utils.Random(InfantryTypes) } + + if SovietKennel.IsDead and toBuild == "dog" then + toBuild = "e1" + end + + ussr.Build(toBuild, function(unit) + IdlingUnits[#IdlingUnits + 1] = unit[1] + Trigger.AfterDelay(InfantryDelay, InfantryProduction) + + if #IdlingUnits >= (AttackGroupSize * 1.5) then + SendAttack() + end + end) end -MissionFailed = function() - Media.PlaySpeechNotification(player, "MissionFailed") +VehicleProduction = function() + if SovietWarfactory.IsDead then + return + end + + if HarvesterKilled then + ussr.Build({ "harv" }, function(harv) + harv[1].FindResources() + Trigger.OnKilled(harv[1], function() HarvesterKilled = true end) + + HarvesterKilled = false + VehicleProduction() + end) + return + end + + local toBuild = { Utils.Random(VehicleTypes) } + ussr.Build(toBuild, function(unit) + IdlingUnits[#IdlingUnits + 1] = unit[1] + Trigger.AfterDelay(VehicleDelay, VehicleProduction) + + if #IdlingUnits >= (AttackGroupSize * 1.5) then + SendAttack() + end + end) +end + +SendAttack = function() + local units = { } + + for i = 0, AttackGroupSize, 1 do + local number = Utils.RandomInteger(1, #IdlingUnits) + + if IdlingUnits[number] and not IdlingUnits[number].IsDead then + units[i] = IdlingUnits[number] + table.remove(IdlingUnits, number) + end + end + + Utils.Do(units, function(unit) + if Map.Difficulty ~= "Real tough guy" then + unit.AttackMove(DeployPoint.Location) + end + Trigger.OnIdle(unit, unit.Hunt) + end) end ticked = TimerTicks Tick = function() ussr.Resources = ussr.Resources - (0.01 * ussr.ResourceCapacity / 25) - if ukraine.HasNoRequiredUnits() then - SendTrucks() + if ussr.HasNoRequiredUnits() then player.MarkCompletedObjective(ConquestObjective) end if player.HasNoRequiredUnits() then - player.MarkFailedObjective(ConquestObjective) + ussr.MarkCompletedObjective(ussrObj) end if ticked > 0 then @@ -69,8 +191,11 @@ ConvoyOnSite = false SendTrucks = function() if not ConvoyOnSite then ConvoyOnSite = true + ticked = 0 ConvoyObjective = player.AddPrimaryObjective("Escort the convoy.") + player.MarkCompletedObjective(SecureObjective) + Media.PlaySpeechNotification(player, "ConvoyApproaching") Trigger.AfterDelay(DateTime.Seconds(3), function() ConvoyUnharmed = true @@ -102,19 +227,20 @@ ConvoyCasualites = function() end end -ConvoyTimer = function(delay, notification) - Trigger.AfterDelay(delay, function() - if not ConvoyOnSite then - Media.PlaySpeechNotification(player, notification) - end - end) +ConvoyTimerAnnouncements = function() + for i = #Announcements, 1, -1 do + Trigger.AfterDelay(Announcements[i][2], function() + if not ConvoyOnSite then + Media.PlaySpeechNotification(player, Announcements[i][1]) + end + end) + end end WorldLoaded = function() player = Player.GetPlayer("Greece") france = Player.GetPlayer("France") ussr = Player.GetPlayer("USSR") - ukraine = Player.GetPlayer("Ukraine") Trigger.OnObjectiveAdded(player, function(p, id) Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") @@ -125,26 +251,28 @@ WorldLoaded = function() Trigger.OnObjectiveFailed(player, function(p, id) Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") end) - Trigger.OnPlayerLost(player, MissionFailed) - Trigger.OnPlayerWon(player, MissionAccomplished) + Trigger.OnPlayerLost(player, function() + Media.PlaySpeechNotification(player, "MissionFailed") + end) + Trigger.OnPlayerWon(player, function() + Media.PlaySpeechNotification(player, "MissionAccomplished") + end) - ConquestObjective = player.AddPrimaryObjective("Secure the area.") + ussrObj = ussr.AddPrimaryObjective("Deny the allies!") + + SecureObjective = player.AddPrimaryObjective("Secure the convoy's path.") + ConquestObjective = player.AddPrimaryObjective("Eliminate the entire soviet presence in this area.") Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(allies, "MissionTimerInitialised") end) RunInitialActivities() - SendConstructionVehicleReinforcements() + Reinforcements.Reinforce(player, ConstructionVehicleReinforcements, ConstructionVehiclePath) Trigger.AfterDelay(DateTime.Seconds(5), SendJeepReinforcements) Trigger.AfterDelay(DateTime.Seconds(10), SendJeepReinforcements) Camera.Position = ReinforcementsEntryPoint.CenterPosition TimerColor = player.Color - ConvoyTimer(DateTime.Seconds(3), "TenMinutesRemaining") - ConvoyTimer(DateTime.Minutes(5), "WarningFiveMinutesRemaining") - ConvoyTimer(DateTime.Minutes(6), "WarningFourMinutesRemaining") - ConvoyTimer(DateTime.Minutes(7), "WarningThreeMinutesRemaining") - ConvoyTimer(DateTime.Minutes(8), "WarningTwoMinutesRemaining") - ConvoyTimer(DateTime.Minutes(9), "WarningOneMinuteRemaining") + ConvoyTimerAnnouncements() end diff --git a/mods/ra/maps/allies-02/map.yaml b/mods/ra/maps/allies-02/map.yaml index a63ff33729..29b7fa9cc7 100644 --- a/mods/ra/maps/allies-02/map.yaml +++ b/mods/ra/maps/allies-02/map.yaml @@ -33,32 +33,26 @@ Options: StartingCash: 5700 ConfigurableStartingUnits: False ShortGame: False + Difficulties: Easy, Normal, Hard, Real tough guy Players: PlayerReference@USSR: Name: USSR Faction: soviet ColorRamp: 3,255,127 - Allies: Ukraine Enemies: Greece, France PlayerReference@France: Name: France NonCombatant: True Faction: allies ColorRamp: 115,115,143 - Allies: Greece, France - Enemies: USSR, Ukraine + Allies: Greece + Enemies: USSR PlayerReference@Neutral: Name: Neutral OwnsWorld: True NonCombatant: True Faction: allies - PlayerReference@Ukraine: - Name: Ukraine - Faction: soviet - ColorRamp: 3,255,127 - Allies: USSR - Enemies: Greece, France PlayerReference@Greece: Name: Greece Playable: True @@ -71,7 +65,7 @@ Players: LockSpawn: True LockTeam: True Allies: France - Enemies: USSR, Ukraine + Enemies: USSR Actors: EntryPoint: t06 @@ -255,16 +249,9 @@ Actors: Actor60: powr Location: 57,62 Owner: USSR - Actor61: barr - Location: 56,66 - Owner: USSR Actor62: powr Location: 59,62 Owner: USSR - Actor63: kenn - Location: 58,68 - Owner: USSR - Health: 99 Actor64: brl3 Location: 65,59 Owner: USSR @@ -395,7 +382,7 @@ Actors: SubCell: 0 Actor103: e1 Location: 77,74 - Owner: Ukraine + Owner: USSR Facing: 128 SubCell: 2 Actor104: e1 @@ -408,11 +395,6 @@ Actors: Owner: USSR Facing: 160 SubCell: 3 - Actor106: e1 - Location: 50,72 - Owner: USSR - Facing: 160 - SubCell: 4 Actor107: e1 Location: 73,60 Owner: USSR @@ -428,31 +410,6 @@ Actors: Owner: USSR Facing: 64 SubCell: 0 - Actor110: e1 - Location: 49,58 - Owner: USSR - Facing: 192 - SubCell: 0 - Actor111: e1 - Location: 51,58 - Owner: USSR - Facing: 32 - SubCell: 1 - Actor112: e1 - Location: 60,78 - Owner: USSR - Facing: 192 - SubCell: 4 - Actor113: e2 - Location: 62,79 - Owner: USSR - Facing: 160 - SubCell: 4 - Actor114: e1 - Location: 57,82 - Owner: USSR - Facing: 160 - SubCell: 1 Actor115: e1 Location: 60,64 Owner: USSR @@ -463,11 +420,6 @@ Actors: Owner: USSR Facing: 96 SubCell: 0 - Actor117: e1 - Location: 48,72 - Owner: USSR - Facing: 96 - SubCell: 0 Actor118: e1 Location: 57,69 Owner: USSR @@ -505,58 +457,19 @@ Actors: SubCell: 1 Actor125: dog Location: 78,75 - Owner: Ukraine + Owner: USSR Facing: 160 SubCell: 1 Actor126: e1 Location: 71,61 - Owner: Ukraine + Owner: USSR Facing: 160 SubCell: 0 Actor127: dog Location: 70,61 - Owner: Ukraine + Owner: USSR Facing: 96 SubCell: 4 - Actor128: e1 - Location: 50,46 - Owner: Ukraine - Facing: 32 - SubCell: 1 - Actor129: e1 - Location: 49,47 - Owner: Ukraine - Facing: 64 - SubCell: 0 - Actor130: e2 - Location: 49,49 - Owner: Ukraine - Facing: 160 - SubCell: 1 - Actor131: e2 - Location: 47,46 - Owner: Ukraine - Facing: 96 - SubCell: 3 - Actor132: e2 - Location: 48,63 - Owner: Ukraine - SubCell: 1 - Actor133: e1 - Location: 49,63 - Owner: Ukraine - Facing: 96 - SubCell: 2 - Actor134: e1 - Location: 74,81 - Owner: Ukraine - Facing: 64 - SubCell: 3 - Actor135: e2 - Location: 75,83 - Owner: Ukraine - Facing: 96 - SubCell: 0 Actor136: e2 Location: 69,66 Owner: USSR @@ -668,6 +581,13 @@ Actors: Actor170: fenc Location: 50,51 Owner: USSR + SovietKennel: kenn + Location: 58,68 + Owner: USSR + Health: 99 + SovietBarracks: barr + Location: 56,66 + Owner: USSR SovietWarfactory: weap Location: 60,66 Owner: USSR @@ -676,6 +596,80 @@ Actors: Owner: USSR Health: 50 Facing: 160 + PathGuard1: e1 + Location: 50,72 + Owner: USSR + Facing: 160 + SubCell: 4 + PathGuard2: e1 + Location: 49,58 + Owner: USSR + Facing: 192 + SubCell: 0 + PathGuard3: e1 + Location: 51,58 + Owner: USSR + Facing: 32 + SubCell: 1 + PathGuard4: e1 + Location: 60,78 + Owner: USSR + Facing: 192 + SubCell: 4 + PathGuard5: e2 + Location: 62,79 + Owner: USSR + Facing: 160 + SubCell: 4 + PathGuard6: e1 + Location: 48,72 + Owner: USSR + Facing: 96 + SubCell: 0 + PathGuard7: e1 + Location: 50,46 + Owner: USSR + Facing: 32 + SubCell: 1 + PathGuard8: e1 + Location: 49,47 + Owner: USSR + Facing: 64 + SubCell: 0 + PathGuard9: e2 + Location: 49,49 + Owner: USSR + Facing: 160 + SubCell: 1 + PathGuard10: e2 + Location: 47,46 + Owner: USSR + Facing: 96 + SubCell: 3 + PathGuard11: e2 + Location: 48,63 + Owner: USSR + SubCell: 1 + PathGuard12: e1 + Location: 49,63 + Owner: USSR + Facing: 96 + SubCell: 2 + PathGuard13: e1 + Location: 74,81 + Owner: USSR + Facing: 64 + SubCell: 3 + PathGuard14: e2 + Location: 75,83 + Owner: USSR + Facing: 96 + SubCell: 0 + PathGuard15: e1 + Location: 57,82 + Owner: USSR + Facing: 160 + SubCell: 1 TruckEntryPoint: waypoint Location: 49,44 Owner: Neutral @@ -748,6 +742,9 @@ Rules: GenericVisibility: Enemy, Ally, Neutral GenericStancePrefix: false ShowOwnerRow: false + HARV: + Buildable: + Prerequisites: weap APWR: Buildable: Prerequisites: ~disabled @@ -805,9 +802,6 @@ Rules: E7: Buildable: Prerequisites: ~disabled - HIJACKER: - Buildable: - Prerequisites: ~disabled FACF: Buildable: Prerequisites: ~disabled