Page 1 of 1

Randomly select Aircraft Loadout to load

Posted: Mon Jun 20, 2022 11:17 am
by obrien979
Good Day to all the smart LUA Programmers and users, I am requesting some guidance and help on creating an LUA script that will randomly select a Loadout from an aircraft's designed loadouts and load it onto the aircraft. This will hopefully add some randomness to my scenario so that the users do not get too comfortable with certain planes using the exact same loadout each time the scenario runs.

Here's the plan, and please correct me if I am way off base. I want to either modify or add on to the following LUA commands where the bold and underline are. I would like to have the loadout randomly selected from the Aircraft's available loadouts and the quantity randomly selected between 5-15.

--Adding to Munitions Storage at base in bunkers--
ScenEdit_FillMagsForLoadout('{unit='That Base', loadoutid=45162, quantity=12}')
**This would be based on a single type of airctaft stationed at the base. If there is a way to use this for multiple different types of aircraft..even better**

--Adding Loadout to AIrcrtaft--
for i=1,6 do ScenEdit_AddUnit({type = 'Aircraft', name = 'HAMMER "..i , dbid = 1986, loadoutid = 2755, side = 'NATO', base = 'That Base', proficiency=4}) end
**Additional if there would be a way to use this on different ypes of airctraft stationed at the base, that would be awesome as well**

Any help would be greatly appreciated :)

Re: Randomly select Aircraft Loadout to load

Posted: Wed Jun 22, 2022 1:06 am
by thewood1
You might get a response if you put it in the lua section.

https://www.matrixgames.com/forums/view ... hp?f=10236