Port nod01 to New Lua

This commit is contained in:
Oliver Brakmann
2014-08-17 20:56:42 +02:00
parent f0fc63b15d
commit ccd6540e13
2 changed files with 49 additions and 30 deletions

View File

@@ -310,8 +310,8 @@ Rules:
-CrateSpawner: -CrateSpawner:
-SpawnMPUnits: -SpawnMPUnits:
-MPStartLocations: -MPStartLocations:
LuaScriptInterface: LuaScript:
LuaScripts: nod01.lua Scripts: nod01.lua
ObjectivesPanel: ObjectivesPanel:
PanelName: MISSION_OBJECTIVES PanelName: MISSION_OBJECTIVES
C10: C10:

View File

@@ -1,47 +1,66 @@
RifleInfantryReinforcements = { "e1", "e1", } RifleInfantryReinforcements = { "e1", "e1" }
RocketInfantryReinforcements = { "e3", "e3", "e3" } RocketInfantryReinforcements = { "e3", "e3", "e3" }
MissionAccomplished = function()
Mission.MissionOver({ player }, nil, true)
end
MissionFailed = function()
Mission.MissionOver(nil, { player }, true)
Media.PlayMovieFullscreen("nodlose.vqa")
end
SendFirstInfantryReinforcements = function() SendFirstInfantryReinforcements = function()
Media.PlaySpeechNotification("Reinforce") Media.PlaySpeechNotification(nod, "Reinforce")
Reinforcements.Reinforce(player, RifleInfantryReinforcements, StartSpawnPointRight.Location, StartRallyPoint.Location, 15) Reinforcements.Reinforce(nod, RifleInfantryReinforcements, { StartSpawnPointRight.Location, StartRallyPoint.Location }, 15)
end end
SendSecondInfantryReinforcements = function() SendSecondInfantryReinforcements = function()
Media.PlaySpeechNotification("Reinforce") Media.PlaySpeechNotification(nod, "Reinforce")
Reinforcements.Reinforce(player, RifleInfantryReinforcements, StartSpawnPointLeft.Location, StartRallyPoint.Location, 15) Reinforcements.Reinforce(nod, RifleInfantryReinforcements, { StartSpawnPointLeft.Location, StartRallyPoint.Location }, 15)
end end
SendLastInfantryReinforcements = function() SendLastInfantryReinforcements = function()
Media.PlaySpeechNotification("Reinforce") Media.PlaySpeechNotification(nod, "Reinforce")
Reinforcements.Reinforce(player, RocketInfantryReinforcements, VillageSpawnPoint.Location, VillageRallyPoint.Location, 15) Reinforcements.Reinforce(nod, RocketInfantryReinforcements, { VillageSpawnPoint.Location, VillageRallyPoint.Location }, 15)
end end
WorldLoaded = function() WorldLoaded = function()
player = OpenRA.GetPlayer("Nod") nod = Player.GetPlayer("Nod")
enemy = OpenRA.GetPlayer("Villagers") gdi = Player.GetPlayer("GDI")
villagers = Player.GetPlayer("Villagers")
NodObjective1 = nod.AddPrimaryObjective("Kill Nikoomba")
NodObjective2 = nod.AddPrimaryObjective("Destroy the village")
NodObjective3 = nod.AddSecondaryObjective("Destroy all GDI troops in the area")
GDIObjective1 = gdi.AddPrimaryObjective("Eliminate all Nod forces")
Trigger.OnObjectiveCompleted(nod, function() Media.DisplayMessage("Objective completed") end)
Trigger.OnObjectiveFailed(nod, function() Media.DisplayMessage("Objective failed") end)
Trigger.OnPlayerWon(nod, function()
Media.PlaySpeechNotification(nod, "Win")
end)
Trigger.OnPlayerLost(nod, function()
Media.PlaySpeechNotification(nod, "Lose")
Trigger.AfterDelay(Utils.Seconds(1), function()
Media.PlayMovieFullscreen("nodlose.vqa")
end)
end)
Trigger.OnKilled(Nikoomba, function()
nod.MarkCompletedObjective(NodObjective1)
Trigger.AfterDelay(Utils.Seconds(1), function()
SendLastInfantryReinforcements()
end)
end)
Trigger.AfterDelay(Utils.Seconds(30), SendFirstInfantryReinforcements)
Trigger.AfterDelay(Utils.Seconds(60), SendSecondInfantryReinforcements)
Media.PlayMovieFullscreen("nod1pre.vqa", function() Media.PlayMovieFullscreen("nod1.vqa") end) Media.PlayMovieFullscreen("nod1pre.vqa", function() Media.PlayMovieFullscreen("nod1.vqa") end)
Actor.OnKilled(Nikoomba, SendLastInfantryReinforcements)
OpenRA.RunAfterDelay(25 * 30, SendFirstInfantryReinforcements)
OpenRA.RunAfterDelay(25 * 60, SendSecondInfantryReinforcements)
end end
Tick = function() Tick = function()
if Mission.RequiredUnitsAreDestroyed(player) then if nod.HasNoRequiredUnits() then
MissionFailed() gdi.MarkCompletedObjective(GDIObjective1)
end end
if Mission.RequiredUnitsAreDestroyed(enemy) then if villagers.HasNoRequiredUnits() then
MissionAccomplished() nod.MarkCompletedObjective(NodObjective2)
end end
end if gdi.HasNoRequiredUnits() then
nod.MarkCompletedObjective(NodObjective3)
end
end