Polish and standardize Allies01

This commit is contained in:
Smittytron
2021-07-16 14:29:00 -05:00
committed by reaperrr
parent 0ea6a5626f
commit 8a4945d20a
3 changed files with 88 additions and 70 deletions

View File

@@ -15,9 +15,12 @@ TanyaReinforcements = { "e7.noautotarget" }
EinsteinType = "einstein"
FlareType = "flare"
CruisersReinforcements = { "ca", "ca", "ca", "ca" }
OpeningAttack = { Patrol1, Patrol2, Patrol3, Patrol4 }
Responders = { Response1, Response2, Response3, Response4, Response5 }
LabGuardsTeam = { LabGuard1, LabGuard2, LabGuard3 }
SendInsertionHelicopter = function()
local passengers = Reinforcements.ReinforceWithTransport(player, InsertionHelicopterType,
local passengers = Reinforcements.ReinforceWithTransport(Greece, InsertionHelicopterType,
TanyaReinforcements, InsertionPath, { InsertionEntry.Location })[2]
local tanya = passengers[1]
Trigger.OnKilled(tanya, TanyaKilledInAction)
@@ -27,41 +30,54 @@ SendInsertionHelicopter = function()
end
SendJeeps = function()
Reinforcements.Reinforce(player, JeepReinforcements, InsertionPath, DateTime.Seconds(2))
Media.PlaySpeechNotification(player, "ReinforcementsArrived")
Reinforcements.Reinforce(Greece, JeepReinforcements, InsertionPath, DateTime.Seconds(2))
Media.PlaySpeechNotification(Greece, "ReinforcementsArrived")
end
RunInitialActivities = function()
SendInsertionHelicopter()
Patrol1.Hunt()
Patrol2.Hunt()
Patrol3.Hunt()
Patrol4.Hunt()
Civilian1.Wait(DateTime.Seconds(6))
Civilian2.Wait(DateTime.Seconds(6))
Civilian1.Hunt()
Civilian2.Hunt()
Utils.Do(OpeningAttack, function(a)
IdleHunt(a)
end)
Trigger.OnKilled(Patrol3, function()
if not Civilian1.IsDead then
Civilian1.Move(CivMove.Location)
end
end)
Trigger.OnKilled(BarrelPower, function()
if not Civilian2.IsDead then
Civilian2.Move(CivMove.Location)
end
Utils.Do(Responders, function(r)
if not r.IsDead then
IdleHunt(r)
end
end)
end)
end
LabGuardsKilled = function()
CreateEinstein()
Trigger.AfterDelay(DateTime.Seconds(2), function()
Actor.Create(FlareType, true, { Owner = england, Location = ExtractionFlarePoint.Location })
Media.PlaySpeechNotification(player, "SignalFlareNorth")
Actor.Create(FlareType, true, { Owner = England, Location = ExtractionFlarePoint.Location })
Media.PlaySpeechNotification(Greece, "SignalFlareNorth")
SendExtractionHelicopter()
end)
Trigger.AfterDelay(DateTime.Seconds(10), function()
Media.PlaySpeechNotification(player, "AlliedReinforcementsArrived")
Actor.Create("camera", true, { Owner = player, Location = CruiserCameraPoint.Location })
Media.PlaySpeechNotification(Greece, "AlliedReinforcementsArrived")
Actor.Create("camera", true, { Owner = Greece, Location = CruiserCameraPoint.Location })
SendCruisers()
end)
Trigger.AfterDelay(DateTime.Seconds(12), function()
for i = 0, 2 do
Trigger.AfterDelay(DateTime.Seconds(i), function()
Media.PlaySoundNotification(player, "AlertBuzzer")
Media.PlaySoundNotification(Greece, "AlertBuzzer")
end)
end
Utils.Do(sovietArmy, function(a)
@@ -73,7 +89,7 @@ LabGuardsKilled = function()
end
SendExtractionHelicopter = function()
heli = Reinforcements.ReinforceWithTransport(player, ExtractionHelicopterType, nil, ExtractionPath)[1]
heli = Reinforcements.ReinforceWithTransport(Greece, ExtractionHelicopterType, nil, ExtractionPath)[1]
if not einstein.IsDead then
Trigger.OnRemovedFromWorld(einstein, EvacuateHelicopter)
end
@@ -91,7 +107,7 @@ end
SendCruisers = function()
local i = 1
Utils.Do(CruisersReinforcements, function(cruiser)
local ca = Actor.Create(cruiser, true, { Owner = england, Location = SouthReinforcementsPoint.Location + CVec.New(2 * i, 0) })
local ca = Actor.Create(cruiser, true, { Owner = England, Location = SouthReinforcementsPoint.Location + CVec.New(2 * i, 0) })
ca.Move(Map.NamedActor("CruiserPoint" .. i).Location)
i = i + 1
end)
@@ -104,13 +120,13 @@ LabDestroyed = function()
end
RescueFailed = function()
Media.PlaySpeechNotification(player, "ObjectiveNotMet")
player.MarkFailedObjective(EinsteinSurviveObjective)
Media.PlaySpeechNotification(Greece, "ObjectiveNotMet")
Greece.MarkFailedObjective(EinsteinSurviveObjective)
end
TanyaKilledInAction = function()
Media.PlaySpeechNotification(player, "ObjectiveNotMet")
player.MarkFailedObjective(TanyaSurviveObjective)
Media.PlaySpeechNotification(Greece, "ObjectiveNotMet")
Greece.MarkFailedObjective(TanyaSurviveObjective)
end
OilPumpDestroyed = function()
@@ -118,8 +134,8 @@ OilPumpDestroyed = function()
end
CiviliansKilled = function()
player.MarkFailedObjective(CivilProtectionObjective)
Media.PlaySpeechNotification(player, "ObjectiveNotMet")
Greece.MarkFailedObjective(CivilProtectionObjective)
Media.PlaySpeechNotification(Greece, "ObjectiveNotMet")
collateralDamage = true
end
@@ -130,83 +146,82 @@ LostMate = function()
end
CreateEinstein = function()
player.MarkCompletedObjective(FindEinsteinObjective)
Media.PlaySpeechNotification(player, "ObjectiveMet")
einstein = Actor.Create(EinsteinType, true, { Location = EinsteinSpawnPoint.Location, Owner = player })
Greece.MarkCompletedObjective(FindEinsteinObjective)
Media.PlaySpeechNotification(Greece, "ObjectiveMet")
einstein = Actor.Create(EinsteinType, true, { Location = EinsteinSpawnPoint.Location, Owner = Greece })
einstein.Scatter()
Trigger.OnKilled(einstein, RescueFailed)
ExtractObjective = player.AddObjective("Wait for the helicopter and extract Einstein.")
Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(player, "TargetFreed") end)
ExtractObjective = Greece.AddObjective("Wait for the helicopter and extract Einstein.")
Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(Greece, "TargetFreed") end)
end
HelicopterGone = function()
if not heli.IsDead then
Media.PlaySpeechNotification(player, "TargetRescued")
Media.PlaySpeechNotification(Greece, "TargetRescued")
Trigger.AfterDelay(DateTime.Seconds(1), function()
player.MarkCompletedObjective(ExtractObjective)
player.MarkCompletedObjective(EinsteinSurviveObjective)
if not player.IsObjectiveFailed(TanyaSurviveObjective) then
player.MarkCompletedObjective(TanyaSurviveObjective)
Greece.MarkCompletedObjective(ExtractObjective)
Greece.MarkCompletedObjective(EinsteinSurviveObjective)
if not Greece.IsObjectiveFailed(TanyaSurviveObjective) then
Greece.MarkCompletedObjective(TanyaSurviveObjective)
end
if not collateralDamage then
player.MarkCompletedObjective(CivilProtectionObjective)
Greece.MarkCompletedObjective(CivilProtectionObjective)
end
end)
end
end
MissionAccomplished = function()
Media.PlaySpeechNotification(player, "MissionAccomplished")
Media.PlaySpeechNotification(Greece, "MissionAccomplished")
end
MissionFailed = function()
Media.PlaySpeechNotification(player, "MissionFailed")
Media.PlaySpeechNotification(Greece, "MissionFailed")
end
SetUnitStances = function()
Utils.Do(Map.NamedActors, function(a)
if a.Owner == player then
if a.Owner == Greece then
a.Stance = "Defend"
end
end)
end
Tick = function()
ussr.Resources = ussr.Resources - (0.01 * ussr.ResourceCapacity / 25)
USSR.Resources = USSR.Resources - (0.01 * USSR.ResourceCapacity / 25)
end
WorldLoaded = function()
player = Player.GetPlayer("Greece")
england = Player.GetPlayer("England")
ussr = Player.GetPlayer("USSR")
Greece = Player.GetPlayer("Greece")
England = Player.GetPlayer("England")
USSR = Player.GetPlayer("USSR")
Trigger.OnObjectiveAdded(player, function(p, id)
Trigger.OnObjectiveAdded(Greece, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
end)
Trigger.OnObjectiveCompleted(player, function(p, id)
Trigger.OnObjectiveCompleted(Greece, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
end)
Trigger.OnObjectiveFailed(player, function(p, id)
Trigger.OnObjectiveFailed(Greece, function(p, id)
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
end)
Trigger.OnPlayerLost(player, MissionFailed)
Trigger.OnPlayerWon(player, MissionAccomplished)
Trigger.OnPlayerLost(Greece, MissionFailed)
Trigger.OnPlayerWon(Greece, MissionAccomplished)
FindEinsteinObjective = player.AddObjective("Find Einstein.")
TanyaSurviveObjective = player.AddObjective("Tanya must survive.")
EinsteinSurviveObjective = player.AddObjective("Einstein must survive.")
CivilProtectionObjective = player.AddObjective("Protect all civilians.", "Secondary", false)
FindEinsteinObjective = Greece.AddObjective("Find Einstein.")
TanyaSurviveObjective = Greece.AddObjective("Tanya must survive.")
EinsteinSurviveObjective = Greece.AddObjective("Einstein must survive.")
CivilProtectionObjective = Greece.AddObjective("Protect all civilians.", "Secondary", false)
RunInitialActivities()
Trigger.OnKilled(Lab, LabDestroyed)
Trigger.OnKilled(OilPump, OilPumpDestroyed)
sovietArmy = ussr.GetGroundAttackers()
sovietArmy = USSR.GetGroundAttackers()
labGuardsTeam = { LabGuard1, LabGuard2, LabGuard3 }
Trigger.OnAllKilled(labGuardsTeam, LabGuardsKilled)
Trigger.OnAllKilled(LabGuardsTeam, LabGuardsKilled)
collateralDamage = false
civilianTeam = { Civilian1, Civilian2 }
@@ -215,7 +230,7 @@ WorldLoaded = function()
SetUnitStances()
Trigger.AfterDelay(DateTime.Seconds(5), function() Actor.Create("camera", true, { Owner = player, Location = BaseCameraPoint.Location }) end)
Trigger.AfterDelay(DateTime.Seconds(5), function() Actor.Create("camera", true, { Owner = Greece, Location = BaseCameraPoint.Location }) end)
Camera.Position = InsertionLZ.CenterPosition
end