Port gdi04c to New Lua
This commit is contained in:
@@ -12,73 +12,120 @@ Civvie2Wpts = { waypoint26, waypoint3, waypoint9, waypoint4, waypoint5, waypoint
|
|||||||
|
|
||||||
FollowCivvieWpts = function(actor, wpts)
|
FollowCivvieWpts = function(actor, wpts)
|
||||||
Utils.Do(wpts, function(wpt)
|
Utils.Do(wpts, function(wpt)
|
||||||
Actor.MoveNear(actor, wpt.Location, 2)
|
actor.Move(wpt.Location, 2)
|
||||||
Actor.Wait(actor, Utils.Seconds(2))
|
actor.Wait(Utils.Seconds(2))
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
FollowWaypoints = function(actor, wpts)
|
FollowWaypoints = function(actor, wpts)
|
||||||
Utils.Do(wpts, function(wpt)
|
Utils.Do(wpts, function(wpt)
|
||||||
Actor.AttackMove(actor, wpt.Location, 2)
|
actor.AttackMove(wpt.Location, 2)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
TownAttackersIdleAction = function(actor)
|
TownAttackersIdleAction = function(actor)
|
||||||
Actor.AttackMove(actor, TownAttackWpt.Location, 2)
|
actor.AttackMove(TownAttackWpt.Location, 2)
|
||||||
Actor.Hunt(actor)
|
actor.Hunt()
|
||||||
end
|
end
|
||||||
|
|
||||||
TownAttackAction = function(actor)
|
TownAttackAction = function(actor)
|
||||||
Actor.OnIdle(actor, TownAttackersIdleAction)
|
Trigger.OnIdle(actor, TownAttackersIdleAction)
|
||||||
FollowWaypoints(actor, TownAttackWpts)
|
FollowWaypoints(actor, TownAttackWpts)
|
||||||
end
|
end
|
||||||
|
|
||||||
AttackTown = function()
|
AttackTown = function()
|
||||||
TownAttackTriggered = true
|
TownAttackTriggered = true
|
||||||
|
|
||||||
Reinforcements.Reinforce(nod, TownAttackWave1, NodReinfEntry.Location, waypoint0.Location, Utils.Seconds(0.25), TownAttackAction)
|
Reinforcements.Reinforce(nod, TownAttackWave1, { NodReinfEntry.Location, waypoint0.Location }, Utils.Seconds(0.25), TownAttackAction)
|
||||||
OpenRA.RunAfterDelay(Utils.Seconds(2), function()
|
Trigger.AfterDelay(Utils.Seconds(2), function()
|
||||||
Reinforcements.Reinforce(nod, TownAttackWave2, NodReinfEntry.Location, waypoint0.Location, Utils.Seconds(1), TownAttackAction)
|
Reinforcements.Reinforce(nod, TownAttackWave2, { NodReinfEntry.Location, waypoint0.Location }, Utils.Seconds(1), TownAttackAction)
|
||||||
end)
|
end)
|
||||||
OpenRA.RunAfterDelay(Utils.Seconds(4), function()
|
Trigger.AfterDelay(Utils.Seconds(4), function()
|
||||||
Reinforcements.Reinforce(nod, TownAttackWave3, NodReinfEntry.Location, waypoint0.Location, Utils.Seconds(1), TownAttackAction)
|
Reinforcements.Reinforce(nod, TownAttackWave3, { NodReinfEntry.Location, waypoint0.Location }, Utils.Seconds(1), TownAttackAction)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
SendGDIReinforcements = function()
|
SendGDIReinforcements = function()
|
||||||
GDIReinforcementsTriggered = true
|
GDIReinforcementsTriggered = true
|
||||||
|
|
||||||
Reinforcements.Reinforce(player, GDIReinforcementsPart1, GDIReinfEntry1.Location, waypoint12.Location, Utils.Seconds(1), function(actor)
|
Reinforcements.Reinforce(player, GDIReinforcementsPart1, { GDIReinfEntry1.Location, waypoint12.Location }, Utils.Seconds(1), function(actor)
|
||||||
Media.PlaySpeechNotification("Reinforce")
|
Media.PlaySpeechNotification(player, "Reinforce")
|
||||||
Actor.Move(actor, waypoint10.Location)
|
actor.Move(waypoint10.Location)
|
||||||
Actor.SetStance(actor, "Defend")
|
actor.Stance = "Defend"
|
||||||
end)
|
end)
|
||||||
OpenRA.RunAfterDelay(Utils.Seconds(5), function()
|
Trigger.AfterDelay(Utils.Seconds(5), function()
|
||||||
Reinforcements.ReinforceWithCargo(player, "apc", { GDIReinfEntry2, waypoint13 }, GDIReinforcementsPart2, function(apc, team)
|
Reinforcements.ReinforceWithTransport(player, "apc", GDIReinforcementsPart2, { GDIReinfEntry2.Location, waypoint13.Location }, nil, function(apc, team)
|
||||||
Media.PlaySpeechNotification("Reinforce")
|
Media.PlaySpeechNotification(player, "Reinforce")
|
||||||
Actor.Move(apc, GDIUnloadWpt.Location)
|
apc.Move(GDIUnloadWpt.Location)
|
||||||
Actor.UnloadCargo(apc, true)
|
apc.UnloadPassengers()
|
||||||
Team.Do(team, function(unit) Actor.SetStance(unit, "Defend") end)
|
Utils.Do(team, function(unit) unit.Stance = "Defend" end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- FIXME: replace with real cell trigger when available
|
-- FIXME: replace with real cell trigger when available
|
||||||
CellTrigger = function(player, trigger, radius, func)
|
CellTrigger = function(player, trigger, radius, func)
|
||||||
local units = Map.FindUnitsInCircle(player, trigger, radius)
|
local units = Map.ActorsInCircle(trigger.CenterPosition, WRange.FromCells(radius), function(actor)
|
||||||
|
return actor.Owner == player and actor.HasProperty("Move")
|
||||||
|
end)
|
||||||
|
|
||||||
if #units > 0 then
|
if #units > 0 then
|
||||||
func()
|
func()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
WorldLoaded = function()
|
||||||
|
player = Player.GetPlayer("GDI")
|
||||||
|
nod = Player.GetPlayer("Nod")
|
||||||
|
|
||||||
|
nodObjective = nod.AddPrimaryObjective("Destroy all GDI troops")
|
||||||
|
gdiObjective1 = player.AddPrimaryObjective("Defend the town of Białystok")
|
||||||
|
gdiObjective2 = player.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
||||||
|
|
||||||
|
Trigger.OnObjectiveCompleted(player, function() Media.DisplayMessage("Objective completed") end)
|
||||||
|
Trigger.OnObjectiveFailed(player, function() Media.DisplayMessage("Objective failed") end)
|
||||||
|
|
||||||
|
Trigger.OnAllKilled(LoseTriggerHouses, function()
|
||||||
|
player.MarkFailedObjective(gdiObjective1)
|
||||||
|
end)
|
||||||
|
|
||||||
|
Trigger.OnPlayerWon(player, function()
|
||||||
|
Media.PlaySpeechNotification(player, "Win")
|
||||||
|
Trigger.AfterDelay(Utils.Seconds(1), function()
|
||||||
|
Media.PlayMovieFullscreen("burdet1.vqa")
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
Trigger.OnPlayerLost(player, function()
|
||||||
|
Trigger.AfterDelay(Utils.Seconds(1), function()
|
||||||
|
Media.PlaySpeechNotification(player, "Lose")
|
||||||
|
Media.PlayMovieFullscreen("gameover.vqa")
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
Utils.Do(player.GetGroundAttackers(), function(unit)
|
||||||
|
unit.Stance = "Defend"
|
||||||
|
end)
|
||||||
|
|
||||||
|
Trigger.AfterDelay(1, function()
|
||||||
|
FollowCivvieWpts(civvie1, Civvie1Wpts)
|
||||||
|
FollowCivvieWpts(civvie2, Civvie2Wpts)
|
||||||
|
end)
|
||||||
|
|
||||||
|
Camera.Position = Actor141.CenterPosition
|
||||||
|
|
||||||
|
Media.PlayMovieFullscreen("bkground.vqa", function() Media.PlayMovieFullscreen("gdi4a.vqa", function() Media.PlayMovieFullscreen("nodsweep.vqa") end) end)
|
||||||
|
end
|
||||||
|
|
||||||
TownAttackTriggered = false
|
TownAttackTriggered = false
|
||||||
GDIReinforcementsTriggered = false
|
GDIReinforcementsTriggered = false
|
||||||
Tick = function()
|
Tick = function()
|
||||||
if Mission.RequiredUnitsAreDestroyed(player) then
|
if player.HasNoRequiredUnits() then
|
||||||
OpenRA.RunAfterDelay(Utils.Seconds(1), MissionFailed)
|
nod.MarkCompletedObjective(nodObjective)
|
||||||
end
|
end
|
||||||
if Mission.RequiredUnitsAreDestroyed(nod) then
|
if nod.HasNoRequiredUnits() then
|
||||||
OpenRA.RunAfterDelay(Utils.Seconds(1), MissionAccomplished)
|
player.MarkCompletedObjective(gdiObjective1)
|
||||||
|
player.MarkCompletedObjective(gdiObjective2)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not TownAttackTriggered then
|
if not TownAttackTriggered then
|
||||||
@@ -87,33 +134,3 @@ Tick = function()
|
|||||||
CellTrigger(player, GDIReinfTrigger, 2, SendGDIReinforcements)
|
CellTrigger(player, GDIReinfTrigger, 2, SendGDIReinforcements)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
WorldLoaded = function()
|
|
||||||
Media.PlayMovieFullscreen("bkground.vqa", function() Media.PlayMovieFullscreen("gdi4a.vqa", function() Media.PlayMovieFullscreen("nodsweep.vqa") end) end)
|
|
||||||
player = OpenRA.GetPlayer("GDI")
|
|
||||||
nod = OpenRA.GetPlayer("Nod")
|
|
||||||
|
|
||||||
LoseTriggerTeam = Team.New(LoseTriggerHouses)
|
|
||||||
Team.AddEventHandler(LoseTriggerTeam.OnAllKilled, MissionFailed)
|
|
||||||
|
|
||||||
Utils.Do(Mission.GetGroundAttackersOf(player), function(unit)
|
|
||||||
Actor.SetStance(unit, "Defend")
|
|
||||||
end)
|
|
||||||
|
|
||||||
OpenRA.RunAfterDelay(1, function()
|
|
||||||
FollowCivvieWpts(civvie1, Civvie1Wpts)
|
|
||||||
FollowCivvieWpts(civvie2, Civvie2Wpts)
|
|
||||||
end)
|
|
||||||
|
|
||||||
OpenRA.SetViewportCenterPosition(Actor141.CenterPosition)
|
|
||||||
end
|
|
||||||
|
|
||||||
MissionAccomplished = function()
|
|
||||||
Mission.MissionOver({ player }, nil, true)
|
|
||||||
Media.PlayMovieFullscreen("burdet1.vqa")
|
|
||||||
end
|
|
||||||
|
|
||||||
MissionFailed = function()
|
|
||||||
Mission.MissionOver(nil, { player }, true)
|
|
||||||
Media.PlayMovieFullscreen("gameover.vqa")
|
|
||||||
end
|
|
||||||
|
|||||||
@@ -898,8 +898,8 @@ Rules:
|
|||||||
-SpawnMPUnits:
|
-SpawnMPUnits:
|
||||||
-MPStartLocations:
|
-MPStartLocations:
|
||||||
-CrateSpawner:
|
-CrateSpawner:
|
||||||
LuaScriptInterface:
|
LuaScript:
|
||||||
LuaScripts: gdi04c.lua
|
Scripts: gdi04c.lua
|
||||||
ObjectivesPanel:
|
ObjectivesPanel:
|
||||||
PanelName: MISSION_OBJECTIVES
|
PanelName: MISSION_OBJECTIVES
|
||||||
Player:
|
Player:
|
||||||
@@ -915,6 +915,8 @@ Rules:
|
|||||||
^CivInfantry:
|
^CivInfantry:
|
||||||
Health:
|
Health:
|
||||||
HP: 125
|
HP: 125
|
||||||
|
^Bridge:
|
||||||
|
Invulnerable:
|
||||||
|
|
||||||
Sequences:
|
Sequences:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user