Home   Help Search Login Register  

Author Topic: Read magazine type from weapons config  (Read 1114 times)

0 Members and 1 Guest are viewing this topic.

Offline myke13021

  • Contributing Member
  • **
  • Myke
Read magazine type from weapons config
« on: 01 Apr 2008, 01:16:22 »
Probably something simple but with my very limited understanding of config files and how to use them (in scripting terms).
What i need is a way to get the magazine name from a known weapon.

So, in exemple i have weapon "BombLauncher" and what i need is a line that tells me (or the script) that the related magazine is the "6Rnd_GBU12_AV8B".
Thats all.

Why do i need this?
I write a Aircraft carrier simulation (sort of) which lets the missionmaker change the loadout of each plane. Right now it takes an array for each weapon which contains weapon classname and magazine classname. I would like to shorten it so only weapon classname has to be given to the script and the script itself loads the correct magazine.

I guess it's doable in one or two lines but i can't figure it out.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Read magazine type from weapons config
« Reply #1 on: 01 Apr 2008, 01:26:50 »
Nice easy one here, which gives an array of strings as the result, since a weapon may allow the use of multiple magazine types:
Code: [Select]
_usableMagazineClasses = getArray (configFile >> "cfgWeapons" >> "BombLauncher" >> "magazines");
« Last Edit: 01 Apr 2008, 01:28:24 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Read magazine type from weapons config
« Reply #2 on: 01 Apr 2008, 01:36:55 »
Wow, quick answer. Thx Spooner. Maybe one day i'll see through this config stuff.