Question on fn_selectRandomNested.sqf and vehicleSpawnClasses.sqf


"//Random Weapon List - Change this to what you want to spawn in cars.
vehicleWeapons ="

is an array whose items also contain an array.  I see the practicality of this for the many SMG_03 variants, you have as much likelihood of getting the Sting smg as any one of the SMG_03 variants.

My question is under "vehicleAddition =" and "vehicleAddition2 =" can you also uses arrays within that array like you can for vehicleWeapons?  I am trying to get a random backpack or a random vest to spawn as often as other items like "ToolKit"s.

Re: Question on fn_selectRandomNested.sqf and vehicleSpawnClasses.sqf

« Reply #1 posted: Jun 05, 2019, 09:43 AM »
I think it is this line of code in randomWeapon.sqf that breaks the funtionality of vehicle spawning when arrays are in vehicleAddition = []

_additionArray = _additionArray - [_additionOne];

It is meant to keep the same items from spawning in the same vehicle again, BUT!  When arrays are available to be selected under vehicleAddition =, the line of code above can't find _additionOne.  Because if fnRandomNested.sqf selects an array when randomly selecting from an array, it will choose an item at random from THAT array until it has something.  The line of code above can only 'see' one nested level deep.

I would be interested if anyone knows the proper terminology for this.  I'm just learning to code for Arma 3.

Edit: Or it was broken because I was trying to put smoke grenades in there also.  Those can't use the addItemCargoGlobal command, they use the addMagazineCargoGlobal command.