Magazine Proxies – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "Category:Arma 3: Editing {{Cfg ref|abc}} ==Overview== Magazine Proxies, as name suggest, is a technology that allows moving weapon magazines to seperate proxy & swap it...")
 
m (Text replacement - " ( *class [a-zA-Z0-9_]+): *([a-zA-Z0-9_]+ *) " to " $1 : $2 ")
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Arma 3: Editing]]
{{TOC|side}}
{{Cfg ref|abc}}
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
Following feature was introduced in {{GVI|arma3|1.78}} version of game.




==Overview==
== Configuration ==


Magazine Proxies, as name suggest, is a technology that allows moving weapon magazines to seperate proxy & swap it dynamically by just swapping a different magazine. Magazine
=== P3D ===
Following feature was introduced in 1.78 version of game.


=Configuration=
Magazines in all LODs (shadow & geometry too) need to be replaced with new proxy which is linked to cfgNonAIVehicles entry. In {{GVI|arma3|1.80}} patch following proxy was created for this purpose A3\Data_f\proxies\weapon_slots\MAGAZINESLOT.p3d
==P3D==
Magazines in all LODs (shadow & geometry too) need to be replaced with new proxy which is linked to cfgNonAIVehicles entry. In 1.80 patch following proxy was created for this purpose A3\Data_f\proxies\weapon_slots\MAGAZINESLOT.p3d


