Jump to content
Sign in to follow this  
Igitur

Any command similar to 'isKindOf' for Weapons ?

Recommended Posts

Hi,

I'd like to simplify a condition line in a script of mine. Basically, I want to replace the precarious weapons lists by a more general Weapon type name that would subsume all the particular classnames.

Something like this :

if (secondaryWeapon player) isKindOf "Launcher") then {hint 'Yop'};

Unfortunately, isKindOf does not work for weapons. However,

base = inheritsFrom (configFile >> "CfgWeapons" >> "Launcher");
hint format ['%1', base];

returns "LauncherCore" (-"PistolCore" or "RifleCore" for pistols or rifles).

So the question : is it possible to use that result to identify all types of lauchers, rifles or pistols, and use it in a condition line ? If yes, what should the syntax look like ?

Thanks.

Share this post


Link to post
Share on other sites

You can use the weapon's type which is a config value that indicates what category the weapon is (primary, secondary, pistol).

getNumber(configFile >> "CfgWeapons" >> _weapon >> "type")

The possible values can be found here although things might have changed in A3.

Edited by Deadfast

Share this post


Link to post
Share on other sites

Thanks a lot, I'll try that out.

Share this post


Link to post
Share on other sites

I use this,

_class = [secondaryWeapon player] call BIS_fnc_classWeapon;

_parents = [_class,true] call BIS_fnc_returnParents;

if("Launcher_Base_F" in _parents)

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  

×