Page 1 of 1

Multiple triggers required for an event

Posted: Mon Jun 23, 2025 6:20 pm
by AAaronson
Heya Gang,

Here's the quick version: I have a scenario I'm working on where the Blue team doesn't know if the Red team has MANPADs. I would like to have an event that will withdraw all air assets after a second airframe is lost. I saw this thread:
https://forums.matrixgames.com/viewtopic.php?t=391832
however, it wasn't quite right. In my example, I don't have two specific aircraft that would be shot down, it's ANY aircraft. Is this something that can be done via lua? Maybe I just need to rethink this?

Any help would be appreciated.

-AAa

Re: Multiple triggers required for an event

Posted: Mon Jun 23, 2025 6:44 pm
by caelunshun
You can use ScenEdit_SetKeyValue to keep track of how many aircraft have been lost. Make an event that is triggered whenever an aircraft for your side is destroyed. Add a Lua script action:

local destroyed_count = tonumber(ScenEdit_GetKeyValue("aircraft_lost")) or 0
destroyed_count = destroyed_count + 1
if destroyed_count == 2 then
-- withdraw aircraft, e.g. ScenEdit_SetMission(side_name, mission_name, { isactive = false })
end
ScenEdit_SetKeyValue("aircraft_lost", tostring(destroyed_count))

Re: Multiple triggers required for an event

Posted: Mon Jun 23, 2025 7:48 pm
by AAaronson
Thank you for the quick reply! This'll be my first foray into lua, so, fingers crossed!

-AAa