Convert Lua array-like structures to use named entries

This commit is contained in:
atlimit8
2015-10-18 15:14:11 -05:00
parent c87c2270ca
commit f79ac636f2
18 changed files with 265 additions and 267 deletions

View File

@@ -11,19 +11,19 @@ GDIReinforcements = { "e2", "e2", "e2", "e2", "e2" }
GDIReinforcementsWaypoints = { GDIReinforcementsEntry.Location, GDIReinforcementsWP1.Location }
NodHelis = {
{ DateTime.Seconds(HeliDelay[1]), { NodHeliEntry.Location, NodHeliLZ1.Location }, { "e1", "e1", "e3" } },
{ DateTime.Seconds(HeliDelay[2]), { NodHeliEntry.Location, NodHeliLZ2.Location }, { "e1", "e1", "e1", "e1" } },
{ DateTime.Seconds(HeliDelay[3]), { NodHeliEntry.Location, NodHeliLZ3.Location }, { "e1", "e1", "e3" } }
{ delay = DateTime.Seconds(HeliDelay[1]), entry = { NodHeliEntry.Location, NodHeliLZ1.Location }, types = { "e1", "e1", "e3" } },
{ delay = DateTime.Seconds(HeliDelay[2]), entry = { NodHeliEntry.Location, NodHeliLZ2.Location }, types = { "e1", "e1", "e1", "e1" } },
{ delay = DateTime.Seconds(HeliDelay[3]), entry = { NodHeliEntry.Location, NodHeliLZ3.Location }, types = { "e1", "e1", "e3" } }
}
SendHeli = function(heli)
units = Reinforcements.ReinforceWithTransport(enemy, "tran", heli[3], heli[2], { heli[2][1] })
units = Reinforcements.ReinforceWithTransport(enemy, "tran", heli.types, heli.entry, { heli.entry[1] })
Utils.Do(units[2], function(actor)
actor.Hunt()
Trigger.OnIdle(actor, actor.Hunt)
Trigger.OnKilled(actor, KillCounter)
end)
Trigger.AfterDelay(heli[1], function() SendHeli(heli) end)
Trigger.AfterDelay(heli.delay, function() SendHeli(heli) end)
end
SendGDIReinforcements = function()
@@ -134,7 +134,7 @@ WorldLoaded = function()
BuildNod1()
Utils.Do(NodHelis, function(heli)
Trigger.AfterDelay(heli[1], function() SendHeli(heli) end)
Trigger.AfterDelay(heli.delay, function() SendHeli(heli) end)
end)
autoTrigger = false

View File

