From e0af4cf6711729fbb9ae119043d658efc206fcc8 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Sun, 17 Aug 2014 22:15:41 +0200 Subject: [PATCH] Port nod03b to New Lua --- mods/cnc/maps/nod03b/map.yaml | 11 +++- mods/cnc/maps/nod03b/nod03b.lua | 104 ++++++++++++++++---------------- 2 files changed, 61 insertions(+), 54 deletions(-) diff --git a/mods/cnc/maps/nod03b/map.yaml b/mods/cnc/maps/nod03b/map.yaml index 7569bd87e7..0193213ec4 100644 --- a/mods/cnc/maps/nod03b/map.yaml +++ b/mods/cnc/maps/nod03b/map.yaml @@ -539,7 +539,7 @@ Actors: SubCell: 4 Actor101: c1 Location: 16,36 - Owner: GDI + Owner: Neutral Health: 1 Facing: 192 SubCell: 4 @@ -645,10 +645,14 @@ Rules: -CrateSpawner: -SpawnMPUnits: -MPStartLocations: - LuaScriptInterface: - LuaScripts: nod03b.lua + LuaScript: + Scripts: nod03b.lua ObjectivesPanel: PanelName: MISSION_OBJECTIVES + ^Infantry: + MustBeDestroyed: + ^Vehicle: + MustBeDestroyed: NUK2: Buildable: Prerequisites: ~disabled @@ -704,6 +708,7 @@ Rules: Tooltip: Name: Prison Capturable: + CaptureThreshold: 1 HQ.NOAIRSTRIKE: RequiresPower: CanPowerDown: diff --git a/mods/cnc/maps/nod03b/nod03b.lua b/mods/cnc/maps/nod03b/nod03b.lua index 88a6037a87..25d99c4838 100644 --- a/mods/cnc/maps/nod03b/nod03b.lua +++ b/mods/cnc/maps/nod03b/nod03b.lua @@ -1,65 +1,67 @@ -FirstAttackWave = { "e1", "e1", "e2", } -SecondAttackWave = { "e1", "e1", "e1", } -ThirdAttackWave = { "e1", "e1", "e1", "e2", } +FirstAttackWaveUnits = { "e1", "e1", "e2" } +SecondAttackWaveUnits = { "e1", "e1", "e1" } +ThirdAttackWaveUnits = { "e1", "e1", "e1", "e2" } -MissionAccomplished = function() - Mission.MissionOver({ player }, nil, true) - Media.PlayMovieFullscreen("desflees.vqa") +SendAttackWave = function(units, action) + Reinforcements.Reinforce(enemy, units, { GDIBarracksSpawn.Location, WP0.Location, WP1.Location }, 15, action) end -MissionFailed = function() - Mission.MissionOver(nil, { player }, true) - Media.PlayMovieFullscreen("flag.vqa") +FirstAttackWave = function(soldier) + soldier.Move(WP2.Location) + soldier.Move(WP3.Location) + soldier.Move(WP4.Location) + soldier.AttackMove(PlayerBase.Location) end -SendFirstAttackWave = function() - local wave = Reinforcements.Reinforce(enemy, FirstAttackWave, GDIBarracksSpawn.Location, WP0.Location, 0) - Utils.Do(wave, function(soldier) - Actor.Move(soldier, WP1.Location) - Actor.Move(soldier, WP2.Location) - Actor.Move(soldier, WP3.Location) - Actor.Move(soldier, WP4.Location) - --Actor.Move(soldier, WP5.Location) - Actor.AttackMove(soldier, PlayerBase.Location) - end) -end - -SendSecondAttackWave = function() - local wave = Reinforcements.Reinforce(enemy, SecondAttackWave, GDIBarracksSpawn.Location, WP0.Location, 0) - Utils.Do(wave, function(soldier) - Actor.Move(soldier, WP1.Location) - Actor.Move(soldier, WP5.Location) - Actor.Move(soldier, WP6.Location) - Actor.Move(soldier, WP7.Location) - Actor.Move(soldier, WP9.Location) - Actor.AttackMove(soldier, PlayerBase.Location) - end) -end - -SendThirdAttackWave = function() - local wave = Reinforcements.Reinforce(enemy, ThirdAttackWave, GDIBarracksSpawn.Location, WP0.Location, 0) - Utils.Do(wave, function(soldier) - Actor.Move(soldier, WP1.Location) - Actor.Move(soldier, WP2.Location) - Actor.Move(soldier, WP3.Location) - Actor.Move(soldier, WP4.Location) - Actor.AttackMove(soldier, PlayerBase.Location) - end) +SecondAttackWave = function(soldier) + soldier.Move(WP5.Location) + soldier.Move(WP6.Location) + soldier.Move(WP7.Location) + soldier.Move(WP9.Location) + soldier.AttackMove(PlayerBase.Location) 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.OnObjectiveCompleted(player, function() Media.DisplayMessage("Objective completed") end) + Trigger.OnObjectiveFailed(player, function() Media.DisplayMessage("Objective failed") end) + + Trigger.AfterDelay(Utils.Seconds(40), function() SendAttackWave(FirstAttackWaveUnits, FirstAttackWave) end) + Trigger.AfterDelay(Utils.Seconds(80), function() SendAttackWave(SecondAttackWaveUnits, SecondAttackWave) end) + Trigger.AfterDelay(Utils.Seconds(140), function() SendAttackWave(ThirdAttackWaveUnits, FirstAttackWave) 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 * 40, SendFirstAttackWave) - OpenRA.RunAfterDelay(25 * 80, SendSecondAttackWave) - OpenRA.RunAfterDelay(25 * 140, 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