norrin 9 Posted October 17, 2007 I've been told that using this command one can get the parent class of any vehicle or unit but for the life of me I can't figure out the syntax. The biki gives this as an example: _base = inheritsFrom (configFile >> "CfgVehicles" >> "Car") What I want to be able to determine is from a specific class such as "soldierWAA" what the parent class it belongs to is using a script. Any suggestions on how to get this command to work? Share this post Link to post Share on other sites
Big Dawg KS 6 Posted October 17, 2007 The exact syntax is this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_parent = inheritsFrom (configFile >> "CfgVehicles" >> "soldierWAA") The biki couldn't be any more clear... Share this post Link to post Share on other sites
norrin 9 Posted October 17, 2007 The exact syntax is this:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_parent = inheritsFrom (configFile >> "CfgVehicles" >> "soldierWAA") The biki couldn't be any more clear... Thanks Kyle you're right its a stupid question compounded by a bad example. What I was really trying to ask was what if you don't know what the intermediate class is ie. "cfgVehicles". Can you still get the parent class from a specific unit class? (Lightbulb going off above head) But I guess if its a unit or a vehicle we're are talking about it has to be a member of "cfgvehicles". Anyway with your gentle prodding and despite my stupidity its now working (wow twice in one week and its only Wednesday ). I'll go and stand in the corner now. Share this post Link to post Share on other sites
vova _fox 0 Posted October 17, 2007 vf_checkclass= { private ["_class","_cfg","_check"]; _class=_this select 0; _cfg=_this select 1; _check=_this select 2; while {_class != _check and _class != ""} do {_class=configname (inheritsfrom (_cfg>>_class))}; _class == _check }; usage : _condition=[_class,_config,_check] call vf_checkclass; _class - string of search class ("SoldierWSaboteurPipe2" for example) _config -entry (type config) where we find this class (configfile>>"cfgvehicles"....configfile>>"cfgweapons"...e tc) _check - string of parrent class return true if _check have class or false if isn't example _config=configfile>>"CfgVehicles"; _check="all"; _a=["SoldierWSaboteurPipe2",_config, _check] call vf_checkclass; if (_a) then {hint "<all> is a parent of <SoldierWSaboteurPipe2> in <CfgVehicles>"} but you can't use "CfgVehicles" like _check , because cfgvehicles isn't a parent of any class just see config class cfgvehicles { class all { .... }; ... }; all haven't parent.... Share this post Link to post Share on other sites