@@ -28,25 +28,25 @@ AttackUnitTypes =
{
Easy =
{
{ HandOfNod, { "e1", "e1" } },
{ HandOfNod, { "e1", "e3" } },
{ HandOfNod, { "e1", "e1", "e3" } },
{ HandOfNod, { "e1", "e3", "e3" } },
{ factory = HandOfNod, types = { "e1", "e1" } },
{ factory = HandOfNod, types = { "e1", "e3" } },
{ factory = HandOfNod, types = { "e1", "e1", "e3" } },
{ factory = HandOfNod, types = { "e1", "e3", "e3" } },
},
Normal =
{
{ HandOfNod, { "e1", "e1", "e3" } },
{ HandOfNod, { "e1", "e3", "e3" } },
{ HandOfNod, { "e1", "e1", "e3", "e3" } },
{ Airfield, { "bggy" } },
{ factory = HandOfNod, types = { "e1", "e1", "e3" } },
{ factory = HandOfNod, types = { "e1", "e3", "e3" } },
{ factory = HandOfNod, types = { "e1", "e1", "e3", "e3" } },
{ factory = Airfield, types = { "bggy" } },
},
Hard =
{
{ HandOfNod, { "e1", "e1", "e3", "e3" } },
{ HandOfNod, { "e1", "e1", "e1", "e3", "e3" } },
{ HandOfNod, { "e1", "e1", "e3", "e3", "e3" } },
{ Airfield, { "bggy" } },
{ Airfield, { "ltnk" } },
{ factory = HandOfNod, types = { "e1", "e1", "e3", "e3" } },
{ factory = HandOfNod, types = { "e1", "e1", "e1", "e3", "e3" } },
{ factory = HandOfNod, types = { "e1", "e1", "e3", "e3", "e3" } },
{ factory = Airfield, types = { "bggy" } },
{ factory = Airfield, types = { "ltnk" } },
}
}
AttackPaths =
@@ -68,9 +68,9 @@ Build = function(factory, units, action)
end
Attack = function()
local types = Utils.Random(AttackUnitTypes[Map.Difficulty])
local production = Utils.Random(AttackUnitTypes[Map.Difficulty])
local path = Utils.Random(AttackPaths)
Build(types[1], types[2], function(units)
Build(production.factory, production.types, function(units)
Utils.Do(units, function(unit)
if unit.Owner ~= enemy then return end
unit.Patrol(path, false)
@@ -224,4 +224,4 @@ Tick = function()
if baseDiscovered and enemy.HasNoRequiredUnits() then
player.MarkCompletedObjective(gdiObjective3)
end
end
end

View File

@@ -8,14 +8,14 @@ AtkRoute2 = { waypoint0.Location, waypoint1.Location, waypoint2.Location, waypoi
AutoCreateTeams =
{
{ { ['e1'] = 1, ['e3'] = 3 }, AtkRoute2 },
{ { ['e1'] = 3, ['e3'] = 1 }, AtkRoute2 },
{ { ['e3'] = 4 } , AtkRoute1 },
{ { ['e1'] = 4 } , AtkRoute1 },
{ { ['bggy'] = 1 } , AtkRoute1 },
{ { ['bggy'] = 1 } , AtkRoute2 },
{ { ['ltnk'] = 1 } , AtkRoute1 },
{ { ['ltnk'] = 1 } , AtkRoute2 }
{ types = { e1 = 1, e3 = 3 }, route = AtkRoute2 },
{ types = { e1 = 3, e3 = 1 }, route = AtkRoute2 },
{ types = { e3 = 4 } , route = AtkRoute1 },
{ types = { e1 = 4 } , route = AtkRoute1 },
{ types = { bggy = 1 } , route = AtkRoute1 },
{ types = { bggy = 1 } , route = AtkRoute2 },
{ types = { ltnk = 1 } , route = AtkRoute1 },
{ types = { ltnk = 1 } , route = AtkRoute2 }
}
RepairThreshold = 0.6
@@ -55,8 +55,8 @@ end
AutoCreateTeam = function()
local team = Utils.Random(AutoCreateTeams)
for type, count in pairs(team[1]) do
MoveThenHunt(Utils.Take(count, enemy.GetActorsByType(type)), team[2])
for type, count in pairs(team.types) do
MoveThenHunt(Utils.Take(count, enemy.GetActorsByType(type)), team.route)
end
Trigger.AfterDelay(Utils.RandomInteger(AutoAtkMinDelay, AutoAtkMaxDelay), AutoCreateTeam)

View File

@@ -15,23 +15,23 @@ if Map.Difficulty == "Easy" then
TimerTicks = DateTime.Minutes(10)
Announcements =
{
{ "TenMinutesRemaining", DateTime.Seconds(3) },
{ "WarningFiveMinutesRemaining", DateTime.Minutes(5) },
{ "WarningFourMinutesRemaining", DateTime.Minutes(6) },
{ "WarningThreeMinutesRemaining", DateTime.Minutes(7) },
{ "WarningTwoMinutesRemaining", DateTime.Minutes(8) },
{ "WarningOneMinuteRemaining", DateTime.Minutes(9) }
{ speech = "TenMinutesRemaining", delay = DateTime.Seconds(3) },
{ speech = "WarningFiveMinutesRemaining", delay = DateTime.Minutes(5) },
{ speech = "WarningFourMinutesRemaining", delay = DateTime.Minutes(6) },
{ speech = "WarningThreeMinutesRemaining", delay = DateTime.Minutes(7) },
{ speech = "WarningTwoMinutesRemaining", delay = DateTime.Minutes(8) },
{ speech = "WarningOneMinuteRemaining", delay = DateTime.Minutes(9) }
}
elseif Map.Difficulty == "Normal" then
TimerTicks = DateTime.Minutes(5)
Announcements =
{
{ "WarningFiveMinutesRemaining", DateTime.Seconds(3) },
{ "WarningFourMinutesRemaining", DateTime.Minutes(1) },
{ "WarningThreeMinutesRemaining", DateTime.Minutes(2) },
{ "WarningTwoMinutesRemaining", DateTime.Minutes(3) },
{ "WarningOneMinuteRemaining", DateTime.Minutes(4) }
{ speech = "WarningFiveMinutesRemaining", delay = DateTime.Seconds(3) },
{ speech = "WarningFourMinutesRemaining", delay = DateTime.Minutes(1) },
{ speech = "WarningThreeMinutesRemaining", delay = DateTime.Minutes(2) },
{ speech = "WarningTwoMinutesRemaining", delay = DateTime.Minutes(3) },
{ speech = "WarningOneMinuteRemaining", delay = DateTime.Minutes(4) }
}
InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "e1" }
@@ -42,9 +42,9 @@ elseif Map.Difficulty == "Hard" then
TimerTicks = DateTime.Minutes(3)
Announcements =
{
{ "WarningThreeMinutesRemaining", DateTime.Seconds(3) },
{ "WarningTwoMinutesRemaining", DateTime.Minutes(1) },
{ "WarningOneMinuteRemaining", DateTime.Minutes(2) },
{ speech = "WarningThreeMinutesRemaining", delay = DateTime.Seconds(3) },
{ speech = "WarningTwoMinutesRemaining", delay = DateTime.Minutes(1) },
{ speech = "WarningOneMinuteRemaining", delay = DateTime.Minutes(2) },
}
InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "e1" }
@@ -55,7 +55,7 @@ elseif Map.Difficulty == "Hard" then
else
TimerTicks = DateTime.Minutes(1)
Announcements = { { "WarningOneMinuteRemaining", DateTime.Seconds(3) } }
Announcements = { { speech = "WarningOneMinuteRemaining", delay = DateTime.Seconds(3) } }
ConstructionVehicleReinforcements = { "jeep" }
InfantryTypes = { "e1", "e1", "e1", "e2", "e2", "dog", "dog" }
@@ -229,9 +229,9 @@ end
ConvoyTimerAnnouncements = function()
for i = #Announcements, 1, -1 do
Trigger.AfterDelay(Announcements[i][2], function()
Trigger.AfterDelay(Announcements[i].delay, function()
if not ConvoyOnSite then
Media.PlaySpeechNotification(player, Announcements[i][1])
Media.PlaySpeechNotification(player, Announcements[i].speech)
end
end)
end

View File

@@ -29,9 +29,9 @@ HeliReinforcements = { "medi", "mech", "mech" }
GreeceReinforcements =
{
{ { "2tnk", "2tnk", "2tnk", "arty", "arty" }, { SpyEntry.Location, SpyLoadout.Location } },
{ { "e3", "e3", "e3", "e6", "e6" }, { SpyEntry.Location, GreeceLoadout1.Location } },
{ { "jeep", "jeep", "e1", "e1", "2tnk" }, { SpyEntry.Location, GreeceLoadout2.Location } }
{ types = { "2tnk", "2tnk", "2tnk", "arty", "arty" }, entry = { SpyEntry.Location, SpyLoadout.Location } },
{ types = { "e3", "e3", "e3", "e6", "e6" }, entry = { SpyEntry.Location, GreeceLoadout1.Location } },
{ types = { "jeep", "jeep", "e1", "e1", "2tnk" }, entry = { SpyEntry.Location, GreeceLoadout2.Location } }
}
DogPatrol = { Dog1, Dog2 }
@@ -104,8 +104,8 @@ SendReinforcements = function()
Camera.Position = ReinforceCamera.CenterPosition
greece.Cash = greece.Cash + ReinforceCash
Utils.Do(GreeceReinforcements, function(reinforceTable)
Reinforcements.ReinforceWithTransport(greece, InsertionTransport, reinforceTable[1], reinforceTable[2], { SpyEntry.Location })
Utils.Do(GreeceReinforcements, function(reinforcements)
Reinforcements.ReinforceWithTransport(greece, InsertionTransport, reinforcements.types, reinforcements.entry, { SpyEntry.Location })
end)
Media.PlaySpeechNotification(greece, "AlliedReinforcementsArrived")

View File

@@ -4,13 +4,13 @@ if DateTime.IsHalloween then
ProxyType = "powerproxy.parazombies"
ProducedUnitTypes =
{
{ AlliedBarracks1, { "e1", "e3" } },
{ AlliedBarracks2, { "e1", "e3" } },
{ SovietBarracks1, { "ant" } },
{ SovietBarracks2, { "ant" } },
{ SovietBarracks3, { "ant" } },
{ AlliedWarFactory1, { "jeep", "1tnk", "2tnk", "arty", "ctnk" } },
{ SovietWarFactory1, { "3tnk", "4tnk", "v2rl", "ttnk", "apc" } }
{ factory = AlliedBarracks1, types = { "e1", "e3" } },
{ factory = AlliedBarracks2, types = { "e1", "e3" } },
{ factory = SovietBarracks1, types = { "ant" } },
{ factory = SovietBarracks2, types = { "ant" } },
{ factory = SovietBarracks3, types = { "ant" } },
{ factory = AlliedWarFactory1, types = { "jeep", "1tnk", "2tnk", "arty", "ctnk" } },
{ factory = SovietWarFactory1, types = { "3tnk", "4tnk", "v2rl", "ttnk", "apc" } }
}
else
UnitTypes = { "3tnk", "ftrk", "ttnk", "apc" }
@@ -18,13 +18,13 @@ else
ProxyType = "powerproxy.paratroopers"
ProducedUnitTypes =
{
{ AlliedBarracks1, { "e1", "e3" } },
{ AlliedBarracks2, { "e1", "e3" } },
{ SovietBarracks1, { "dog", "e1", "e2", "e3", "e4", "shok" } },
{ SovietBarracks2, { "dog", "e1", "e2", "e3", "e4", "shok" } },
{ SovietBarracks3, { "dog", "e1", "e2", "e3", "e4", "shok" } },
{ AlliedWarFactory1, { "jeep", "1tnk", "2tnk", "arty", "ctnk" } },
{ SovietWarFactory1, { "3tnk", "4tnk", "v2rl", "ttnk", "apc" } }
{ factory = AlliedBarracks1, types = { "e1", "e3" } },
{ factory = AlliedBarracks2, types = { "e1", "e3" } },
{ factory = SovietBarracks1, types = { "dog", "e1", "e2", "e3", "e4", "shok" } },
{ factory = SovietBarracks2, types = { "dog", "e1", "e2", "e3", "e4", "shok" } },
{ factory = SovietBarracks3, types = { "dog", "e1", "e2", "e3", "e4", "shok" } },
{ factory = AlliedWarFactory1, types = { "jeep", "1tnk", "2tnk", "arty", "ctnk" } },
{ factory = SovietWarFactory1, types = { "3tnk", "4tnk", "v2rl", "ttnk", "apc" } }
}
end
@@ -102,9 +102,9 @@ ParadropSovietUnits = function()
end
ProduceUnits = function(t)
local factory = t[1]
local factory = t.factory
if not factory.IsDead then
local unitType = t[2][Utils.RandomInteger(1, #t[2] + 1)]
local unitType = t.types[Utils.RandomInteger(1, #t.types + 1)]
factory.Wait(Actor.BuildTime(unitType))
factory.Produce(unitType)
factory.CallFunc(function() ProduceUnits(t) end)
@@ -121,8 +121,8 @@ SetupAlliedUnits = function()
end
SetupFactories = function()
Utils.Do(ProducedUnitTypes, function(pair)
Trigger.OnProduction(pair[1], function(_, a) BindActorTriggers(a) end)
Utils.Do(ProducedUnitTypes, function(production)
Trigger.OnProduction(production.factory, function(_, a) BindActorTriggers(a) end)
end)
end

View File

@@ -15,87 +15,87 @@ Snipers = { Sniper1, Sniper2, Sniper3, Sniper4, Sniper5, Sniper6, Sniper7, Snipe
Wave = 0
Waves =
{
{ 500, SovietEntryPoints, Infantry, SpawnPoints },
{ delay = 500, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ 750, PatrolWaypoints, Patrol, ParadropWaypoints },
{ delay = 750, entries = PatrolWaypoints, units = Patrol, targets = ParadropWaypoints },
{ 750, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Vehicles, SpawnPoints },
{ delay = 750, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Vehicles, targets = SpawnPoints },
{ 1500, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ delay = 1500, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ 1500, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Vehicles, SpawnPoints },
{ delay = 1500, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Vehicles, targets = SpawnPoints },
{ 1500, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Tank, SpawnPoints },
{ 1, SovietEntryPoints, Vehicles, SpawnPoints },
{ delay = 1500, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Tank, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Vehicles, targets = SpawnPoints },
{ 1500, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Tank, SpawnPoints },
{ 1, SovietEntryPoints, Tank, SpawnPoints },
{ delay = 1500, entries = SovietEntryPoints, Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Tank, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Tank, targets = SpawnPoints },
{ 1500, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, LongRange, SpawnPoints },
{ delay = 1500, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = LongRange, targets = SpawnPoints },
{ 1500, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, LongRange, SpawnPoints },
{ 1, SovietEntryPoints, Tank, SpawnPoints },
{ 1, SovietEntryPoints, LongRange, SpawnPoints },
{ delay = 1500, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = LongRange, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Tank, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = LongRange, targets = SpawnPoints },
{ 1500, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, LongRange, SpawnPoints },
{ 1, SovietEntryPoints, LongRange, SpawnPoints },
{ 1, SovietEntryPoints, Tank, SpawnPoints },
{ 1, SovietEntryPoints, Tank, SpawnPoints },
{ 1, SovietEntryPoints, Vehicles, SpawnPoints },
{ delay = 1500, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = LongRange, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = LongRange, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Tank, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Tank, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Vehicles, targets = SpawnPoints },
{ 1500, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Infantry, SpawnPoints },
{ 1, SovietEntryPoints, Boss, SpawnPoints }
{ delay = 1500, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Infantry, targets = SpawnPoints },
{ delay = 1, entries = SovietEntryPoints, units = Boss, targets = SpawnPoints }
}
SendUnits = function(entryCell, unitTypes, interval, targetCell)
@@ -121,13 +121,11 @@ SendWave = function()
Wave = Wave + 1
local wave = Waves[Wave]
local delay = wave[1]
local entry = Utils.Random(wave[2]).Location
local units = wave[3]
local target = Utils.Random(wave[4]).Location
local entry = Utils.Random(wave.entries).Location
local target = Utils.Random(wave.targets).Location
Trigger.AfterDelay(delay, function()
SendUnits(entry, units, 40, target)
Trigger.AfterDelay(wave.delay, function()
SendUnits(entry, wave.units, 40, target)
if not played then
played = true

View File

@@ -1,8 +1,8 @@
AlliedUnits =
{
{ 0, { "1tnk", "1tnk", "2tnk", "2tnk" } },
{ DateTime.Seconds(3), { "e1", "e1", "e1", "e3", "e3" } },
{ DateTime.Seconds(7), { "e6" } }
{ delay = 0, types = { "1tnk", "1tnk", "2tnk", "2tnk" } },
{ delay = DateTime.Seconds(3), types = { "e1", "e1", "e1", "e3", "e3" } },
{ delay = DateTime.Seconds(7), types = { "e6" } }
}
ReinforceBaseUnits = { "1tnk", "1tnk", "2tnk", "arty", "arty" }
CivilianEvacuees = { "c1", "c2", "c5", "c7", "c8" }
@@ -102,8 +102,8 @@ SendAlliedUnits = function()
Media.PlaySpeechNotification(player, "ReinforcementsArrived")
Utils.Do(AlliedUnits, function(table)
Trigger.AfterDelay(table[1], function()
Reinforcements.Reinforce(player, table[2], { StartEntryPoint.Location, StartMovePoint.Location }, 18)
Trigger.AfterDelay(table.delay, function()
Reinforcements.Reinforce(player, table.types, { StartEntryPoint.Location, StartMovePoint.Location }, 18)
end)
end)

View File

@@ -11,12 +11,15 @@ IdlingUnits = function()
end)
end
BaseBarracks = { type = "tent", pos = CVec.New(-9, 6), cost = 400, exists = true }
BaseProc = { type = "proc", pos = CVec.New(4, 7), cost = 1400, exists = true }
BaseWeaponsFactory = { type = "weap", pos = CVec.New(8, -1), cost = 2000, exists = true }
BaseBuildings =
{
{ "powr", CVec.New(0, 4), 300 },
{ "tent", CVec.New(-9, 6), 400, true },
{ "proc", CVec.New(4, 7), 1400, true },
{ "weap", CVec.New(8, -1), 2000, true }
{ type = "powr", pos = CVec.New(0, 4), cost = 300 },
BaseBarracks,
BaseProc,
BaseWeaponsFactory
}
BuildBase = function()
@@ -27,7 +30,7 @@ BuildBase = function()
end
for i,v in ipairs(BaseBuildings) do
if not v[4] then
if not v.exists then
BuildBuilding(v)
return
end
@@ -37,12 +40,12 @@ BuildBase = function()
end
BuildBuilding = function(building)
Trigger.AfterDelay(Actor.BuildTime(building[1]), function()
local actor = Actor.Create(building[1], true, { Owner = Greece, Location = GreeceCYard.Location + building[2] })
Greece.Cash = Greece.Cash - building[3]
Trigger.AfterDelay(Actor.BuildTime(building.type), function()
local actor = Actor.Create(building.type, true, { Owner = Greece, Location = GreeceCYard.Location + building.pos })
Greece.Cash = Greece.Cash - building.cost
building[4] = true
Trigger.OnKilled(actor, function() building[4] = true end)
building.exists = true
Trigger.OnKilled(actor, function() building.exists = false end)
Trigger.OnDamaged(actor, function(building)
if building.Owner == Greece and building.Health < building.MaxHealth * 3/4 then
building.StartBuildingRepairs()
@@ -54,7 +57,7 @@ BuildBuilding = function(building)
end
ProduceInfantry = function()
if not BaseBuildings[2][4] then
if not BaseBarracks.exists then
return
elseif Harvester.IsDead and Greece.Resources <= 299 then
return
@@ -77,7 +80,7 @@ ProduceInfantry = function()
end
ProduceArmor = function()
if not BaseBuildings[4][4] then
if not BaseWeaponsFactory.exists then
return
elseif Harvester.IsDead and Greece.Resources <= 599 then
return

View File

@@ -24,15 +24,15 @@ RunInitialActivities = function()
Media.PlaySpeechNotification(player, "ReinforcementsArrived")
Trigger.OnKilled(Barr, function(building)
BaseBuildings[2][4] = false
BaseBarracks.exists = false
end)
Trigger.OnKilled(Proc, function(building)
BaseBuildings[3][4] = false
BaseProc.exists = false
end)
Trigger.OnKilled(Weap, function(building)
BaseBuildings[4][4] = false
BaseWeaponsFactory.exists = false
end)
Trigger.OnEnteredFootprint(VillageCamArea, function(actor, id)

View File

@@ -11,13 +11,12 @@ IdlingUnits = function()
end)
end
BaseBuildings =
{
{ "powr", CVec.New(-4, -2), 300, true },
{ "tent", CVec.New(-8, 1), 400, true },
{ "proc", CVec.New(-5, 1), 1400, true },
{ "weap", CVec.New(-12, -1), 2000, true }
}
BasePower = { type = "powr", pos = CVec.New(-4, -2), cost = 300, exists = true }
BaseBarracks = { type = "tent", pos = CVec.New(-8, 1), cost = 400, exists = true }
BaseProc = { type = "proc", pos = CVec.New(-5, 1), cost = 1400, exists = true }
BaseWeaponsFactory = { type = "weap", pos = CVec.New(-12, -1), cost = 2000, exists = true }
BaseBuildings = { BasePower, BaseBarracks, BaseProc, BaseWeaponsFactory }
BuildBase = function()
if CYard.IsDead or CYard.Owner ~= Greece then
@@ -27,7 +26,7 @@ BuildBase = function()
end
for i,v in ipairs(BaseBuildings) do
if not v[4] then
if not v.exists then
BuildBuilding(v)
return
end
@@ -37,12 +36,12 @@ BuildBase = function()
end
BuildBuilding = function(building)
Trigger.AfterDelay(Actor.BuildTime(building[1]), function()
local actor = Actor.Create(building[1], true, { Owner = Greece, Location = GreeceCYard.Location + building[2] })
Greece.Cash = Greece.Cash - building[3]
Trigger.AfterDelay(Actor.BuildTime(building.type), function()
local actor = Actor.Create(building.type, true, { Owner = Greece, Location = GreeceCYard.Location + building.pos })
Greece.Cash = Greece.Cash - building.cost
building[4] = true
Trigger.OnKilled(actor, function() building[4] = true end)
building.exists = true
Trigger.OnKilled(actor, function() building.exists = false end)
Trigger.OnDamaged(actor, function(building)
if building.Owner == Greece and building.Health < building.MaxHealth * 3/4 then
building.StartBuildingRepairs()
@@ -54,7 +53,7 @@ BuildBuilding = function(building)
end
ProduceInfantry = function()
if not BaseBuildings[2][4] then
if not BaseBarracks.exists then
return
elseif Harvester.IsDead and Greece.Resources <= 299 then
return
@@ -77,7 +76,7 @@ ProduceInfantry = function()
end
ProduceArmor = function()
if not BaseBuildings[4][4] then
if not BaseWeaponsFactory.exists then
return
elseif Harvester.IsDead and Greece.Resources <= 599 then
return

View File

@@ -22,19 +22,19 @@ RunInitialActivities = function()
end)
Trigger.OnKilled(Powr, function(building)
BaseBuildings[1][4] = false
BasePower.exists = false
end)
Trigger.OnKilled(Barr, function(building)
BaseBuildings[2][4] = false
BaseBarracks.exists = false
end)
Trigger.OnKilled(Proc, function(building)
BaseBuildings[3][4] = false
BaseProc.exists = false
end)
Trigger.OnKilled(Weap, function(building)
BaseBuildings[4][4] = false
BaseWeaponsFactory.exists = false
end)
Trigger.OnEnteredFootprint(VillageCamArea, function(actor, id)

View File

@@ -13,28 +13,28 @@ IdlingUnits = function()
end
BaseBuildings = {
{ "powr", CVec.New(3, -2), 300 },
{ "tent", CVec.New(0, 4), 400 },
{ "hbox", CVec.New(3, 6), 600 },
{ "proc", CVec.New(4, 2), 1400 },
{ "powr", CVec.New(5, -3), 300 },
{ "weap", CVec.New(-5, 3), 2000 },
{ "hbox", CVec.New(-6, 5), 600 },
{ "gun", CVec.New(0, 8), 600 },
{ "gun", CVec.New(-4, 7), 600 },
{ "powr", CVec.New(-4, -3), 300 },
{ "proc", CVec.New(-9, 1), 1400 },
{ "powr", CVec.New(-8, -2), 300 },
{ "silo", CVec.New(6, 0), 150 },
{ "agun", CVec.New(-3, 0), 800 },
{ "powr", CVec.New(-6, -2), 300 },
{ "agun", CVec.New(4, 1), 800 },
{ "gun", CVec.New(-9, 5), 600 },
{ "gun", CVec.New(-2, -3), 600 },
{ "powr", CVec.New(4, 6), 300 },
{ "gun", CVec.New(3, -6), 600 },
{ "hbox", CVec.New(3, -4), 600 },
{ "gun", CVec.New(2, 3), 600 }
{ type = "powr", pos = CVec.New(3, -2), cost = 300 },
{ type = "tent", pos = CVec.New(0, 4), cost = 400 },
{ type = "hbox", pos = CVec.New(3, 6), cost = 600 },
{ type = "proc", pos = CVec.New(4, 2), cost = 1400 },
{ type = "powr", pos = CVec.New(5, -3), cost = 300 },
{ type = "weap", pos = CVec.New(-5, 3), cost = 2000 },
{ type = "hbox", pos = CVec.New(-6, 5), cost = 600 },
{ type = "gun", pos = CVec.New(0, 8), cost = 600 },
{ type = "gun", pos = CVec.New(-4, 7), cost = 600 },
{ type = "powr", pos = CVec.New(-4, -3), cost = 300 },
{ type = "proc", pos = CVec.New(-9, 1), cost = 1400 },
{ type = "powr", pos = CVec.New(-8, -2), cost = 300 },
{ type = "silo", pos = CVec.New(6, 0), cost = 150 },
{ type = "agun", pos = CVec.New(-3, 0), cost = 800 },
{ type = "powr", pos = CVec.New(-6, -2), cost = 300 },
{ type = "agun", pos = CVec.New(4, 1), cost = 800 },
{ type = "gun", pos = CVec.New(-9, 5), cost = 600 },
{ type = "gun", pos = CVec.New(-2, -3), cost = 600 },
{ type = "powr", pos = CVec.New(4, 6), cost = 300 },
{ type = "gun", pos = CVec.New(3, -6), cost = 600 },
{ type = "hbox", pos = CVec.New(3, -4), cost = 600 },
{ type = "gun", pos = CVec.New(2, 3), cost = 600 }
}
BuildBase = function()
@@ -43,7 +43,7 @@ BuildBase = function()
end
for i,v in ipairs(BaseBuildings) do
if not v[4] then
if not v.exists then
BuildBuilding(v)
return
end
@@ -53,12 +53,12 @@ BuildBase = function()
end
BuildBuilding = function(building)
Trigger.AfterDelay(Actor.BuildTime(building[1]), function()
local actor = Actor.Create(building[1], true, { Owner = GoodGuy, Location = MCVDeploy.Location + building[2] })
GoodGuy.Cash = GoodGuy.Cash - building[3]
Trigger.AfterDelay(Actor.BuildTime(building.type), function()
local actor = Actor.Create(building.type, true, { Owner = GoodGuy, Location = MCVDeploy.Location + building.pos })
GoodGuy.Cash = GoodGuy.Cash - building.cost
building[4] = true
Trigger.OnKilled(actor, function() building[4] = false end)
building.exists = true
Trigger.OnKilled(actor, function() building.exists = false end)
Trigger.OnDamaged(actor, function(building)
if building.Owner == GoodGuy and building.Health < building.MaxHealth * 3/4 then
building.StartBuildingRepairs()

View File

@@ -11,14 +11,13 @@ IdlingUnits = function()
end)
end
BaseBuildings =
{
{ "apwr", CVec.New(-13, 7), 500, true },
{ "tent", CVec.New(-2, 12), 400, true },
{ "proc", CVec.New(-7, 5), 1400, true },
{ "weap", CVec.New(-9, 11), 2000, true },
{ "apwr", CVec.New(-4, 1), 500, true }
}
BaseApwr = { type = "apwr", pos = CVec.New(-13, 7), cost = 500, exists = true }
BaseTent = { type = "tent", pos = CVec.New(-2, 12), cost = 400, exists = true }
BaseProc = { type = "proc", pos = CVec.New(-7, 5), cost = 1400, exists = true }
BaseWeap = { type = "weap", pos = CVec.New(-9, 11), cost = 2000, exists = true }
BaseApwr2 = { type = "apwr", pos = CVec.New(-4, 1), cost = 500, exists = true }
BaseBuildings = { BaseApwr, BaseTent, BaseProc, BaseWeap, BaseApwr2 }
BuildBase = function()
if CYard.IsDead or CYard.Owner ~= enemy then
@@ -28,7 +27,7 @@ BuildBase = function()
end
for i,v in ipairs(BaseBuildings) do
if not v[4] then
if not v.exists then
BuildBuilding(v)
return
end
@@ -38,12 +37,12 @@ BuildBase = function()
end
BuildBuilding = function(building)
Trigger.AfterDelay(Actor.BuildTime(building[1]), function()
local actor = Actor.Create(building[1], true, { Owner = enemy, Location = CYardLocation.Location + building[2] })
enemy.Cash = enemy.Cash - building[3]
Trigger.AfterDelay(Actor.BuildTime(building.type), function()
local actor = Actor.Create(building.type, true, { Owner = enemy, Location = CYardLocation.Location + building.pos })
enemy.Cash = enemy.Cash - building.cost
building[4] = true
Trigger.OnKilled(actor, function() building[4] = false end)
building.exists = true
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()

View File

@@ -57,23 +57,23 @@ Trigger.OnAllKilled(Trucks, function()
end)
Trigger.OnKilled(Apwr, function(building)
BaseBuildings[1][4] = false
BaseApwr.exists = false
end)
Trigger.OnKilled(Barr, function(building)
BaseBuildings[2][4] = false
BaseTent.exists = false
end)
Trigger.OnKilled(Proc, function(building)
BaseBuildings[3][4] = false
BaseProc.exists = false
end)
Trigger.OnKilled(Weap, function(building)
BaseBuildings[4][4] = false
BaseWeap.exists = false
end)
Trigger.OnKilled(Apwr2, function(building)
BaseBuildings[5][4] = false
BaseApwr2.exists = false
end)
-- Activate the AI once the player deployed the Mcv

View File

@@ -11,14 +11,13 @@ IdlingUnits = function()
end)
end
BaseBuildings =
{
{ "apwr", CVec.New(5, -9), 500, true },
{ "tent", CVec.New(-4, -4), 400, true },
{ "proc", CVec.New(0, -8), 1400, true },
{ "weap", CVec.New(-4, -8), 2000, true },
{ "apwr", CVec.New(6, -5), 500, true }
}
BaseApwr = { type = "apwr", pos = CVec.New(5, -9), cost = 500, exists = true }
BaseTent = { type = "tent", pos = CVec.New(-4, -4), cost = 400, exists = true }
BaseProc = { type = "proc", pos = CVec.New(0, -8), cost = 1400, exists = true }
BaseWeap = { type = "weap", pos = CVec.New(-4, -8), cost = 2000, exists = true }
BaseApwr2 = { type = "apwr", pos = CVec.New(6, -5), cost = 500, exists = true }
BaseBuildings = { BaseApwr, BaseTent, BaseProc, BaseWeap, BaseApwr2 }
BuildBase = function()
if CYard.IsDead or CYard.Owner ~= enemy then
@@ -28,7 +27,7 @@ BuildBase = function()
end
for i,v in ipairs(BaseBuildings) do
if not v[4] then
if not v.exists then
BuildBuilding(v)
return
end
@@ -38,12 +37,12 @@ BuildBase = function()
end
BuildBuilding = function(building)
Trigger.AfterDelay(Actor.BuildTime(building[1]), function()
local actor = Actor.Create(building[1], true, { Owner = enemy, Location = CYardLocation.Location + building[2] })
enemy.Cash = enemy.Cash - building[3]
Trigger.AfterDelay(Actor.BuildTime(building.type), function()
local actor = Actor.Create(building.type, true, { Owner = enemy, Location = CYardLocation.Location + building.pos })
enemy.Cash = enemy.Cash - building.cost
building[4] = true
Trigger.OnKilled(actor, function() building[4] = false end)
building.exists = true
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()

View File

@@ -28,23 +28,23 @@ Trigger.OnAllKilled(Trucks, function()
end)
Trigger.OnKilled(Apwr, function(building)
BaseBuildings[1][4] = false
BaseApwr.exists = false
end)
Trigger.OnKilled(Barr, function(building)
BaseBuildings[2][4] = false
BaseTent.exists = false
end)
Trigger.OnKilled(Proc, function(building)
BaseBuildings[3][4] = false
BaseProc.exists = false
end)
Trigger.OnKilled(Weap, function(building)
BaseBuildings[4][4] = false
BaseWeap.exists = false
end)
Trigger.OnKilled(Apwr2, function(building)
BaseBuildings[5][4] = false
BaseApwr2.exists = false
end)
Trigger.OnRemovedFromWorld(Mcv, function()

View File

@@ -24,15 +24,15 @@ NewSovietRallyPoints = { SovietRally3, SovietRally4, SovietRally8 }
ParaWaves =
{
{ AttackTicks, { "SovietSquad", SovietRally5 } },
{ 0, { "SovietSquad", SovietRally6 } },
{ AttackTicks * 2, { "SovietSquad", SovietParaDrop3 } },
{ 0, { "SovietPlatoonUnits", SovietRally5 } },
{ 0, { "SovietPlatoonUnits", SovietRally6 } },
{ 0, { "SovietSquad", SovietRally2 } },
{ AttackTicks * 2, { "SovietSquad", SovietParaDrop2 } },
{ AttackTicks * 2, { "SovietSquad", SovietParaDrop1 } },
{ AttackTicks * 3, { "SovietSquad", SovietParaDrop1 } }
{ delay = AttackTicks, type = "SovietSquad", target = SovietRally5 },
{ delay = 0, type = "SovietSquad", target = SovietRally6 },
{ delay = AttackTicks * 2, type = "SovietSquad", target = SovietParaDrop3 },
{ delay = 0, type = "SovietPlatoonUnits", target = SovietRally5 },
{ delay = 0, type = "SovietPlatoonUnits", target = SovietRally6 },
{ delay = 0, type = "SovietSquad", target = SovietRally2 },
{ delay = AttackTicks * 2, type = "SovietSquad", target = SovietParaDrop2 },
{ delay = AttackTicks * 2, type = "SovietSquad", target = SovietParaDrop1 },
{ delay = AttackTicks * 3, type = "SovietSquad", target = SovietParaDrop1 }
}
IdleHunt = function(unit)
@@ -120,8 +120,8 @@ Tick = function()
end
SendSovietParadrops = function(table)
local paraproxy = Actor.Create(table[1], false, { Owner = soviets })
units = paraproxy.SendParatroopers(table[2].CenterPosition)
local paraproxy = Actor.Create(table.type, false, { Owner = soviets })
units = paraproxy.SendParatroopers(table.target.CenterPosition)
Utils.Do(units, function(unit) IdleHunt(unit) end)
paraproxy.Destroy()
end
@@ -227,13 +227,13 @@ end
wave = 1
SendParadrops = function()
SendSovietParadrops(ParaWaves[wave][2])
SendSovietParadrops(ParaWaves[wave])
wave = wave + 1
if wave > #ParaWaves then
Trigger.AfterDelay(AttackTicks, FrenchReinforcements)
else
Trigger.AfterDelay(ParaWaves[wave][1], SendParadrops)
Trigger.AfterDelay(ParaWaves[wave].delay, SendParadrops)
end
end