Jump to content
Sign in to follow this  
jakkob4682

getting info from the config and then comparing that to another object how to

Recommended Posts

Can someone break this down barny style for me. I.E. Lets say I want to get the screenname of an object?

Share this post


Link to post
Share on other sites

For getting the screen name you can use this

_dispname = getText (configFile >> "cfgVehicles" >> typeof _target >> "displayName");

with _target being the object you want the displayname of.

You can use the very same method to get custom parameters you defined in the config. Lets say you made something called cfgVehicleWeight where the weight for each vehicle is stored under the same object name as in cfgVehicles and now you want the weight of your target:

_weight = getText (configFile >> "cfgVehiclesWeight" >> typeof _target >> "weight");

You see it is pretty easy. You define the root with configFile and then use the >> operator to go deeper in class hierarchy until you reached the level the desired information is stored in.

The datatype returned is called config. If you want an array, a number or a text just wrap your config search with one of these: getNumber(),getArray(),getText() and the return value will be casted to the given type. You can then just handle it like every other variable of the same type.

Edited by MrSherenai

Share this post


Link to post
Share on other sites

so if I wanted to get the indirect hit range of an explosion _dangerZone = getNumber(ConfigFile>>"CfgMagazine">>"Explosion">>_explosive>>"indirecthitrange")? then check it in a function with if (_dangerZone > someNumber) then {}?

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  

×