Page MenuHomeFeedback Tracker

There is no getVehicleAmmo command
Closed, ResolvedPublic

Description

There is a setter

https://community.bistudio.com/wiki/setVehicleAmmo

but no equivalent getVehicleAmmo

Details

Legacy ID
1272734211
Severity
None
Resolution
No Bug
Reproducibility
Always
Category
Scripting

Event Timeline

micovery edited Steps To Reproduce. (Show Details)Oct 24 2014, 1:48 AM
micovery edited Additional Information. (Show Details)
micovery set Category to Scripting.
micovery set Reproducibility to Always.
micovery set Severity to None.
micovery set Resolution to No Bug.
micovery set Legacy ID to 1272734211.May 7 2016, 7:40 PM

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"
Returns:40

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.

What Benargee said, why do you need this command?

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.

Because setVehicleAmmo tops up ALL weapons, what should getVehicleAmmo return after you have all weapons topped up but 1 weapon empty?

@Killzone_Kid

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.

@micovery: "Sets how much ammunition (compared to a full state defined by the vehicle type) the vehicle has.".

It sets how many percents of the 'full' state of the vehicle.
setVehicleAmmo 0.5 sets the amount of ammo to 50% of the full state as defined by the vehicle type.

@Killzone_Kid

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.

@MulleDK19

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.

Do you still have questions or is this considered resolved?

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:

https://community.bistudio.com/wiki/setVehicleAmmoDef

explains it better.

Given this conversation, how is this command different from setVehicleAmmo?

You can mark this ticket as closed ... as there is no point in a "getter" for this.

Resolved at OP's request

Feel free to add notes to wiki pages. Anybody can contribute.