Use a global script in Tiberian Dawn

This commit is contained in:
abcdefg30
2019-05-01 23:13:39 +02:00
committed by reaperrr
parent dbe73a06ad
commit b1f6c69fce
71 changed files with 2001 additions and 3877 deletions

View File

@@ -6,6 +6,7 @@
the License, or (at your option) any later version. For more
information, see COPYING.
]]
NodUnits = { "e1", "e1", "bggy", "bike", "e1", "e1", "bike", "bggy", "e1", "e1" }
Engineers = { "e6", "e6", "e6" }
FirstAttackWaveUnits = { "e1", "e1", "e2" }
@@ -13,7 +14,7 @@ SecondAttackWaveUnits = { "e1", "e1", "e1" }
ThirdAttackWaveUnits = { "e1", "e1", "e1", "e2" }
SendAttackWave = function(units, action)
Reinforcements.Reinforce(enemy, units, { GDIBarracksSpawn.Location, WP0.Location, WP1.Location }, 15, action)
Reinforcements.Reinforce(GDI, units, { GDIBarracksSpawn.Location, WP0.Location, WP1.Location }, 15, action)
end
FirstAttackWave = function(soldier)
@@ -31,50 +32,33 @@ SecondAttackWave = function(soldier)
soldier.AttackMove(PlayerBase.Location)
end
InsertNodUnits = function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, { "mcv" }, { McvEntry.Location, McvDeploy.Location })
Reinforcements.Reinforce(player, NodUnits, { NodEntry.Location, NodRallypoint.Location })
Trigger.AfterDelay(DateTime.Seconds(15), function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, Engineers, { McvEntry.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")
InitObjectives(Nod)
CapturePrison = Nod.AddObjective("Capture the prison.")
DestroyGDI = Nod.AddObjective("Destroy all GDI forces.", "Secondary", false)
Trigger.OnKilled(TechCenter, function()
Nod.MarkFailedObjective(CapturePrison)
end)
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.")
Trigger.OnKilled(TechCenter, function() player.MarkFailedObjective(nodObjective1) end)
Trigger.OnCapture(TechCenter, function()
Trigger.AfterDelay(DateTime.Seconds(2), function()
player.MarkCompletedObjective(nodObjective1)
Nod.MarkCompletedObjective(CapturePrison)
end)
end)
InsertNodUnits()
Media.PlaySpeechNotification(Nod, "Reinforce")
Reinforcements.Reinforce(Nod, { "mcv" }, { McvEntry.Location, McvDeploy.Location })
Reinforcements.Reinforce(Nod, NodUnits, { NodEntry.Location, NodRallypoint.Location })
Trigger.AfterDelay(DateTime.Seconds(15), function()
Media.PlaySpeechNotification(Nod, "Reinforce")
Reinforcements.Reinforce(Nod, Engineers, { McvEntry.Location, PlayerBase.Location })
end)
Trigger.AfterDelay(DateTime.Seconds(40), function() SendAttackWave(FirstAttackWaveUnits, FirstAttackWave) end)
Trigger.AfterDelay(DateTime.Seconds(80), function() SendAttackWave(SecondAttackWaveUnits, SecondAttackWave) end)
Trigger.AfterDelay(DateTime.Seconds(140), function() SendAttackWave(ThirdAttackWaveUnits, FirstAttackWave) end)
@@ -82,12 +66,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