Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
theend3r

How to check if a vehicle has full ammo?

Recommended Posts

I know there is the setVehicleAmmo command but is there an equivalent to get the ratio of current/full ammo or at least boolean if the ammo is full? If not, I'm sure many of you have already written something like this so could you please share your solutions? I know I could probably save all the turrets in an array, somehow retrieve their max ammo from configs and compare it to the current ammo but if someone's already done it, I would prefer not to.

Share this post


Link to post
Share on other sites

Why not use ammo? It doesn't tell you in %, but at least you can count the current amount and then compare with what it should be.

Share this post


Link to post
Share on other sites

Why not use ammo? It doesn't tell you in %, but at least you can count the current amount and then compare with what it should be.

I know, I just don't know how to get the "what it should be" from config.

Share this post


Link to post
Share on other sites

I know, I just don't know how to get the "what it should be" from config.

 

To return a magazine's maximum capacity:

getNumber (configFile >> "CfgMagazines" >> MAGAZINE >> "count");
  • Like 1

Share this post


Link to post
Share on other sites

OK, solved it. For future reference:

if (({getNumber (configFile >> "CfgMagazines" >> _x select 0 >> "count") != _x select 1} count (magazinesAmmo _this)) > 0) exitWith {false};
true

Thanks

  • Like 2

Share this post


Link to post
Share on other sites

×