Merge pull request #6699 from obrakmann/fix6692_new_objective_notification
Added notifications for new objectives to scripted missions
This commit is contained in:
@@ -97,6 +97,16 @@ namespace OpenRA.Mods.RA.Scripting
|
||||
return mo.Objectives[id].Description;
|
||||
}
|
||||
|
||||
[ScriptActorPropertyActivity]
|
||||
[Desc("Returns the type of an objective.")]
|
||||
public string GetObjectiveType(int id)
|
||||
{
|
||||
if (id < 0 || id >= mo.Objectives.Count)
|
||||
throw new LuaException("Objective ID is out of range.");
|
||||
|
||||
return mo.Objectives[id].Type == ObjectiveType.Primary ? "Primary" : "Secondary";
|
||||
}
|
||||
|
||||
[ScriptActorPropertyActivity]
|
||||
[Desc("Returns true if this player has lost all units/actors that have the MustBeDestroyed trait.")]
|
||||
public bool HasNoRequiredUnits()
|
||||
|
||||
@@ -44,10 +44,9 @@ WorldLoaded = function()
|
||||
player = Player.GetPlayer("GDI")
|
||||
enemy = Player.GetPlayer("Nod")
|
||||
|
||||
nodObjective = enemy.AddPrimaryObjective("Destroy all GDI troops")
|
||||
gdiObjective1 = player.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
||||
gdiObjective2 = player.AddSecondaryObjective("Establish a beachhead")
|
||||
|
||||
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)
|
||||
@@ -69,6 +68,10 @@ WorldLoaded = function()
|
||||
end)
|
||||
end)
|
||||
|
||||
nodObjective = enemy.AddPrimaryObjective("Destroy all GDI troops")
|
||||
gdiObjective1 = player.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
||||
gdiObjective2 = player.AddSecondaryObjective("Establish a beachhead")
|
||||
|
||||
Trigger.OnIdle(Gunboat, function() SetGunboatPath(Gunboat) end)
|
||||
|
||||
SendNodPatrol()
|
||||
|
||||
@@ -33,10 +33,9 @@ WorldLoaded = function()
|
||||
player = Player.GetPlayer("GDI")
|
||||
enemy = Player.GetPlayer("Nod")
|
||||
|
||||
nodObjective = enemy.AddPrimaryObjective("Destroy all GDI troops")
|
||||
gdiObjective1 = player.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
||||
gdiObjective2 = player.AddSecondaryObjective("Capture the Tiberium Refinery")
|
||||
|
||||
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)
|
||||
@@ -58,6 +57,10 @@ WorldLoaded = function()
|
||||
end)
|
||||
end)
|
||||
|
||||
nodObjective = enemy.AddPrimaryObjective("Destroy all GDI troops")
|
||||
gdiObjective1 = player.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
||||
gdiObjective2 = player.AddSecondaryObjective("Capture the Tiberium Refinery")
|
||||
|
||||
Trigger.OnCapture(NodRefinery, function() player.MarkCompletedObjective(gdiObjective2) end)
|
||||
Trigger.OnKilled(NodRefinery, function() player.MarkFailedObjective(gdiObjective2) end)
|
||||
|
||||
|
||||
@@ -65,10 +65,9 @@ WorldLoaded = function()
|
||||
player = Player.GetPlayer("GDI")
|
||||
nod = Player.GetPlayer("Nod")
|
||||
|
||||
nodObjective = nod.AddPrimaryObjective("Destroy all GDI troops")
|
||||
gdiObjective1 = player.AddPrimaryObjective("Defend the town of Białystok")
|
||||
gdiObjective2 = player.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
||||
|
||||
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)
|
||||
@@ -94,6 +93,10 @@ WorldLoaded = function()
|
||||
end)
|
||||
end)
|
||||
|
||||
nodObjective = nod.AddPrimaryObjective("Destroy all GDI troops")
|
||||
gdiObjective1 = player.AddPrimaryObjective("Defend the town of Bialystok")
|
||||
gdiObjective2 = player.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
||||
|
||||
Trigger.OnExitedFootprint(TownAttackTrigger, function(a, id)
|
||||
if a.Owner == player then
|
||||
Trigger.RemoveFootprintTrigger(id)
|
||||
|
||||
@@ -21,11 +21,9 @@ WorldLoaded = function()
|
||||
gdi = Player.GetPlayer("GDI")
|
||||
villagers = Player.GetPlayer("Villagers")
|
||||
|
||||
NodObjective1 = nod.AddPrimaryObjective("Kill Nikoomba")
|
||||
NodObjective2 = nod.AddPrimaryObjective("Destroy the village")
|
||||
NodObjective3 = nod.AddSecondaryObjective("Destroy all GDI troops in the area")
|
||||
GDIObjective1 = gdi.AddPrimaryObjective("Eliminate all Nod forces")
|
||||
|
||||
Trigger.OnObjectiveAdded(nod, function(p, id)
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
|
||||
end)
|
||||
Trigger.OnObjectiveCompleted(nod, function(p, id)
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
|
||||
end)
|
||||
@@ -44,6 +42,11 @@ WorldLoaded = function()
|
||||
end)
|
||||
end)
|
||||
|
||||
NodObjective1 = nod.AddPrimaryObjective("Kill Nikoomba")
|
||||
NodObjective2 = nod.AddPrimaryObjective("Destroy the village")
|
||||
NodObjective3 = nod.AddSecondaryObjective("Destroy all GDI troops in the area")
|
||||
GDIObjective1 = gdi.AddPrimaryObjective("Eliminate all Nod forces")
|
||||
|
||||
Trigger.OnKilled(Nikoomba, function()
|
||||
nod.MarkCompletedObjective(NodObjective1)
|
||||
Trigger.AfterDelay(Utils.Seconds(1), function()
|
||||
|
||||
@@ -19,15 +19,9 @@ WorldLoaded = function()
|
||||
player = Player.GetPlayer("Nod")
|
||||
enemy = Player.GetPlayer("GDI")
|
||||
|
||||
gdiObjective = enemy.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
||||
nodObjective1 = player.AddPrimaryObjective("Capture the prison")
|
||||
nodObjective2 = player.AddSecondaryObjective("Destroy all GDI forces")
|
||||
|
||||
InsertNodUnits()
|
||||
Trigger.AfterDelay(Utils.Seconds(20), function() SendAttackWave(FirstAttackWave, AttackWaveSpawnA.Location) end)
|
||||
Trigger.AfterDelay(Utils.Seconds(50), function() SendAttackWave(SecondThirdAttackWave, AttackWaveSpawnB.Location) end)
|
||||
Trigger.AfterDelay(Utils.Seconds(100), function() SendAttackWave(SecondThirdAttackWave, AttackWaveSpawnC.Location) end)
|
||||
|
||||
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)
|
||||
@@ -35,16 +29,6 @@ WorldLoaded = function()
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
|
||||
end)
|
||||
|
||||
Trigger.OnCapture(TechCenter, function()
|
||||
Trigger.AfterDelay(Utils.Seconds(2), function()
|
||||
player.MarkCompletedObjective(nodObjective1)
|
||||
end)
|
||||
end)
|
||||
|
||||
Trigger.OnKilled(TechCenter, function()
|
||||
player.MarkFailedObjective(nodObjective1)
|
||||
end)
|
||||
|
||||
Trigger.OnPlayerWon(player, function()
|
||||
Media.PlaySpeechNotification(player, "Win")
|
||||
Trigger.AfterDelay(Utils.Seconds(1), function()
|
||||
@@ -59,6 +43,25 @@ WorldLoaded = function()
|
||||
end)
|
||||
end)
|
||||
|
||||
gdiObjective = enemy.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
||||
nodObjective1 = player.AddPrimaryObjective("Capture the prison")
|
||||
nodObjective2 = player.AddSecondaryObjective("Destroy all GDI forces")
|
||||
|
||||
Trigger.OnCapture(TechCenter, function()
|
||||
Trigger.AfterDelay(Utils.Seconds(2), function()
|
||||
player.MarkCompletedObjective(nodObjective1)
|
||||
end)
|
||||
end)
|
||||
|
||||
Trigger.OnKilled(TechCenter, function()
|
||||
player.MarkFailedObjective(nodObjective1)
|
||||
end)
|
||||
|
||||
InsertNodUnits()
|
||||
Trigger.AfterDelay(Utils.Seconds(20), function() SendAttackWave(FirstAttackWave, AttackWaveSpawnA.Location) end)
|
||||
Trigger.AfterDelay(Utils.Seconds(50), function() SendAttackWave(SecondThirdAttackWave, AttackWaveSpawnB.Location) end)
|
||||
Trigger.AfterDelay(Utils.Seconds(100), function() SendAttackWave(SecondThirdAttackWave, AttackWaveSpawnC.Location) end)
|
||||
|
||||
Media.PlayMovieFullscreen("nod3.vqa")
|
||||
end
|
||||
|
||||
|
||||
@@ -35,11 +35,9 @@ WorldLoaded = function()
|
||||
player = Player.GetPlayer("Nod")
|
||||
enemy = Player.GetPlayer("GDI")
|
||||
|
||||
gdiObjective = enemy.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
||||
nodObjective1 = player.AddPrimaryObjective("Capture the prison")
|
||||
nodObjective2 = player.AddSecondaryObjective("Destroy all GDI forces")
|
||||
|
||||
InsertNodUnits()
|
||||
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)
|
||||
@@ -47,17 +45,6 @@ WorldLoaded = function()
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
|
||||
end)
|
||||
|
||||
Trigger.AfterDelay(Utils.Seconds(40), function() SendAttackWave(FirstAttackWaveUnits, FirstAttackWave) end)
|
||||
Trigger.AfterDelay(Utils.Seconds(80), function() SendAttackWave(SecondAttackWaveUnits, SecondAttackWave) end)
|
||||
Trigger.AfterDelay(Utils.Seconds(140), function() SendAttackWave(ThirdAttackWaveUnits, FirstAttackWave) end)
|
||||
|
||||
Trigger.OnKilled(TechCenter, function() player.MarkFailedObjective(nodObjective1) end)
|
||||
Trigger.OnCapture(TechCenter, function()
|
||||
Trigger.AfterDelay(Utils.Seconds(2), function()
|
||||
player.MarkCompletedObjective(nodObjective1)
|
||||
end)
|
||||
end)
|
||||
|
||||
Trigger.OnPlayerWon(player, function()
|
||||
Media.PlaySpeechNotification(player, "Win")
|
||||
Trigger.AfterDelay(Utils.Seconds(1), function()
|
||||
@@ -72,6 +59,22 @@ WorldLoaded = function()
|
||||
end)
|
||||
end)
|
||||
|
||||
gdiObjective = enemy.AddPrimaryObjective("Eliminate all Nod forces in the area")
|
||||
nodObjective1 = player.AddPrimaryObjective("Capture the prison")
|
||||
nodObjective2 = player.AddSecondaryObjective("Destroy all GDI forces")
|
||||
|
||||
Trigger.OnKilled(TechCenter, function() player.MarkFailedObjective(nodObjective1) end)
|
||||
Trigger.OnCapture(TechCenter, function()
|
||||
Trigger.AfterDelay(Utils.Seconds(2), function()
|
||||
player.MarkCompletedObjective(nodObjective1)
|
||||
end)
|
||||
end)
|
||||
|
||||
InsertNodUnits()
|
||||
Trigger.AfterDelay(Utils.Seconds(40), function() SendAttackWave(FirstAttackWaveUnits, FirstAttackWave) end)
|
||||
Trigger.AfterDelay(Utils.Seconds(80), function() SendAttackWave(SecondAttackWaveUnits, SecondAttackWave) end)
|
||||
Trigger.AfterDelay(Utils.Seconds(140), function() SendAttackWave(ThirdAttackWaveUnits, FirstAttackWave) end)
|
||||
|
||||
Media.PlayMovieFullscreen("nod3.vqa")
|
||||
end
|
||||
|
||||
|
||||
@@ -162,12 +162,9 @@ WorldLoaded = function()
|
||||
england = Player.GetPlayer("England")
|
||||
ussr = Player.GetPlayer("USSR")
|
||||
|
||||
FindEinsteinObjective = player.AddPrimaryObjective("Find Einstein.")
|
||||
SurviveObjective = player.AddPrimaryObjective("Tanya and Einstein must survive.")
|
||||
england.AddPrimaryObjective("Destroy the soviet base after a successful rescue.")
|
||||
CivilProtectionObjective = player.AddSecondaryObjective("Protect all civilians.")
|
||||
DefendObjective = ussr.AddPrimaryObjective("Kill Tanya and keep Einstein hostage.")
|
||||
|
||||
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)
|
||||
@@ -178,6 +175,12 @@ WorldLoaded = function()
|
||||
Trigger.OnPlayerLost(player, MissionFailed)
|
||||
Trigger.OnPlayerWon(player, MissionAccomplished)
|
||||
|
||||
FindEinsteinObjective = player.AddPrimaryObjective("Find Einstein.")
|
||||
SurviveObjective = player.AddPrimaryObjective("Tanya and Einstein must survive.")
|
||||
england.AddPrimaryObjective("Destroy the soviet base after a successful rescue.")
|
||||
CivilProtectionObjective = player.AddSecondaryObjective("Protect all civilians.")
|
||||
DefendObjective = ussr.AddPrimaryObjective("Kill Tanya and keep Einstein hostage.")
|
||||
|
||||
Trigger.OnKilled(Lab, LabDestroyed)
|
||||
Trigger.OnKilled(OilPump, OilPumpDestroyed)
|
||||
|
||||
|
||||
@@ -97,6 +97,18 @@ WorldLoaded = function()
|
||||
ussr = Player.GetPlayer("USSR")
|
||||
ukraine = Player.GetPlayer("Ukraine")
|
||||
|
||||
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)
|
||||
Trigger.OnPlayerLost(player, MissionFailed)
|
||||
Trigger.OnPlayerWon(player, MissionAccomplished)
|
||||
|
||||
ConquestObjective = player.AddPrimaryObjective("Secure the area.")
|
||||
ussr.AddPrimaryObjective("Defend your base.")
|
||||
ukraine.AddPrimaryObjective("Destroy the convoy.")
|
||||
@@ -109,16 +121,6 @@ WorldLoaded = function()
|
||||
|
||||
Trigger.AfterDelay(Utils.Minutes(10), SendTrucks)
|
||||
|
||||
Trigger.OnPlayerLost(player, MissionFailed)
|
||||
Trigger.OnPlayerWon(player, MissionAccomplished)
|
||||
|
||||
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)
|
||||
|
||||
Camera.Position = ReinforcementsEntryPoint.CenterPosition
|
||||
|
||||
Media.PlayMovieFullscreen("ally2.vqa", function() Media.PlayMovieFullscreen("mcv.vqa") end)
|
||||
@@ -129,4 +131,4 @@ WorldLoaded = function()
|
||||
ConvoyTimer(Utils.Minutes(7), "WarningThreeMinutesRemaining")
|
||||
ConvoyTimer(Utils.Minutes(8), "WarningTwoMinutesRemaining")
|
||||
ConvoyTimer(Utils.Minutes(9), "WarningOneMinuteRemaining")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user