Ideas for improving the randomization of weapons.
Issue:
If you have a loadout that randomizes weapon selection, there is no way to assign appropriate magazines unless all randomized weapons use the same magazine.
Example:
class rifleman : baseMan {
displayName = "Rifleman";
primaryWeapon[] = {
"CUP_arifle_AKM_Early",
"CUP_SKS"
};
magazines[] = {
LIST_2("CUP_HandGrenade_RGD5"),
LIST_2("ACE_HandFlare_White"),
"ACE_HandFlare_Yellow",
"ACE_HandFlare_Red",
"ACE_HandFlare_Green"
};
};
In this example the unit could be assigned an AKM, or an SKS, but magazines is not randomized, so either both AK and SKS mags must be added to the unit, magazines must be added outside the magazines[] array, or weapon randomization must not be used.
Solution I'd like:
Allow the magazines[] array to have subarrays for each weapon type, with the index of each subarray corresponding to the index of the weapon in the weapon array.
primaryWeapon select 0 would be assigned magazines select 0
It may also be advantageous to have specific magazine arrays for primary, seconday, and handgun weapons, in the same way as each weapon type has an attachment array.
The current magazines array could still be retained for general purpose use.
Example:
class rifleman : baseMan {
displayName = "Rifleman";
primaryWeapon[] = {
"CUP_arifle_AKM_Early",
"CUP_SKS"
};
primaryWeaponMagazines[] = {
[
LIST_5("CUP_30Rnd_762x39_AK47_bakelite_M")
],
[
LIST_10("CUP_10Rnd_762x39_SKS_M")
]
};
sidearmWeapon[] = {"CUP_hgun_Makarov","CUP_hgun_TT"};
sidearmWeaponMagazines[] = {
[
LIST_2("CUP_8Rnd_9x18_Makarov_M")
],
[
LIST_2("CUP_8Rnd_762x25_TT")
]
};
magazines[] = {
"CUP_75Rnd_TE4_LRT4_Green_Tracer_762x39_RPK_M",
LIST_2("CUP_HandGrenade_RGD5"),
LIST_2("ACE_HandFlare_White"),
"ACE_HandFlare_Yellow",
"ACE_HandFlare_Red",
"ACE_HandFlare_Green"
};
};
This subarray idea could also be used for the previously mentioned attachment arrays.
Example:
class rifleman : baseMan {
displayName = "Rifleman";
primaryWeapon[] = {
"CUP_arifle_M4A1_black",
"CUP_arifle_HK_M27"
};
scope[] = {
["cup_optic_compm4"],
["cup_optic_acog_ta01b_black"]
};
magazines[] = {
LIST_10("CUP_30Rnd_556x45_Stanag")
LIST_2("ACE_HandFlare_White"),
"ACE_HandFlare_Yellow",
"ACE_HandFlare_Red",
"ACE_HandFlare_Green"
};
};
Current workaround:
In a militia loadout I'm developing I'm randomizing between a large number of weapons, most of which cannot interchange magazines.
My current workaround is to use the code entry to get the primary weapon of the unit and then assign magazines based on which weapon was assigned.
Example:
class rifleman : baseMan {
displayName = "Rifleman";
primaryWeapon[] = {
LIST_6("CUP_arifle_AKM_Early"),
LIST_2("CUP_arifle_AKMS_Early"),
LIST_2("CUP_SKS")
};
magazines[] = {
LIST_2("CUP_HandGrenade_RGD5"),
LIST_2("ACE_HandFlare_White"),
"ACE_HandFlare_Yellow",
"ACE_HandFlare_Red",
"ACE_HandFlare_Green"
};
code = " \
private _primaryWeapon = primaryWeapon _this; \
private _vest = vestContainer _this; \
switch true do { \
case ( \
_primaryWeapon isEqualTo 'CUP_arifle_AKM_Early' \
|| {_primaryWeapon isEqualTo 'CUP_arifle_AKMS_Early'} \
) : {_vest addItemCargoGlobal ['CUP_30Rnd_762x39_AK47_bakelite_M', 5]}; \
case (_primaryWeapon isEqualTo 'CUP_SKS') : {_vest addItemCargoGlobal ['CUP_10Rnd_762x39_SKS_M', 9]}; \
case (_primaryWeapon isEqualTo 'CUP_arifle_AKMS_Early') : {_vest addItemCargoGlobal ['CUP_30Rnd_762x39_AK47_bakelite_M', 5]}; \
}; \
";
};
Unforunately this causes the magazines assigned via code not to show up in the TMF Vehicle Inventory system, because they aren't assigned through the traditional magzines array.
related issue #438
IMO this becomes a bit too much of a mess. For example, if you have multiple AKs and a single SKS, you'll need to specify the AK magazines multiple times. Besides that, it is a pretty niche usecase, mostly occurring with guerrillas, and for that the code field is sufficient.
What I tend to do in these kinds of loadouts is to distribute the weapons depending on ammo type to different roles. For example, AKs to riflemen, SKS to carabiniers, bolt actions to medics, etc. Which gives a sufficient level of "randomization".
Besides the problem surrounding magazines, you also run into issues concerning things like attachments, scopes, bipods, and muzzle attachments, which will also need additional logic.
the code field is sufficient
This is not really good solution as I address both here as a workaround and with more detail in #438.
AKs to riflemen, SKS to carabiniers, bolt actions to medics
I don't find this sufficient, as it is the opposite of randomization.
things like attachments, scopes...
Agreed, I address this in my comments, subarrays could be used for them as well, or if no subarray is present then current behavior happens.
need to specify the AK magazines multiple times
Multi entries are easly to do with a list macro, if a weapon is LIST_6 then it's associated subarrays would also be LIST_6 and everything lines up.
class rifleman : baseMan {
displayName = "Rifleman";
primaryWeapon[] = {
LIST_6("Rifle_A"),
"Rifle_B"
};
scope[] = {
LIST_6(["Optic_A"]),
["Optic_B"]
};
primaryWeaponMagazines[] = {
LIST_6([LIST_10("Rifle_Mag_A")]),
[LIST_10("Rifle_Mag_B")]
};
magazines[] = {
LIST_2("ACE_HandFlare_White"),
"ACE_HandFlare_Yellow",
"ACE_HandFlare_Red",
"ACE_HandFlare_Green"
};
};
Why not make a specific class for randomizing that executes code that selects another role.
class r_random {
code= "_this setVariable ['tmf_assignGear_role', selectRandom ['r_ak', 'r_m4', 'r_fal']]; _this call tmf_assignGear_fnc_assignGear";
}
Why not make a specific class for randomizing that executes code that selects another role.
This would make all those extra loadouts available in the #loadouts chat command menu which I'd prefer to avoid cluttering, so I'd still call this a workaround.
But it's a pretty good workaround so I'm going to use it. A flag to prevent loadouts from being visible to players like I mention in #438 would correct that.
Why not make a specific class for randomizing that executes code that selects another role.
class r_random { code= "_this setVariable ['tmf_assignGear_role', selectRandom ['r_ak', 'r_m4', 'r_fal']]; _this call tmf_assignGear_fnc_assignGear"; }
On further reflection I don't think is as good a workaround as I'd hoped, I would have to make a randomization sub-classes for each role class for each weapon, that's a lot of classes, and will seriously clutter the role selection in both eden and #loadout menus.
class rifleman_random {
code= "_this setVariable ['tmf_assignGear_role', selectRandom ['rifleman_AK', 'rifleman_M4', 'rifleman_FAL']]; _this call tmf_assignGear_fnc_assignGear";
};
class rifleman_AK {
};
class rifleman_M4 {
};
class rifleman_FAL {
};
class rifleman_AT_random {
code= "_this setVariable ['tmf_assignGear_role', selectRandom ['rifleman_AT_AK', 'rifleman_AT_M4', 'rifleman_AT_FAL']]; _this call tmf_assignGear_fnc_assignGear";
};
class rifleman_AT_AK {
};
class rifleman_AT_M4 {
};
class rifleman_AT_FAL {
};
class cls_random {
code= "_this setVariable ['tmf_assignGear_role', selectRandom ['cls_AK', 'cls_M4', 'cls_FAL']]; _this call tmf_assignGear_fnc_assignGear";
};
class cls_AK {
};
class cls_M4 {
};
class cls_FAL {
};
class ftl_random {
code= "_this setVariable ['tmf_assignGear_role', selectRandom ['ftl_AK', 'ftl_M4', 'ftl_FAL']]; _this call tmf_assignGear_fnc_assignGear";
};
class ftl_AK {
};
class ftl_M4 {
};
class ftl_FAL {
};
etc.