Jump to content

Is it possible to work out what an ammo is used for from its config.

Recommended Posts

I'm creating a mod that shows what each ammo type is useful for. There is definitely some confusion regarding what ammo does what, many people think the ATGM (anti tank guided missile) is actually an Air to Ground Missile!

Now my first thought is to simply manually add a description to each ammo config myself (definitely doable, would only take a few hours), but I'm wondering if it's possible to programatically determine if a ammo is anti-air/anti-infantary/anti-land from its config attributes?

Attributes such as indirectHit, dangerRadiusHit, caliber maybe. Apologies if this is a bit of an open ended question.

Share this post

Link to post
Share on other sites

Yep. Have a look at this page.



You need to pick this token but the result is not immediate. As examples:

configfile >> "CfgAmmo" >> "B_20mm_AP" >> "aiAmmoUsageFlags"  // will give  "128 + 512"; (use against vehicle and armored vehicles)


configfile >> "CfgAmmo" >> "B_20mm_Tracer_Red" >> "aiAmmoUsageFlags"  // will give "64 + 128"; (use against infantry and vehicles)

but also, sometimes, when unique usage:

configfile >> "CfgAmmo" >> "B_556x45_Ball" >> "aiAmmoUsageFlags"   // will give 64 (number...  Don't ask me why not "64" ☹️)


Now, you need to convert that into a workable script. What I'm doing:

_class = (configfile >> "CfgAmmo" >>  a type of ammo here  >> "aiAmmoUsageFlags");

 _usage = if (istext _class) then [{(getText _class) splitString " + "},{[str(getNumber _class)]}];  // returning something like ["64","128","256"] much easier to work.



  • Like 1

Share this post

Link to post
Share on other sites

thank you so much, really detailed answer. and thanks for pointing out that unique ammo returns a number rather than a string that would have tripped me up for sure.

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