Convert gdi01 to new Lua

This commit is contained in:
Oliver Brakmann
2014-08-04 11:50:21 +02:00
parent 8c43ffb802
commit 00fcf5f969
2 changed files with 55 additions and 37 deletions

View File

@@ -2,58 +2,76 @@ InfantryReinforcements = { "e1", "e1", "e1" }
VehicleReinforcements = { "jeep" }
NodPatrol = { "e1", "e1" }
MissionAccomplished = function()
Mission.MissionOver({ player }, nil, true)
Media.PlayMovieFullscreen("consyard.vqa")
end
MissionFailed = function()
Mission.MissionOver(nil, { player }, true)
Media.PlayMovieFullscreen("gameover.vqa")
end
SendNodPatrol = function()
local patrol = Reinforcements.Reinforce(enemy, NodPatrol, nod0.Location, nod1.Location, 0)
Utils.Do(patrol, function(soldier)
Actor.Move(soldier, nod2.Location)
Actor.Move(soldier, nod3.Location)
Actor.Hunt(soldier)
Utils.Do(NodPatrol, function(type)
local soldier = Actor.Create(type, true, { Location = nod0.Location, Owner = enemy })
soldier.Move(nod1.Location)
soldier.AttackMove(nod2.Location)
soldier.Move(nod3.Location)
soldier.Hunt()
end)
end
SetGunboatPath = function()
Actor.AttackMove(Gunboat, gunboatLeft.Location)
Actor.AttackMove(Gunboat, gunboatRight.Location)
SetGunboatPath = function(gunboat)
gunboat.AttackMove(gunboatLeft.Location)
gunboat.AttackMove(gunboatRight.Location)
end
ReinforceFromSea = function(passengers)
local hovercraft, troops = Reinforcements.Insert(player, "oldlst", passengers, { lstStart.Location, lstEnd.Location }, { lstStart.Location })
Media.PlaySpeechNotification("Reinforce")
local transport = Actor.Create("oldlst", true, { Location = lstStart.Location, Owner = player })
Utils.Do(passengers, function(actorType)
local passenger = Actor.Create(actorType, false, { Owner = player })
transport.LoadPassenger(passenger)
end)
transport.Move(lstEnd.Location)
transport.UnloadPassengers()
transport.Wait(50)
transport.Move(lstStart.Location)
transport.Destroy()
Media.PlaySpeechNotification(player, "Reinforce")
end
WorldLoaded = function()
player = OpenRA.GetPlayer("GDI")
enemy = OpenRA.GetPlayer("Nod")
Media.PlayMovieFullscreen("gdi1.vqa", function() Media.PlayMovieFullscreen("landing.vqa") end)
player = Player.GetPlayer("GDI")
enemy = Player.GetPlayer("Nod")
gdiObjective = player.AddPrimaryObjective("Destroy all Nod forces in the area!")
Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(player, "Win")
Trigger.AfterDelay(25, function()
Media.PlayMovieFullscreen("consyard.vqa")
end)
end)
Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(player, "Lose")
Trigger.AfterDelay(25, function()
Media.PlayMovieFullscreen("gameover.vqa")
end)
end)
Trigger.OnIdle(Gunboat, function() SetGunboatPath(Gunboat) end)
SendNodPatrol()
OpenRA.RunAfterDelay(25 * 5, function() ReinforceFromSea(InfantryReinforcements) end)
OpenRA.RunAfterDelay(25 * 15, function() ReinforceFromSea(InfantryReinforcements) end)
OpenRA.RunAfterDelay(25 * 30, function() ReinforceFromSea(VehicleReinforcements) end)
OpenRA.RunAfterDelay(25 * 60, function() ReinforceFromSea(VehicleReinforcements) end)
Trigger.AfterDelay(25 * 5, function() ReinforceFromSea(InfantryReinforcements) end)
Trigger.AfterDelay(25 * 15, function() ReinforceFromSea(InfantryReinforcements) end)
Trigger.AfterDelay(25 * 30, function() ReinforceFromSea(VehicleReinforcements) end)
Trigger.AfterDelay(25 * 60, function() ReinforceFromSea(VehicleReinforcements) end)
end
Tick = function()
if Actor.IsIdle(Gunboat) then
SetGunboatPath()
if enemy.HasNoRequiredUnits() then
player.MarkCompletedObjective(gdiObjective)
end
if Mission.RequiredUnitsAreDestroyed(player) then
MissionFailed()
if player.HasNoRequiredUnits() then
player.MarkFailedObjective(gdiObjective)
end
if Mission.RequiredUnitsAreDestroyed(enemy) then
MissionAccomplished()
end
end
end

View File

@@ -457,8 +457,8 @@ Rules:
PlayMusicOnMapLoad:
Music: aoi
Loop: false
LuaScriptInterface:
LuaScripts: gdi01.lua
LuaScript:
Scripts: gdi01.lua
ObjectivesPanel:
PanelName: MISSION_OBJECTIVES
Player: