Merge pull request #6324 from obrakmann/gdi02

Port gdi02 to New Lua
This commit is contained in:
Paul Chote
2014-08-31 21:57:57 +12:00
2 changed files with 52 additions and 37 deletions

View File

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

View File

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