Randomly select Aircraft Loadout to load

Share your best strategies and tactics with other players by posting them here.

Moderator: MOD_Command

Post Reply
obrien979
Posts: 33
Joined: Fri May 18, 2018 2:10 pm
Location: Germany

Randomly select Aircraft Loadout to load

Post 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 :)
V/R,
Brandon "OB" OBrien
thewood1
Posts: 10101
Joined: Sun Nov 27, 2005 6:24 pm
Location: Boston

Re: Randomly select Aircraft Loadout to load

Post by thewood1 »

You might get a response if you put it in the lua section.

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

Return to “The War Room”