Jump to content
Sign in to follow this  
carlostex

Check Vehicle Ammo

Recommended Posts

Hey guys i need to check a vehicle ammo so that i can save that value in a variable and then pass it on to the new respawned unit via setvehicleammo command. I was unable to find.

Is there any command that will return vehicle ammo value range from 0 to 1?

Share this post


Link to post
Share on other sites

This should do.

_Magazines = magazines _Vehicle;

{ _Vehicle addMagazine _x } forEach _Magazines;

Share this post


Link to post
Share on other sites

I've been looking at it.... and if sxp2high's code above doesn't work as you'd like.... then it gets more complicated with turrets, weapons, magazines etc.

EDIT: There's no command to get ammo amount from 0 to 1 as far as I know.... if you want to transfer the vehicles ammo to the respawned vehicle....that's when it gets messy!

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites

The problem is i want the respawned unit to inherit the value of ammo set in the editor (the ammo slider). So yeah sxp2high's code does not work for me (thanks anyway).

My opinion is, if there is a setvehicleammo command there should be a getvehicleammo as well. These commands are and would be good to set generic values and you don't want to be too specific.

Share this post


Link to post
Share on other sites
if there is a setvehicleammo command there should be a getvehicleammo as well.

Agreed....you'd think there would be!

Share this post


Link to post
Share on other sites
Agreed....you'd think there would be!

Another one we should have is setUnitSide. So we could do something like : this setUnitSide WEST

Maybe in Arma 3

Share this post


Link to post
Share on other sites

What's wrong with my suggestion?

_Mags = magazines _Vehicle;

// wait until respawn...

if (count _Mags > 0) then { _Vehicle setVehicleAmmo 0; { _Vehicle addMagazine _x } forEach _Mags; } else { _Vehicle setVehicleAmmo 0; };

This is what magazines return for an Abrams if the slider is full:

m1full.jpg

And the slider at ~50%

m1half.jpg

Share this post


Link to post
Share on other sites
What's wrong with my suggestion?

I don't think that will work for vehicles with multiple turrets. Try it on a UH 60-M chopper for instance.

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  

×