Ammo
Flag: | Ammo |
File(s): | Rules(md).ini |
Values: | Unsigned integers |
Special Values: | -1 (see below) |
Default: | -1 |
Applicable to: | InfantryTypes, VehicleTypes, AircraftTypes, BuildingTypes (see respective notes below) |
This flag essentially controls exactly what it is named after: The "number of rounds carried between reloads", i.e. how many shots the object has before it needs to be/gets reloaded.
Special Values
The only special value is -1, which means "unlimited". It is used as the default value for this flag as well.
Standard Usage
The ammo-system in RA2 and YR is mainly used for aircraft, and has therefore been re-coded to best fit this purpose; on one hand, this means that using ammo on non-AircraftTypes is often buggy, in the sense that not all flags work or have the desired effect. On the other hand, it means that AircraftTypes are required to have finite ammo, i.e. each AircraftType must have an Ammo= statement with a number greater than or equal to one in order to work correctly.
In addition, Ammo is sometimes used to limit the number of times a tech building can deliver it's effect, meaning that an Armory with Ammo=20 could only promote troopers 20 times before becoming useless.
The System in Detail
The ammo + reloading system is controlled by a number of flags, namely
Ammo, which controls the maximum amount of rounds a unit can carry
InitialAmmo, which controls with how many rounds loaded the unit starts with when built
Reload, which controls the time delay between reloading a certain amount of ammo; is no other specification given, it simply reloads to full ammo
ReloadIncrement, which controls how much ammo should be reloaded, in percent of maximum
EmptyReload, which controls the time delay before the first reload occurs when the unit is out of ammo
ManualReload, which controls whether this unit cannot reload itself, but has to dock with a building; this is not set on aircraft because, other than all other Types, it defaults to "yes" for them
Other Ammo-related flags on objects are
DamageReducesReadiness, which tells the game to reduce the amount of available ammo if the unit gets damaged
PipScale, which in the form of PipScale=Ammo tells the game to show the amount of ammo a unit has (left)
Also important are
UnitReload, which gives buildings the ability to reload units who require a manual reload
ReloadRate, which is the flag in the general section controlling the number of minutes needed to restore one round of ammo on units docked to a building that reloads them
Example
If a unit was set to
Ammo=10
PipScale=Ammo
ReloadIncrement=30%
Reload=450
EmptyReload=150
InitialAmmo=1
it would start out with 1 round of ammo when it comes from it's factory. If it shot itself empty, it would take about 10 seconds (on medium game speed) until reloading started. It would then be reloaded by 3 rounds of ammo every 30 seconds, up until it's maximum amount of 10 rounds. This is all visible to us, because the PipScale is drawn. Note that, in some cases, the unit does not necessarily need to be empty in order to reload itself.
Ammo on Aircraft
Ammo and reloading on AircraftTypes works as seen in the game. I have not tested auto-reloading.
This section should be expanded after more testing was done.
Ammo on Vehicles
Ammo and auto-reloading on VehicleTypes works perfectly, but I did not get manual reloading to work. Since this may have been my fault, I would not draw conclusions from this. If somebody tested it and has a conclusive answer to the question, please update this part.
Ammo on Infantry
Ammo on Infantry is wacky.
You can give Infantry ammo, but they will not auto-reload until they are hurt. Yes, you read right. If your soldier runs out of ammo, you have to have him shot by something in order to make the reload mechanism start. But even if that happened, it will still ignore all special settings and just reload the soldier to full ammo.
Partly a solution to this is the addition of a "reloader"-unit with a weapon doing just 1 point of damage, having FireOnce, AttackCursorOnFriendlies, CloseRange and a very small range. This will make the reloader go very close to your unit, as if it handed off ammo, enable it to shoot someone from his own team, and shoot just once on him for a damage of 1. Since "1" is still damage, the reload mechanism kicks in and a few seconds later the ammo-restricted infantry can fire again.
Note that even with the addition of a reloader, your ammo-restricted infantry has to be empty before it can be reloaded. As long as there is ammo left, it will just take damage and die eventually.
Ammo on Buildings
Ammo on buildings is totally useless.
It does work, yes.
And it even reloads on it's own.
Unfortunately, it simply reloads to full ammo as soon as it is out of rounds, meaning that it makes no difference if ammo is defined or not. It doesn't even stop shooting while reloading.
In addition, if a building with ammo is used to force-fire somewhere, the ROF seems to get overridden, effectively turning whatever weapon there is on it into a machine gun.
Note that this contradicts the usage of Ammo on Tech Buildings for limiting purposes; it is possible that Tech Buildings are a special case, that objects without a weapon are a special case, or that the logic simply got changed since the last time someone tried, meaning that it did work that way, but does not anymore. Again, more tests need to be done.
However, there is one definate use for Ammo= on BuildingTypes. If the building in question has Template:TTL (i.e. it can promote infantry that enter it) or Template:TTL (i.e. it heals infantry that enter it) then the Ammo= tag can be used to set how many times you can promote an infantry with it.
Once you have expended this amount, it seems that it can never reload - but to reiterate: more testing is required in this area.