Jump to content
Sign in to follow this  
Chairborne

Little question about cfgpatches

Recommended Posts

I was wondering, what is the cfgpatches part for?

class CfgPatches
{
class CHA_HHobj
{
	units[] = {};
	weapons[] = {};
	requiredVersion = 0.1;
	requiredAddons[] = {"A3_Characters_F"};
};
};

What does the "class cha_hhobj" part define?

What are the "units" and "weapons" bits for? Even if i don't put anything in there but have other units defined in the cfgvehicles or cfgweapons everything runs without problems in game.

Do they work just as information on the content of the config file for the developers or they have some actual in-game use?

Share this post


Link to post
Share on other sites

"Class CHA_HHobj" is basically the name of the addon .pbo you are creating. If another addon is made dependant on this addon being installed, you would include "CHA_HHobj" in the requiredAddons[] section of their config and the game would make sure it loaded the CHA_HHobj addon before the addon that inherits from it.

But AFAIK yes, the rest is basically an index of the contents of the addon to help the game load classes in the right order (and I guess more quickly) if there are multiple addons using the same classname (e.g a soundmod where a separate addon inherits from and modifies a cfgweapons class contained in one of BIS' .pbos)

Share this post


Link to post
Share on other sites

Thank you very much.

Is there any rule onto which i would assign a given classname to units or weapons? I mean, i guess it's pretty obvious where vehicles go but say i create a different type of magazine, backpack, uniform, etc, would i have to put them in units (or would i have to write them at all)?

Also the required version has any particular purpose like an automatic check of client vs server version or it's related to the game version? Say i release an addon, then update it, would i have to change that too to make sure everyone is running the updated version?

Share this post


Link to post
Share on other sites

You asked for a different type of magazine, here you go.

class CfgMagazines
{
class Default;
class CA_Magazine: Default
{
	scope = 1;
	value = 1;
	displayName = "";
	model = "\A3\weapons_F\ammo\mag_univ.p3d";
	picture = "";
	modelSpecial = "";
	useAction = 0;
	useActionTitle = "";
	reloadAction = "";
	ammo = "";
	count = 30;
	type = 256;
	initSpeed = 900;
	selectionFireAnim = "zasleh";
	nameSound = "magazine";
	maxLeadSpeed = 23;
	weaponpoolavailable = 1;
	mass = 8;
};
	class 7Rnd_12gauge: CA_Magazine
{
	scope = 2;
	displayName = "7-Round 12 Gauge";
	picture = "\RP_870mcs_A3\data\7ro_12g_ca.paa";
	ammo = "7Rnd_12gauge";
	count = 7;
	initSpeed = 930;
	tracersEvery = 0;
	lastRoundsTracer = 4;
	descriptionShort = "Standard NATO 12-gauge shotgun pellets shell.";
};

This is how I coded my new magazine types. But be sure to inculde in cfgPatches requiredaddons[] = {"A3_Weapons_F"};.

Cheers

Share this post


Link to post
Share on other sites
Thank you very much.

Is there any rule onto which i would assign a given classname to units or weapons? I mean, i guess it's pretty obvious where vehicles go but say i create a different type of magazine, backpack, uniform, etc, would i have to put them in units (or would i have to write them at all)?

By convention it seem if it's a cfgWeapons class (weapons, uniforms, NVGs etc.) it goes in the weapons[] field, and if it's a cfgVehicles class (men, vehicles, containers etc.) it goes in the units[] field.

cfgMagazines and cfgAmmo classnames don't appear to be included.

I checked the cfgPatches sections of characters_f.pbo, weapons_f.pbo and soft_f.pbo

Also the required version has any particular purpose like an automatic check of client vs server version or it's related to the game version? Say i release an addon, then update it, would i have to change that too to make sure everyone is running the updated version?

Requiredversion relates to the version of the game software used.

This is in case the addon is dependant on features added by a certain update by BIS (patches, DLC, Expansions etc.) For example Op Arrowhead/Combined Arms versions were numbered >v1.5, where Arma 2 only patches (even those that came out after Arrowhead was released) were numbered <v1.5, same was true of OFP where it basically served as a warning to people to patch their game.

The requiredversion only really needs updating if you add something to make the addon dependant on something added in a subsequent update to Arma 3, but I imagine it's less of a concern now that all updates to Arma 3 are now automatic and we don't have to manually download patches.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×