Merge pull request #6328 from obrakmann/nod03b

Port nod03b to New Lua
This commit is contained in:
Paul Chote
2014-09-06 10:39:16 +12:00
2 changed files with 61 additions and 54 deletions

View File

@@ -539,7 +539,7 @@ Actors:
SubCell: 4 SubCell: 4
Actor101: c1 Actor101: c1
Location: 16,36 Location: 16,36
Owner: GDI Owner: Neutral
Health: 1 Health: 1
Facing: 192 Facing: 192
SubCell: 4 SubCell: 4
@@ -645,10 +645,14 @@ Rules:
-CrateSpawner: -CrateSpawner:
-SpawnMPUnits: -SpawnMPUnits:
-MPStartLocations: -MPStartLocations:
LuaScriptInterface: LuaScript:
LuaScripts: nod03b.lua Scripts: nod03b.lua
ObjectivesPanel: ObjectivesPanel:
PanelName: MISSION_OBJECTIVES PanelName: MISSION_OBJECTIVES
^Infantry:
MustBeDestroyed:
^Vehicle:
MustBeDestroyed:
NUK2: NUK2:
Buildable: Buildable:
Prerequisites: ~disabled Prerequisites: ~disabled
@@ -704,6 +708,7 @@ Rules:
Tooltip: Tooltip:
Name: Prison Name: Prison
Capturable: Capturable:
CaptureThreshold: 1
HQ.NOAIRSTRIKE: HQ.NOAIRSTRIKE:
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:

View File

@@ -1,65 +1,67 @@
FirstAttackWave = { "e1", "e1", "e2", } FirstAttackWaveUnits = { "e1", "e1", "e2" }
SecondAttackWave = { "e1", "e1", "e1", } SecondAttackWaveUnits = { "e1", "e1", "e1" }
ThirdAttackWave = { "e1", "e1", "e1", "e2", } ThirdAttackWaveUnits = { "e1", "e1", "e1", "e2" }
MissionAccomplished = function() SendAttackWave = function(units, action)
Mission.MissionOver({ player }, nil, true) Reinforcements.Reinforce(enemy, units, { GDIBarracksSpawn.Location, WP0.Location, WP1.Location }, 15, action)
Media.PlayMovieFullscreen("desflees.vqa")
end end
MissionFailed = function() FirstAttackWave = function(soldier)
Mission.MissionOver(nil, { player }, true) soldier.Move(WP2.Location)
Media.PlayMovieFullscreen("flag.vqa") soldier.Move(WP3.Location)
soldier.Move(WP4.Location)
soldier.AttackMove(PlayerBase.Location)
end end
SendFirstAttackWave = function() SecondAttackWave = function(soldier)
local wave = Reinforcements.Reinforce(enemy, FirstAttackWave, GDIBarracksSpawn.Location, WP0.Location, 0) soldier.Move(WP5.Location)
Utils.Do(wave, function(soldier) soldier.Move(WP6.Location)
Actor.Move(soldier, WP1.Location) soldier.Move(WP7.Location)
Actor.Move(soldier, WP2.Location) soldier.Move(WP9.Location)
Actor.Move(soldier, WP3.Location) soldier.AttackMove(PlayerBase.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)
end end
WorldLoaded = function() WorldLoaded = function()
player = OpenRA.GetPlayer("Nod") player = Player.GetPlayer("Nod")
enemy = OpenRA.GetPlayer("GDI") 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") 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 end
Tick = function() Tick = function()
if Mission.RequiredUnitsAreDestroyed(player) then if player.HasNoRequiredUnits() then
MissionFailed() enemy.MarkCompletedObjective(gdiObjective)
end
if enemy.HasNoRequiredUnits() then
player.MarkCompletedObjective(nodObjective2)
end end
end end