LUA request. Ive looked and cant figure out a better place to post this.
Posted: Thu Nov 19, 2026 10:51 pm
Hello,
I'm a scenario designer building a large, heavily scripted Puget Sound / Strait of Juan de Fuca scenario: about 1,350 units across nine sides, with dozens of Lua scripts running live civilian traffic, scoring, readiness and so on. It runs well in peacetime. My concern is what happens once the shooting starts.
THE PROBLEM
A lot of my scripting depends on knowing what weapons are in the air: who fired, at what, and how it ended. That feeds the scoring (rules of engagement and proportionality), story events, and the information shown to the player. At the moment the only way I've found to get it is to poll: scripts that run every few seconds and sweep the sides looking for new weapons. That costs more and more as the fight grows. The busiest moment of a battle is exactly when it costs the most.
And once a missile hits, it vanishes and leaves no trace. By the time a Unit Damaged or Unit Destroyed trigger fires, the weapon is gone. ScenEdit_UnitY() can't tell us which weapon it was, who launched it, or what it was aimed at. So even polling misses the end of the story: whether it hit, missed, or was shot down.
WHAT WOULD HELP (any one of these)
1. A "Weapon Launched" event trigger, with ScenEdit_UnitX() as the weapon and access to its launching unit, side and assigned target. One firing per launch would replace all of our polling.
2. A "Weapon Terminated" trigger, fired just before a weapon is removed, saying how it ended (impact, miss, intercepted, out of fuel), with the same fields still readable: weapon type, shooter, target, position and time.
3. Or, simplest of all, a short-lived record kept for each weapon after it's gone (readable by its GUID, or a side-level list such as VP_GetSide().weapons). For each weapon: type/DBID, launching unit and side, target, launch time, position, and a final result once it ends.
Option 1 plus either 2 or 3 would let designers drop the heavy polling scripts altogether, which should help everyone running busy scenarios, not just me.
If something like this already exists in a current build and I've missed it, I'd be very grateful for a pointer.
Thank you for a wonderful sim and for keeping the Lua API growing. The additions in recent builds (readytime, unassign and others) have already made a big difference to what I can build.
Best regards,
Marcus Miller
I'm a scenario designer building a large, heavily scripted Puget Sound / Strait of Juan de Fuca scenario: about 1,350 units across nine sides, with dozens of Lua scripts running live civilian traffic, scoring, readiness and so on. It runs well in peacetime. My concern is what happens once the shooting starts.
THE PROBLEM
A lot of my scripting depends on knowing what weapons are in the air: who fired, at what, and how it ended. That feeds the scoring (rules of engagement and proportionality), story events, and the information shown to the player. At the moment the only way I've found to get it is to poll: scripts that run every few seconds and sweep the sides looking for new weapons. That costs more and more as the fight grows. The busiest moment of a battle is exactly when it costs the most.
And once a missile hits, it vanishes and leaves no trace. By the time a Unit Damaged or Unit Destroyed trigger fires, the weapon is gone. ScenEdit_UnitY() can't tell us which weapon it was, who launched it, or what it was aimed at. So even polling misses the end of the story: whether it hit, missed, or was shot down.
WHAT WOULD HELP (any one of these)
1. A "Weapon Launched" event trigger, with ScenEdit_UnitX() as the weapon and access to its launching unit, side and assigned target. One firing per launch would replace all of our polling.
2. A "Weapon Terminated" trigger, fired just before a weapon is removed, saying how it ended (impact, miss, intercepted, out of fuel), with the same fields still readable: weapon type, shooter, target, position and time.
3. Or, simplest of all, a short-lived record kept for each weapon after it's gone (readable by its GUID, or a side-level list such as VP_GetSide().weapons). For each weapon: type/DBID, launching unit and side, target, launch time, position, and a final result once it ends.
Option 1 plus either 2 or 3 would let designers drop the heavy polling scripts altogether, which should help everyone running busy scenarios, not just me.
If something like this already exists in a current build and I've missed it, I'd be very grateful for a pointer.
Thank you for a wonderful sim and for keeping the Lua API growing. The additions in recent builds (readytime, unassign and others) have already made a big difference to what I can build.
Best regards,
Marcus Miller