Skip to content

Ideas for improving the randomization of weapons. #437

@Drofseh

Description

@Drofseh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions