diff --git a/mods/cnc/maps/gdi08b/gdi08b.lua b/mods/cnc/maps/gdi08b/gdi08b.lua index d01e9a4737..ccad23749b 100644 --- a/mods/cnc/maps/gdi08b/gdi08b.lua +++ b/mods/cnc/maps/gdi08b/gdi08b.lua @@ -103,36 +103,18 @@ WorldLoaded = function() StartAI() - Trigger.OnObjectiveAdded(GDI, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - - Trigger.OnObjectiveCompleted(GDI, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - - Trigger.OnObjectiveFailed(GDI, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerWon(GDI, function() - Media.PlaySpeechNotification(Nod, "Win") - end) - - Trigger.OnPlayerLost(GDI, function() - Media.PlaySpeechNotification(Nod, "Lose") - end) + InitObjectives(GDI) ProtectMoebius = GDI.AddObjective("Protect Dr. Mobius.") Trigger.OnKilled(DrMoebius, function() GDI.MarkFailedObjective(ProtectMoebius) end) - + ProtectHospital = GDI.AddObjective("Protect the Hospital.") Trigger.OnKilled(Hospital, function() GDI.MarkFailedObjective(ProtectHospital) end) - + CiviliansKilledThreshold = CiviliansKilledThreshold[Difficulty] ProtectCivilians = GDI.AddObjective("Keep at least " .. 14 - CiviliansKilledThreshold .. " out of 14 Civilians alive.") Utils.Do(Civilians, function(civilian) @@ -143,11 +125,11 @@ WorldLoaded = function() end end) end) - + SecureArea = GDI.AddObjective("Destroy the Nod bases.") KillGDI = Nod.AddObjective("Kill all enemies!") - + AirSupport = GDI.AddObjective("Destroy the SAM sites to receive air support.", "Secondary", false) Trigger.OnAllKilled(SamSites, function() GDI.MarkCompletedObjective(AirSupport) @@ -159,20 +141,20 @@ WorldLoaded = function() Trigger.AfterDelay(DateTime.Minutes(1), function() SendWaves(1, AutoAttackWaves) end) Trigger.AfterDelay(DateTime.Minutes(2), function() ProduceInfantry(handofnod) end) Trigger.AfterDelay(DateTime.Minutes(3), function() ProduceVehicle(nodairfield) end) - + local InitialArrivingUnits = - { + { { units = { Actor252, Actor253, Actor223, Actor225, Actor222, Actor258, Actor259, Actor260, Actor261, Actor254, Actor255, Actor256, Actor257 }, distance = -1 }, { units = { Actor218, Actor220, Actor224, Actor226 }, distance = -2 }, { units = { gdiAPC1 }, distance = -3 } } - + Utils.Do(InitialArrivingUnits, function(group) Utils.Do(group.units, function(unit) unit.Move(unit.Location + CVec.New(0, group.distance), 0) end) end) - + Utils.Do(NodHelis, function(heli) if heli.delay == DateTime.Seconds(0) then -- heli1 comes only when specific units are killed, see below return diff --git a/mods/ra/maps/allies-01/allies01.lua b/mods/ra/maps/allies-01/allies01.lua index 8e9849fca0..fb78aaeb52 100644 --- a/mods/ra/maps/allies-01/allies01.lua +++ b/mods/ra/maps/allies-01/allies01.lua @@ -171,14 +171,6 @@ HelicopterGone = function() end end -MissionAccomplished = function() - Media.PlaySpeechNotification(Greece, "MissionAccomplished") -end - -MissionFailed = function() - Media.PlaySpeechNotification(Greece, "MissionFailed") -end - SetUnitStances = function() Utils.Do(Map.NamedActors, function(a) if a.Owner == Greece then @@ -196,18 +188,7 @@ WorldLoaded = function() England = Player.GetPlayer("England") USSR = Player.GetPlayer("USSR") - Trigger.OnObjectiveAdded(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - Trigger.OnObjectiveCompleted(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(Greece, MissionFailed) - Trigger.OnPlayerWon(Greece, MissionAccomplished) + InitObjectives(Greece) FindEinsteinObjective = Greece.AddObjective("Find Einstein.") TanyaSurviveObjective = Greece.AddObjective("Tanya must survive.") diff --git a/mods/ra/maps/allies-02/allies02.lua b/mods/ra/maps/allies-02/allies02.lua index 7a3d7cf221..311efb7c65 100644 --- a/mods/ra/maps/allies-02/allies02.lua +++ b/mods/ra/maps/allies-02/allies02.lua @@ -218,21 +218,7 @@ WorldLoaded = function() england = Player.GetPlayer("England") ussr = Player.GetPlayer("USSR") - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "MissionFailed") - end) - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "MissionAccomplished") - end) + InitObjectives(player) ussrObj = ussr.AddObjective("Deny the allies!") diff --git a/mods/ra/maps/allies-03a/allies03a.lua b/mods/ra/maps/allies-03a/allies03a.lua index f49d41044d..b8b1bd01ef 100644 --- a/mods/ra/maps/allies-03a/allies03a.lua +++ b/mods/ra/maps/allies-03a/allies03a.lua @@ -106,34 +106,12 @@ InitPlayers = function() ussr.Cash = 10000 end -InitObjectives = function() - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - +AddObjectives = function() KillBridges = player.AddObjective("Destroy all bridges.") TanyaSurvive = player.AddObjective("Tanya must survive.") KillUSSR = player.AddObjective("Destroy all Soviet oil pumps.", "Secondary", false) FreePrisoners = player.AddObjective("Free all Allied soldiers and keep them alive.", "Secondary", false) ussr.AddObjective("Bridges must not be destroyed.") - - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(player, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(player, "MissionFailed") - end) - end) - Trigger.OnPlayerWon(player, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(player, "MissionAccomplished") - end) - end) end InitTriggers = function() @@ -276,7 +254,8 @@ WorldLoaded = function() InitPlayers() - InitObjectives() + InitObjectives(player) + AddObjectives() InitTriggers() SendAlliedUnits() end diff --git a/mods/ra/maps/allies-03b/allies03b.lua b/mods/ra/maps/allies-03b/allies03b.lua index 7881108e2e..fa768b502c 100644 --- a/mods/ra/maps/allies-03b/allies03b.lua +++ b/mods/ra/maps/allies-03b/allies03b.lua @@ -170,34 +170,14 @@ InitPlayers = function() ussr.Cash = 10000 end -InitObjectives = function() - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) +AddObjectives = function() + InitObjectives(player) KillBridges = player.AddObjective("Destroy all bridges.") TanyaSurvive = player.AddObjective("Tanya must survive.") FindAllies = player.AddObjective("Find our lost tanks.", "Secondary", false) FreePrisoners = player.AddObjective("Free all Allied soldiers and keep them alive.", "Secondary", false) ussr.AddObjective("Bridges must not be destroyed.") - - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(player, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(player, "Lose") - end) - end) - Trigger.OnPlayerWon(player, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(player, "Win") - end) - end) end InitTriggers = function() @@ -381,7 +361,7 @@ WorldLoaded = function() InitPlayers() - InitObjectives() + AddObjectives() InitTriggers() SetupAlliedUnits() end diff --git a/mods/ra/maps/allies-04/allies04.lua b/mods/ra/maps/allies-04/allies04.lua index d0075e5466..ae52d2ac9f 100644 --- a/mods/ra/maps/allies-04/allies04.lua +++ b/mods/ra/maps/allies-04/allies04.lua @@ -138,31 +138,9 @@ Tick = function() end end -InitObjectives = function() - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - +AddObjectives = function() KillUSSR = player.AddObjective("Destroy all Soviet units and buildings in this region.") DestroyConvoys = player.AddObjective("Eliminate all passing Soviet convoys.", "Secondary", false) - - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(player, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(player, "MissionFailed") - end) - end) - Trigger.OnPlayerWon(player, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(player, "MissionAccomplished") - end) - end) end WorldLoaded = function() @@ -171,7 +149,8 @@ WorldLoaded = function() Camera.Position = AlliedConyard.CenterPosition - InitObjectives() + InitObjectives(player) + AddObjectives() ConvoyDelay = ConvoyDelays[Difficulty] ParadropDelay = ParadropDelays[Difficulty] diff --git a/mods/ra/maps/allies-05a/allies05a.lua b/mods/ra/maps/allies-05a/allies05a.lua index b435c59ee9..24d5b95a5c 100644 --- a/mods/ra/maps/allies-05a/allies05a.lua +++ b/mods/ra/maps/allies-05a/allies05a.lua @@ -371,36 +371,19 @@ InitTriggers = function() end) end -InitObjectives = function() - Trigger.OnObjectiveAdded(greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - +AddObjectives = function() ussrObj = ussr.AddObjective("Deny the Allies.") mainObj = greece.AddObjective("Rescue Tanya.") KillAll = greece.AddObjective("Eliminate all Soviet units in this area.") infWarfactory = greece.AddObjective("Infiltrate the Soviet warfactory.", "Secondary", false) - - Trigger.OnObjectiveCompleted(greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(greece, function() - Media.PlaySpeechNotification(player, "Lose") - end) - Trigger.OnPlayerWon(greece, function() - Media.PlaySpeechNotification(player, "Win") - end) end WorldLoaded = function() greece = Player.GetPlayer("Greece") ussr = Player.GetPlayer("USSR") - InitObjectives() + InitObjectives(greece) + AddObjectives() InitTriggers() SendSpy() diff --git a/mods/ra/maps/allies-05b/allies05b.lua b/mods/ra/maps/allies-05b/allies05b.lua index 474836c8f7..ed2a08f7b1 100644 --- a/mods/ra/maps/allies-05b/allies05b.lua +++ b/mods/ra/maps/allies-05b/allies05b.lua @@ -386,29 +386,13 @@ WorldLoaded = function() USSR = Player.GetPlayer("USSR") GoodGuy = Player.GetPlayer("GoodGuy") - Trigger.OnObjectiveAdded(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + InitObjectives(Greece) USSRObj = USSR.AddObjective("Deny the Allies.") MainObj = Greece.AddObjective("Rescue Tanya.") KillAll = Greece.AddObjective("Eliminate all Soviet units in this area.") InfWarfactory = Greece.AddObjective("Infiltrate the Soviet warfactory.", "Secondary", false) - Trigger.OnObjectiveCompleted(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(Greece, function() - Media.PlaySpeechNotification(Greece, "Lose") - end) - Trigger.OnPlayerWon(Greece, function() - Media.PlaySpeechNotification(Greece, "Win") - end) - InitTriggers() SendSpy() ChurchFootprint() diff --git a/mods/ra/maps/allies-05c/allies05c.lua b/mods/ra/maps/allies-05c/allies05c.lua index e2f40d2000..ce4091562f 100644 --- a/mods/ra/maps/allies-05c/allies05c.lua +++ b/mods/ra/maps/allies-05c/allies05c.lua @@ -344,29 +344,13 @@ WorldLoaded = function() Greece = Player.GetPlayer("Greece") USSR = Player.GetPlayer("USSR") - Trigger.OnObjectiveAdded(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + InitObjectives(Greece) USSRObj = USSR.AddObjective("Deny the Allies.") MainObj = Greece.AddObjective("Rescue Tanya.") KillAll = Greece.AddObjective("Eliminate all Soviet units in this area.") InfWarfactory = Greece.AddObjective("Infiltrate the Soviet warfactory.", "Secondary", false) - Trigger.OnObjectiveCompleted(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(Greece, function() - Media.PlaySpeechNotification(Greece, "Lose") - end) - Trigger.OnPlayerWon(Greece, function() - Media.PlaySpeechNotification(Greece, "Win") - end) - InitTriggers() SendSpy() Trigger.AfterDelay(DateTime.Seconds(3), ActivatePatrols) diff --git a/mods/ra/maps/allies-06a/allies06a.lua b/mods/ra/maps/allies-06a/allies06a.lua index a8af019a44..b5d97e497d 100644 --- a/mods/ra/maps/allies-06a/allies06a.lua +++ b/mods/ra/maps/allies-06a/allies06a.lua @@ -179,24 +179,7 @@ WorldLoaded = function() player = Player.GetPlayer("Greece") ussr = Player.GetPlayer("USSR") - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "MissionFailed") - end) - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "MissionAccomplished") - end) + InitObjectives(Greece) InfiltrateTechCenterObj = player.AddObjective("Infiltrate one of the Soviet tech centers with a spy.") CaptureRadarDomeObj = player.AddObjective("Capture the Radar Dome at the shore.", "Secondary", false) diff --git a/mods/ra/maps/allies-06b/allies06b.lua b/mods/ra/maps/allies-06b/allies06b.lua index e28d95c049..77190c13e9 100644 --- a/mods/ra/maps/allies-06b/allies06b.lua +++ b/mods/ra/maps/allies-06b/allies06b.lua @@ -183,24 +183,7 @@ WorldLoaded = function() player = Player.GetPlayer("Greece") ussr = Player.GetPlayer("USSR") - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "MissionFailed") - end) - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "MissionAccomplished") - end) + InitObjectives(player) InfiltrateTechCenterObj = player.AddObjective("Infiltrate one of the Soviet tech centers with a spy.") CaptureRadarDomeObj = player.AddObjective("Capture the Radar Dome at the shore.", "Secondary", false) diff --git a/mods/ra/maps/allies-07/allies07.lua b/mods/ra/maps/allies-07/allies07.lua index 82be8ccf54..89fca66b25 100644 --- a/mods/ra/maps/allies-07/allies07.lua +++ b/mods/ra/maps/allies-07/allies07.lua @@ -185,29 +185,12 @@ WorldLoaded = function() Camera.Position = DefaultCameraPosition.CenterPosition + InitObjectives(greece) CaptureRadarDomeObj = greece.AddObjective("Capture the Radar Dome.") DestroySubPens = greece.AddObjective("Destroy all Soviet Sub Pens") ClearSubActivity = greece.AddObjective("Clear the area of all sub activity", "Secondary", false) BeatAllies = ussr.AddObjective("Defeat the Allied forces.") - Trigger.OnObjectiveCompleted(greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(greece, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(greece, "MissionFailed") - end) - end) - Trigger.OnPlayerWon(greece, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(greece, "MissionAccomplished") - end) - end) - PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) InitialAlliedReinforcements() diff --git a/mods/ra/maps/allies-08a/allies08a.lua b/mods/ra/maps/allies-08a/allies08a.lua index fa5f79e68c..83cbf21bf9 100644 --- a/mods/ra/maps/allies-08a/allies08a.lua +++ b/mods/ra/maps/allies-08a/allies08a.lua @@ -119,29 +119,12 @@ WorldLoaded = function() ussr = Player.GetPlayer("USSR") germany = Player.GetPlayer("Germany") + InitObjectives(greece) DefendChronosphere = greece.AddObjective("Defend the Chronosphere and the Tech Center\nat all costs.") KeepBasePowered = greece.AddObjective("The Chronosphere must have power when the\ntimer runs out.") EvacuateScientists = greece.AddObjective("Evacuate all scientists from the island to\nthe west.", "Secondary", false) BeatAllies = ussr.AddObjective("Defeat the Allied forces.") - Trigger.OnObjectiveCompleted(greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(greece, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(greece, "MissionFailed") - end) - end) - Trigger.OnPlayerWon(greece, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(greece, "MissionAccomplished") - end) - end) - Trigger.AfterDelay(DateTime.Minutes(1), function() Media.PlaySpeechNotification(greece, "TwentyMinutesRemaining") end) diff --git a/mods/ra/maps/allies-08b/allies08b.lua b/mods/ra/maps/allies-08b/allies08b.lua index 0d693000a9..55905584e8 100644 --- a/mods/ra/maps/allies-08b/allies08b.lua +++ b/mods/ra/maps/allies-08b/allies08b.lua @@ -119,29 +119,12 @@ WorldLoaded = function() ussr = Player.GetPlayer("USSR") england = Player.GetPlayer("England") + InitObjectives(greece) DefendChronosphere = greece.AddObjective("Defend the Chronosphere and the Tech Center\nat all costs.") KeepBasePowered = greece.AddObjective("The Chronosphere must have power when the\ntimer runs out.") EvacuateScientists = greece.AddObjective("Evacuate all scientists from the island to\nthe east.", "Secondary", false) BeatAllies = ussr.AddObjective("Defeat the Allied forces.") - Trigger.OnObjectiveCompleted(greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(greece, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(greece, "MissionFailed") - end) - end) - Trigger.OnPlayerWon(greece, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(greece, "MissionAccomplished") - end) - end) - Trigger.AfterDelay(DateTime.Minutes(1), function() Media.PlaySpeechNotification(greece, "TwentyMinutesRemaining") end) diff --git a/mods/ra/maps/allies-09a/allies09a.lua b/mods/ra/maps/allies-09a/allies09a.lua index 1478eb4c87..c5821b35ac 100644 --- a/mods/ra/maps/allies-09a/allies09a.lua +++ b/mods/ra/maps/allies-09a/allies09a.lua @@ -25,14 +25,6 @@ HuntDogsGroup = { Dog701, Dog702, Dog703, Dog704, Dog705, Dog706 } KosyginType = "gnrl" KosyginContacted = false -MissionAccomplished = function() - Media.PlaySpeechNotification(Greece, "MissionAccomplished") -end - -MissionFailed = function() - Media.PlaySpeechNotification(Greece, "MissionFailed") -end - InitialAlliedReinforcements = function() Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(Greece, "ReinforcementsArrived") @@ -138,7 +130,7 @@ TriggerRevealUSSRBase = function() Trigger.AfterDelay(DateTime.Seconds(15), cam.Destroy) end end) -end +end TriggerRevealUSSRFC = function() Trigger.OnEnteredProximityTrigger(UpperBaseWP.CenterPosition, WDist.FromCells(10), function(a, id) @@ -148,14 +140,14 @@ TriggerRevealUSSRFC = function() Trigger.AfterDelay(DateTime.Seconds(15), cam.Destroy) end end) -end +end TriggerExtractKosygin = function() Trigger.OnEnteredProximityTrigger(KosyginExtractPoint.CenterPosition, WDist.FromCells(10), function(actor, triggerflee) if actor.Type == KosyginType then Reinforcements.ReinforceWithTransport(Greece, ExtractionHelicopterType, nil, ExtractionPath) Trigger.RemoveProximityTrigger(triggerflee) - Trigger.AfterDelay(DateTime.Seconds(10), function() + Trigger.AfterDelay(DateTime.Seconds(10), function() Greece.MarkCompletedObjective(KosyginSurviveObjective) Greece.MarkCompletedObjective(ExtractObjective) Media.PlaySpeechNotification(Greece, "ObjectiveMet") @@ -167,12 +159,11 @@ end WorldLoaded = function() Greece = Player.GetPlayer("Greece") USSR = Player.GetPlayer("USSR") - Camera.Position = DefaultCameraPosition.CenterPosition + Camera.Position = DefaultCameraPosition.CenterPosition + InitObjectives(Greece) UseSpyObjective = Greece.AddObjective("Infiltrate the Soviet command center and\ncontact Kosygin.") KosyginSurviveObjective = Greece.AddObjective("Kosygin must survive.") USSRObj = USSR.AddObjective("Eliminate all Allied forces.") - Trigger.OnPlayerLost(Greece, MissionFailed) - Trigger.OnPlayerWon(Greece, MissionAccomplished) InitialAlliedReinforcements() InfiltrateForwardCenter() InitialSovietPatrols() diff --git a/mods/ra/maps/ant-01/ant-01.lua b/mods/ra/maps/ant-01/ant-01.lua index 40e99a54f7..62afa01132 100644 --- a/mods/ra/maps/ant-01/ant-01.lua +++ b/mods/ra/maps/ant-01/ant-01.lua @@ -137,10 +137,8 @@ Tick = function() end end -InitObjectives = function() - Trigger.OnObjectiveAdded(Allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) +AddObjectives = function() + InitObjectives(Allies) DiscoverObjective = Allies.AddObjective("Find the outpost.") @@ -154,21 +152,6 @@ InitObjectives = function() Creeps.GetActorsByType("harv")[1].Stop() end) - Trigger.OnObjectiveCompleted(Allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(Allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(Allies, function() - Media.PlaySpeechNotification(Allies, "MissionFailed") - end) - - Trigger.OnPlayerWon(Allies, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(Allies, "MissionAccomplished") end) - end) - Camera.Position = Ranger.CenterPosition end @@ -176,7 +159,7 @@ WorldLoaded = function() Allies = Player.GetPlayer("Spain") AntMan = Player.GetPlayer("AntMan") Creeps = Player.GetPlayer("Creeps") - InitObjectives() + AddObjectives() Trigger.OnKilled(MoneyDerrick, function() Actor.Create("moneycrate", true, { Owner = Allies, Location = MoneyDerrick.Location + CVec.New(1,0) }) end) diff --git a/mods/ra/maps/ant-03/ant-03.lua b/mods/ra/maps/ant-03/ant-03.lua index 64417b8f16..627076e2fc 100644 --- a/mods/ra/maps/ant-03/ant-03.lua +++ b/mods/ra/maps/ant-03/ant-03.lua @@ -92,27 +92,12 @@ WorldLoaded = function() USSR = Player.GetPlayer("USSR") England = Player.GetPlayer("England") - Trigger.OnObjectiveAdded(Spain, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + InitObjectives(Spain) EatSpain = BadGuy.AddObjective("For the Swarm!") GasNests = Spain.AddObjective("Gas every ant nest.") KillAll = Spain.AddObjective("Kill every ant lurking above ground.") - Trigger.OnObjectiveCompleted(Spain, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(Spain, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - Trigger.OnPlayerLost(Spain, function() - Media.PlaySpeechNotification(Spain, "Lose") - end) - Trigger.OnPlayerWon(Spain, function() - Media.PlaySpeechNotification(Spain, "Win") - end) - Camera.Position = DefaultCameraPosition.CenterPosition Start() GasAntNests() diff --git a/mods/ra/maps/evacuation/evacuation.lua b/mods/ra/maps/evacuation/evacuation.lua index a132b59b02..61e97d17f3 100644 --- a/mods/ra/maps/evacuation/evacuation.lua +++ b/mods/ra/maps/evacuation/evacuation.lua @@ -322,25 +322,7 @@ WorldLoaded = function() Utils.Do({ allies1, allies2 }, function(player) if player and player.IsLocalPlayer then - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "MissionAccomplished") - end) - - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "MissionFailed") - end) + InitObjectives(player) end end) diff --git a/mods/ra/maps/exodus/exodus.lua b/mods/ra/maps/exodus/exodus.lua index 77591cd3a4..b0ad1edd49 100644 --- a/mods/ra/maps/exodus/exodus.lua +++ b/mods/ra/maps/exodus/exodus.lua @@ -295,26 +295,7 @@ WorldLoaded = function() humans = { allies1, allies2 } Utils.Do(humans, function(player) if player and player.IsLocalPlayer then - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "MissionAccomplished") - end) - - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "MissionFailed") - end) - + InitObjectives(player) TextColor = player.Color end end) diff --git a/mods/ra/maps/fall-of-greece-1-personal-war/personal-war.lua b/mods/ra/maps/fall-of-greece-1-personal-war/personal-war.lua index 38ca4c9c79..edf1eeea45 100644 --- a/mods/ra/maps/fall-of-greece-1-personal-war/personal-war.lua +++ b/mods/ra/maps/fall-of-greece-1-personal-war/personal-war.lua @@ -490,28 +490,12 @@ WorldLoaded = function() England = Player.GetPlayer("England") Civilians = Player.GetPlayer("GreekCivilians") - Trigger.OnObjectiveAdded(Allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + AddObjectives(Allies) SovietObj = USSR.AddObjective("Kill Stavros.") ProtectVIPs = Allies.AddObjective("Keep Stavros and Tanya alive.") ExtractStavros = Allies.AddObjective("Get Stavros and Tanya to the extraction helicopter.") - Trigger.OnObjectiveCompleted(Allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(Allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(Allies, function() - Media.PlaySpeechNotification(Allies, "Lose") - end) - Trigger.OnPlayerWon(Allies, function() - Media.PlaySpeechNotification(Allies, "Win") - end) - InsertionDrop = Actor.Create("insertiondrop", false, { Owner = Allies }) InsertionDropHard = Actor.Create("insertiondrophard", false, { Owner = Allies }) RifleDropA = Actor.Create("rifledrop", false, { Owner = Allies }) diff --git a/mods/ra/maps/fall-of-greece-2-evacuation/evacuation.lua b/mods/ra/maps/fall-of-greece-2-evacuation/evacuation.lua index c17093ad50..ac33bdde7b 100644 --- a/mods/ra/maps/fall-of-greece-2-evacuation/evacuation.lua +++ b/mods/ra/maps/fall-of-greece-2-evacuation/evacuation.lua @@ -233,9 +233,7 @@ WorldLoaded = function() Allies = Player.GetPlayer("Allies") USSR = Player.GetPlayer("USSR") - Trigger.OnObjectiveAdded(Allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + InitObjectives(Allies) if Difficulty == "easy" then RescueCivilians = Allies.AddObjective("Evacuate at least half of the civilians to the island\nshelter.") @@ -248,20 +246,6 @@ WorldLoaded = function() ClearWaterway = Allies.AddObjective("Clear the area of enemy submarine activity.", "Secondary", false) SovietObj = USSR.AddObjective("Defeat Allies.") - Trigger.OnObjectiveCompleted(Allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(Allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(Allies, function() - Media.PlaySpeechNotification(Allies, "Lose") - end) - Trigger.OnPlayerWon(Allies, function() - Media.PlaySpeechNotification(Allies, "Win") - end) - CiviliansEvacuatedThreshold = CiviliansEvacuatedThreshold[Difficulty] CiviliansKilledThreshold = CiviliansKilledThreshold[Difficulty] TextColor = Allies.Color diff --git a/mods/ra/maps/in-the-nick-of-time/in-the-nick-of-time.lua b/mods/ra/maps/in-the-nick-of-time/in-the-nick-of-time.lua index ac0da1f533..0614415d93 100644 --- a/mods/ra/maps/in-the-nick-of-time/in-the-nick-of-time.lua +++ b/mods/ra/maps/in-the-nick-of-time/in-the-nick-of-time.lua @@ -92,7 +92,7 @@ AlliedReinforcements = function() Reinforcements.Reinforce(Greece, AlliedHouseSquad, { VillageSpawnAllies.Location, VillageRally.Location }, 0) end end) - end + end end end) @@ -356,26 +356,11 @@ WorldLoaded = function() USSR = Player.GetPlayer("USSR") GoodGuy = Player.GetPlayer("GoodGuy") - Trigger.OnObjectiveAdded(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + InitObjectives(Greece) SovietObj = USSR.AddObjective("Defeat Allies.") RescueScientists = Greece.AddObjective("Rescue the scientists and escort them back to the\nextraction point.") - Trigger.OnObjectiveCompleted(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - Trigger.OnPlayerLost(Greece, function() - Media.PlaySpeechNotification(Greece, "Lose") - end) - Trigger.OnPlayerWon(Greece, function() - Media.PlaySpeechNotification(Greece, "Win") - end) - Camera.Position = DefaultCameraPosition.CenterPosition Paradrop1 = Actor.Create("paradrop1", false, { Owner = USSR }) Paradrop2 = Actor.Create("paradrop2", false, { Owner = USSR }) diff --git a/mods/ra/maps/infiltration/infiltration.lua b/mods/ra/maps/infiltration/infiltration.lua index 6e6a979b96..8b63684f63 100644 --- a/mods/ra/maps/infiltration/infiltration.lua +++ b/mods/ra/maps/infiltration/infiltration.lua @@ -353,26 +353,7 @@ WorldLoaded = function() Utils.Do(humans, function(player) if player and player.IsLocalPlayer then - Trigger.OnObjectiveAdded(player, function(p, id) - local objectiveType = string.lower(p.GetObjectiveType(id)) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. objectiveType .. " objective") - end) - - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "MissionAccomplished") - end) - - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "MissionFailed") - end) + InitObjectives(player) end end) diff --git a/mods/ra/maps/intervention/intervention.lua b/mods/ra/maps/intervention/intervention.lua index 87141f7eca..83528445ee 100644 --- a/mods/ra/maps/intervention/intervention.lua +++ b/mods/ra/maps/intervention/intervention.lua @@ -243,23 +243,7 @@ WorldLoaded = function() player = Player.GetPlayer("Allies") soviets = Player.GetPlayer("Soviets") - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "MissionAccomplished") - end) - - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "MissionFailed") - end) + InitObjectives(player) sovietObjective = soviets.AddObjective("Destroy the village.") villageObjective = player.AddObjective("Save the village.") diff --git a/mods/ra/maps/monster-tank-madness/monster-tank-madness.lua b/mods/ra/maps/monster-tank-madness/monster-tank-madness.lua index fd32c64856..e619571cf5 100644 --- a/mods/ra/maps/monster-tank-madness/monster-tank-madness.lua +++ b/mods/ra/maps/monster-tank-madness/monster-tank-madness.lua @@ -107,7 +107,7 @@ SetupAlliedBase = function() end SendAlliedUnits = function() - InitObjectives() + AddObjectives() Camera.Position = StartEntryPoint.CenterPosition @@ -124,7 +124,7 @@ SendAlliedUnits = function() Trigger.OnKilled(unit, function() player.MarkFailedObjective(StealMoney) end) - end + end end) end) end) @@ -294,10 +294,8 @@ InitPlayers = function() Trigger.AfterDelay(0, function() badguy.Resources = badguy.ResourceCapacity * 0.75 end) end -InitObjectives = function() - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) +AddObjectives = function() + InitObjectives(player) EliminateSuperTanks = player.AddObjective("Eliminate these super tanks.") StealMoney = player.AddObjective("Steal money from the nearby outpost with the Thief.") @@ -309,25 +307,15 @@ InitObjectives = function() UkraineObj = ukraine.AddObjective("Survive.") TurkeyObj = turkey.AddObjective("Destroy.") - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "MissionFailed") - ussr.MarkCompletedObjective(USSRObj) badguy.MarkCompletedObjective(BadGuyObj) ukraine.MarkCompletedObjective(UkraineObj) turkey.MarkCompletedObjective(TurkeyObj) end) - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "MissionAccomplished") - Media.DisplayMessage("Dr. Demitri has been extracted and the super tanks have been dealt with.") + Trigger.OnPlayerWon(player, function() + Media.DisplayMessage("Dr. Demitri has been extracted and the super tanks have been dealt with.") ussr.MarkFailedObjective(USSRObj) badguy.MarkFailedObjective(BadGuyObj) ukraine.MarkFailedObjective(UkraineObj) diff --git a/mods/ra/maps/production-disruption/production-disruption.lua b/mods/ra/maps/production-disruption/production-disruption.lua index 1d426e2b3e..dcb7060f2a 100644 --- a/mods/ra/maps/production-disruption/production-disruption.lua +++ b/mods/ra/maps/production-disruption/production-disruption.lua @@ -227,22 +227,7 @@ WorldLoaded = function() StopProduction = Greece.AddObjective("Destroy the Soviet sub pen.") PowerDownTeslaCoils = Greece.AddObjective("Take down power to the tesla coils.") - Trigger.OnObjectiveAdded(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - - Trigger.OnObjectiveCompleted(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - Trigger.OnPlayerLost(Greece, function() - Media.PlaySpeechNotification(Greece, "Lose") - end) - Trigger.OnPlayerWon(Greece, function() - Media.PlaySpeechNotification(Greece, "Win") - end) + InitObjectives(Greece) Trigger.AfterDelay(DateTime.Minutes(2), function() Media.PlaySpeechNotification(Greece, "TenMinutesRemaining") diff --git a/mods/ra/maps/sarin-gas-1-crackdown/crackdown.lua b/mods/ra/maps/sarin-gas-1-crackdown/crackdown.lua index 261f3e2f73..5c38fd9852 100644 --- a/mods/ra/maps/sarin-gas-1-crackdown/crackdown.lua +++ b/mods/ra/maps/sarin-gas-1-crackdown/crackdown.lua @@ -137,29 +137,13 @@ WorldLoaded = function() ussr = Player.GetPlayer("USSR") badguy = Player.GetPlayer("BadGuy") - Trigger.OnObjectiveAdded(greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + InitObjectives(greece) objDestroyAllTrucks = greece.AddObjective("Prevent Soviet convoy trucks from escaping.") objKillAll = greece.AddObjective("Clear the sector of all Soviet presence.") objRadarSpy = greece.AddObjective("Infiltrate the Soviet Radar Dome to reveal truck \necape routes.", "Secondary", false) ussrObj = ussr.AddObjective("Deny the Allies.") - Trigger.OnObjectiveCompleted(greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(greece, function() - Media.PlaySpeechNotification(player, "Lose") - end) - Trigger.OnPlayerWon(greece, function() - Media.PlaySpeechNotification(player, "Win") - end) - ActivateAI() SetupTriggers() MissionStart() diff --git a/mods/ra/maps/sarin-gas-2-down-under/downunder.lua b/mods/ra/maps/sarin-gas-2-down-under/downunder.lua index 50d2cff581..2446d300ab 100644 --- a/mods/ra/maps/sarin-gas-2-down-under/downunder.lua +++ b/mods/ra/maps/sarin-gas-2-down-under/downunder.lua @@ -457,9 +457,7 @@ WorldLoaded = function() france = Player.GetPlayer("France") germany = Player.GetPlayer("Germany") - Trigger.OnObjectiveAdded(greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + InitObjectives(greece) ussrObj = ussr.AddObjective("Defeat the Allies.") ExitBase = greece.AddObjective("Reach the eastern exit of the facility.") @@ -470,20 +468,6 @@ WorldLoaded = function() NoCasualties = greece.AddPrimaryObjective("Do not lose a single soldier or civilian\nunder your command.") end - Trigger.OnObjectiveCompleted(greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(greece, function() - Media.PlaySpeechNotification(greece, "Lose") - end) - Trigger.OnPlayerWon(greece, function() - Media.PlaySpeechNotification(greece, "Win") - end) - StartSpy.DisguiseAsType("e1", ussr) StartAttacker1.AttackMove(start.Location) StartAttacker2.AttackMove(start.Location) diff --git a/mods/ra/maps/sarin-gas-3-controlled-burn/controlledburn.lua b/mods/ra/maps/sarin-gas-3-controlled-burn/controlledburn.lua index 8c377e99ba..b9c59e2a1d 100644 --- a/mods/ra/maps/sarin-gas-3-controlled-burn/controlledburn.lua +++ b/mods/ra/maps/sarin-gas-3-controlled-burn/controlledburn.lua @@ -124,22 +124,7 @@ WorldLoaded = function() SovietObj = USSR.AddObjective("Defeat the Allies.") TakeOutPower = Greece.AddObjective("Bring down the power of the base to the east.") - Trigger.OnObjectiveAdded(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - - Trigger.OnObjectiveCompleted(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(Greece, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - Trigger.OnPlayerLost(Greece, function() - Media.PlaySpeechNotification(Greece, "Lose") - end) - Trigger.OnPlayerWon(Greece, function() - Media.PlaySpeechNotification(Greece, "Win") - end) + InitObjectives(Greece) StartSpy.DisguiseAsType("e1", BadGuy) Camera.Position = DefaultCameraPosition.CenterPosition diff --git a/mods/ra/maps/shock-therapy/shock-therapy.lua b/mods/ra/maps/shock-therapy/shock-therapy.lua index 304c38d844..d583e58be2 100644 --- a/mods/ra/maps/shock-therapy/shock-therapy.lua +++ b/mods/ra/maps/shock-therapy/shock-therapy.lua @@ -120,7 +120,7 @@ MissionTriggers = function() end end) Trigger.AfterDelay(DateTime.Seconds(3), function() - if not NEVillage3.IsDead then + if not NEVillage3.IsDead then Reinforcements.Reinforce(Spain, Utils.Random(CivSquads), { NECivSpawn3.Location, CivRallyNW.Location }, 0) end if not NEVillage4.IsDead then @@ -249,7 +249,7 @@ MissionTriggers = function() if not SWVillage3.IsDead then Reinforcements.Reinforce(Spain, Utils.Random(CivSquads), { SWCivSpawn3.Location, CivRallySE.Location }, 0) end - if not SWVillage4.IsDead then + if not SWVillage4.IsDead then Reinforcements.Reinforce(Spain, Utils.Random(CivSquads), { SWCivSpawn4.Location, CivRallyNW.Location }, 0) end end) @@ -307,32 +307,12 @@ WorldLoaded = function() GoodGuy = Player.GetPlayer("GoodGuy") Spain = Player.GetPlayer("Spain") - Trigger.OnObjectiveAdded(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + InitObjectives(USSR) BeatRussia = Greece.AddObjective("Stop Ivan.") KillAll = USSR.AddObjective("Destroy all that oppose us.") CaptureDome = USSR.AddObjective("Capture the enemy radar dome.", "Secondary", false) - Trigger.OnObjectiveCompleted(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionFailed") - end) - end) - Trigger.OnPlayerWon(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionAccomplished") - end) - end) - Camera.Position = LZ.CenterPosition ShockDrop = Actor.Create("shockdrop", false, { Owner = USSR }) MissionStart() diff --git a/mods/ra/maps/siberian-conflict-1-fresh-tracks/fresh-tracks.lua b/mods/ra/maps/siberian-conflict-1-fresh-tracks/fresh-tracks.lua index 2142b0a95a..12441c40d4 100644 --- a/mods/ra/maps/siberian-conflict-1-fresh-tracks/fresh-tracks.lua +++ b/mods/ra/maps/siberian-conflict-1-fresh-tracks/fresh-tracks.lua @@ -240,22 +240,7 @@ WorldLoaded = function() StopTrucks = Allies.AddObjective("Destroy all Soviet convoy trucks.") DestroyBridges = Allies.AddObjective("Destroy the nearby bridges to slow the\nconvoys down.", "Secondary", false) - Trigger.OnObjectiveAdded(Allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - - Trigger.OnObjectiveCompleted(Allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(Allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - Trigger.OnPlayerLost(Allies, function() - Media.PlaySpeechNotification(Allies, "Lose") - end) - Trigger.OnPlayerWon(Allies, function() - Media.PlaySpeechNotification(Allies, "Win") - end) + InitObjectives(Allies) Trigger.AfterDelay(DateTime.Minutes(3), function() Media.PlaySpeechNotification(Allies, "WarningFiveMinutesRemaining") diff --git a/mods/ra/maps/siberian-conflict-3-wasteland/wasteland.lua b/mods/ra/maps/siberian-conflict-3-wasteland/wasteland.lua index 1277791ce9..c72fc8d8db 100644 --- a/mods/ra/maps/siberian-conflict-3-wasteland/wasteland.lua +++ b/mods/ra/maps/siberian-conflict-3-wasteland/wasteland.lua @@ -54,27 +54,11 @@ WorldLoaded = function() USSR = Player.GetPlayer("USSR") BadGuy = Player.GetPlayer("BadGuy") - Trigger.OnObjectiveAdded(Allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + InitObjectives(Allies) SovietObj = USSR.AddObjective("Stop the Allies") DestroyAll = Allies.AddObjective("Destroy all Soviet units and structures.") - Trigger.OnObjectiveCompleted(Allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(Allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(Allies, function() - Media.PlaySpeechNotification(Allies, "Lose") - end) - Trigger.OnPlayerWon(Allies, function() - Media.PlaySpeechNotification(Allies, "Win") - end) - Camera.Position = DefaultCameraPosition.CenterPosition PowerProxy = Actor.Create("paratroopers", false, { Owner = BadGuy }) Setup() diff --git a/mods/ra/maps/situation-critical/situation-critical.lua b/mods/ra/maps/situation-critical/situation-critical.lua index 5541d19a27..021bbb84ab 100644 --- a/mods/ra/maps/situation-critical/situation-critical.lua +++ b/mods/ra/maps/situation-critical/situation-critical.lua @@ -169,9 +169,7 @@ WorldLoaded = function() USSR = Player.GetPlayer("USSR") Turkey = Player.GetPlayer("Turkey") - Trigger.OnObjectiveAdded(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + InitObjectives(USSR) LaunchMissles = Turkey.AddObjective("Survive until time expires.") KillPower = USSR.AddObjective("Bring the base to low power. Volkov will arrive\nonce the defenses are down.") @@ -180,24 +178,6 @@ WorldLoaded = function() KillSams = USSR.AddObjective("Destroy all sam sites on the island.\nOur strategic bombers will finish the rest.", "Secondary", false) VolkovSurvive = USSR.AddObjective("Volkov must survive.") - Trigger.OnObjectiveCompleted(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionFailed") - end) - end) - Trigger.OnPlayerWon(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionAccomplished") - end) - end) - Trigger.AfterDelay(DateTime.Minutes(3), function() Media.PlaySpeechNotification(USSR, "WarningFiveMinutesRemaining") end) diff --git a/mods/ra/maps/soviet-01/soviet01.lua b/mods/ra/maps/soviet-01/soviet01.lua index 9e4ce4cdb5..f7c1327c0f 100644 --- a/mods/ra/maps/soviet-01/soviet01.lua +++ b/mods/ra/maps/soviet-01/soviet01.lua @@ -72,15 +72,7 @@ WorldLoaded = function() france = Player.GetPlayer("France") germany = Player.GetPlayer("Germany") - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) + InitObjectives(player) VillageRaidObjective = player.AddObjective("Raze the village.") @@ -90,14 +82,6 @@ WorldLoaded = function() JeepDemolishingBridge() - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "MissionAccomplished") - end) - - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "MissionFailed") - end) - Paradrop = Actor.Create("powerproxy.paratroopers", false, { Owner = player }) Trigger.AfterDelay(DateTime.Seconds(2), InsertYaks) Paratroopers() diff --git a/mods/ra/maps/soviet-02a/soviet02a.lua b/mods/ra/maps/soviet-02a/soviet02a.lua index d269cadcef..1b971b6fea 100644 --- a/mods/ra/maps/soviet-02a/soviet02a.lua +++ b/mods/ra/maps/soviet-02a/soviet02a.lua @@ -50,26 +50,11 @@ WorldLoaded = function() player = Player.GetPlayer("USSR") greece = Player.GetPlayer("Greece") - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) + InitObjectives(player) CommandCenterIntact = player.AddObjective("Protect the Command Center.") DestroyAllAllied = player.AddObjective("Destroy all Allied units and structures.") - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "MissionAccomplished") - end) - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "MissionFailed") - end) - Camera.Position = CameraWaypoint.CenterPosition Trigger.OnKilled(CommandCenter, function() diff --git a/mods/ra/maps/soviet-02b/soviet02b.lua b/mods/ra/maps/soviet-02b/soviet02b.lua index 50afe2e338..34bfbb6904 100644 --- a/mods/ra/maps/soviet-02b/soviet02b.lua +++ b/mods/ra/maps/soviet-02b/soviet02b.lua @@ -178,21 +178,8 @@ WorldLoaded = function() end) end) end) - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "Win") - end) - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "Lose") - end) + + InitObjectives(player) alliedObjective = enemy.AddObjective("Destroy all Soviet troops.") sovietObjective1 = player.AddObjective("Protect the Command Center.") sovietObjective2 = player.AddObjective("Destroy all Allied units and structures.") diff --git a/mods/ra/maps/soviet-03/soviet03.lua b/mods/ra/maps/soviet-03/soviet03.lua index 940ef33052..76434fc9f2 100644 --- a/mods/ra/maps/soviet-03/soviet03.lua +++ b/mods/ra/maps/soviet-03/soviet03.lua @@ -335,23 +335,11 @@ WorldLoaded = function() player = Player.GetPlayer("USSR") enemy = Player.GetPlayer("England") greece = Player.GetPlayer("Greece") + Camera.Position = Playerbase.CenterPosition IntroSequence() - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "Win") - end) - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "Lose") - end) + + InitObjectives(player) alliedObjective = enemy.AddObjective("Destroy all Soviet troops.") sovietObjective1 = player.AddObjective("Kill the enemy spy.") sovietObjective2 = player.AddObjective("Clear the nearby farm for reinforcements.", "Secondary", false) diff --git a/mods/ra/maps/soviet-04a/soviet04a.lua b/mods/ra/maps/soviet-04a/soviet04a.lua index 3f7761eb53..d34f1274b4 100644 --- a/mods/ra/maps/soviet-04a/soviet04a.lua +++ b/mods/ra/maps/soviet-04a/soviet04a.lua @@ -132,28 +132,12 @@ WorldLoaded = function() RunInitialActivities() - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) + InitObjectives(player) KillAll = player.AddObjective("Defeat the Allied forces.") BeatUSSR = Greece.AddObjective("Defeat the Soviet forces.") KillRadar = player.AddObjective("Destroy Allied Radar Dome to stop enemy\nreinforcements.", "Secondary", false) - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "Lose") - end) - - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "Win") - end) - Trigger.OnKilled(RadarDome, function() player.MarkCompletedObjective(KillRadar) Media.PlaySpeechNotification(player, "ObjectiveMet") diff --git a/mods/ra/maps/soviet-04b/soviet04b.lua b/mods/ra/maps/soviet-04b/soviet04b.lua index 806a27e080..970aade39c 100644 --- a/mods/ra/maps/soviet-04b/soviet04b.lua +++ b/mods/ra/maps/soviet-04b/soviet04b.lua @@ -117,28 +117,12 @@ WorldLoaded = function() RunInitialActivities() - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) + InitObjectives(player) KillAll = player.AddObjective("Defeat the Allied forces.") BeatUSSR = Greece.AddObjective("Defeat the Soviet forces.") KillRadar = player.AddObjective("Destroy Allied Radar Dome to stop enemy\nreinforcements.", "Secondary", false) - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "Lose") - end) - - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "Win") - end) - Trigger.OnKilled(RadarDome, function() player.MarkCompletedObjective(KillRadar) Media.PlaySpeechNotification(player, "ObjectiveMet") diff --git a/mods/ra/maps/soviet-05/soviet05.lua b/mods/ra/maps/soviet-05/soviet05.lua index 597668e35e..6dd0503204 100644 --- a/mods/ra/maps/soviet-05/soviet05.lua +++ b/mods/ra/maps/soviet-05/soviet05.lua @@ -186,16 +186,7 @@ WorldLoaded = function() GoodGuy = Player.GetPlayer("GoodGuy") Greece = Player.GetPlayer("Greece") - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - Media.PlaySpeechNotification(player, "ObjectiveMet") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) + InitObjectives(player) CaptureObjective = player.AddObjective("Capture the Radar Dome.") KillAll = player.AddObjective("Defeat the Allied forces.") @@ -271,13 +262,5 @@ WorldLoaded = function() end end) - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "Lose") - end) - - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "Win") - end) - Camera.Position = StartCamPoint.CenterPosition end diff --git a/mods/ra/maps/soviet-06a/soviet06a.lua b/mods/ra/maps/soviet-06a/soviet06a.lua index d9142f2a42..4fa92f90c9 100644 --- a/mods/ra/maps/soviet-06a/soviet06a.lua +++ b/mods/ra/maps/soviet-06a/soviet06a.lua @@ -113,12 +113,15 @@ end) WorldLoaded = function() player = Player.GetPlayer("USSR") enemy = Player.GetPlayer("Greece") + Camera.Position = CameraStart.CenterPosition + Mcv.Move(McvWaypoint.Location) Harvester.FindResources() Utils.Do(IntroAttackers, function(actor) IdleHunt(actor) end) + Utils.Do(Map.NamedActors, function(actor) if actor.Owner == enemy and actor.HasProperty("StartBuildingRepairs") then Trigger.OnDamaged(actor, function(building) @@ -128,23 +131,12 @@ WorldLoaded = function() end) end end) + Reinforcements.ReinforceWithTransport(player, "apc", SovietReinforcements1, SovietReinforcements1Waypoints) Reinforcements.ReinforceWithTransport(player, "apc", SovietReinforcements2, SovietReinforcements2Waypoints) - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "Win") - end) - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "Lose") - end) + + InitObjectives(player) + alliedObjective = enemy.AddObjective("Destroy all Soviet troops.") sovietObjective = player.AddObjective("Escort the Convoy.") sovietObjective2 = player.AddObjective("Destroy or capture the Allied radar dome to stop\nenemy reinforcements.", "Secondary", false) diff --git a/mods/ra/maps/soviet-06b/soviet06b.lua b/mods/ra/maps/soviet-06b/soviet06b.lua index 0b3fee39ee..8af94460de 100644 --- a/mods/ra/maps/soviet-06b/soviet06b.lua +++ b/mods/ra/maps/soviet-06b/soviet06b.lua @@ -78,14 +78,18 @@ end) WorldLoaded = function() player = Player.GetPlayer("USSR") enemy = Player.GetPlayer("Greece") + Camera.Position = CameraStart.CenterPosition + Mcv.Move(McvWaypoint.Location) Harvester.FindResources() Utils.Do(IntroAttackers, function(actor) IdleHunt(actor) end) + Reinforcements.ReinforceWithTransport(player, "apc", SovietReinforcements1, SovietReinforcements1Waypoints) Reinforcements.ReinforceWithTransport(player, "apc", SovietReinforcements2, SovietReinforcements2Waypoints) + Utils.Do(Map.NamedActors, function(actor) if actor.Owner == enemy and actor.HasProperty("StartBuildingRepairs") then Trigger.OnDamaged(actor, function(building) @@ -95,21 +99,8 @@ WorldLoaded = function() end) end end) - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "Win") - end) - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "Lose") - end) + + InitObjectives(player) alliedObjective = enemy.AddObjective("Destroy all Soviet troops.") sovietObjective = player.AddObjective("Escort the Convoy.") sovietObjective2 = player.AddObjective("Destroy or capture the Allied radar dome to stop\nenemy reinforcements.", "Secondary", false) diff --git a/mods/ra/maps/soviet-07/soviet07.lua b/mods/ra/maps/soviet-07/soviet07.lua index 04d6b86306..4b5d3c0e0e 100644 --- a/mods/ra/maps/soviet-07/soviet07.lua +++ b/mods/ra/maps/soviet-07/soviet07.lua @@ -277,22 +277,7 @@ WorldLoaded = function() IntroSequence() - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "Win") - end) - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "Lose") - end) - + InitObjectives(player) alliedObjective = enemy.AddObjective("Destroy all Soviet troops.") sovietObjective1 = player.AddObjective("Deactivate the security system.") sovietObjective2 = player.AddObjective("Rescue the engineers.") diff --git a/mods/ra/maps/soviet-08a/soviet08a.lua b/mods/ra/maps/soviet-08a/soviet08a.lua index 09be3c78f8..f7bd65ac78 100644 --- a/mods/ra/maps/soviet-08a/soviet08a.lua +++ b/mods/ra/maps/soviet-08a/soviet08a.lua @@ -119,32 +119,12 @@ WorldLoaded = function() Germany = Player.GetPlayer("Germany") Greece = Player.GetPlayer("Greece") - Trigger.OnObjectiveAdded(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + InitObjectives(USSR) 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) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionFailed") - end) - end) - Trigger.OnPlayerWon(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionAccomplished") - end) - end) - AddEastReinforcementTrigger() AddSouthReinforcementTrigger() AddParadropReinforcementTrigger() diff --git a/mods/ra/maps/soviet-08b/soviet08b.lua b/mods/ra/maps/soviet-08b/soviet08b.lua index 137084b432..7a38e3a663 100644 --- a/mods/ra/maps/soviet-08b/soviet08b.lua +++ b/mods/ra/maps/soviet-08b/soviet08b.lua @@ -119,32 +119,12 @@ WorldLoaded = function() Germany = Player.GetPlayer("Germany") Greece = Player.GetPlayer("Greece") - Trigger.OnObjectiveAdded(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + InitObjectives(USSR) 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) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionFailed") - end) - end) - Trigger.OnPlayerWon(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionAccomplished") - end) - end) - FirstReinforcementTrigger() SecondReinforcementTrigger() AddParadropReinforcementTrigger() diff --git a/mods/ra/maps/soviet-09/soviet09.lua b/mods/ra/maps/soviet-09/soviet09.lua index beb86da066..46070e63f9 100644 --- a/mods/ra/maps/soviet-09/soviet09.lua +++ b/mods/ra/maps/soviet-09/soviet09.lua @@ -77,31 +77,11 @@ WorldLoaded = function() Germany = Player.GetPlayer("Germany") Greece = Player.GetPlayer("Greece") - Trigger.OnObjectiveAdded(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + InitObjectives(USSR) DestroyTruck = USSR.AddObjective("Destroy the stolen convoy truck.\nDo not let it escape.") DefendCommand = USSR.AddObjective("Defend our forward command center.") - Trigger.OnObjectiveCompleted(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionFailed") - end) - end) - Trigger.OnPlayerWon(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionAccomplished") - end) - end) - Camera.Position = DefaultCameraPosition.CenterPosition MissionStart() diff --git a/mods/ra/maps/soviet-10/soviet10.lua b/mods/ra/maps/soviet-10/soviet10.lua index 39e45bbd57..bb77883d2c 100644 --- a/mods/ra/maps/soviet-10/soviet10.lua +++ b/mods/ra/maps/soviet-10/soviet10.lua @@ -309,33 +309,13 @@ WorldLoaded = function() Greece = Player.GetPlayer("Greece") Turkey = Player.GetPlayer("Turkey") - Trigger.OnObjectiveAdded(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + InitObjectives(USSR) EscortTrucks = USSR.AddObjective("Escort the convoy through the mountain pass.") ProtectEveryTruck = USSR.AddObjective("Do not lose a single truck.", "Secondary", false) SaveMigs = USSR.AddObjective("Do not squander any of our new MiG aircraft.", "Secondary", false) BeatUSSR = Greece.AddObjective("Defeat the Soviet forces.") - Trigger.OnObjectiveCompleted(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionFailed") - end) - end) - Trigger.OnPlayerWon(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionAccomplished") - end) - end) - ConvoyEscort = ConvoyEscort[Difficulty] StartTimerDelay = StartTimerDelay[Difficulty] diff --git a/mods/ra/maps/soviet-11a/soviet11a.lua b/mods/ra/maps/soviet-11a/soviet11a.lua index 3afd9160f7..e42f7e032a 100644 --- a/mods/ra/maps/soviet-11a/soviet11a.lua +++ b/mods/ra/maps/soviet-11a/soviet11a.lua @@ -31,31 +31,11 @@ end WorldLoaded = function() USSR = Player.GetPlayer("USSR") Greece = Player.GetPlayer("Greece") - - Trigger.OnObjectiveAdded(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + + InitObjectives(USSR) DestroyNavalBase = USSR.AddPrimaryObjective("Destroy all Allied units and structures.") BeatSoviets = Greece.AddPrimaryObjective("Destroy all Soviet troops.") - - Trigger.OnObjectiveCompleted(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionFailed") - end) - end) - Trigger.OnPlayerWon(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionAccomplished") - end) - end) Camera.Position = DefaultCameraPosition.CenterPosition InitialSovietReinforcements() diff --git a/mods/ra/maps/soviet-11b/soviet11b.lua b/mods/ra/maps/soviet-11b/soviet11b.lua index e41dcd2a1d..3183a7d6e6 100644 --- a/mods/ra/maps/soviet-11b/soviet11b.lua +++ b/mods/ra/maps/soviet-11b/soviet11b.lua @@ -31,31 +31,11 @@ end WorldLoaded = function() USSR = Player.GetPlayer("USSR") Greece = Player.GetPlayer("Greece") - - Trigger.OnObjectiveAdded(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) + + InitObjectives(USSR) DestroyNavalBase = USSR.AddPrimaryObjective("Destroy Allied naval base") BeatSoviets = Greece.AddPrimaryObjective("Destroy all Soviet troops.") - - Trigger.OnObjectiveCompleted(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(USSR, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionFailed") - end) - end) - Trigger.OnPlayerWon(USSR, function() - Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(USSR, "MissionAccomplished") - end) - end) Camera.Position = DefaultCameraPosition.CenterPosition InitialSovietReinforcements() diff --git a/mods/ra/maps/soviet-soldier-volkov-n-chitzkoi/soviet-soldier-volkov-n-chitzkoi.lua b/mods/ra/maps/soviet-soldier-volkov-n-chitzkoi/soviet-soldier-volkov-n-chitzkoi.lua index 259ab90a8f..80f77f18c6 100644 --- a/mods/ra/maps/soviet-soldier-volkov-n-chitzkoi/soviet-soldier-volkov-n-chitzkoi.lua +++ b/mods/ra/maps/soviet-soldier-volkov-n-chitzkoi/soviet-soldier-volkov-n-chitzkoi.lua @@ -62,28 +62,13 @@ WorldLoaded = function() end --Objectives Setup - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) + InitObjectives(player) DestroyControlCenter = player.AddObjective("Destroy the Control Center.") KeepTanksAlive = player.AddObjective("Your tank division must not be destroyed before\n the alloy facility is dealt with.") KeepVolkovAlive = player.AddObjective("Keep Volkov Alive.") KeepChitzkoiAlive = player.AddObjective("Keep Chitzkoi Alive.", "Secondary", false) - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "MissionAccomplished") - end) - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "MissionFailed") - end) - Trigger.OnKilled(ControlCenter, function() Utils.Do(HeavyTurrets, function(struc) if not struc.IsDead then struc.Kill() end diff --git a/mods/ra/maps/survival01/survival01.lua b/mods/ra/maps/survival01/survival01.lua index 7fbb0bc06b..d77731f893 100644 --- a/mods/ra/maps/survival01/survival01.lua +++ b/mods/ra/maps/survival01/survival01.lua @@ -296,10 +296,8 @@ SendLongBowReinforcements = function() end end -InitObjectives = function() - Trigger.OnObjectiveAdded(allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) +AddObjectives = function() + InitObjectives(allies) SurviveObj = allies.AddObjective("Enforce your position and hold-out the onslaught\nuntil reinforcements arrive.") KillSams = allies.AddObjective("Destroy the two SAM sites before reinforcements\narrive.", "Secondary", false) @@ -307,18 +305,7 @@ InitObjectives = function() CaptureAirfields = allies.AddObjective("Capture and hold the Soviet airbase\nin the northeast.", "Secondary", false) SovietObj = soviets.AddObjective("Eliminate all Allied forces.") - Trigger.OnObjectiveCompleted(allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(allies, function() - Media.PlaySpeechNotification(allies, "MissionFailed") - end) Trigger.OnPlayerWon(allies, function() - Media.PlaySpeechNotification(allies, "MissionAccomplished") Media.DisplayMessage("The French forces have survived and dismantled the Soviet presence in the area!") end) end @@ -422,7 +409,7 @@ WorldLoaded = function() allies = Player.GetPlayer("Allies") soviets = Player.GetPlayer("Soviets") - InitObjectives() + AddObjectives() InitMission() SetupSoviets() end diff --git a/mods/ra/maps/survival02/survival02.lua b/mods/ra/maps/survival02/survival02.lua index 8eb5949b51..d1391263ea 100644 --- a/mods/ra/maps/survival02/survival02.lua +++ b/mods/ra/maps/survival02/survival02.lua @@ -282,10 +282,8 @@ InitCountDown = function() Trigger.AfterDelay(DateTime.Minutes(4), function() Media.PlaySpeechNotification(allies, "WarningOneMinuteRemaining") end) end -InitObjectives = function() - Trigger.OnObjectiveAdded(allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) +AddObjectives = function() + InitObjectives(allies) SurviveObj = allies.AddObjective("Enforce your position and hold-out the onslaught.") SovietObj = soviets.AddObjective("Eliminate all Allied forces.") @@ -294,18 +292,7 @@ InitObjectives = function() SetupBridges() end) - Trigger.OnObjectiveCompleted(allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(allies, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) - - Trigger.OnPlayerLost(allies, function() - Media.PlaySpeechNotification(allies, "Lose") - end) Trigger.OnPlayerWon(allies, function() - Media.PlaySpeechNotification(allies, "Win") Media.DisplayMessage("We have destroyed the remaining Soviet presence!", "Incoming Report") end) end @@ -398,7 +385,7 @@ WorldLoaded = function() allies = Player.GetPlayer("Allies") soviets = Player.GetPlayer("Soviets") - InitObjectives() + AddObjectives() InitMission() SetupSoviets() end diff --git a/mods/ra/maps/top-o-the-world/top-o-the-world.lua b/mods/ra/maps/top-o-the-world/top-o-the-world.lua index f8417a8e1e..7842ed2a50 100644 --- a/mods/ra/maps/top-o-the-world/top-o-the-world.lua +++ b/mods/ra/maps/top-o-the-world/top-o-the-world.lua @@ -100,28 +100,13 @@ WorldLoaded = function() Camera.Position = DefaultCameraPosition.CenterPosition --Objectives Setup - Trigger.OnObjectiveAdded(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective") - end) - Trigger.OnObjectiveCompleted(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") - end) - Trigger.OnObjectiveFailed(player, function(p, id) - Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") - end) + InitObjectives(player) BringSupplyTruck = player.AddObjective("Bring the supply truck to the waystation.") ProtectWaystation = player.AddObjective("The waystation must not be destroyed.") DestroyAAGuns = player.AddObjective("Destroy all the AA Guns to enable air support.", "Secondary", false) PreventAlliedIncursions = player.AddObjective("Find and destroy the bridge the allies are using\nto bring their reinforcements in the area.", "Secondary", false) - Trigger.OnPlayerWon(player, function() - Media.PlaySpeechNotification(player, "MissionAccomplished") - end) - Trigger.OnPlayerLost(player, function() - Media.PlaySpeechNotification(player, "MissionFailed") - end) - Trigger.OnKilled(USSRTechCenter01, function() player.MarkFailedObjective(ProtectWaystation) end)