Page 1 of 2

New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Mon Oct 05, 2020 1:24 pm
by orca
Time: Dec 1, 2025 00:000:00
Scenario duration: 3 days

Sides:
Axis (China units) -->Defending Midway
Allies (US units)-->Attacking Midway

Scenario Designer Note: This is a fictional scenario inspired by the historic World War Two Battle of Midway. The scenario pits modern (and hypothetical) Chinese against US forces and hopefully results in an engaging and challenging scenario.

Background:

The Battle of Midway, fought between Allied and Axis fleets in the Pacific Ocean, began on December 1 2025. The Allies had not lost a naval battle in years, and had nearly destroyed the Axis fleet just six months earlier in a surprise attack on Pearl Harbor, Hawaii.

In the 6 months after the devastating strike on Pearl Harbor, the Allies have continued to advance throughout the Pacific. However the Axis has regrouped and is now a growing threat. The Allied and Axis fleets faced off in the Battle of the Coral Sea approximately 1 month ago during which carriers from both sides were sunk. This battle convinced the Allies of the need to destroy the remaining Axis fleet.

Midway Island is a fairly isolated atoll, so named because it is midway between North America and Asia in the North Pacific. Midway is the focus of Operation MI, the Allied plan to smash the Axis resistance to their dominance of the Indo-Pacific. A large Allied carrier strike force followed by an amphibious invasion force is heading towards Midway. The Allies correctly predict that the Axis would consider Midway vital and the invasion would draw out Axis forces, including the carriers. The Allies then plan to defeat the Axis fleet in a decisive battle.


Any feedback is welcomed. I've utilized a lot of LUA (and I'm not even close to a LUA expert) so if there are LUA errors let me know. I'm also particularly interested in others comments on force balance and axis strike and recon missions.

Thanks.

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Tue Oct 06, 2020 6:09 am
by Parel803
Just opened it, looks impressive. Also try to learn from you're lua in the special actions and events.
with regards

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Tue Oct 06, 2020 6:26 am
by Parel803
Me newby, but is in the event of points-allies: allies CG Tico destroyed, the class missing at the trigger?

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Tue Oct 06, 2020 12:20 pm
by orca
Update Operation MI- The Battle of Midway (2025) 1.01

-removed unused remnant triggers, actions, events from earlier version
-added load out special actions for all MQ-25A

thanks to post by Parel8003

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Tue Oct 06, 2020 12:52 pm
by orca
Update Operation MI- The Battle of Midway (2025) 1.02
-updated carrier magazines

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Tue Oct 06, 2020 3:23 pm
by orca
Update Operation MI- The Battle of Midway (2025) 1.03
-additional carrier magazine updates

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Wed Oct 07, 2020 10:25 am
by KnightHawk75
v1.03

Upload loadup:
Lua script execution error: [string "scenario start- update magazines"]:21: attempt to call a nil value (global 'ScenEdit_ClearMagazine'
)

Check LuaAction: "Scenario start-update magazines-axis" The CV Type 002 line should likely be ScenEdit_ClearAllMagazines.

Still looking around, but I like attempts at making it dynamic (some loadout choice pkg, hit X enemy could loses Y,dmg=% of lost comms,etc). Good stuff, suggest clearing the log before release too, easy to forget.

