Use a global script in Tiberian Dawn
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
the License, or (at your option) any later version. For more
|
||||
information, see COPYING.
|
||||
]]
|
||||
|
||||
nodInBaseTeam = { RushBuggy, RushRifle1, RushRifle2, RushRifle3 }
|
||||
MobileConstructionVehicle = { "mcv" }
|
||||
EngineerReinforcements = { "e6", "e6", "e6" }
|
||||
@@ -13,36 +14,9 @@ VehicleReinforcements = { "jeep" }
|
||||
|
||||
AttackerSquadSize = 3
|
||||
|
||||
ReinforceWithLandingCraft = function(units, transportStart, transportUnload, rallypoint)
|
||||
local transport = Actor.Create("oldlst", true, { Owner = player, Facing = 0, Location = transportStart })
|
||||
local subcell = 0
|
||||
Utils.Do(units, function(a)
|
||||
transport.LoadPassenger(Actor.Create(a, false, { Owner = transport.Owner, Facing = transport.Facing, Location = transportUnload, SubCell = subcell }))
|
||||
subcell = subcell + 1
|
||||
end)
|
||||
|
||||
transport.ScriptedMove(transportUnload)
|
||||
|
||||
transport.CallFunc(function()
|
||||
Utils.Do(units, function()
|
||||
local a = transport.UnloadPassenger()
|
||||
a.IsInWorld = true
|
||||
a.MoveIntoWorld(transport.Location - CVec.New(0, 1))
|
||||
|
||||
if rallypoint ~= nil then
|
||||
a.Move(rallypoint)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
transport.Wait(5)
|
||||
transport.ScriptedMove(transportStart)
|
||||
transport.Destroy()
|
||||
end
|
||||
|
||||
Reinforce = function(units)
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
ReinforceWithLandingCraft(units, lstStart.Location, lstEnd.Location)
|
||||
Media.PlaySpeechNotification(GDI, "Reinforce")
|
||||
ReinforceWithLandingCraft(GDI, units, lstStart.Location, lstEnd.Location)
|
||||
end
|
||||
|
||||
BridgeheadSecured = function()
|
||||
@@ -53,54 +27,39 @@ BridgeheadSecured = function()
|
||||
end
|
||||
|
||||
NodAttack = function()
|
||||
local nodUnits = enemy.GetGroundAttackers()
|
||||
local nodUnits = Nod.GetGroundAttackers()
|
||||
if #nodUnits > AttackerSquadSize * 2 then
|
||||
local attackers = Utils.Skip(nodUnits, #nodUnits - AttackerSquadSize)
|
||||
Utils.Do(attackers, function(unit)
|
||||
unit.AttackMove(NodAttackWaypoint.Location)
|
||||
Trigger.OnIdle(unit, unit.Hunt)
|
||||
IdleHunt(unit)
|
||||
end)
|
||||
Trigger.OnAllKilled(attackers, function() Trigger.AfterDelay(DateTime.Seconds(15), NodAttack) end)
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
player = Player.GetPlayer("GDI")
|
||||
enemy = Player.GetPlayer("Nod")
|
||||
GDI = Player.GetPlayer("GDI")
|
||||
Nod = Player.GetPlayer("Nod")
|
||||
|
||||
Trigger.OnObjectiveAdded(player, function(p, id)
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
|
||||
end)
|
||||
Trigger.OnObjectiveCompleted(player, function(p, id)
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
|
||||
end)
|
||||
Trigger.OnObjectiveFailed(player, function(p, id)
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
|
||||
end)
|
||||
InitObjectives(GDI)
|
||||
|
||||
Trigger.OnPlayerWon(player, function()
|
||||
Media.PlaySpeechNotification(player, "Win")
|
||||
end)
|
||||
nodObjective = Nod.AddObjective("Destroy all GDI troops.")
|
||||
gdiObjective1 = GDI.AddObjective("Eliminate all Nod forces in the area.")
|
||||
gdiObjective2 = GDI.AddObjective("Capture the Tiberium refinery.", "Secondary", false)
|
||||
|
||||
Trigger.OnPlayerLost(player, function()
|
||||
Media.PlaySpeechNotification(player, "Lose")
|
||||
end)
|
||||
|
||||
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.OnCapture(NodRefinery, function() player.MarkCompletedObjective(gdiObjective2) end)
|
||||
Trigger.OnKilled(NodRefinery, function() player.MarkFailedObjective(gdiObjective2) end)
|
||||
Trigger.OnCapture(NodRefinery, function() GDI.MarkCompletedObjective(gdiObjective2) end)
|
||||
Trigger.OnKilled(NodRefinery, function() GDI.MarkFailedObjective(gdiObjective2) end)
|
||||
|
||||
Trigger.OnAllKilled(nodInBaseTeam, BridgeheadSecured)
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if player.HasNoRequiredUnits() then
|
||||
enemy.MarkCompletedObjective(nodObjective)
|
||||
if GDI.HasNoRequiredUnits() then
|
||||
Nod.MarkCompletedObjective(nodObjective)
|
||||
end
|
||||
if enemy.HasNoRequiredUnits() then
|
||||
player.MarkCompletedObjective(gdiObjective1)
|
||||
|
||||
if Nod.HasNoRequiredUnits() then
|
||||
GDI.MarkCompletedObjective(gdiObjective1)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user