Jump to content
Sign in to follow this  
jakkob4682

how to use config commands?

Recommended Posts

Can someone break it down barny style how I would actually go about using these? I.E. If I wanted to check the displayname for a unit or check if a location is a secondary airport etc. How do you reference the variable with these commands?_isMan = getText(configFile>>"CfgVehicles">>"Land">>"Man">>"displayName") but would I then use if(_x getText == "Takistani")?

Edited by jakkob4682

Share this post


Link to post
Share on other sites

If you want to do this in a script to run within a mission or addon, Ican't help you much, only just getting to grips with it myself so anything I posted might have errors.

If you want to pull the classname out for a particular vehicle / man / weapon etc. there are 2 routes: search for the "AllInOne" config, which as the name suggests is a complied list of configs; alternatively try helijunkie's Config Explorer, which is great for pulling class names out from mods like AFRS.

Share this post


Link to post
Share on other sites

In your example, the variable is referenced as _isMan.

A good practice, though, is to make those _isSomething variables boolean. Makes it easier to read.

So:

_isMan = (getText(configFile>>"CfgVehicles">>"Land">>"Man">> "displayName") == "Takistani (turban)");

_isMan will be true or false, depending on whether your dude is actually a Tkistani with a turban or not.

Although this would work, the displayName is probably not the best option to check on the identity of a unit. faction, or typeOf might be better, depending on the case.

Share this post


Link to post
Share on other sites

You must know the value you're looking for first. I.E. by looking at the config, use the appropriate retrieval method. See below:

getNumber -- if the config value is a number (isMan=1;)

getText -- if the config value is text (displayName="Man";)

getArray -- if the config value is an array (secondary airport ils array ilsPosition[]={1358,900};)

Example:

_type = typeOf _unit;

_isMan = if ((getNumber(configFile>>"CfgVehicles">>_type>> "isMan") == 1) then {true} else {false};

Now _isMan is boolean, and can be used elsewhere in the script by checking:

If (_isMan) then {whatever code here};

Edited by panther42

Share this post


Link to post
Share on other sites

so the preceeding entry is the object you're checking and the entry after that is the condition if I understand you correct. So if I wanted to check the indirect range of an explosion effect such as ACE_pipbombexplosion

_xplosion = _this select 0;

_explosive = typeOf _explosion
_IHR = if( getNumber(configFile>>"configAmmos">>"Explosion">>_explosive>>"indirecthitrange") < 5) then {true} else {false};

if (_IHR) then {} else {};


?

Share this post


Link to post
Share on other sites

You don't need the if check here.

_IHR = getNumber (configFile>>"configAmmos">>"Explosion">>_explosive>>"indirecthitrange") < 5;

already makes it a boolean.

Edit: Basically what you were doing amounts to if (true) then {true} else {false};

Share this post


Link to post
Share on other sites

sweet thanks trying to use this in place of a defined number for a scripted trigger for ied's/suicide bombers to make it more realistic, going to do some more digging to see what the sensitivity range for mines/ied's if there is an entry for that

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  

×