Jump to content
Sign in to follow this  
norrin

inheritsFrom command help

Recommended Posts

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

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
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. smile_o.gif

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 tounge2.gif and despite my stupidity its now working (wow twice in one week and its only Wednesday crazy_o.gif ).

I'll go and stand in the corner now. smile_o.gif

Share this post


Link to post
Share on other sites

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×