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.
]]
AttackPaths = { { AttackPath1 }, { AttackPath2 } }
GDIBase = { GDICYard, GDIPyle, GDIWeap, GDIHQ, GDIProc, GDINuke1, GDINuke2, GDINuke3, GDIBuilding1, GDIBuilding2, GDIBuilding3, GDIBuilding4, GDIBuilding5, GDIBuilding6, GDIBuilding7, GDIBuilding8 }
InfantryAttackGroup = { }
@@ -19,39 +20,33 @@ VehicleProductionCooldown = DateTime.Minutes(4)
VehicleProductionTypes = { "jeep", "jeep", "mtnk", "mtnk", "mtnk" }
StartingCash = 4000
BaseProc = { type = "proc", pos = CPos.New(22, 51), cost = 1500, exists = true }
BaseNuke1 = { type = "nuke", pos = CPos.New(16, 56), cost = 500, exists = true }
BaseNuke2 = { type = "nuke", pos = CPos.New(18, 57), cost = 500, exists = true }
BaseNuke3 = { type = "nuke", pos = CPos.New(27, 51), cost = 500, exists = true }
InfantryProduction = { type = "pyle", pos = CPos.New(18, 54), cost = 500, exists = true }
VehicleProduction = { type = "weap", pos = CPos.New(27, 55), cost = 2000, exists = true }
BaseProc = { type = "proc", pos = CPos.New(22, 51), cost = 1500 }
BaseNuke1 = { type = "nuke", pos = CPos.New(16, 56), cost = 500 }
BaseNuke2 = { type = "nuke", pos = CPos.New(18, 57), cost = 500 }
BaseNuke3 = { type = "nuke", pos = CPos.New(27, 51), cost = 500 }
InfantryProduction = { type = "pyle", pos = CPos.New(18, 54), cost = 500 }
VehicleProduction = { type = "weap", pos = CPos.New(27, 55), cost = 2000 }
BaseBuildings = { BaseProc, BaseNuke1, BaseNuke2, BaseNuke3, InfantryProduction, VehicleProduction }
BuildBase = function(cyard)
Utils.Do(BaseBuildings, function(building)
if not building.exists and not cyardIsBuilding then
BuildBuilding(building, cyard)
return
end
end)
Trigger.AfterDelay(DateTime.Seconds(10), function() BuildBase(cyard) end)
end
BuildBuilding = function(building, cyard)
cyardIsBuilding = true
if CyardIsBuilding or GDI.Cash < building.cost then
Trigger.AfterDelay(DateTime.Seconds(10), function() BuildBuilding(building, cyard) end)
return
end
CyardIsBuilding = true
GDI.Cash = GDI.Cash - building.cost
Trigger.AfterDelay(Actor.BuildTime(building.type), function()
cyardIsBuilding = false
CyardIsBuilding = false
if cyard.IsDead or cyard.Owner ~= enemy then
if cyard.IsDead or cyard.Owner ~= GDI then
GDI.Cash = GDI.Cash + building.cost
return
end
local actor = Actor.Create(building.type, true, { Owner = enemy, Location = building.pos })
enemy.Cash = enemy.Cash - building.cost
building.exists = true
local actor = Actor.Create(building.type, true, { Owner = GDI, Location = building.pos })
if actor.Type == 'pyle' or actor.Type == 'hand' then
Trigger.AfterDelay(DateTime.Seconds(10), function() ProduceInfantry(actor) end)
@@ -59,37 +54,19 @@ BuildBuilding = function(building, cyard)
Trigger.AfterDelay(DateTime.Seconds(10), function() ProduceVehicle(actor) end)
end
Trigger.OnKilled(actor, function() building.exists = false end)
Trigger.OnDamaged(actor, function(building)
if building.Owner == enemy and building.Health < building.MaxHealth * 3/4 then
building.StartBuildingRepairs()
end
Trigger.OnKilled(actor, function()
BuildBuilding(building, cyard)
end)
Trigger.AfterDelay(DateTime.Seconds(10), function() BuildBase(cyard) end)
RepairBuilding(GDI, actor, 0.75)
end)
end
CheckForHarvester = function()
local harv = enemy.GetActorsByType("harv")
local harv = GDI.GetActorsByType("harv")
return #harv > 0
end
IdleHunt = function(unit)
if not unit.IsDead then
Trigger.OnIdle(unit, unit.Hunt)
end
end
IdlingUnits = function(enemy)
local lazyUnits = enemy.GetGroundAttackers()
Utils.Do(lazyUnits, function(unit)
IdleHunt(unit)
end)
end
ProduceHarvester = function(building)
if not buildingHarvester then
buildingHarvester = true
@@ -100,10 +77,11 @@ ProduceHarvester = function(building)
end
ProduceInfantry = function(building)
if building.IsDead or building.Owner ~= enemy then
if building.IsDead or building.Owner ~= GDI then
return
elseif not CheckForHarvester() then
Trigger.AfterDelay(DateTime.Seconds(10), function() ProduceInfantry(building) end)
return
end
local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9))
@@ -113,22 +91,22 @@ ProduceInfantry = function(building)
InfantryAttackGroup[#InfantryAttackGroup + 1] = unit[1]
if #InfantryAttackGroup >= InfantryGroupSize then
SendUnits(InfantryAttackGroup, Path)
MoveAndHunt(InfantryAttackGroup, Path)
InfantryAttackGroup = { }
Trigger.AfterDelay(InfantryProductionCooldown, function() ProduceInfantry(building) end)
else
Trigger.AfterDelay(delay, function() ProduceInfantry(building) end)
end
end)
end
ProduceVehicle = function(building)
if building.IsDead or building.Owner ~= enemy then
if building.IsDead or building.Owner ~= GDI then
return
elseif not CheckForHarvester() then
ProduceHarvester(building)
Trigger.AfterDelay(DateTime.Seconds(10), function() ProduceVehicle(building) end)
return
end
local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(17))
@@ -138,7 +116,7 @@ ProduceVehicle = function(building)
VehicleAttackGroup[#VehicleAttackGroup + 1] = unit[1]
if #VehicleAttackGroup >= VehicleGroupSize then
SendUnits(VehicleAttackGroup, Path)
MoveAndHunt(VehicleAttackGroup, Path)
VehicleAttackGroup = { }
Trigger.AfterDelay(VehicleProductionCooldown, function() ProduceVehicle(building) end)
else
@@ -147,55 +125,35 @@ ProduceVehicle = function(building)
end)
end
SendUnits = function(units, waypoints)
Utils.Do(units, function(unit)
if not unit.IsDead then
Utils.Do(waypoints, function(waypoint)
unit.AttackMove(waypoint.Location)
end)
IdleHunt(unit)
end
end)
StartAI = function()
RepairNamedActors(GDI, 0.75)
GDI.Cash = StartingCash
Trigger.AfterDelay(DateTime.Minutes(2), function() ProduceInfantry(GDIPyle) end)
Trigger.AfterDelay(DateTime.Minutes(3), function() ProduceVehicle(GDIWeap) end)
end
StartAI = function(cyard)
Utils.Do(Map.NamedActors, function(actor)
if actor.Owner == enemy and actor.HasProperty("StartBuildingRepairs") then
Trigger.OnDamaged(actor, function(building)
if building.Owner == enemy and building.Health < 3/4 * building.MaxHealth then
building.StartBuildingRepairs()
end
end)
end
end)
enemy.Cash = StartingCash
BuildBase(cyard)
end
Trigger.OnAllKilledOrCaptured(GDIBase, function()
IdlingUnits(enemy)
Trigger.OnKilled(GDIProc, function()
BuildBuilding(BaseProc, GDICYard)
end)
Trigger.OnKilled(GDIProc, function(building)
BaseProc.exists = false
Trigger.OnKilled(GDINuke1, function()
BuildBuilding(BaseNuke1, GDICYard)
end)
Trigger.OnKilled(GDINuke1, function(building)
BaseNuke1.exists = false
Trigger.OnKilled(GDINuke2, function()
BuildBuilding(BaseNuke2, GDICYard)
end)
Trigger.OnKilled(GDINuke2, function(building)
BaseNuke2.exists = false
Trigger.OnKilled(GDINuke3, function()
BuildBuilding(BaseNuke3, GDICYard)
end)
Trigger.OnKilled(GDINuke3, function(building)
BaseNuke3.exists = false
Trigger.OnKilled(GDIPyle, function()
BuildBuilding(InfantryProduction, GDICYard)
end)
Trigger.OnKilled(GDIPyle, function(building)
InfantryProduction.exists = false
end)
Trigger.OnKilled(GDIWeap, function(building)
VehicleProduction.exists = false
Trigger.OnKilled(GDIWeap, function()
BuildBuilding(VehicleProduction, GDICYard)
end)

View File

@@ -6,29 +6,30 @@
the License, or (at your option) any later version. For more
information, see COPYING.
]]
GDI1 = { teamType = "atk", units = { ['e2'] = 3 }, waypoints = { waypoint0, waypoint1, waypoint2, waypoint14 }, delay = 40 }
GDI2 = { teamType = "atk", units = { ['mtnk'] = 2 }, waypoints = { waypoint0, waypoint1, waypoint2, waypoint3, waypoint4, waypoint9 }, delay = 30 }
GDI3 = { teamType = "atk", units = { ['e2'] = 4 }, waypoints = { waypoint0, waypoint4, waypoint5, waypoint6, waypoint7, waypoint8 }, delay = 40 }
GDI4 = { teamType = "atk", units = { ['e1'] = 1, ['e2'] = 2 }, waypoints = { waypoint0, waypoint4, waypoint9 }, delay = 30 }
GDI5 = { teamType = "atk", units = { ['mtnk'] = 1 }, waypoints = { waypoint0, waypoint4, waypoint10, waypoint11, waypoint12, waypoint13 }, delay = 80 }
GDI6 = { teamType = "atk", units = { ['mtnk'] = 1 }, waypoints = { waypoint0, waypoint4, waypoint9 }, delay = 50 }
GDI7 = { teamType = "atk", units = { ['jeep'] = 1 }, waypoints = { waypoint0, waypoint4, waypoint5, waypoint6, waypoint7, waypoint8 }, delay = 40 }
GDI8 = { teamType = "rei", units = { ['e2'] = 3, ['e6'] = 2 }, waypoints = { waypoint12, waypoint11, waypoint10, waypoint4, waypoint5, waypoint8 }, delay = 8 }
GDI9 = { teamType = "atk", units = { ['e2'] = 4 }, waypoints = { waypoint8 }, delay = 80 }
GDI10 = { teamType = "atk", units = { ['e2'] = 4 }, waypoints = { waypoint14 }, delay = 0 }
GDI1 = { teamType = "atk", units = { "e2", "e2", "e2" }, waypoints = { waypoint0, waypoint1, waypoint2, waypoint14 }, delay = 40 }
GDI2 = { teamType = "atk", units = { "mtnk", "mtnk" }, waypoints = { waypoint0, waypoint1, waypoint2, waypoint3, waypoint4, waypoint9 }, delay = 30 }
GDI3 = { teamType = "atk", units = { "e2", "e2", "e2", "e2" }, waypoints = { waypoint0, waypoint4, waypoint5, waypoint6, waypoint7, waypoint8 }, delay = 40 }
GDI4 = { teamType = "atk", units = { "e1", "e2", "e2" }, waypoints = { waypoint0, waypoint4, waypoint9 }, delay = 30 }
GDI5 = { teamType = "atk", units = { "mtnk" }, waypoints = { waypoint0, waypoint4, waypoint10, waypoint11, waypoint12, waypoint13 }, delay = 80 }
GDI6 = { teamType = "atk", units = { "mtnk" }, waypoints = { waypoint0, waypoint4, waypoint9 }, delay = 50 }
GDI7 = { teamType = "atk", units = { "jeep" }, waypoints = { waypoint0, waypoint4, waypoint5, waypoint6, waypoint7, waypoint8 }, delay = 40 }
GDI8 = { teamType = "rei", units = { "e2", "e2", "e2", "e6", "e6" }, waypoints = { waypoint12, waypoint11, waypoint10, waypoint4, waypoint5, waypoint8 }, delay = 8 }
GDI9 = { teamType = "atk", units = { "e2", "e2", "e2", "e2" }, waypoints = { waypoint8 }, delay = 80 }
GDI10 = { teamType = "atk", units = { "e2", "e2", "e2", "e2" }, waypoints = { waypoint14 }, delay = 0 }
AirstrikeDelay = DateTime.Minutes(2) + DateTime.Seconds(20)
AutoAttackWaves = { GDI3, GDI4, GDI5, GDI6, GDI7, GDI8, GDI9, GDI10 }
IntroAttackWaves = { GDI1, GDI2 }
WhitelistedStructures = { 'afld', 'hand', 'hq', 'nuke', 'silo', 'proc', 'sam' }
WhitelistedStructures = { "afld", "hand", "hq", "nuke", "silo", "proc", "sam" }
NodUnitsBikes = { 'bike', 'bike', 'bike' }
NodUnitsEngineers = { 'e6', 'e6' }
NodUnitsRockets = { 'e3', 'e3', 'e3', 'e3' }
NodUnitsGunners = { 'e1', 'e1', 'e1', 'e1' }
NodUnitsFlamers = { 'e4', 'e4', 'e4', 'e4' }
ReinforcementsRockets = { 'e3', 'e3', 'e3', 'e3', 'e3' }
NodUnitsBikes = { "bike", "bike", "bike" }
NodUnitsEngineers = { "e6", "e6" }
NodUnitsRockets = { "e3", "e3", "e3", "e3" }
NodUnitsGunners = { "e1", "e1", "e1", "e1" }
NodUnitsFlamers = { "e4", "e4", "e4", "e4" }
ReinforcementsRockets = { "e3", "e3", "e3", "e3", "e3" }
NodBase = { NodBuilding1, NodBuilding2, NodBuilding3, NodHarvester }
@@ -37,98 +38,42 @@ ReinforcementsTrigger = { CPos.New(35, 23), CPos.New(34, 23), CPos.New(35, 22),
CaptureStructures = function(actor)
for i = 1, #WhitelistedStructures do
structures = player.GetActorsByType(WhitelistedStructures[i])
if #structures > 0 then
if not actor.IsDead and not structures[1].IsDead then
actor.Capture(structures[1])
return
end
structures = Nod.GetActorsByType(WhitelistedStructures[i])
if #structures > 0 and not actor.IsDead and not structures[1].IsDead then
actor.Capture(structures[1])
return
end
end
end
CheckForSams = function()
local sams = player.GetActorsByType("sam")
local sams = Nod.GetActorsByType("sam")
return #sams >= 3
end
searches = 0
getAirstrikeTarget = function()
local list = player.GetGroundAttackers()
if #list == 0 then
return
end
local target = list[DateTime.GameTime % #list + 1].CenterPosition
local sams = Map.ActorsInCircle(target, WDist.New(8 * 1024), function(actor)
return actor.Type == "sam" end)
if #sams == 0 then
searches = 0
return target
elseif searches < 6 then
searches = searches + 1
return getAirstrikeTarget()
else
searches = 0
return nil
end
end
GetCargo = function(team)
cargo = { }
for type, count in pairs(team.units) do
for i = 1, count, 1 do
cargo[#cargo + 1] = type
end
end
return cargo
end
InsertNodUnits = function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.Reinforce(player, { 'ltnk'}, { ReinforcementsTopSpawn.Location, ReinforcementsTank1Rally.Location }, 1)
Reinforcements.Reinforce(player, NodUnitsEngineers, { ReinforcementsTopSpawn.Location, ReinforcementsEngineersRally.Location }, 10)
Reinforcements.Reinforce(player, NodUnitsRockets, { ReinforcementsTopSpawn.Location, ReinforcementsRocketsRally.Location }, 10)
Media.PlaySpeechNotification(Nod, "Reinforce")
Reinforcements.Reinforce(Nod, { "ltnk" }, { ReinforcementsTopSpawn.Location, ReinforcementsTank1Rally.Location }, 1)
Reinforcements.Reinforce(Nod, NodUnitsEngineers, { ReinforcementsTopSpawn.Location, ReinforcementsEngineersRally.Location }, 10)
Reinforcements.Reinforce(Nod, NodUnitsRockets, { ReinforcementsTopSpawn.Location, ReinforcementsRocketsRally.Location }, 10)
Trigger.AfterDelay(DateTime.Seconds(3), function()
Reinforcements.Reinforce(player, NodUnitsGunners, { ReinforcementsBottomSpawn.Location, ReinforcementsGunnersRally.Location }, 10)
Reinforcements.Reinforce(player, NodUnitsFlamers, { ReinforcementsTopSpawn.Location, ReinforcementsFlamersRally.Location }, 10)
Reinforcements.Reinforce(player, { 'ltnk'}, { ReinforcementsBottomSpawn.Location, ReinforcementsTank2Rally.Location }, 10)
Reinforcements.Reinforce(Nod, NodUnitsGunners, { ReinforcementsBottomSpawn.Location, ReinforcementsGunnersRally.Location }, 10)
Reinforcements.Reinforce(Nod, NodUnitsFlamers, { ReinforcementsTopSpawn.Location, ReinforcementsFlamersRally.Location }, 10)
Reinforcements.Reinforce(Nod, { "ltnk" }, { ReinforcementsBottomSpawn.Location, ReinforcementsTank2Rally.Location }, 10)
end)
end
SendAttackWave = function(team)
for type, amount in pairs(team.units) do
count = 0
actors = enemy.GetActorsByType(type)
Utils.Do(actors, function(actor)
if actor.IsIdle and count < amount then
SetAttackWaypoints(actor, team.waypoints)
if actor.Type == "e6" then
CaptureStructures(actor)
else
IdleHunt(actor)
end
count = count + 1
end
end)
end
end
SetAttackWaypoints = function(actor, waypoints)
if not actor.IsDead then
Utils.Do(waypoints, function(waypoint)
actor.AttackMove(waypoint.Location)
end)
end
Utils.Do(team.units, function(unitType)
local actors = Utils.Where(GDI.GetActorsByType(unitType), function(unit) return unit.IsIdle end)
MoveAndHunt(Utils.Take(1, actors), team.waypoints)
end)
end
SendGDIAirstrike = function(hq, delay)
if not hq.IsDead and hq.Owner == enemy then
local target = getAirstrikeTarget()
if not hq.IsDead and hq.Owner == GDI then
local target = GetAirstrikeTarget(Nod)
if target then
hq.SendAirstrike(target, false, Facing.NorthEast + 4)
@@ -147,22 +92,27 @@ SendWaves = function(counter, Waves)
elseif team.teamType == "rei" then
SendReinforcementsWave(team)
end
Trigger.AfterDelay(DateTime.Seconds(team.delay), function() SendWaves(counter + 1, Waves) end)
end
end
SendReinforcementsWave = function(team)
Reinforcements.ReinforceWithTransport(enemy, "apc", GetCargo(team), { ReinforcementsGDISpawn.Location, waypoint12.Location}, nil, function(transport, passengers)
SetReinforcementsWaypoints(transport, team.waypoints)
Reinforcements.ReinforceWithTransport(GDI, "apc", team.units, { ReinforcementsGDISpawn.Location, waypoint12.Location }, nil, function(transport, passengers)
Utils.Do(team.waypoints, function(waypoint)
transport.Move(waypoint.Location)
end)
transport.UnloadPassengers()
Trigger.OnPassengerExited(transport, function(_, passenger)
Utils.Do(passengers, function(actor)
if actor.Type == "e6" then
if actor.Type == "e6" then
CaptureStructures(actor)
else
IdleHunt(actor)
end
end)
if not transport.HasPassengers then
IdleHunt(transport)
end
@@ -170,58 +120,42 @@ SendReinforcementsWave = function(team)
end)
end
SetReinforcementsWaypoints = function(actor, waypoints)
if not actor.IsDead then
Utils.Do(waypoints, function(waypoint)
actor.Move(waypoint.Location)
end)
end
end
StartWaves = function(Waves)
SendWaves(1, Waves)
end
Trigger.OnEnteredFootprint(AbandonedBaseTrigger, function(a, id)
if not abandonedBaseTrigger and a.Owner == player then
if not abandonedBaseTrigger and a.Owner == Nod then
abandonedBaseTrigger = true
Trigger.RemoveFootprintTrigger(id)
FlareCamera = Actor.Create("camera", true, { Owner = player, Location = waypoint25.Location })
Flare = Actor.Create("flare", true, { Owner = player, Location = waypoint25.Location })
FlareCamera = Actor.Create("camera", true, { Owner = Nod, Location = waypoint25.Location })
Flare = Actor.Create("flare", true, { Owner = Nod, Location = waypoint25.Location })
Utils.Do(NodBase, function(actor)
if not actor.IsDead then
actor.Owner = player
actor.Owner = Nod
end
end)
player.MarkCompletedObjective(NodObjective1)
Nod.MarkCompletedObjective(FindBase)
Trigger.AfterDelay(DateTime.Seconds(3), function()
Media.PlaySpeechNotification(player, "NewOptions")
Media.PlaySpeechNotification(Nod, "NewOptions")
end)
end
end)
Trigger.OnEnteredFootprint(ReinforcementsTrigger, function(a, id)
if not reinforcementsTrigger and a.Owner == player and a.Type ~= 'harv' then
if not reinforcementsTrigger and a.Owner == Nod and a.Type ~= "harv" then
reinforcementsTrigger = true
Trigger.RemoveFootprintTrigger(id)
Trigger.AfterDelay(DateTime.Seconds(5), function()
Media.PlaySpeechNotification(player, "Reinforce")
Reinforcements.ReinforceWithTransport(player, 'tran.in', ReinforcementsRockets, { ReinforcementsHelicopterSpawn.Location, waypoint24.Location }, { ReinforcementsHelicopterSpawn.Location }, nil, nil)
Media.PlaySpeechNotification(Nod, "Reinforce")
Reinforcements.ReinforceWithTransport(Nod, "tran.in", ReinforcementsRockets, { ReinforcementsHelicopterSpawn.Location, waypoint24.Location }, { ReinforcementsHelicopterSpawn.Location })
end)
StartWaves(IntroAttackWaves)
SendWaves(1, IntroAttackWaves)
Trigger.AfterDelay(AirstrikeDelay, function() SendGDIAirstrike(GDIHQ, AirstrikeDelay) end)
Trigger.AfterDelay(DateTime.Minutes(2), function() ProduceInfantry(GDIPyle) end)
Trigger.AfterDelay(DateTime.Minutes(3), function() ProduceVehicle(GDIWeap) end)
Trigger.AfterDelay(DateTime.Minutes(3), function()StartWaves(AutoAttackWaves) end)
Trigger.AfterDelay(DateTime.Minutes(3), function() SendWaves(1, AutoAttackWaves) end)
Trigger.AfterDelay(DateTime.Minutes(2), function()
Flare.Destroy()
FlareCamera.Destroy()
@@ -230,49 +164,31 @@ Trigger.OnEnteredFootprint(ReinforcementsTrigger, function(a, id)
end)
WorldLoaded = function()
player = Player.GetPlayer("Nod")
enemy = Player.GetPlayer("GDI")
Nod = Player.GetPlayer("Nod")
GDI = Player.GetPlayer("GDI")
Camera.Position = waypoint26.CenterPosition
InsertNodUnits()
StartAI(GDICYard)
StartAI()
Trigger.OnObjectiveAdded(player, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end)
InitObjectives(Nod)
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)
Trigger.OnPlayerWon(player, function()
Media.PlaySpeechNotification(player, "Win")
end)
Trigger.OnPlayerLost(player, function()
Media.PlaySpeechNotification(player, "Lose")
end)
NodObjective1 = player.AddPrimaryObjective("Find the Nod base.")
NodObjective2 = player.AddPrimaryObjective("Eliminate all GDI forces in the area.")
NodObjective3 = player.AddSecondaryObjective("Build 3 SAMs to fend off the GDI bombers.")
GDIObjective = enemy.AddPrimaryObjective("Eliminate all Nod forces in the area.")
FindBase = Nod.AddObjective("Find the Nod base.")
EliminateGDI = Nod.AddObjective("Eliminate all GDI forces in the area.")
BuildSAMs = Nod.AddObjective("Build 3 SAMs to fend off the GDI bombers.", "Secondary", false)
GDIObjective = GDI.AddObjective("Eliminate all Nod forces in the area.")
end
Tick = function()
if DateTime.GameTime > 2 and player.HasNoRequiredUnits() then
enemy.MarkCompletedObjective(GDIObjective)
if DateTime.GameTime > 2 and Nod.HasNoRequiredUnits() then
GDI.MarkCompletedObjective(GDIObjective)
end
if DateTime.GameTime > 2 and enemy.HasNoRequiredUnits() then
player.MarkCompletedObjective(NodObjective2)
if DateTime.GameTime > 2 and GDI.HasNoRequiredUnits() then
Nod.MarkCompletedObjective(EliminateGDI)
end
if not player.IsObjectiveCompleted(NodObjective3) and CheckForSams() then
player.MarkCompletedObjective(NodObjective3)
if not Nod.IsObjectiveCompleted(BuildSAMs) and CheckForSams() then
Nod.MarkCompletedObjective(BuildSAMs)
end
end

View File

@@ -1,6 +1,6 @@
World:
LuaScript:
Scripts: nod07a.lua, nod07a-AI.lua
Scripts: campaign-global.lua, nod07a.lua, nod07a-AI.lua
MusicPlaylist:
StartingMusic: justdoit
VictoryMusic: nod_win1