OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Cheetah on 17 Nov 2007, 14:36:12

Title: Retrieve ammo info from config
Post by: Cheetah on 17 Nov 2007, 14:36:12
I'd like to be able to use:

configFile >> "CfgWeapons" >> weapon >> ammo

to retrieve the ammo for a specific weapon. I know where this info is,  don't know which class / name I have to use to retrieve the ammo for a 'weapon', because the config.bin is binarized. Could anyone point me to a tool to debinarize?
Title: Re: Retrieve ammo info from config
Post by: Wolfrug on 17 Nov 2007, 16:14:21
Attached is the excellent prog PboView by...um...someone. MrFlea maybe  :D It allows you to open Pbos, view .pac files, open binarized configs etc etc...all without actually extracting the pbo (like cpbo does, for instance). You can also extract the files you want or need, or the whole pbo as well. It's great!  :good:

Wolfrug out.

PBOView OFPEC Resource (http://www.ofpec.com/ed_depot/index.php?action=details&id=505&game=ArmA)
Title: Re: Retrieve ammo info from config
Post by: Planck on 17 Nov 2007, 16:51:52
Is it the ammo you actually want or is it the magazine?

The ammo information is held in the cfgMagazines definition for the magazine.

The cfgWeapon definition for the weapon defines the magazine.

So you have:

Code: [Select]
cfgAmmo
    Definition of some ammo

cfgMagazines
    Definition of the magazine using above ammo

cfgWeapons
    Definition of weapon using the above magazine.


Planck
Title: Re: Retrieve ammo info from config
Post by: Cheetah on 18 Nov 2007, 14:54:36
Alright I managed to open the config with PBOview. I can't return the ammo used by a specific weapon with the code:

Code: [Select]
_ammo = configFile >> "CfgWeapons" >> _weapon >> "magazines[]";
hint format ["%1",_ammo];

What is wrong with this code?
Title: Re: Retrieve ammo info from config
Post by: Spooner on 18 Nov 2007, 15:04:57
Whenever you delve into the config with >> you always end up with a "config entry", not the ArmA data type that it contains, thus you need to extract the array data from the config type:
Code: [Select]
_magazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines");
_description = getText (configFile >> "CfgWeapons" >> _weapon >> "displayName");