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.
|
||||
]]
|
||||
|
||||
LoseTriggerHouses = { TrigLos2Farm1, TrigLos2Farm2, TrigLos2Farm3, TrigLos2Farm4 }
|
||||
TownAttackTrigger = { CPos.New(54, 38), CPos.New(55, 38), CPos.New(56, 38), CPos.New(57, 38) }
|
||||
GDIReinforcementsTrigger = { CPos.New(32, 51), CPos.New(32, 52), CPos.New(33, 52) }
|
||||
@@ -44,83 +45,56 @@ TownAttackAction = function(actor)
|
||||
end
|
||||
|
||||
AttackTown = function()
|
||||
Reinforcements.Reinforce(enemy, TownAttackWave1, { NodReinfEntry.Location, NodReinfRally.Location }, DateTime.Seconds(0.25), TownAttackAction)
|
||||
Reinforcements.Reinforce(Nod, TownAttackWave1, { NodReinfEntry.Location, NodReinfRally.Location }, DateTime.Seconds(0.25), TownAttackAction)
|
||||
Trigger.AfterDelay(DateTime.Seconds(2), function()
|
||||
Reinforcements.Reinforce(enemy, TownAttackWave2, { NodReinfEntry.Location, NodReinfRally.Location }, DateTime.Seconds(1), TownAttackAction)
|
||||
Reinforcements.Reinforce(Nod, TownAttackWave2, { NodReinfEntry.Location, NodReinfRally.Location }, DateTime.Seconds(1), TownAttackAction)
|
||||
end)
|
||||
Trigger.AfterDelay(DateTime.Seconds(4), function()
|
||||
Reinforcements.Reinforce(enemy, TownAttackWave3, { NodReinfEntry.Location, NodReinfRally.Location }, DateTime.Seconds(1), TownAttackAction)
|
||||
Reinforcements.Reinforce(Nod, TownAttackWave3, { NodReinfEntry.Location, NodReinfRally.Location }, DateTime.Seconds(1), TownAttackAction)
|
||||
end)
|
||||
end
|
||||
|
||||
SendGDIReinforcements = function()
|
||||
Reinforcements.Reinforce(player, GDIReinforcementsPart1, { GDIReinfEntry1.Location, GDIReinfRally1.Location }, DateTime.Seconds(1), function(actor)
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
actor.Move(GDIReinfRally3.Location)
|
||||
actor.Stance = "Defend"
|
||||
end)
|
||||
Media.PlaySpeechNotification(GDI, "Reinforce")
|
||||
Reinforcements.Reinforce(GDI, GDIReinforcementsPart1, { GDIReinfEntry1.Location, GDIReinfRally1.Location, GDIReinfRally3.Location }, DateTime.Seconds(1))
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(5), function()
|
||||
Reinforcements.ReinforceWithTransport(player, "apc", GDIReinforcementsPart2, { GDIReinfEntry2.Location, GDIReinfRally2.Location }, nil, function(apc, team)
|
||||
Media.PlaySpeechNotification(player, "Reinforce")
|
||||
apc.Move(GDIUnloadWpt.Location)
|
||||
apc.UnloadPassengers()
|
||||
Utils.Do(team, function(unit) unit.Stance = "Defend" end)
|
||||
end)
|
||||
Media.PlaySpeechNotification(GDI, "Reinforce")
|
||||
local apc = Reinforcements.ReinforceWithTransport(GDI, "apc", GDIReinforcementsPart2, { GDIReinfEntry2.Location, GDIReinfRally2.Location, GDIUnloadWpt.Location })[1]
|
||||
apc.UnloadPassengers()
|
||||
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.OnAllKilled(LoseTriggerHouses, function()
|
||||
player.MarkFailedObjective(gdiObjective1)
|
||||
GDI.MarkFailedObjective(DefendTown)
|
||||
end)
|
||||
|
||||
Trigger.OnPlayerWon(player, function()
|
||||
Media.PlaySpeechNotification(player, "Win")
|
||||
end)
|
||||
NodObjective = Nod.AddPrimaryObjective("Destroy all GDI troops.")
|
||||
DefendTown = GDI.AddPrimaryObjective("Defend the town of Białystok.")
|
||||
EliminateNod = GDI.AddPrimaryObjective("Eliminate all Nod forces in the area.")
|
||||
|
||||
Trigger.OnPlayerLost(player, function()
|
||||
Media.PlaySpeechNotification(player, "Lose")
|
||||
end)
|
||||
|
||||
nodObjective = enemy.AddPrimaryObjective("Destroy all GDI troops.")
|
||||
gdiObjective1 = player.AddPrimaryObjective("Defend the town of Białystok.")
|
||||
gdiObjective2 = player.AddPrimaryObjective("Eliminate all Nod forces in the area.")
|
||||
|
||||
townAttackTrigger = false
|
||||
Trigger.OnExitedFootprint(TownAttackTrigger, function(a, id)
|
||||
if not townAttackTrigger and a.Owner == player then
|
||||
if not townAttackTrigger and a.Owner == GDI then
|
||||
townAttackTrigger = true
|
||||
Trigger.RemoveFootprintTrigger(id)
|
||||
AttackTown()
|
||||
end
|
||||
end)
|
||||
|
||||
gdiReinforcementsTrigger = false
|
||||
Trigger.OnEnteredFootprint(GDIReinforcementsTrigger, function(a, id)
|
||||
if not gdiReinforcementsTrigger and a.Owner == player then
|
||||
if not gdiReinforcementsTrigger and a.Owner == GDI then
|
||||
gdiReinforcementsTrigger = true
|
||||
Trigger.RemoveFootprintTrigger(id)
|
||||
SendGDIReinforcements()
|
||||
end
|
||||
end)
|
||||
|
||||
Utils.Do(player.GetGroundAttackers(), function(unit)
|
||||
unit.Stance = "Defend"
|
||||
end)
|
||||
|
||||
Trigger.AfterDelay(1, function()
|
||||
FollowCivvieWpts(civvie1, Civvie1Wpts)
|
||||
FollowCivvieWpts(civvie2, Civvie2Wpts)
|
||||
@@ -130,11 +104,12 @@ WorldLoaded = function()
|
||||
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)
|
||||
player.MarkCompletedObjective(gdiObjective2)
|
||||
|
||||
if Nod.HasNoRequiredUnits() then
|
||||
GDI.MarkCompletedObjective(DefendTown)
|
||||
GDI.MarkCompletedObjective(EliminateNod)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
World:
|
||||
LuaScript:
|
||||
Scripts: gdi04c.lua
|
||||
Scripts: campaign-global.lua, gdi04c.lua
|
||||
MusicPlaylist:
|
||||
StartingMusic: ind
|
||||
MissionData:
|
||||
|
||||
Reference in New Issue
Block a user