{"name":"Arma 3: Magazine Proxies","title":"Arma 3: Magazine Proxies","type":"topic","url":"https://community.bistudio.com/wiki/Arma_3:_Magazine_Proxies","revid":364522,"updated":"2024-05-16T20:46:23Z","aliases":["Arma 3 Magazine Proxies","Magazine Proxies"],"markdown":"Magazine Proxies, as name suggest, is a technology that allows moving weapon magazines to separate proxy & swap it dynamically by just swapping a different magazine. Magazine\nFollowing feature was introduced in Arma 3 v1.78 version of game.\n\n### Configuration\n\n#### P3D\n\nMagazines in all LODs (shadow & geometry too) need to be replaced with new proxy which is linked to cfgNonAIVehicles entry. In Arma 3 v1.80 patch following proxy was created for this purpose A3\\Data_f\\proxies\\weapon_slots\\MAGAZINESLOT.p3d\n\n> [!NOTE]\n> See Object Builder manual for some tips regarding handling of proxies.\n\n*MX magazine in separate p3d*\n\nFor testing purposes (especially when you are repositioning magazine) it is good to directly link in proxy to p3d containing your magazine so you can easily see it in buldozer\n\n#### Model Config\n\nMagazine proxies can be **animated** and **retextured**. At the moment, it supports following animation sources\n\n- reload\n- reloadMagazine\n- revolving\n- ammo\n- ammoRandom\n- isEmpty\n\nConfiguring of bones, animations & sections for texturing is same as with any other model.cfg p3d & more info about it can be found on Model Config page.\n\n> [!NOTE]\n> Example model.cfg code for bullet hiding for transparent magazines.\n\n```cpp\n// Macro for hiding bullets\n#define BULLET_HIDE(x,from,count) class Bullet##x\\\n{\\\n    type=hide;\\\n    source=revolving;\\\n    sourceAddress=\"mirror\";\\\n    selection=bullet##x;\\\n    minValue=-1.000000;\\\n    maxValue= 0.000000;\\\n    hideValue=((count+x-from-2)/count)+0.00001;\\\n};\n\nclass CfgSkeletons\n{\n    class Default\n    {\n        isDiscrete = 1;\n        skeletonInherit = \"\";\n        skeletonBones[] = {};\n    };\n    class magazine_transparent_skeleton : Default\n    {\n        skeletonInherit = \"\";\n        skeletonBones[] =\n        {\n            \"bullet030\",    \"\",\n            \"Bullet002\",    \"\",\n            \"Bullet003\",    \"\",\n            \"Bullet004\",    \"\",\n            \"bullet005\",    \"\",\n            \"bullet006\",    \"\",\n            \"bullet007\",    \"\",\n            \"bullet008\",    \"\",\n            \"bullet009\",    \"\",\n            \"bullet010\",    \"\",\n            \"bullet011\",    \"\",\n            \"bullet012\",    \"\",\n            \"bullet013\",    \"\",\n            \"bullet014\",    \"\",\n            \"bullet015\",    \"\",\n            \"bullet016\",    \"\",\n            \"bullet017\",    \"\"\n        };\n    };\n};\nclass CfgModels\n{\n    class Default\n    {\n        skeletonName    = \"\";\n        sectionsInherit    = \"\";\n        sections[]        = {};\n    };\n    class magazine_transparent : Default\n    {\n        skeletonName=\"magazine_transparent_skeleton\";\n        // Magazine proxies supports hidden selections\n        sections[] =\n        {\n            \"camo\"\n        };\n        class Animations\n        {\n            BULLET_HIDE(030,30,30)\n            BULLET_HIDE(029,30,30)\n            BULLET_HIDE(002,30,30)\n            BULLET_HIDE(003,30,30)\n            BULLET_HIDE(004,30,30)\n            BULLET_HIDE(005,30,30)\n            BULLET_HIDE(006,30,30)\n            BULLET_HIDE(007,30,30)\n            BULLET_HIDE(008,30,30)\n            BULLET_HIDE(009,30,30)\n            BULLET_HIDE(010,30,30)\n            BULLET_HIDE(011,30,30)\n            BULLET_HIDE(012,30,30)\n            BULLET_HIDE(013,30,30)\n            BULLET_HIDE(014,30,30)\n            BULLET_HIDE(015,30,30)\n            BULLET_HIDE(016,30,30)\n            BULLET_HIDE(017,30,30)\n        };\n    };\n};\n```\n\n#### CfgMagazines\n\nHeart of magazine proxy system lies in modelSpecial - a system originally designed in OFP for rifle mounted grenades. It was redesigned and now allows you to change to use magazine defined in modelSpecial as a proxy in weapon. In order to do so, you need to add following parameter - modelSpecialIsProxy = 1;\n\nIn addition to that, it is still possible to use reloadAction inside magazine config, which means you can have different reload animation depending on currently loaded magazine.\n\n```cpp\nclass CfgMagazines\n{\n    class RPG32_F;\n    class RPG7_F : RPG32_F\n    {\n        modelSpecial = \"linkToP3d\";\n        modelSpecialIsProxy = 1\n        hiddenSelections[] = {\"camo\"};\n        hiddenSelectionsTextures[] = {\"linkToTexture.paa\"};\n    };\n    class RPG7_YellowMagazine_F : RPG7_F\n    {\n        displayName = \"Go, go my yellow rocket!\";\n        reloadAction = \"ReloadRPG\"; // Switches reload action from RPG-7 front loading anim defined in cfgWeapons to RPG-32 back loading animation\n        hiddenSelectionsTextures[] = {\"#(argb,8,8,3)color(1,0.952941,0.0509804,1.0,CO)\"}; // procedural yellow rocket\n    };\n};\n```\n\n#### CfgWeapons\n\nMoment of switching between old & new model is controlled by already existing parameter - magazineReloadSwitchPhase. It controls now both restart of revolving source (pre magazine proxy behavior) & model switching. Default value is 0.5 which means magazines will get swapped in the middle of reload animation (same as reloadMagazine source). It's worth to mention that following parameter can be applied per muzzle.\n\n```cpp\nclass CfgWeapons\n{\n    class Launcher_Base_F;\n    class launch_RPG7_F : Launcher_Base_F\n    {\n        magazineReloadSwitchPhase = 0.3; // magazine will get replaced pretty early\n    };\n};\n```\n\n#### CfgNonAIVehicles\n\n> [!WARNING]\n> It is strongly suggested to use **\"\\A3\\Data_f\\proxies\\weapon_slots\\MAGAZINESLOT.p3d\"** as proxy but in case you want to create your own, here are the instructions.\n\nProxy that is used in p3d need to be listed in **CfgNonAIVehicles** class. There is following rule for creating those entries\n\n> [!NOTE]\n> class **Proxy** + **nameOfP3d**\n\nBear in mind that same as with i.e. missile proxies for dynamic loadouts, name need to be unique in order to have it working properly. Since for game only thing that matters is p3d name, location of this proxy doesn't need to be same across different models. For sake of simplicity it is advised to use just single proxy on all weapons.\n\n```cpp\nclass CfgNonAIVehicles\n{\n    class ProxyWeapon;\n    class ProxyMagazine : ProxyWeapon\n    {\n        model        = \"\";\n        simulation    = \"magazine\";\n    };\n};\n```\n\n### Examples\n\nExample proxies for AKM, MX, STANAG & RPG-7 magazines - https://drive.google.com/open?id=1hZvLu8rJqg6WSrNoOoy0tUctFTccFmJj\n\nE-Mag sample provided by da12thMonkey, model by Tigg - https://www.dropbox.com/s/am5ke5b02xr2jit/proxymag_example.7z?dl=0\n\n### Known issues\n\nCurrently known issues:\n\n- There is no magazine model visible if magazine doesn't have modelSpecial defined which might be quite problematic when it comes to community magazine interchangeability.\n- Loading magazine without modelSpecial & then loading one which have it defined will result in on screen assert and invisible rifle (magazine will be still visible though)\n- There is no way to manipulate model.cfg animation (i.e. M249 STANG & Box magazines)\n\n### See Also\n\n- Model Config","sections":[{"heading":null,"level":1,"markdown":"Magazine Proxies, as name suggest, is a technology that allows moving weapon magazines to separate proxy & swap it dynamically by just swapping a different magazine. Magazine\nFollowing feature was introduced in Arma 3 v1.78 version of game."},{"heading":"Configuration","level":3,"markdown":""},{"heading":"P3D","level":4,"markdown":"Magazines in all LODs (shadow & geometry too) need to be replaced with new proxy which is linked to cfgNonAIVehicles entry. In Arma 3 v1.80 patch following proxy was created for this purpose A3\\Data_f\\proxies\\weapon_slots\\MAGAZINESLOT.p3d\n\n> [!NOTE]\n> See Object Builder manual for some tips regarding handling of proxies.\n\n*MX magazine in separate p3d*\n\nFor testing purposes (especially when you are repositioning magazine) it is good to directly link in proxy to p3d containing your magazine so you can easily see it in buldozer"},{"heading":"Model Config","level":4,"markdown":"Magazine proxies can be **animated** and **retextured**. At the moment, it supports following animation sources\n\n- reload\n- reloadMagazine\n- revolving\n- ammo\n- ammoRandom\n- isEmpty\n\nConfiguring of bones, animations & sections for texturing is same as with any other model.cfg p3d & more info about it can be found on Model Config page.\n\n> [!NOTE]\n> Example model.cfg code for bullet hiding for transparent magazines.\n\n```cpp\n// Macro for hiding bullets\n#define BULLET_HIDE(x,from,count) class Bullet##x\\\n{\\\n    type=hide;\\\n    source=revolving;\\\n    sourceAddress=\"mirror\";\\\n    selection=bullet##x;\\\n    minValue=-1.000000;\\\n    maxValue= 0.000000;\\\n    hideValue=((count+x-from-2)/count)+0.00001;\\\n};\n\nclass CfgSkeletons\n{\n    class Default\n    {\n        isDiscrete = 1;\n        skeletonInherit = \"\";\n        skeletonBones[] = {};\n    };\n    class magazine_transparent_skeleton : Default\n    {\n        skeletonInherit = \"\";\n        skeletonBones[] =\n        {\n            \"bullet030\",    \"\",\n            \"Bullet002\",    \"\",\n            \"Bullet003\",    \"\",\n            \"Bullet004\",    \"\",\n            \"bullet005\",    \"\",\n            \"bullet006\",    \"\",\n            \"bullet007\",    \"\",\n            \"bullet008\",    \"\",\n            \"bullet009\",    \"\",\n            \"bullet010\",    \"\",\n            \"bullet011\",    \"\",\n            \"bullet012\",    \"\",\n            \"bullet013\",    \"\",\n            \"bullet014\",    \"\",\n            \"bullet015\",    \"\",\n            \"bullet016\",    \"\",\n            \"bullet017\",    \"\"\n        };\n    };\n};\nclass CfgModels\n{\n    class Default\n    {\n        skeletonName    = \"\";\n        sectionsInherit    = \"\";\n        sections[]        = {};\n    };\n    class magazine_transparent : Default\n    {\n        skeletonName=\"magazine_transparent_skeleton\";\n        // Magazine proxies supports hidden selections\n        sections[] =\n        {\n            \"camo\"\n        };\n        class Animations\n        {\n            BULLET_HIDE(030,30,30)\n            BULLET_HIDE(029,30,30)\n            BULLET_HIDE(002,30,30)\n            BULLET_HIDE(003,30,30)\n            BULLET_HIDE(004,30,30)\n            BULLET_HIDE(005,30,30)\n            BULLET_HIDE(006,30,30)\n            BULLET_HIDE(007,30,30)\n            BULLET_HIDE(008,30,30)\n            BULLET_HIDE(009,30,30)\n            BULLET_HIDE(010,30,30)\n            BULLET_HIDE(011,30,30)\n            BULLET_HIDE(012,30,30)\n            BULLET_HIDE(013,30,30)\n            BULLET_HIDE(014,30,30)\n            BULLET_HIDE(015,30,30)\n            BULLET_HIDE(016,30,30)\n            BULLET_HIDE(017,30,30)\n        };\n    };\n};\n```"},{"heading":"CfgMagazines","level":4,"markdown":"Heart of magazine proxy system lies in modelSpecial - a system originally designed in OFP for rifle mounted grenades. It was redesigned and now allows you to change to use magazine defined in modelSpecial as a proxy in weapon. In order to do so, you need to add following parameter - modelSpecialIsProxy = 1;\n\nIn addition to that, it is still possible to use reloadAction inside magazine config, which means you can have different reload animation depending on currently loaded magazine.\n\n```cpp\nclass CfgMagazines\n{\n    class RPG32_F;\n    class RPG7_F : RPG32_F\n    {\n        modelSpecial = \"linkToP3d\";\n        modelSpecialIsProxy = 1\n        hiddenSelections[] = {\"camo\"};\n        hiddenSelectionsTextures[] = {\"linkToTexture.paa\"};\n    };\n    class RPG7_YellowMagazine_F : RPG7_F\n    {\n        displayName = \"Go, go my yellow rocket!\";\n        reloadAction = \"ReloadRPG\"; // Switches reload action from RPG-7 front loading anim defined in cfgWeapons to RPG-32 back loading animation\n        hiddenSelectionsTextures[] = {\"#(argb,8,8,3)color(1,0.952941,0.0509804,1.0,CO)\"}; // procedural yellow rocket\n    };\n};\n```"},{"heading":"CfgWeapons","level":4,"markdown":"Moment of switching between old & new model is controlled by already existing parameter - magazineReloadSwitchPhase. It controls now both restart of revolving source (pre magazine proxy behavior) & model switching. Default value is 0.5 which means magazines will get swapped in the middle of reload animation (same as reloadMagazine source). It's worth to mention that following parameter can be applied per muzzle.\n\n```cpp\nclass CfgWeapons\n{\n    class Launcher_Base_F;\n    class launch_RPG7_F : Launcher_Base_F\n    {\n        magazineReloadSwitchPhase = 0.3; // magazine will get replaced pretty early\n    };\n};\n```"},{"heading":"CfgNonAIVehicles","level":4,"markdown":"> [!WARNING]\n> It is strongly suggested to use **\"\\A3\\Data_f\\proxies\\weapon_slots\\MAGAZINESLOT.p3d\"** as proxy but in case you want to create your own, here are the instructions.\n\nProxy that is used in p3d need to be listed in **CfgNonAIVehicles** class. There is following rule for creating those entries\n\n> [!NOTE]\n> class **Proxy** + **nameOfP3d**\n\nBear in mind that same as with i.e. missile proxies for dynamic loadouts, name need to be unique in order to have it working properly. Since for game only thing that matters is p3d name, location of this proxy doesn't need to be same across different models. For sake of simplicity it is advised to use just single proxy on all weapons.\n\n```cpp\nclass CfgNonAIVehicles\n{\n    class ProxyWeapon;\n    class ProxyMagazine : ProxyWeapon\n    {\n        model        = \"\";\n        simulation    = \"magazine\";\n    };\n};\n```"},{"heading":"Examples","level":3,"markdown":"Example proxies for AKM, MX, STANAG & RPG-7 magazines - https://drive.google.com/open?id=1hZvLu8rJqg6WSrNoOoy0tUctFTccFmJj\n\nE-Mag sample provided by da12thMonkey, model by Tigg - https://www.dropbox.com/s/am5ke5b02xr2jit/proxymag_example.7z?dl=0"},{"heading":"Known issues","level":3,"markdown":"Currently known issues:\n\n- There is no magazine model visible if magazine doesn't have modelSpecial defined which might be quite problematic when it comes to community magazine interchangeability.\n- Loading magazine without modelSpecial & then loading one which have it defined will result in on screen assert and invisible rifle (magazine will be still visible though)\n- There is no way to manipulate model.cfg animation (i.e. M249 STANG & Box magazines)"},{"heading":"See Also","level":3,"markdown":"- Model Config"}],"categories":["Arma 3: Weapon & Magazine Configuration"],"groups":["Configuration"]}