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.
]]
InitialForcesA = { "bggy", "e1", "e1", "e1", "e1" }
InitialForcesB = { "e1", "e1", "bggy", "e1", "e1" }
@@ -13,62 +14,40 @@ RifleInfantryReinforcements = { "e1", "e1" }
RocketInfantryReinforcements = { "e3", "e3", "e3", "e3", "e3" }
SendInitialForces = function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, InitialForcesA, { StartSpawnPointLeft.Location, StartRallyPoint.Location }, 5)
Reinforcements.Reinforce(player, InitialForcesB, { StartSpawnPointRight.Location, StartRallyPoint.Location }, 10)
Media.PlaySpeechNotification(Nod, "Reinforce")
Reinforcements.Reinforce(Nod, InitialForcesA, { StartSpawnPointLeft.Location, StartRallyPoint.Location }, 5)
Reinforcements.Reinforce(Nod, InitialForcesB, { StartSpawnPointRight.Location, StartRallyPoint.Location }, 10)
end
SendFirstInfantryReinforcements = function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, RifleInfantryReinforcements, { StartSpawnPointRight.Location, StartRallyPoint.Location }, 15)
Media.PlaySpeechNotification(Nod, "Reinforce")
Reinforcements.Reinforce(Nod, RifleInfantryReinforcements, { StartSpawnPointRight.Location, StartRallyPoint.Location }, 15)
end
SendSecondInfantryReinforcements = function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, RifleInfantryReinforcements, { StartSpawnPointLeft.Location, StartRallyPoint.Location }, 15)
Media.PlaySpeechNotification(Nod, "Reinforce")
Reinforcements.Reinforce(Nod, RifleInfantryReinforcements, { StartSpawnPointLeft.Location, StartRallyPoint.Location }, 15)
end
SendLastInfantryReinforcements = function()
Media.PlaySpeechNotification(player, "Reinforce")
-- Move the units properly into the map before they start attacking
local forces = Reinforcements.Reinforce(player, RocketInfantryReinforcements, { VillageSpawnPoint.Location, VillageRallyPoint.Location }, 8)
Utils.Do(forces, function(a)
a.Stance = "Defend"
a.CallFunc(function() a.Stance = "AttackAnything" end)
end)
Media.PlaySpeechNotification(Nod, "Reinforce")
Reinforcements.Reinforce(Nod, RocketInfantryReinforcements, { VillageSpawnPoint.Location, VillageRallyPoint.Location }, 8)
end
WorldLoaded = function()
player = Player.GetPlayer("Nod")
enemy = Player.GetPlayer("GDI")
villagers = Player.GetPlayer("Villagers")
Nod = Player.GetPlayer("Nod")
GDI = Player.GetPlayer("GDI")
Villagers = Player.GetPlayer("Villagers")
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)
NodObjective1 = player.AddPrimaryObjective("Kill Nikoomba.")
NodObjective2 = player.AddPrimaryObjective("Destroy the village.")
NodObjective3 = player.AddSecondaryObjective("Destroy all GDI troops in the area.")
GDIObjective1 = enemy.AddPrimaryObjective("Eliminate all Nod forces.")
KillNikoomba = Nod.AddObjective("Kill Nikoomba.")
DestroyVillage = Nod.AddObjective("Destroy the village.")
DestroyGDI = Nod.AddObjective("Destroy all GDI troops in the area.", "Secondary", false)
GDIObjective = GDI.AddObjective("Eliminate all Nod forces.")
Trigger.OnKilled(Nikoomba, function()
player.MarkCompletedObjective(NodObjective1)
Nod.MarkCompletedObjective(KillNikoomba)
Trigger.AfterDelay(DateTime.Seconds(1), function()
SendLastInfantryReinforcements()
end)
@@ -83,14 +62,16 @@ end
Tick = function()
if DateTime.GameTime > 2 then
if player.HasNoRequiredUnits() then
enemy.MarkCompletedObjective(GDIObjective1)
if Nod.HasNoRequiredUnits() then
GDI.MarkCompletedObjective(GDIObjective)
end
if villagers.HasNoRequiredUnits() then
player.MarkCompletedObjective(NodObjective2)
if Villagers.HasNoRequiredUnits() then
Nod.MarkCompletedObjective(DestroyVillage)
end
if enemy.HasNoRequiredUnits() then
player.MarkCompletedObjective(NodObjective3)
if GDI.HasNoRequiredUnits() then
Nod.MarkCompletedObjective(DestroyGDI)
end
end
end

View File

@@ -1,6 +1,6 @@
World:
LuaScript:
Scripts: nod01.lua
Scripts: campaign-global.lua, nod01.lua
MusicPlaylist:
StartingMusic: nomercy
VictoryMusic: nod_win1