Jump to content
Sign in to follow this  
charon productions

Config info of muzzles (like base class)

Recommended Posts

Has anyone managed to obtain any config info from muzzles?

Like:

_weapbase=inheritsFrom (configFile >> "CfgWeapons" >> "M203Muzzle");

or subentries of that class?

I always get "any" on both baseclass and subentries ?!

Share this post


Link to post
Share on other sites

M203 Muzzle is a subclass of "Rifle" inherited from Grenadelauncher.

so, _weapbase=inheritsFrom (configFile >> "CfgWeapons" >> "Rifle" >> "M203Muzzle"); should give you the class at hand.

else, if you're just interested in the actual M203Muzzle:

	class M203Muzzle : GrenadeLauncher {
		displayName = $STR_DN_M203;
		magazines[] = {"1Rnd_HE_M203", "FlareWhite_M203", "FlareGreen_M203", "FlareRed_M203", "FlareYellow_M203", "1Rnd_Smoke_M203", "1Rnd_SmokeRed_M203", "1Rnd_SmokeGreen_M203", "1Rnd_SmokeYellow_M203"};
		sound[] = {"\ca\Weapons\Data\Sound\grenadelauncher_1", 0.1, 1, 400};
		reloadMagazineSound[] = {"\ca\Weapons\Data\Sound\flare_reload", 0.000316228, 1, 20};
		magazineReloadTime = 0;
		reloadTime = 0.1;
		optics = true;
		modelOptics = "-";
		cameraDir = "GL look";
		memoryPointCamera = "GL eye";
		opticsZoomMin = 0.25;
		opticsZoomMax = 1.1;
		opticsZoomInit = 0.5;
	};

Share this post


Link to post
Share on other sites
ODEN;1434007']M203 Muzzle is a subclass of "Rifle" inherited from Grenadelauncher.

so' date=' _weapbase=inheritsFrom (configFile >> "CfgWeapons" >> "Rifle" >> "M203Muzzle"); should give you the class at hand.

else, if you're just interested in the actual M203Muzzle:

[/quote']

Excellent answer !

I forgot indeed about the specification "Rifle".

Thanks a lot !

Charon

---------- Post added at 03:51 PM ---------- Previous post was at 03:22 PM ----------

@[ASA]ODEN:

Maybe you can help me with my 2nd issue:

How can you check if a weapon is a subclass of the rifle class.

The line

_weapbase=inheritsFrom (configFile >> "CfgWeapons" >> _weap1);

returns the proper base class for pistols and launchers, but

for any kind of rifle it returns for example " M16A2".

When i apply the inheritsfrom command again on that class it returns nothing.

Like:

_weapbase2=inheritsFrom (configFile >> "CfgWeapons" >> format ["%1",_weapbase]);

How would i proceed to achieve the result "Rifle" as a base class?

Share this post


Link to post
Share on other sites

Hi again.

Didn't notice you added another question :-)

I tried this in a radio Alpha Trigger un Utes:

base=inheritsFrom (configFile >> "CfgWeapons" >> "M16A2"); player globalChat format[">> %1",configName inheritsFrom (configFile >> "CfgWeapons" >> configName base)]

base will be M16_base class and that one comes from Rifle, paste and try and you'll get the picture (you're just about correct in your code just replace format with configName).

/configOden

Share this post


Link to post
Share on other sites

@[ASA]ODEN:

Works great ! Many thanks.

With that syntax i can keep weapon identification as general as possible by just checking with the topmost classes. Cool

Share this post


Link to post
Share on other sites

I have made a little function out of [ASA]ODEN`s tip and want to share it here:

CHN_FindConfigRoot = {

private ["_classname","_cfgname","_base","_root"];

_classname= _this select 0;

_cfgname= _this select 1;

_root=-1;

_base=configname inheritsFrom (configFile >> _cfgname >> _classname);

if (_base=="DEFAULT") then {_root=_classname};

while {_base!="DEFAULT"} do

{

_root=_base;

_base=configname inheritsFrom (configFile >> _cfgname >> _base);

};

_root;

};

It finds the configclass one level under the DEFAULT class.

Example call would be :

_root= ["Igla","CfgWeapons"] call CHN_FindConfigRoot;

return would be :

LAUNCHERCORE

The line

if (_base=="DEFAULT") then {_root=_classname};

is to make sure that the function returns something even if you call the function already with the root class accidentally.

Maybe someone finds this useful ;)

Charon

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  

×