OP with issue ("fix" found below)
Hi @Larrow, I've been using your script for quite a bit with a scenario I'm working on but have now hit a wall:
When creating a composition with a unit that has customized loadout / inventory, spawning the composition triggers a "bad vehicle" error.
I've also found the post where you said you fixed a similar (or even the exact same) issue back in 2017, but it seems the fix has been broken now.
Update 2023-09-09 - Potential fix:
Sorry, please disregard the code below. It turns out that as soon as the _loadout array is shorter than usual, the bad vehicle type error will no longer occur. However, the loadout will also not be applied at all.
So I think I have found a "solution" (it's actually more of a workaround rn). Doing this will cause the script to set all slots correctly EXCEPT THE BINOCULARS. If that's irrelevant to you, here's what you can do:
1. Go to "LARs/spawnComp/functions/fn_getUnitInventory.sqf" and find this line:
private _nul = _loadout pushBack ( "binocular" call _fnc_getWeaponDetails );
2. Change it to this (comment it out):
//private _nul = _loadout pushBack ( "binocular" call _fnc_getWeaponDetails );
3. Save the changes and you're all set.
Just a heads-up, though: This isn't a perfect fix. As mentioned before, your units won't have their "Binoculars" slot set as in the collection, but if that's not a big deal for you, it should work. I haven't tested this change thoroughly, so I can't be certain if it might cause any other issues.