- Legacy ID
- No Bug
I dont think it would make sense for there to be.
What if you setvehicleammo to 1 and then empty your main weapon, but your secondary is full? what value would you expect be returned?
You need to specify the turret, magazine or weapon. These commands already exist.
Example(M2A4 Slammer UP):
currentWeapon (vehicle player)
Returns:"cannon_105mm" //main gun
(vehicle player) ammo "cannon_105mm"
There are also several other commands that return vehicle ammo, some are in stable some are in dev only.
setVehicleAmmo simply sets the relative ammo for every weapon.
Whatever the algorithm is that the BIS developers implemented for the setter ... there is got to be a complementary/reverse logic.
That's what getVehicleAmmo should do. It's just a matter of completeness.
If you were to call setVehicleAmmo 1 ... the vehicle would be in a "fully-loaded" state according to the documentation.
So I would expect that the getVehicleAmmo would give the average ammo count throughout all the magazines in relation to the fully-loaded state.
EDIT: I am probably not understanding exactly what "setVehicleAmmo 1" does.
It seems that it only fills the ammunition on the magazines that the vehicle currently has. So if the vehicle has no magazines, "setVehicleAmmo 1" does nothing.
Given that's the behavior, if you were to call "getVehicleAmmo" after the scenario you provided.
You would get 1, since all the magazines currently in the vehicle are topped.
I am not talking about executing setVehicleAmmo 1 and then immediately call getVehicleAmmo, in this case it is fairly obvious what result would be. Im talking about having different amount of ammo in weapons after they have been used. What should getVehicleAmmo return? If main gun has 0 ammo, of one type, 30℅ ammo of another type and secondary gun has 99% of ammo. What should getVehicleAmmo return, a single number from 0 to 1 that is somehow meaningful or useful? Saying just because there is set variant there must be get variant is not enough I'm afraid in this case.
I see you point. Averaging out the ammo percentages for each kind of mag would not give a meaningful number that can then be passed back to setVehicleAmmo (no number would). Such a weird command, I am probably not the only person confused by it.
Yep, I get that now :-)
The documentation on the wiki is somewhat misleading though.
From this sentence:
"Sets how much ammunition (compared to a full state defined by the vehicle type) the vehicle has."
I was assuming that every vehicle has some known constant "full-state" that depends on the type of vehicle.
However, the way the command works, the "full-state" is always changing ... as it depends on the number and type of magazines currently present in the vehicle.
Would be nice if the documentation for setVehicleAmmo clearly specified that the full-state is not solely dependent on the vehicle type ... that it actually depends on the set of magazines present in the vehicle.
This other command:
explains it better.
Given this conversation, how is this command different from setVehicleAmmo?