Operation Sunset: The Battle for Badme (1999)
Moderator: MOD_Command
- Correcaminos
- Posts: 121
- Joined: Sun Jun 01, 2025 7:25 am
Re: Final Version. Operation Sunset: The Battle for Badme (1999)
Damn, in the end it was much simpler than I thought... but better that way.
Apologies for missing the obvious . I was overcomplicating things...Thanks for pointing it out.
Apologies for missing the obvious . I was overcomplicating things...Thanks for pointing it out.
"Si vis pacem, para bellum."
Re: Final Version. Operation Sunset: The Battle for Badme (1999)
Even doing that, you still need to check it. In my experience, even if I tell it to use function X, it'll still do stupid shit. ChatGPT in particular loves to put the scen edit add unit function inside a custom add unit function that does the same thing. It's better then it used to be but it still requires a sanity check of everything it spits out.Nikel wrote: Thu Jan 22, 2026 7:34 am Was it that?
It is always a good idea when requesting lua code for CMO to an AI, to add:
But use only working lua code from this site
https://commandlua.github.io/
- Correcaminos
- Posts: 121
- Joined: Sun Jun 01, 2025 7:25 am
Re: Final Version. Operation Sunset: The Battle for Badme (1999)
It is clear that manual review is more than necessary. I actually tried testing via the console, but evidently not thoroughly enough to catch that specific crash.
I ll try avoiding Lua when possible, too. Sometimes we overcomplicate our lives with scripts when native triggers might work just fine.
Thanks for the help, guys.
I ll try avoiding Lua when possible, too. Sometimes we overcomplicate our lives with scripts when native triggers might work just fine.
Thanks for the help, guys.
"Si vis pacem, para bellum."
Re: Final Version. Operation Sunset: The Battle for Badme (1999)
I have tested just a few times and have no knowledge of lua.
Tried with Chatgpt, Grok and Perplexity, the last one seems the less prone to inventions, always giving them the link posted above.
But without knowledge I only could try running this code in the lua console, copy the errors to the AI and repeat.
Tried with Chatgpt, Grok and Perplexity, the last one seems the less prone to inventions, always giving them the link posted above.
But without knowledge I only could try running this code in the lua console, copy the errors to the AI and repeat.
- Correcaminos
- Posts: 121
- Joined: Sun Jun 01, 2025 7:25 am
Re: Final Version. Operation Sunset: The Battle for Badme (1999)
Just completed a full verification run on v1.37.
Happy to say that everything is working correctly and as I wished . The logic holds up, the triggers fire correctly upon reaching 700 points + Ship Kill, and the session ends smoothly with no stability issues

Mission accomplished. Thanks to everyone who helped polish the final details
I am posting the final working script below, in case it helps anyone else trying to combine a Score check with specific Unit kills
Happy to say that everything is working correctly and as I wished . The logic holds up, the triggers fire correctly upon reaching 700 points + Ship Kill, and the session ends smoothly with no stability issues

Mission accomplished. Thanks to everyone who helped polish the final details
SIDE: ETHIOPIA
===========================================================
LOSSES:
-------------------------------
2x 23mm ZU-23-2 [Type 89 APC]
3x BMP-1 [AT-3 Sagger B] IFV
1x MiG-23BN Flogger H
1x Su-25TK Frogfoot A
1x Su-27UB Flanker C
EXPENDITURES:
------------------
100x 23mm ZU-23-2 Burst [20 rnds]
1x 30mm Gsh-30-1 Burst [30 rnds]
7x 30mm Gsh-30-2 Burst [50 rnds]
111x 73mm 2A28 Grom HE
48x 82mm HE Mortar
4x AA-10 Alamo A [R-27R, MR TSARH]
12x AA-10 Alamo A [R-27R1, MR TSARH]
1x AA-10 Alamo B [R-27T, MR IR]
2x AA-10 Alamo C [R-27ER, LR TSARH]
4x AA-10 Alamo C [R-27ER1, LR TSARH]
2x AA-11 Archer [R-73]
14x AT-6 Spiral [9M114 Kokon]
24x FAB-500M-54 GPB
1x Generic Chaff Salvo [4x Cartridges]
3x Generic Flare Salvo [4x Cartridges, Single Spectral]
6x RBK-250-PTAB CB [30 x PTAB-2.5 Anti-Tank Bomblets]
40x S-13B 122mm Rocket [Penetrator]
149x S-5K 57mm Rocket
14x SA-3b Goa [5V27, V-601P]
SIDE: ERITREA
===========================================================
LOSSES:
-------------------------------
6x 130mm/52 M-46 M1954 Towed Howitzer
2x 23mm ZSU-23-4 Shilka
2x 23mm ZU-23-2 [Type 89 APC]
1x BM-21 Grad MLRS
15x BMP-1 [AT-3 Sagger B] IFV
1x Commercial Container Vessel - Small Feeder [750 TEU, 9,500t DWT]
2x GAZ-66-11
8x MB.339A
3x MiG-29 Fulcrum A
1x RK Osa II [Pr.205U]
6x SA-16 Gimlet [9K310 Igla-1] MANPADS
4x SA-6a Gainful [2P25] TEL
6x SA-7b Grail [9K32M Strela-2M] MANPADS
12x T-55 Main Battle Tank
2x Ural-4320
1x Vehicle (Straight Flush [1S91])
EXPENDITURES:
------------------
39x 100mm AP
40x 100mm HE
12x 100mm HEAT
40x 12.7mm/50 MG Burst [10 rnds]
600x 130mm/52 HE
2x 30mm DEFA 553 x 2 Burst [50 rnds]
202x 73mm 2A28 Grom HE
10x AA-10 Alamo A [R-27R, MR TSARH]
4x AA-11 Archer [R-73]
47x AK-230 30mm/65 Twin Burst [50 rnds]
6x Generic Chaff Salvo [5x Cartridges]
1x Generic Flare Salvo [3x Cartridges, Single Spectral]
3x SA-16 Gimlet [9M313]
SIDE: Civil
===========================================================
LOSSES:
-------------------------------
EXPENDITURES:
I am posting the final working script below, in case it helps anyone else trying to combine a Score check with specific Unit kills
-- Requirements: 700 Points + Ship Sunk
local score = ScenEdit_GetScore('ETHIOPIA')
local barcoHundido = ScenEdit_GetKeyValue('Obj_Barco_Hundido')
if score >= 700 and barcoHundido == 'YES' then
-- HTML Message (Truncated for brevity)
local msg = [[
<DIV style="...">
... VICTORY MESSAGE CONTENT ...
</DIV>
]]
ScenEdit_SpecialMessage('ETHIOPIA', msg)
ScenEdit_EndScenario()
end
"Si vis pacem, para bellum."
Re: Final Version. Operation Sunset: The Battle for Badme (1999)
v1.37 tested.
This time could not see the victory screen.
Those nasty MiGs nearly destroyed all my Flankers
Still is considered a major victory with 505 points.
The Grads destroyed one of the hunters-killers, one unit per site should be enough.
Land detachment near Bahir-Dar, still there.
And I still see this.
This time could not see the victory screen.
Those nasty MiGs nearly destroyed all my Flankers
Still is considered a major victory with 505 points.
The Grads destroyed one of the hunters-killers, one unit per site should be enough.
Land detachment near Bahir-Dar, still there.
And I still see this.
Exception: [string "CachedChunk"]:117: attempt to call a nil value (global 'ScenEdit_SetEventState')
Stack Trace: at NLua.Lua.ThrowExceptionFromError(Int32 oldTop)
at NLua.Lua.CallFunction(Object function, Object[] args, Type[] returnTypes)
at NLua.LuaFunction.Call(Object[] args)
at Adfs2QqMGUifo0Ac7CVE.qLd8ynxTUEn(Object , Object[] , Adfs2QqMGUifo0Ac7CVE )
at Command_Core.LuaUtility.DoString_Optimized(Lua lua, String chunk, String chunkName)
at Command_Core.Lua.LuaSandBox.RunScript(String str, Boolean RunInteractively, String script, String fullPath)
Exception: [string "CachedChunk"]:117: attempt to call a nil value (global 'ScenEdit_SetEventState')
Stack Trace: at NLua.Lua.ThrowExceptionFromError(Int32 oldTop)
at NLua.Lua.CallFunction(Object function, Object[] args, Type[] returnTypes)
at NLua.LuaFunction.Call(Object[] args)
at Adfs2QqMGUifo0Ac7CVE.qLd8ynxTUEn(Object , Object[] , Adfs2QqMGUifo0Ac7CVE )
at Command_Core.LuaUtility.DoString_Optimized(Lua lua, String chunk, String chunkName)
at Command_Core.Lua.LuaSandBox.RunScript(String str, Boolean RunInteractively, String script, String fullPath)
AS OF: 26-Feb-99 19:49:34
SIDE: ETHIOPIA
===========================================================
LOSSES:
-------------------------------
1x 82mm 2B14 Podnos
9x BMP-1 [AT-3 Sagger B] IFV
4x Su-27SK Flanker B
1x Su-27UB Flanker C
EXPENDITURES:
------------------
40x 12.7mm Yak-B Burst [100 rnds]
34x 23mm ZU-23-2 Burst [20 rnds]
140x 73mm 2A28 Grom HE
9x 82mm HE Mortar
240x 9M22U [Grad] 122mm Rocket
2x AA-10 Alamo A [R-27R, MR TSARH]
2x AA-10 Alamo A [R-27R1, MR TSARH]
4x AA-10 Alamo B [R-27T, MR IR]
4x AA-10 Alamo C [R-27ER, LR TSARH]
3x AA-10 Alamo C [R-27ER1, LR TSARH]
2x AA-11 Archer [R-73]
6x AT-3 Sagger B [9M14M Malyutka]
16x AT-6 Spiral [9M114 Kokon]
12x FAB-500M-54 GPB
2x Generic Chaff Salvo [4x Cartridges]
4x Generic Flare Salvo [4x Cartridges, Single Spectral]
194x S-5K 57mm Rocket
12x SA-3b Goa [5V27, V-601P]
SIDE: ERITREA
===========================================================
LOSSES:
-------------------------------
6x 130mm/52 M-46 M1954 Towed Howitzer
2x 23mm ZSU-23-4 Shilka
2x 23mm ZU-23-2 [Type 89 APC]
6x BM-21 Grad MLRS
15x BMP-1 [AT-3 Sagger B] IFV
1x Commercial Container Vessel - Small Feeder [750 TEU, 9,500t DWT]
5x GAZ-66-11
4x MB.339A
1x MiG-29 Fulcrum A
1x Radar (Long Track [P-40])
1x RK Osa II [Pr.205U]
6x SA-16 Gimlet [9K310 Igla-1] MANPADS
4x SA-6a Gainful [2P25] TEL
3x SA-7b Grail [9K32M Strela-2M] MANPADS
12x T-55 Main Battle Tank
4x Ural-4320
1x Vehicle (Straight Flush [1S91])
EXPENDITURES:
------------------
600x 130mm/52 HE
5x 30mm Gsh-30-1 Burst [30 rnds]
110x 73mm 2A28 Grom HE
11x AA-10 Alamo A [R-27R, MR TSARH]
4x AA-11 Archer [R-73]
40x AK-230 30mm/65 Twin Burst [50 rnds]
4x Generic Flare Salvo [3x Cartridges, Single Spectral]
1x SA-16 Gimlet [9M313]
14x SNEB 68mm Rocket
SIDE: Civil
===========================================================
LOSSES:
-------------------------------
EXPENDITURES:
------------------
- Correcaminos
- Posts: 121
- Joined: Sun Jun 01, 2025 7:25 am
Re: Final Version. Operation Sunset: The Battle for Badme (1999)
It was the Cargo drop lua! Modified, it wasn't working for me because I had to enter the area at a different height


Scoring Fixed I completely forgot to check this earlier, sorry

Removed most of the Grads. I left just one unit per site, which should be enough
Regarding the units near Bahir-Dar, I decided not to move them. As I mentioned, they are part of the Air Drop sequence and they don't interfere with the mission (they are not meant for hunting SA-9s). I could have hidden them or used a neutral side to avoid confusion, but I didn't want to overcomplicate the mission setup any further for now
V1.38
-- D. CLOSE EVENT
ScenEdit_SetEvent(eventName, {isActive=false})
print("LOG: Launch completed."


Scoring Fixed I completely forgot to check this earlier, sorry

Removed most of the Grads. I left just one unit per site, which should be enough
Regarding the units near Bahir-Dar, I decided not to move them. As I mentioned, they are part of the Air Drop sequence and they don't interfere with the mission (they are not meant for hunting SA-9s). I could have hidden them or used a neutral side to avoid confusion, but I didn't want to overcomplicate the mission setup any further for now
V1.38
"Si vis pacem, para bellum."
Re: Final Version. Operation Sunset: The Battle for Badme (1999)
Yes, I had a save just before the dropping and the lua history file with the errors is created when the first drop happens.
It is printed 2 times because there are 2 drops.
But it has no consequences, has it? The points are assigned and the teleporting of units is done.
The error is printed in the lua history file because of this line, as was indicated by kushan and blu3s.

It is printed 2 times because there are 2 drops.
But it has no consequences, has it? The points are assigned and the teleporting of units is done.
The error is printed in the lua history file because of this line, as was indicated by kushan and blu3s.
It is not related with the altitude, or perhaps I am not understanding what you meanScenEdit_SetEventState(nombreEvento, 'InActive')
Re: Final Version. Operation Sunset: The Battle for Badme (1999)
v1.38 Tested
Triumph with 705 points
This time the Air combat was completely different, and the Flankers destroyed 5 MiGs with 0 losses.
The drop event now appears only one time in the scoring log.
What appears more than one time is the victory message, if you continue the scenario.
I continued because in that moment I was still destroying all the Eritrean Forces with the Hinds, and the victory message appeared 2 more times. I think should only appear 1 time.
NLua errors gone. The only text that is printed now in the lua history file is this:
Perhaps you are happy with this results or want to mess more with this scenario?
The only suggestion I have, is perhaps to make the sinking of the cargo ship more difficult, the Osa II guns are not really very effective in air defense. MiGs CAP?
If the cargo is so important should be better defended.
Triumph with 705 points
This time the Air combat was completely different, and the Flankers destroyed 5 MiGs with 0 losses.
The drop event now appears only one time in the scoring log.
What appears more than one time is the victory message, if you continue the scenario.
I continued because in that moment I was still destroying all the Eritrean Forces with the Hinds, and the victory message appeared 2 more times. I think should only appear 1 time.
NLua errors gone. The only text that is printed now in the lua history file is this:
LOG: Lanzamiento finalizado.
Perhaps you are happy with this results or want to mess more with this scenario?
The only suggestion I have, is perhaps to make the sinking of the cargo ship more difficult, the Osa II guns are not really very effective in air defense. MiGs CAP?
If the cargo is so important should be better defended.
AS OF: 26-Feb-99 09:30:00
SIDE: ETHIOPIA
===========================================================
LOSSES:
-------------------------------
2x 23mm ZU-23-2 [Type 89 APC]
EXPENDITURES:
------------------
26x 12.7mm Yak-B Burst [100 rnds]
72x 23mm ZU-23-2 Burst [20 rnds]
105x 73mm 2A28 Grom HE
48x 82mm HE Mortar
2x AA-10 Alamo A [R-27R, MR TSARH]
3x AA-10 Alamo B [R-27T, MR IR]
3x AA-10 Alamo C [R-27ER, LR TSARH]
4x AA-10 Alamo C [R-27ER1, LR TSARH]
12x AT-6 Spiral [9M114 Kokon]
12x FAB-500M-54 GPB
87x S-5K 57mm Rocket
16x SA-3b Goa [5V27, V-601P]
1x SA-7a Grail [9M32]
SIDE: ERITREA
===========================================================
LOSSES:
-------------------------------
6x 130mm/52 M-46 M1954 Towed Howitzer
2x 23mm ZSU-23-4 Shilka
2x 23mm ZU-23-2 [Type 89 APC]
6x BM-21 Grad MLRS
15x BMP-1 [AT-3 Sagger B] IFV
1x Commercial Container Vessel - Small Feeder [750 TEU, 9,500t DWT]
2x GAZ-66-11
4x MB.339A
5x MiG-29 Fulcrum A
1x RK Osa II [Pr.205U]
12x T-55 Main Battle Tank
EXPENDITURES:
------------------
38x 100mm AP
600x 130mm/52 HE
8x AA-10 Alamo A [R-27R, MR TSARH]
11x AK-230 30mm/65 Twin Burst [50 rnds]
3x Generic Chaff Salvo [5x Cartridges]
SIDE: Civil
===========================================================
LOSSES:
-------------------------------
EXPENDITURES:
------------------
- Correcaminos
- Posts: 121
- Joined: Sun Jun 01, 2025 7:25 am
Re: Final Version. Operation Sunset: The Battle for Badme (1999)
As is often the case, the simplest solution for the Cargo Lua error was the right one. I still want to test one variation of that script for future missions, but for now, it works perfectly.
Regarding the Victory Message loop: That is an easy fix. I just need to add the 'famous' script of this long thread (SetEvent... isActive=false) at the very end. That way, once the victory check is passed, the event shuts down and won't bother the player again if they choose to 'Continue'.
Regarding the Ship: We could definitely ramp it up (random spawn points, heavy traffic, a MiG-21 CAP...), but I think I'll leave it as is. Historically, Eritrea had limited assets in that sector, and the premise is that Intelligence did their job locating the MV Dahlak. I like the current balance.
I think I'm ready to wrap this one up. I'm eager to start a new project in the Barents Sea—something purely Naval—where I plan to test loading Briefing images directly from local folders.
One last thing: I will be adding you to the scenario credits for the v1.39 final release. Your help with testing has been invaluable, as always
Regarding the Victory Message loop: That is an easy fix. I just need to add the 'famous' script of this long thread (SetEvent... isActive=false) at the very end. That way, once the victory check is passed, the event shuts down and won't bother the player again if they choose to 'Continue'.
Regarding the Ship: We could definitely ramp it up (random spawn points, heavy traffic, a MiG-21 CAP...), but I think I'll leave it as is. Historically, Eritrea had limited assets in that sector, and the premise is that Intelligence did their job locating the MV Dahlak. I like the current balance.
I think I'm ready to wrap this one up. I'm eager to start a new project in the Barents Sea—something purely Naval—where I plan to test loading Briefing images directly from local folders.
One last thing: I will be adding you to the scenario credits for the v1.39 final release. Your help with testing has been invaluable, as always
"Si vis pacem, para bellum."
Re: Final Version. Operation Sunset: The Battle for Badme (1999)
Great, thanks.
Waiting for the Barents Sea Menace
Waiting for the Barents Sea Menace
- Correcaminos
- Posts: 121
- Joined: Sun Jun 01, 2025 7:25 am
Re: Final Version. Operation Sunset: The Battle for Badme (1999)
UPDATE V1.39
Fixed Victory Event Loop
Added acknowledgment to Nikel for testing support
Fixed Victory Event Loop
Added acknowledgment to Nikel for testing support
"Si vis pacem, para bellum."