Strike force + The Selector against a Stream transcoder outpost; 6-minute countdown shown via SetMissionText, master lacquer is cut (killed) if the timer beats you. Adds the lacquer prop (deliberately untargetable) and ScriptTriggers on all actor templates, without which Trigger.OnKilled throws at map load. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
58 lines
1.6 KiB
Lua
58 lines
1.6 KiB
Lua
-- 02: CRATE DIGGERS — timed raid, no base building.
|
|
|
|
TIME_LIMIT = DateTime.Minutes(6)
|
|
Deadline = nil
|
|
|
|
WorldLoaded = function()
|
|
Mrp = Player.GetPlayer("Player")
|
|
Stream = Player.GetPlayer("Enemy")
|
|
InitObjectives(Mrp)
|
|
|
|
KillTranscoder = Mrp.AddPrimaryObjective("destroy-the-transcoder")
|
|
KeepSelector = Mrp.AddPrimaryObjective("keep-the-selector-alive")
|
|
WipeOutpost = Mrp.AddSecondaryObjective("wipe-the-outpost")
|
|
|
|
Deadline = DateTime.GameTime + TIME_LIMIT
|
|
|
|
Trigger.OnKilled(Transcoder, function()
|
|
if not Mrp.IsObjectiveCompleted(KillTranscoder) then
|
|
Mrp.MarkCompletedObjective(KillTranscoder)
|
|
Mrp.MarkCompletedObjective(KeepSelector)
|
|
UserInterface.SetMissionText("")
|
|
end
|
|
end)
|
|
|
|
Trigger.OnKilled(TheSelector, function()
|
|
Mrp.MarkFailedObjective(KeepSelector)
|
|
end)
|
|
|
|
local outpost = { Transcoder, outpost1, outpost2, turret1, turret2 }
|
|
Trigger.OnAllKilled(outpost, function()
|
|
Mrp.MarkCompletedObjective(WipeOutpost)
|
|
end)
|
|
|
|
-- the deadline: the master gets cut and the raid was for nothing
|
|
Trigger.AfterDelay(TIME_LIMIT, function()
|
|
if not Mrp.IsObjectiveCompleted(KillTranscoder) then
|
|
if not MasterLacquer.IsDead then
|
|
MasterLacquer.Kill()
|
|
end
|
|
Media.PlaySpeechNotification(Mrp, "Lose")
|
|
Mrp.MarkFailedObjective(KillTranscoder)
|
|
end
|
|
end)
|
|
end
|
|
|
|
Tick = function()
|
|
if Deadline ~= nil and not Mrp.IsObjectiveCompleted(KillTranscoder)
|
|
and not Mrp.IsObjectiveFailed(KillTranscoder) then
|
|
local left = Deadline - DateTime.GameTime
|
|
if left < 0 then
|
|
left = 0
|
|
end
|
|
if left % 25 == 0 then
|
|
UserInterface.SetMissionText("Master cut in " .. Utils.FormatTime(left))
|
|
end
|
|
end
|
|
end
|