edit:
activate-recon UAV Ford - Event has no associated Action, this may be getting assigned\re-assigned later but having it empty initially causes a gui lock (can't close screen) without putting something in there (I put the action "activate-recon UAV Ford" in there).


"activate-strike ASBM alpha" event has two time triggers, one random, one specific. The specific one is set for 10-10-2025 ~two weeks before the scene (which the Scene Description says is dec 1,2025 btw not September).

edit2:
In the set-reference point script actions, while it may not ultimately matter (ie probably work as they are) the following vars should all be prefaced with "local", otherwise you're setting these globally each time and I'm pretty sure that's not what is intended.

Code: Select all

minVarlat=-15
 maxVarlat=15
 varlat=math.random(minVarlat, maxVarlat)/10
 
 minVarlon=-10 
 maxVarlon=10
 varlon=math.random(minVarlon, maxVarlon)/10

Course you could also just wrap all that into one global function at startup to reuse.

Code: Select all

 -- included in a startup script that runs before anything else--
 function gGetLatLonVariation(min1,max1,min2,max2)
  math.randomseed(os.clock() + os.time());
  local varlat = math.random(min1, max1)/10;
  local varlon = math.random(min2, max2)/10;
  return varlat,varlon;
 end
 --
 
 --replacement line in set reference point scripts. avoiding duplicate code.
 local varlat,varlon = gGetLatLonVariation(-15,15,-10,10)
 --print(varlat ..' , '.. varlon);

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Wed Oct 07, 2020 12:34 pm
by KnightHawk75
v1.03

SA: Sabotage attack on Hawaii OTH radar SA.
The action is marked repeatable I'm assuming that's maybe intentional (or just for dev-testing) since it's 50/50 on being successful for -100 points.

That said it will never actually be successful because...

Code: Select all

if a==1 then
 --success
 ScenEdit_SpecialMessage('Allies','Mission success: the Special Forces team has destroyed the Hawaii OTH radar')
 if myunit ~= nil then 
 ScenEdit_DeleteUnit({side="Axis", guid='2QQSQX-0HM2T33SUEIOB'})
 end
 
This will never run because myunit will always be nil (unless you have some global 'myunit var' which you shouldn't and don't), as you didn't assign it anything first (ie getunit() ), also the success message will be displayed even though it failed.

Corrected script:

Code: Select all

 local a=ScenEdit_GetScore("Allies") -- a corrected to local var.
 ScenEdit_SetScore('Allies',(a-100),'-100 Points')
 a=math.random(1,2)
 
 if a==1 then
 --success
   local myunit = ScenEdit_GetUnit({guid='2QQSQX-0HM2T33SUEIOB'}) --get the unit first into a local var.
   if myunit ~= nil then  -- now check it.
     ScenEdit_DeleteUnit({guid=myunit.guid}); --remove unit then message after it succeeds.
     ScenEdit_SpecialMessage('Allies','Mission success: the Special Forces team has destroyed the Hawaii OTH radar')
   end
 else then
   --failure
   ScenEdit_SpecialMessage('Allies','Mission failure: the Special Forces team have been killed and/or captured and were not able to destroy the Hawaii OTH radar');
 end
 
SA: Cyber attack on Axis satellite communications network:
minor: add 'local a;' as the top line, (or local a = .... in line 1) otherwise you're using\creating a global var.

Also consider using a global function created at startup to reduce all the duplicate code or even just a local function at the top of the SA.

Code: Select all

 --in global startup script--
 --preface function with local for one only available in the SA itself.
 
 function gSetUnitOutOfComms(unitguid,value) -- parameters string unitguid, bool value. 
  if ((unitguid ~='') and unitguid ~= nil) and ((value ~= nil) and type(value) == 'boolean') then
   local myunit = ScenEdit_GetUnit({guid = unitguid});
   if myunit ~= nil then 
     print('original value: ' .. tostring(myunit.outOfComms)); --check current value
     if myunit.outOfComms ~= value then --only flip it if it needs flipping.
       ScenEdit_SetUnit( {guid=myunit.guid, OUTOFCOMMS=value} ); --engage out-of-comms
       print('new value: ' .. tostring(myunit.outOfComms)); --check updated value
     end 
   end
  else
   print('gSetUnitOutOfComms() error missing guid parameter or boolean value');
  end
 end
 -- end of function
 
 --How to use in the SA and\or other scripts to call\use above function 
 gSetUnitOutOfComms('2QQSQX-UNITGUIDHERE1',true); --this way all those if then's just become 1 line per unit.
 gSetUnitOutOfComms('2QQSQX-UNITGUIDHERE2',true); --as you can see this saves a ton of lines.
 --etc..
 gSetUnitOutOfComms('2QQSQX-UNITGUIDHEREX',false); 
 

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Thu Oct 08, 2020 12:55 pm
by orca
Thanks KnightHawk for you input.

I made the LUA corrections you suggested. I haven't added the global functions yet as the current LUA for this while cumbersome does work. But your script is much better and I will change this at a later date.

As for the "activate-strike ASBM alpha", I intended there to be 2 triggers. My intention is that the either trigger would run the event. Is it not best to have 2 triggers for the same event? Regardless I separated them into 2 events. The time trigger DF-26 is supposed to be set later than the scenario time so that it doesn't run unless that trigger is changed. The trigger is changed to an appropriate time by the action SetTrigger-time trigger DF-26 which is triggered when an H-6J is launched (event=coordinate-strike ASBM alpha with H-6J strike). This resets the time trigger DF-26 to "coordinate" with the H-6J strike. This is my attempt to use LUA as a time trigger. I'm not sure it's working correctly with the DF-26.

But I also use this method of time trigger for the J-15 and J-16 strikes to change their loadouts back to AAW after the strike. I'm pretty sure it works for these.

I changed the scenario time to match the time in the scenario title & description.

The special actions are supposed to be one time only but I'm keeping them repeatable for now for testing purposes.

I cleared the logs. Is there a LUA script I can use to clear them every time at when the scenario is loaded?

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Thu Oct 08, 2020 12:56 pm
by orca
Update Operation MI- The Battle of Midway (2025) 1.04
-above described updates. Thanks to KnightHawk75

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Thu Oct 08, 2020 9:50 pm
by KnightHawk75
You can have two triggers on same event, it just seemed usual given the time used in one of them which is why I asked, but what you said makes sense since it's getting updated later. As for a function to I can use to clear the logs, don't think there is one, just via gui.

Thanks for the updates.

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Sat Oct 10, 2020 8:49 am
by Lukew
This scenario won't open Error You have (explicitly or implicitly) attempted to load a database that does not exist on the DB folder.

What database did you use to create the scenario and where do I locate said database? Thanks.

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Sat Oct 10, 2020 9:27 am
by BeirutDude
Also probably also created with the Build 11 BETA. [8D]

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Sat Oct 10, 2020 11:25 am
by orca
Yes, it’s with the newest beta build. I always update to these and didn’t think about the fact that it could be an issue. So I guess this scenario will only work for those who also update to the this beta.
ORIGINAL: BeirutDude

Also probably also created with the Build 11 BETA. [8D]

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Sat Oct 10, 2020 4:12 pm
by BeirutDude
Yes, it’s with the newest beta build. I always update to these and didn’t think about the fact that it could be an issue. So I guess this scenario will only work for those who also update to the this beta.

I didn't think about it either. I usually build them with the latest "Official" database and Build, but the one I'm working on right now I had to use the Beta due to an issue with Cargo that was resolved in the Beta. Thus I didn't think about it myself.

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Sun Oct 11, 2020 2:11 am
by KnightHawk75
I think beta 1147.9 and up have auth for db487.

I never think about it either cause I'm always trying out the new goodies and forget to swap it back (lower) when building testcases and stuff unless I'm conscious of it or think a db issue is involved.


RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Mon Oct 12, 2020 12:11 pm
by Lukew
Thankyou. Where exactly do I find the beta build?

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Mon Oct 12, 2020 2:35 pm
by KnightHawk75
On the main\default section of the CMO forums, the most recent beta built is usually\always pinned at the top in the first couple listed.

https://www.matrixgames.com/forums/tm.asp?m=4889956

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Mon Oct 12, 2020 2:36 pm
by orca
I believe this is the most recent beta.

https://www.matrixgames.com/forums/tm.asp?m=4889956

RE: New scenario for testing: Operation MI- The Battle of Midway (2025)

Posted: Thu Jan 28, 2021 3:34 pm
by morphin
I have the 2 following error in the exception.log:

1/28/2021 7:27:39 PM -- B1147.16 -- [string "fighter sweeps and recon-SetReferencePoints"]:8: <name> expected near '('
Exception: [string "fighter sweeps and recon-SetReferencePoints"]:8: <name> expected near '('
Stack Trace: at NLua.Lua.ThrowExceptionFromError(Int32 oldTop)
at NLua.Lua.DoString(String chunk, String chunkName)
at Command_Core.Lua.LuaSandBox.RunScript(String str, Boolean RunInteractively, String script)
at .&#136;.(Scenario , SimEvent )
Call Stack & Error details:
Error at 101316,

1/28/2021 7:27:39 PM -- B1147.16 -- [string "Scenario start-initial comms setttings"]:65: attempt to index a nil value (local 'myunit')
Exception: [string "Scenario start-initial comms setttings"]:65: attempt to index a nil value (local 'myunit')
Stack Trace: at NLua.Lua.ThrowExceptionFromError(Int32 oldTop)
at NLua.Lua.DoString(String chunk, String chunkName)
at Command_Core.Lua.LuaSandBox.RunScript(String str, Boolean RunInteractively, String script)
at .&#136;.(Scenario , SimEvent )
Call Stack & Error details:
Error at 101316,