From 105a9281956139e308925bb4b908a83c9b36def4 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Sun, 17 Aug 2014 18:38:07 +0200 Subject: [PATCH 1/2] Port nod03a to New Lua --- mods/cnc/maps/nod03a/map.yaml | 9 +++- mods/cnc/maps/nod03a/nod03a.lua | 83 ++++++++++++++++++--------------- 2 files changed, 52 insertions(+), 40 deletions(-) diff --git a/mods/cnc/maps/nod03a/map.yaml b/mods/cnc/maps/nod03a/map.yaml index 8715d0c3cd..a495f46409 100644 --- a/mods/cnc/maps/nod03a/map.yaml +++ b/mods/cnc/maps/nod03a/map.yaml @@ -576,10 +576,14 @@ Rules: -CrateSpawner: -SpawnMPUnits: -MPStartLocations: - LuaScriptInterface: - LuaScripts: nod03a.lua + LuaScript: + Scripts: nod03a.lua ObjectivesPanel: PanelName: MISSION_OBJECTIVES + ^Infantry: + MustBeDestroyed: + ^Vehicle: + MustBeDestroyed: NUK2: Buildable: Prerequisites: ~disabled @@ -635,6 +639,7 @@ Rules: Tooltip: Name: Prison Capturable: + CaptureThreshold: 1 HQ.NOAIRSTRIKE: RequiresPower: CanPowerDown: diff --git a/mods/cnc/maps/nod03a/nod03a.lua b/mods/cnc/maps/nod03a/nod03a.lua index f1cf69e834..d25cc91658 100644 --- a/mods/cnc/maps/nod03a/nod03a.lua +++ b/mods/cnc/maps/nod03a/nod03a.lua @@ -1,50 +1,57 @@ FirstAttackWave = { "e1", "e1", "e1", "e2", } SecondThirdAttackWave = { "e1", "e1", "e2", } -MissionAccomplished = function() - Mission.MissionOver({ player }, nil, true) - Media.PlayMovieFullscreen("desflees.vqa") -end - -MissionFailed = function() - Mission.MissionOver(nil, { player }, true) - Media.PlayMovieFullscreen("flag.vqa") -end - -SendFirstAttackWave = function() - for FirstAttackWaveCount = 1, 4 do - local waveunit = Actor.Create(FirstAttackWave[FirstAttackWaveCount], { Owner = enemy, Location = AttackWaveSpawnA.Location }) - Actor.AttackMove(waveunit, PlayerBase.Location) - end -end - -SendSecondAttackWave = function() - for SecondAttackWaveCount = 1, 3 do - local waveunit = Actor.Create(SecondThirdAttackWave[SecondAttackWaveCount], { Owner = enemy, Location = AttackWaveSpawnB.Location }) - Actor.AttackMove(waveunit, PlayerBase.Location) - end -end - -SendThirdAttackWave = function() - for ThirdAttackWaveCount = 1, 3 do - local waveunit = Actor.Create(SecondThirdAttackWave[ThirdAttackWaveCount], { Owner = enemy, Location = AttackWaveSpawnC.Location }) - Actor.AttackMove(waveunit, PlayerBase.Location) - end +SendAttackWave = function(units, spawnPoint) + Reinforcements.Reinforce(enemy, units, { spawnPoint }, Utils.Seconds(1), function(actor) + actor.AttackMove(PlayerBase.Location) + end) end WorldLoaded = function() - player = OpenRA.GetPlayer("Nod") - enemy = OpenRA.GetPlayer("GDI") + player = Player.GetPlayer("Nod") + enemy = Player.GetPlayer("GDI") + + gdiObjective = enemy.AddPrimaryObjective("Eliminate all Nod forces in the area") + nodObjective1 = player.AddPrimaryObjective("Capture the prison") + nodObjective2 = player.AddSecondaryObjective("Destroy all GDI forces") + + Trigger.AfterDelay(Utils.Seconds(20), function() SendAttackWave(FirstAttackWave, AttackWaveSpawnA.Location) end) + Trigger.AfterDelay(Utils.Seconds(50), function() SendAttackWave(SecondThirdAttackWave, AttackWaveSpawnB.Location) end) + Trigger.AfterDelay(Utils.Seconds(100), function() SendAttackWave(SecondThirdAttackWave, AttackWaveSpawnC.Location) end) + + Trigger.OnObjectiveCompleted(player, function() Media.DisplayMessage("Objective completed") end) + Trigger.OnObjectiveFailed(player, function() Media.DisplayMessage("Objective failed") end) + + Trigger.OnCapture(TechCenter, function() + player.MarkCompletedObjective(nodObjective1) + end) + + Trigger.OnKilled(TechCenter, function() + player.MarkFailedObjective(nodObjective1) + end) + + Trigger.OnPlayerWon(player, function() + Trigger.AfterDelay(Utils.Seconds(2), function() + Media.PlaySpeechNotification(player, "Win") + Media.PlayMovieFullscreen("desflees.vqa") + end) + end) + + Trigger.OnPlayerLost(player, function() + Trigger.AfterDelay(Utils.Seconds(1), function() + Media.PlaySpeechNotification(player, "Lose") + Media.PlayMovieFullscreen("flag.vqa") + end) + end) + Media.PlayMovieFullscreen("nod3.vqa") - OpenRA.RunAfterDelay(25 * 20, SendFirstAttackWave) - OpenRA.RunAfterDelay(25 * 50, SendSecondAttackWave) - OpenRA.RunAfterDelay(25 * 100, SendThirdAttackWave) - Actor.OnCaptured(TechCenter, MissionAccomplished) - Actor.OnKilled(TechCenter, MissionFailed) end Tick = function() - if Mission.RequiredUnitsAreDestroyed(player) then - MissionFailed() + if player.HasNoRequiredUnits() then + enemy.MarkCompletedObjective(gdiObjective) + end + if enemy.HasNoRequiredUnits() then + player.MarkCompletedObjective(nodObjective2) end end From e50b8fafb03c01afbdb9819a6ffcf69e251655d9 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Sun, 31 Aug 2014 12:37:28 +0200 Subject: [PATCH 2/2] Fix a typo in gdi02 --- mods/cnc/maps/gdi02/map.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/cnc/maps/gdi02/map.yaml b/mods/cnc/maps/gdi02/map.yaml index d50db7bfe2..b3d8f3f353 100644 --- a/mods/cnc/maps/gdi02/map.yaml +++ b/mods/cnc/maps/gdi02/map.yaml @@ -749,7 +749,7 @@ Rules: EarlyGameOver: true ^Infantry: MustBeDestroyed: - ^Vehicles: + ^Vehicle: MustBeDestroyed: PROC: Buildable: