diff --git a/mods/cnc/maps/gdi02/gdi02.lua b/mods/cnc/maps/gdi02/gdi02.lua index ea566859d3..5aa7c0c6b4 100644 --- a/mods/cnc/maps/gdi02/gdi02.lua +++ b/mods/cnc/maps/gdi02/gdi02.lua @@ -1,59 +1,70 @@ +nodInBaseTeam = { RushBuggy, RushRifle1, RushRifle2, RushRifle3 } MobileConstructionVehicle = { "mcv" } EngineerReinforcements = { "e6", "e6", "e6" } VehicleReinforcements = { "jeep" } AttackerSquadSize = 3 -MissionAccomplished = function() - Mission.MissionOver({ player }, nil, true) - Media.PlayMovieFullscreen("flag.vqa") -end - -MissionFailed = function() - Mission.MissionOver(nil, { player }, true) - Media.PlayMovieFullscreen("gameover.vqa") -end - -ReinforceFromSea = function(passengers) - local hovercraft, troops = Reinforcements.Insert(player, "oldlst", passengers, { lstStart.Location, lstEnd.Location }, { lstStart.Location }) - Media.PlaySpeechNotification("Reinforce") +Reinforce = function(passengers) + Reinforcements.ReinforceWithTransport(player, "oldlst", passengers, { lstStart.Location, lstEnd.Location }, { lstStart.Location }) + Media.PlaySpeechNotification(player, "Reinforce") end BridgeheadSecured = function() - ReinforceFromSea(MobileConstructionVehicle) - OpenRA.RunAfterDelay(25 * 15, NodAttack) - OpenRA.RunAfterDelay(25 * 30, function() ReinforceFromSea(EngineerReinforcements) end) - OpenRA.RunAfterDelay(25 * 60, function() ReinforceFromSea(VehicleReinforcements) end) + Reinforce(MobileConstructionVehicle) + Trigger.AfterDelay(Utils.Seconds(15), NodAttack) + Trigger.AfterDelay(Utils.Seconds(30), function() Reinforce(EngineerReinforcements) end) + Trigger.AfterDelay(Utils.Seconds(60), function() Reinforce(VehicleReinforcements) end) end NodAttack = function() - local nodUnits = Mission.GetGroundAttackersOf(enemy) + local nodUnits = enemy.GetGroundAttackers() if #nodUnits > AttackerSquadSize * 2 then - attackers = Utils.Skip(nodUnits, #nodUnits - AttackerSquadSize) - local attackSquad = Team.New(attackers) - Team.Do(attackSquad, function(unit) - Actor.AttackMove(unit, waypoint2.location) - Actor.Hunt(unit) + local attackers = Utils.Skip(nodUnits, #nodUnits - AttackerSquadSize) + Utils.Do(attackers, function(unit) + unit.AttackMove(waypoint2.Location) + Trigger.OnIdle(unit, unit.Hunt) end) - Team.AddEventHandler(attackSquad.OnAllKilled, OpenRA.RunAfterDelay(25 * 15, NodAttack)) + Trigger.OnAllKilled(attackers, function() Trigger.AfterDelay(Utils.Seconds(15), NodAttack) end) end end WorldLoaded = function() - player = OpenRA.GetPlayer("GDI") - enemy = OpenRA.GetPlayer("Nod") + player = Player.GetPlayer("GDI") + enemy = Player.GetPlayer("Nod") + + nodObjective = enemy.AddPrimaryObjective("Destroy all GDI troops") + gdiObjective1 = player.AddPrimaryObjective("Eliminate all Nod forces in the area") + gdiObjective2 = player.AddSecondaryObjective("Capture the Tiberium Refinery") + + Trigger.OnObjectiveCompleted(player, function() Media.DisplayMessage("Objective completed") end) + Trigger.OnObjectiveFailed(player, function() Media.DisplayMessage("Objective failed") end) + + Trigger.OnPlayerWon(player, function() + Media.PlaySpeechNotification(player, "Win") + Media.PlayMovieFullscreen("flag.vqa") + end) + + Trigger.OnPlayerLost(player, function() + Trigger.AfterDelay(Utils.Seconds(1), function() + Media.PlaySpeechNotification(player, "Lose") + Media.PlayMovieFullscreen("gameover.vqa") + end) + end) + + Trigger.OnCapture(NodRefinery, function() player.MarkCompletedObjective(gdiObjective2) end) + Trigger.OnKilled(NodRefinery, function() player.MarkFailedObjective(gdiObjective2) end) + + Trigger.OnAllKilled(nodInBaseTeam, BridgeheadSecured) Media.PlayMovieFullscreen("gdi2.vqa") - - nodInBaseTeam = Team.New({ RushBuggy, RushRifle1, RushRifle2, RushRifle3 }) - Team.AddEventHandler(nodInBaseTeam.OnAllKilled, BridgeheadSecured) end Tick = function() - if Mission.RequiredUnitsAreDestroyed(player) then - MissionFailed() + if player.HasNoRequiredUnits() then + enemy.MarkCompletedObjective(nodObjective) end - if Mission.RequiredUnitsAreDestroyed(enemy) then - MissionAccomplished() + if enemy.HasNoRequiredUnits() then + player.MarkCompletedObjective(gdiObjective1) end -end \ No newline at end of file +end diff --git a/mods/cnc/maps/gdi02/map.yaml b/mods/cnc/maps/gdi02/map.yaml index 86f229c409..d50db7bfe2 100644 --- a/mods/cnc/maps/gdi02/map.yaml +++ b/mods/cnc/maps/gdi02/map.yaml @@ -323,7 +323,7 @@ Actors: Actor83: nuke Location: 53,52 Owner: GDI - Health: 0.0390625 + Health: 0.025 Facing: 0 NodRefinery: proc Location: 57,34 @@ -739,14 +739,18 @@ Rules: -SpawnMPUnits: -MPStartLocations: -CrateSpawner: - LuaScriptInterface: - LuaScripts: gdi02.lua + LuaScript: + Scripts: gdi02.lua ObjectivesPanel: PanelName: MISSION_OBJECTIVES Player: -ConquestVictoryConditions: MissionObjectives: EarlyGameOver: true + ^Infantry: + MustBeDestroyed: + ^Vehicles: + MustBeDestroyed: PROC: Buildable: Prerequisites: ~disabled