[[Image:magazineProxies_MX_profile.png|800px]]
{{Feature | Informative |See [[Oxygen_2_-_Manual#Proxy_objects|Object Builder manual]] for some tips regarding handling of proxies.}}
 
[[File:magazineProxies_MX_profile.png|800px]]


''MX magazine in separate p3d''
''MX magazine in separate p3d''


[[Image:magazineProxies_MX_magazine.png|800px]]
[[File:magazineProxies_MX_magazine.png|800px]]
 
For 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


For testing purposes (especially when you are repositioning magazine) it's good to directly link in proxy to p3d containing your magazine so you can easily see it in buldozer
=== Model Config ===


==Model Config==
Magazine proxies can be '''animated''' and '''retextured'''. At the moment, it supports following animation sources
Magazine proxies can be '''animated''' and '''retextured'''. At the moment, it supports following animation sources


Line 32: Line 33:
Configuring 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.
Configuring 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.


{{Informative |heading=Example|Example model.cfg code for bullet hiding for transparent magazines.}}
{{Feature | Informative | Example model.cfg code for bullet hiding for transparent magazines.}}


<syntaxhighlight lang="c">
<syntaxhighlight lang="cpp">
// Macro for hiding bullets
// Macro for hiding bullets
#define BULLET_HIDE(x,from,count) class Bullet##x\
#define BULLET_HIDE(x,from,count) class Bullet##x\
            {\
{\
                type=hide;\
type=hide;\
                source=revolving;\
source=revolving;\
                sourceAddress="mirror";\
sourceAddress="mirror";\
                selection=bullet##x;\
selection=bullet##x;\
                minValue=-1.000000;\
minValue=-1.000000;\
                maxValue= 0.000000;\
maxValue= 0.000000;\
                hideValue=((count+x-from-2)/count)+0.00001;\
hideValue=((count+x-from-2)/count)+0.00001;\
            };
};


class CfgSkeletons
class CfgSkeletons
{
{
    class Default
class Default
    {
{
        isDiscrete = 1;
isDiscrete = 1;
        skeletonInherit = "";
skeletonInherit = "";
        skeletonBones[] = {};
skeletonBones[] = {};
    };
};
    class magazine_transparent_skeleton: Default
class magazine_transparent_skeleton : Default
    {
{
        skeletonInherit = "";
skeletonInherit = "";
        skeletonBones[] =  
skeletonBones[] =  
        {
{
            "bullet030",   "",
"bullet030", "",
            "Bullet002",   "",
"Bullet002", "",
            "Bullet003",   "",
"Bullet003", "",
            "Bullet004",   "",
"Bullet004", "",
            "bullet005",   "",
"bullet005", "",
            "bullet006",   "",
"bullet006", "",
            "bullet007",   "",
"bullet007", "",
            "bullet008",   "",
"bullet008", "",
            "bullet009",   "",
"bullet009", "",
            "bullet010",   "",
"bullet010", "",
            "bullet011",   "",
"bullet011", "",
            "bullet012",   "",
"bullet012", "",
            "bullet013",   "",
"bullet013", "",
            "bullet014",   "",
"bullet014", "",
            "bullet015",   "",
"bullet015", "",
            "bullet016",   "",
"bullet016", "",
            "bullet017",   ""
"bullet017", ""
        };
};
    };
};
};
};
class CfgModels
class CfgModels
{
{
    class Default
class Default
    {
{
        skeletonName   = "";
skeletonName = "";
        sectionsInherit = "";
sectionsInherit = "";
        sections[]     = {};
sections[] = {};
    };
};
    class magazine_transparent: Default  
class magazine_transparent : Default  
    {
{
        skeletonName="magazine_transparent_skeleton";
skeletonName="magazine_transparent_skeleton";
        // Magazine proxies supports hidden selections
// Magazine proxies supports hidden selections
        sections[]     =
sections[] =
        {
{
            "camo"
"camo"
        };
};
        class Animations
class Animations
        {
{
            BULLET_HIDE(030,30,30)
BULLET_HIDE(030,30,30)
            BULLET_HIDE(029,30,30)
BULLET_HIDE(029,30,30)
            BULLET_HIDE(002,30,30)
BULLET_HIDE(002,30,30)
            BULLET_HIDE(003,30,30)
BULLET_HIDE(003,30,30)
            BULLET_HIDE(004,30,30)
BULLET_HIDE(004,30,30)
            BULLET_HIDE(005,30,30)
BULLET_HIDE(005,30,30)
            BULLET_HIDE(006,30,30)
BULLET_HIDE(006,30,30)
            BULLET_HIDE(007,30,30)
BULLET_HIDE(007,30,30)
            BULLET_HIDE(008,30,30)
BULLET_HIDE(008,30,30)
            BULLET_HIDE(009,30,30)
BULLET_HIDE(009,30,30)
            BULLET_HIDE(010,30,30)
BULLET_HIDE(010,30,30)
            BULLET_HIDE(011,30,30)
BULLET_HIDE(011,30,30)
            BULLET_HIDE(012,30,30)
BULLET_HIDE(012,30,30)
            BULLET_HIDE(013,30,30)
BULLET_HIDE(013,30,30)
            BULLET_HIDE(014,30,30)
BULLET_HIDE(014,30,30)
            BULLET_HIDE(015,30,30)
BULLET_HIDE(015,30,30)
            BULLET_HIDE(016,30,30)
BULLET_HIDE(016,30,30)
            BULLET_HIDE(017,30,30)
BULLET_HIDE(017,30,30)
        };
};
    };
};
};
};
</syntaxhighlight>
</syntaxhighlight>
==CfgMagazines==
 
=== CfgMagazines ===


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;
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;


In addition to that, it's still possible to use reloadAction inside magazine config, which means you can have different reload animation depending on currently loaded magazine.
In 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.


<syntaxhighlight lang="c">
<syntaxhighlight lang="cpp">
class CfgMagazines
class CfgMagazines
{
{
class RPG32_F;
class RPG32_F;
class RPG7_F: RPG32_F
class RPG7_F : RPG32_F
{
{
modelSpecial = "linkToP3d";
modelSpecial = "linkToP3d";
Line 137: Line 139:
hiddenSelectionsTextures[] = {"linkToTexture.paa"};
hiddenSelectionsTextures[] = {"linkToTexture.paa"};
};
};
class RPG7_YellowMagazine_F: RPG7_F
class RPG7_YellowMagazine_F : RPG7_F
{
{
displayName = "Go, go my yellow rocket!";
displayName = "Go, go my yellow rocket!";
        reloadAction = "ReloadRPG"; // Switches reload action from RPG-7 front loading anim defined in cfgWeapons to RPG-32 back loading animation
reloadAction = "ReloadRPG"; // Switches reload action from RPG-7 front loading anim defined in cfgWeapons to RPG-32 back loading animation
hiddenSelectionsTextures[] = {"#(argb,8,8,3)color(1,0.952941,0.0509804,1.0,CO)"}; // procedural yellow rocket
hiddenSelectionsTextures[] = {"#(argb,8,8,3)color(1,0.952941,0.0509804,1.0,CO)"}; // procedural yellow rocket
};
};
Line 146: Line 148:
</syntaxhighlight>
</syntaxhighlight>


==CfgWeapons==
=== CfgWeapons ===
 
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.
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.
<syntaxhighlight lang="c">
<syntaxhighlight lang="cpp">
class CfgWeapons
class CfgWeapons
{
{
    class Launcher_Base_F;
class Launcher_Base_F;
    class launch_RPG7_F: Launcher_Base_F
class launch_RPG7_F : Launcher_Base_F
    {
{
magazineReloadSwitchPhase = 0.3; // magazine will get replaced pretty early
magazineReloadSwitchPhase = 0.3; // magazine will get replaced pretty early
};
};
Line 159: Line 162:


</syntaxhighlight>
</syntaxhighlight>
==CfgNonAIVehicles==


{{Warning |heading=Example|NOTE: It's 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.}}
=== CfgNonAIVehicles ===
 
{{Feature | Warning | 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.}}




Proxy that is used in p3d need to be listed in '''CfgNonAIVehicles''' class. There is following rule for creating those entries
Proxy that is used in p3d need to be listed in '''CfgNonAIVehicles''' class. There is following rule for creating those entries


{{Informative |heading=Example|class '''Proxy'''+'''nameOfP3d'''}}
{{Feature | Informative | class '''Proxy''' + '''nameOfP3d'''}}




Bear 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's advised to use just single proxy on all weapons.
Bear 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.


<syntaxhighlight lang="c">
<syntaxhighlight lang="cpp">
class CfgNonAIVehicles
class CfgNonAIVehicles
{
{
    class ProxyWeapon;
class ProxyWeapon;
    class ProxyMagazine: ProxyWeapon
class ProxyMagazine : ProxyWeapon
    {
{
        model       = "";
model = "";
        simulation   = "magazine";
simulation = "magazine";
    };
};
};
};
</syntaxhighlight>
</syntaxhighlight>


=Examples=


==config.cpp==
== Examples ==
 
Example proxies for AKM, MX, STANAG & RPG-7 magazines - https://drive.google.com/open?id=1hZvLu8rJqg6WSrNoOoy0tUctFTccFmJj
 
E-Mag sample provided by da12thMonkey, model by Tigg - https://www.dropbox.com/s/am5ke5b02xr2jit/proxymag_example.7z?dl=0


==Model config==
<syntaxhighlight lang="c">
</syntaxhighlight>


=Known issues=
== Known issues ==


Currently known issues:
Currently known issues:
Line 197: Line 201:
* 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)
* 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)
* There is no way to manipulate model.cfg animation (i.e. M249 STANG & Box magazines)
* There is no way to manipulate model.cfg animation (i.e. M249 STANG & Box magazines)
= Related =
 
 
== See Also ==
 
* [[Model Config]]
* [[Model Config]]
{{GameCategory|arma3|Weapon & Magazine Configuration}}

Latest revision as of 11:58, 6 December 2023

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 Following feature was introduced in Arma 3 logo black.png1.78 version of game.


Configuration

P3D

Magazines in all LODs (shadow & geometry too) need to be replaced with new proxy which is linked to cfgNonAIVehicles entry. In Arma 3 logo black.png1.80 patch following proxy was created for this purpose A3\Data_f\proxies\weapon_slots\MAGAZINESLOT.p3d

See Object Builder manual for some tips regarding handling of proxies.

magazineProxies MX profile.png

MX magazine in separate p3d

magazineProxies MX magazine.png

For 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

Model Config

Magazine proxies can be animated and retextured. At the moment, it supports following animation sources

  • reload
  • reloadMagazine
  • revolving
  • ammo
  • ammoRandom
  • isEmpty

Configuring 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.

Example model.cfg code for bullet hiding for transparent magazines.
// Macro for hiding bullets
#define BULLET_HIDE(x,from,count) class Bullet##x\
{\
	type=hide;\
	source=revolving;\
	sourceAddress="mirror";\
	selection=bullet##x;\
	minValue=-1.000000;\
	maxValue= 0.000000;\
	hideValue=((count+x-from-2)/count)+0.00001;\
};

class CfgSkeletons
{
	class Default
	{
		isDiscrete = 1;
		skeletonInherit = "";
		skeletonBones[] = {};
	};
	class magazine_transparent_skeleton : Default
	{
		skeletonInherit = "";
		skeletonBones[] = 
		{
			"bullet030",	"",
			"Bullet002",	"",
			"Bullet003",	"",
			"Bullet004",	"",
			"bullet005",	"",
			"bullet006",	"",
			"bullet007",	"",
			"bullet008",	"",
			"bullet009",	"",
			"bullet010",	"",
			"bullet011",	"",
			"bullet012",	"",
			"bullet013",	"",
			"bullet014",	"",
			"bullet015",	"",
			"bullet016",	"",
			"bullet017",	""
		};
	};
};
class CfgModels
{
	class Default
	{
		skeletonName	= "";
		sectionsInherit	= "";
		sections[]		= {};
	};
	class magazine_transparent : Default 
	{
		skeletonName="magazine_transparent_skeleton";
		// Magazine proxies supports hidden selections
		sections[] =
		{
			"camo"
		};
		class Animations
		{
			BULLET_HIDE(030,30,30)
			BULLET_HIDE(029,30,30)
			BULLET_HIDE(002,30,30)
			BULLET_HIDE(003,30,30)
			BULLET_HIDE(004,30,30)
			BULLET_HIDE(005,30,30)
			BULLET_HIDE(006,30,30)
			BULLET_HIDE(007,30,30)
			BULLET_HIDE(008,30,30)
			BULLET_HIDE(009,30,30)
			BULLET_HIDE(010,30,30)
			BULLET_HIDE(011,30,30)
			BULLET_HIDE(012,30,30)
			BULLET_HIDE(013,30,30)
			BULLET_HIDE(014,30,30)
			BULLET_HIDE(015,30,30)
			BULLET_HIDE(016,30,30)
			BULLET_HIDE(017,30,30)
		};
	};
};

CfgMagazines

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;

In 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.

class CfgMagazines
{
	class RPG32_F;
	class RPG7_F : RPG32_F
	{
		modelSpecial = "linkToP3d";
		modelSpecialIsProxy = 1
		hiddenSelections[] = {"camo"};
		hiddenSelectionsTextures[] = {"linkToTexture.paa"};
	};
	class RPG7_YellowMagazine_F : RPG7_F
	{
		displayName = "Go, go my yellow rocket!";
		reloadAction = "ReloadRPG"; // Switches reload action from RPG-7 front loading anim defined in cfgWeapons to RPG-32 back loading animation
		hiddenSelectionsTextures[] = {"#(argb,8,8,3)color(1,0.952941,0.0509804,1.0,CO)"}; // procedural yellow rocket
	};
};

CfgWeapons

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.

class CfgWeapons
{
	class Launcher_Base_F;
	class launch_RPG7_F : Launcher_Base_F
	{
		magazineReloadSwitchPhase = 0.3; // magazine will get replaced pretty early
	};
};

CfgNonAIVehicles

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.


Proxy that is used in p3d need to be listed in CfgNonAIVehicles class. There is following rule for creating those entries

class Proxy + nameOfP3d


Bear 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.

class CfgNonAIVehicles
{
	class ProxyWeapon;
	class ProxyMagazine : ProxyWeapon
	{
		model		= "";
		simulation	= "magazine";
	};
};


Examples

Example proxies for AKM, MX, STANAG & RPG-7 magazines - https://drive.google.com/open?id=1hZvLu8rJqg6WSrNoOoy0tUctFTccFmJj

E-Mag sample provided by da12thMonkey, model by Tigg - https://www.dropbox.com/s/am5ke5b02xr2jit/proxymag_example.7z?dl=0


Known issues

Currently known issues:

  • 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.
  • 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)
  • There is no way to manipulate model.cfg animation (i.e. M249 STANG & Box magazines)


See Also