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
^Infantry:
MustBeDestroyed:
^Vehicles:
^Vehicle:
MustBeDestroyed:
PROC:
Buildable:

View File

@@ -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:

View File

@@ -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