Merge pull request #6327 from obrakmann/nod03a

Port nod03a to New Lua
This commit is contained in:
Paul Chote
2014-09-06 10:28:26 +12:00
3 changed files with 53 additions and 41 deletions

View File

@@ -749,7 +749,7 @@ Rules:
EarlyGameOver: true EarlyGameOver: true
^Infantry: ^Infantry:
MustBeDestroyed: MustBeDestroyed:
^Vehicles: ^Vehicle:
MustBeDestroyed: MustBeDestroyed:
PROC: PROC:
Buildable: Buildable:

View File

@@ -576,10 +576,14 @@ Rules:
-CrateSpawner: -CrateSpawner:
-SpawnMPUnits: -SpawnMPUnits:
-MPStartLocations: -MPStartLocations:
LuaScriptInterface: LuaScript:
LuaScripts: nod03a.lua Scripts: nod03a.lua
ObjectivesPanel: ObjectivesPanel:
PanelName: MISSION_OBJECTIVES PanelName: MISSION_OBJECTIVES
^Infantry:
MustBeDestroyed:
^Vehicle:
MustBeDestroyed:
NUK2: NUK2:
Buildable: Buildable:
Prerequisites: ~disabled Prerequisites: ~disabled
@@ -635,6 +639,7 @@ Rules:
Tooltip: Tooltip:
Name: Prison Name: Prison
Capturable: Capturable:
CaptureThreshold: 1
HQ.NOAIRSTRIKE: HQ.NOAIRSTRIKE:
RequiresPower: RequiresPower:
CanPowerDown: CanPowerDown:

View File

@@ -1,50 +1,57 @@
FirstAttackWave = { "e1", "e1", "e1", "e2", } FirstAttackWave = { "e1", "e1", "e1", "e2", }
SecondThirdAttackWave = { "e1", "e1", "e2", } SecondThirdAttackWave = { "e1", "e1", "e2", }
MissionAccomplished = function() SendAttackWave = function(units, spawnPoint)
Mission.MissionOver({ player }, nil, true) Reinforcements.Reinforce(enemy, units, { spawnPoint }, Utils.Seconds(1), function(actor)
Media.PlayMovieFullscreen("desflees.vqa") actor.AttackMove(PlayerBase.Location)
end 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
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.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") 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 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