Use a global script in Tiberian Dawn
This commit is contained in:
@@ -6,61 +6,42 @@
|
||||
the License, or (at your option) any later version. For more
|
||||
information, see COPYING.
|
||||
]]
|
||||
|
||||
NodUnits = { "bike", "e3", "e1", "bggy", "e1", "e3", "bike", "bggy" }
|
||||
FirstAttackWave = { "e1", "e1", "e1", "e2", }
|
||||
SecondThirdAttackWave = { "e1", "e1", "e2", }
|
||||
|
||||
SendAttackWave = function(units, spawnPoint)
|
||||
Reinforcements.Reinforce(enemy, units, { spawnPoint }, DateTime.Seconds(1), function(actor)
|
||||
Reinforcements.Reinforce(GDI, units, { spawnPoint }, DateTime.Seconds(1), function(actor)
|
||||
actor.AttackMove(PlayerBase.Location)
|
||||
end)
|
||||
end
|
||||
|
||||
InsertNodUnits = function()
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
Reinforcements.Reinforce(player, NodUnits, { NodEntry.Location, NodRallyPoint.Location })
|
||||
Trigger.AfterDelay(DateTime.Seconds(9), function()
|
||||
Reinforcements.Reinforce(player, { "mcv" }, { NodEntry.Location, PlayerBase.Location })
|
||||
end)
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
player = Player.GetPlayer("Nod")
|
||||
enemy = Player.GetPlayer("GDI")
|
||||
Nod = Player.GetPlayer("Nod")
|
||||
GDI = Player.GetPlayer("GDI")
|
||||
|
||||
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(Nod)
|
||||
|
||||
Trigger.OnPlayerWon(player, function()
|
||||
Media.PlaySpeechNotification(player, "Win")
|
||||
end)
|
||||
|
||||
Trigger.OnPlayerLost(player, function()
|
||||
Media.PlaySpeechNotification(player, "Lose")
|
||||
end)
|
||||
|
||||
gdiObjective = enemy.AddPrimaryObjective("Eliminate all Nod forces in the area.")
|
||||
nodObjective1 = player.AddPrimaryObjective("Capture the prison.")
|
||||
nodObjective2 = player.AddSecondaryObjective("Destroy all GDI forces.")
|
||||
CapturePrison = Nod.AddObjective("Capture the prison.")
|
||||
DestroyGDI = Nod.AddObjective("Destroy all GDI forces.", "Secondary", false)
|
||||
|
||||
Trigger.OnCapture(TechCenter, function()
|
||||
Trigger.AfterDelay(DateTime.Seconds(2), function()
|
||||
player.MarkCompletedObjective(nodObjective1)
|
||||
Nod.MarkCompletedObjective(CapturePrison)
|
||||
end)
|
||||
end)
|
||||
|
||||
Trigger.OnKilled(TechCenter, function()
|
||||
player.MarkFailedObjective(nodObjective1)
|
||||
Nod.MarkFailedObjective(CapturePrison)
|
||||
end)
|
||||
|
||||
Media.PlaySpeechNotification(Nod, "Reinforce")
|
||||
Reinforcements.Reinforce(Nod, NodUnits, { NodEntry.Location, NodRallyPoint.Location })
|
||||
Trigger.AfterDelay(DateTime.Seconds(9), function()
|
||||
Reinforcements.Reinforce(Nod, { "mcv" }, { NodEntry.Location, PlayerBase.Location })
|
||||
end)
|
||||
|
||||
InsertNodUnits()
|
||||
Trigger.AfterDelay(DateTime.Seconds(20), function() SendAttackWave(FirstAttackWave, AttackWaveSpawnA.Location) end)
|
||||
Trigger.AfterDelay(DateTime.Seconds(50), function() SendAttackWave(SecondThirdAttackWave, AttackWaveSpawnB.Location) end)
|
||||
Trigger.AfterDelay(DateTime.Seconds(100), function() SendAttackWave(SecondThirdAttackWave, AttackWaveSpawnC.Location) end)
|
||||
@@ -68,11 +49,12 @@ end
|
||||
|
||||
Tick = function()
|
||||
if DateTime.GameTime > 2 then
|
||||
if player.HasNoRequiredUnits() then
|
||||
enemy.MarkCompletedObjective(gdiObjective)
|
||||
if Nod.HasNoRequiredUnits() then
|
||||
Nod.MarkFailedObjective(CapturePrison)
|
||||
end
|
||||
if enemy.HasNoRequiredUnits() then
|
||||
player.MarkCompletedObjective(nodObjective2)
|
||||
|
||||
if GDI.HasNoRequiredUnits() then
|
||||
Nod.MarkCompletedObjective(DestroyGDI)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user