ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

Difference between revisions of "Ammo"

From ModEnc
Jump to: navigation, search
 
(Fixed TS vehicles entry)
 
(24 intermediate revisions by 14 users not shown)
Line 1: Line 1:
<tt>Ammo=</tt> is a flag of all [[rules|rules(md).ini]]s.<br>
+
{{Flag
It 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. The default value is -1, which means "unlimited".
+
|files={{Categ|ini=rules}}
 +
|values={{Values|Unsigned integers}}
 +
|special=&nbsp;-1 (see [[#Special Values|below]])
 +
|default=&nbsp;-1
 +
|types={{Categ|Technoes}} (see respective notes below)
 +
|ra=yes
 +
|cs=yes
 +
|am=yes
 +
|ts=yes
 +
|fs=yes
 +
|ets=yes
 +
|ra2=yes
 +
|yr=yes
 +
|rp=yes
 +
}}
 +
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.  
  
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-[[AircraftType]]s 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 <tt>Ammo=</tt> statement with a number greater than or equal to one in order to work correctly.
+
== Special Values ==
 +
The only special value is -1, which means "unlimited ammo". This is also the default value for the flag.
  
In addition, <tt>Ammo</tt> is sometimes used to limit the number of times a [[Tech Buildings|tech building]] can deliver it's effect, meaning that an [[Armory]] with <tt>Ammo=20</tt> could only promote troopers 20 times before becoming useless.
+
== 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. This also means AircraftTypes require a declaration of <tt>Ammo=</tt> to work properly, and this number must be either -1 (for unlimited ammunition) or an integer greater than 0.
 +
 
 +
 
 +
In addition, <tt>Ammo</tt> can be used to limit the number of times a Tech Building can deliver it's effect, meaning that a structure with {{f|Armory|yes|link}} and {{f|Ammo|20|link}} could only promote infantry 20 times before becoming useless. This only applies to structures with {{f|Armory|yes|link}} and/or {{f|Hospital|yes|link}}.
 
<br>
 
<br>
 +
 
==The System in Detail==
 
==The System in Detail==
The ammo + reloading system is controlled by a number of flags, namely<br>
+
The ammo and reloading system is controlled by several INI flags:<br>
'''Ammo''', which controls the maximum amount of rounds a unit can carry<br>
+
*{{f|Ammo|link}}, which controls the maximum amount of rounds a unit can carry.<br>
'''InitialAmmo''', which controls with how many rounds loaded the unit starts with when built<br>
+
*{{f|InitialAmmo|link}}, which controls with how much ammo the unit will contain upon construction or spawning.<br>
'''Reload''', which controls the time delay between reloading a certain amount of ammo; is no other specification given, it simply reloads to full ammo<br>
+
*{{f|Reload|link}}, which controls the time delay between reloading a certain amount of ammo; is no other specification given, it simply reloads to full ammo straight away.<br>
'''ReloadIncrement''', which controls how much ammo should be reloaded, in percent of maximum<br>
+
*{{f|ReloadIncrement|link}} can be used to speed up (or slow down) the rate at which a unit will reload with each successive PipWrap set.<br>
'''EmptyReload''', which controls the time delay before the first reload occurs when the unit is out of ammo<br>
+
*{{f|EmptyReload|link}}, which controls the time delay before the first reload occurs when the unit is out of ammo.<br>
'''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<br><br>
+
*{{f|ManualReload|link}}, which controls whether this unit cannot reload itself, but has to [[dock]] with a building; this is not set on aircraft because, unlike other TechnoTypes, it defaults to "yes" for them.<br><br>
Other <tt>Ammo</tt>-related flags on objects are<br>
+
Other <tt>Ammo</tt>-related flags on objects are.<br>
'''DamageReducesReadiness''', which tells the game to reduce the amount of available ammo if the unit gets damaged<br>
+
*{{f|DamageReducesReadiness|link}}, which tells the game to reduce the amount of available ammo if the unit gets damaged<br>
'''PipScale''', which in the form of <tt>PipScale=Ammo</tt> tells the game to show the amount of ammo a unit has (left)<br><br>
+
*{{f|PipScale|link}}, which in the form of {{f|PipScale|Ammo|link}} tells the game to show the amount of ammo a unit currently contains.<br><br>
Also important are<br>
+
And also important are:
'''UnitReload''', which gives buildings the ability to reload units who require a manual reload<br>
+
*{{f|UnitReload|link}}, which gives buildings the ability to reload units with {{f|ManualReload|yes|link}}<br>
'''ReloadRate''', which is the flag in the general section controlling the number of minutes needed to restore one round of ammo on units docked with a building that reloads them<br>
+
*{{f|ReloadRate|link}}, 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.<br>
  
 
===Example===
 
===Example===
If a unit was set to<br>
+
If a unit was set to
<tt>Ammo=10<br>
+
<pre>Ammo=10
PipScale=Ammo<br>
+
PipScale=Ammo
ReloadIncrement=30%<br>
+
ReloadIncrement=30%
Reload=450<br>
+
Reload=450
EmptyReload=150<br>
+
EmptyReload=150
InitialAmmo=1<br></tt>
+
InitialAmmo=1</pre>
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.
+
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 the player, 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 on Aircraft==
Ammo and reloading on AircraftTypes works as seen in the game. I have not tested auto-reloading.<br><br>
+
*Ammo and reloading on AircraftTypes works as seen in the game, using the manual system.<br>
''This section should be expanded after more testing was done.''
+
*Automatic reloading on aircraft does not appear to work.<br><br>
 +
 
 
==Ammo on Vehicles==
 
==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.
+
 
 +
=== In Tiberian Sun ===
 +
 
 +
Ammo works on [[VehicleTypes|vehicles]], but auto-reloading only works on units with {{f|NoMovingFire|yes|link}} ''and'' only when they are standing still. Furthermore, the time it takes to reload one ammo pip is hardcoded to 450 [[frames]].
 +
 
 +
Manual reloading is possible via {{f|ManualReload|link}}.
 +
 
 +
=== In Red Alert 2 and Yuri's Revenge ===
 +
 
 +
Ammo and auto-reloading on VehicleTypes works perfectly, but manual reloading does not work without AI issues.
 +
<!-- ### Commented out since there is no relevant/proven information here ###
 +
'''Allied General''' - Manual reloading shouldn't work with vehicles anyhow. The Manual Reload tag is probably a obsolete tag for the RA1 Minelayer. Also for a bit of trivia when the Aegis was intially being tested, it was going to use a ammo system hence the introduction of certain tags which are never used by RA2 aircraft.-->
 +
 
 
==Ammo on Infantry==
 
==Ammo on Infantry==
Ammo on Infantry is wacky.<br>
+
Ammo on Infantry does not work quite to design.<br>
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.  
+
You can give Infantry ammo, but they will not auto-reload until they are damaged. If your soldier runs out of ammo, they will have to be attacked by something in order to kick-start the reloading mechanism. However, no matter what other flags you set, it will just restore the infantry to full ammo.  
  
Partly a solution to this is the addition 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.
+
A partial solution to this problem is to use a "reloader" unit. I.e. a unit with a weapon that only inflicts one point of damage, uses the {{f|FireOnce|link}}, {{f|AttackCursorOnFriendlies|link}} and {{f|CloseRange|link}} tags in conjunction with a very low {{f|Range|link}} value. The resulting effect is then that the unit moves up close to your unit, and then the "attacked" unit will reload as they take the negligible amount of damage from the reloader's "weapon".
  
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.
+
Also note that an infantry can only be reloaded when all of its ammo has been depleted, regardless of how much damage it takes. The reload mechanism will only fire once <i>all</i> of the unit's ammunition has been depleted.
  
 
==Ammo on Buildings==
 
==Ammo on Buildings==
Ammo on buildings is totally useless.<br>
 
It does work, yes.<br>
 
And it even reloads on it's own.<br>
 
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.<br>
 
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.<br><br>
 
''Note that this contradicts the usage of <tt>Ammo</tt> 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.''
 
  
 +
=== In Red Alert and Tiberian Sun ===
 +
 +
Buildings with a [[Primary|weapon]] and Ammo fire all shots immediately, ignoring {{f|ROF|link}} between shots. Once all ammo has been expended, the building will fully reload instantly, however the building will wait for the duration of the weapon's {{f|ROF|link}} before firing again. {{f|Reload|link}}, if specified, is ignored.
 +
 +
=== In Red Alert 2 and Yuri's Revenge ===
 +
 +
Ammo on buildings is rather useless. While it does work, and even reloads, 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. Your structure won't even stop shooting while reloading.<br>
 +
In addition, if a building with ammo is used to force-fire somewhere, the {{f|ROF|link}} will be ignored, turning the structure's armament into a rapidly firing weapon.
 +
 +
===Ammo on Tech Buildings===
 +
Tech Buildings are a special case for ammunition on structures. More specifically, this involves Tech Buildings that have the tag {{f|Armory|yes|link}} or {{f|Hospital|yes|link}}. The Ammo tag will then have a different function if one of these tags are present. In this instance, the Ammo tag will control the amount of uses the Tech Building has.
 +
 +
For example, you have a Tech Building with {{f|Armory|yes|link}} and {{f|Ammo|25|link}}. The structure will be able to promote infantry 25 times, and then can no longer promote any more infantry.
 +
 +
The EXE file contains a check for when a structure's ammo is depleted. Firstly, the game looks to see if the building has {{f|Armory|yes|link}} or {{f|Hospital|yes|link}}, if not its ammo is then simply reset to full.
 +
 +
If you were to give a base defense structre a weapon along with either {{f|Armory|yes|link}} or {{f|Hospital|yes|link}}, the structure will empty its clip and not do anything again.
 +
 +
Also note that Ammo is shared with between the structure's weapon, and any applicable Tech Building function. For example, if you have {{f|Ammo|5|link}} on a structure with {{f|Armory|yes|link}} and a {{f|Primary|link}} weapon, you could perform 5 infantry promotions, or fire 5 rounds, or any combination of the two that totals up to 5.
 +
 +
==Fixes in Ares==
 +
Version 0.1 of Ares fixes the Ammo logic for InfantryTypes and BuildingTypes; on the latter, Ammo is only reloaded if neither {{f|Armory|link}} nor {{f|Hospital|yes|link}}. No change was made on VehicleTypes and AircraftTypes (latter are still hardcoded to require manual reloading).
  
 
==See also==
 
==See also==
*[[InitialAmmo]]
+
<!-- no longer necessary, since linked in the text -->
*[[Reload]]
+
*[http://www.deezire.net/forums/red-alert-2-yuris-revenge-editing/7165-infantry-ammo-research.html Thread on DeeZire.net regarding Infantry and Ammo]
*[[ReloadIncrement]]
 
*[[EmptyReload]]
 
*[[ManualReload]]
 
*[[DamageReducesReadiness]]
 
*[[PipScale]]
 
*[[UnitReload]]
 
*[[ReloadRate]]
 
*[http://www.deezire.net/modules.php?name=Forums&file=viewtopic&t=10277 Thread on DeeZire.net regarding Infantry and Ammo]
 

Latest revision as of 14:28, 19 December 2023

Tiberian Dawn The Covert Operations Red Alert Counterstrike Aftermath Tiberian Sun Firestorm HyperPatch Red Alert 2 Yuri's Revenge Ares Generals Zero Hour Tiberium Wars Kane's Wrath
Flag: Ammo
File(s): rules(md).ini
Values: Unsigned integers: All non-negative whole numbers from 0 to either 32767, 2147483647 or 4294967295.
Special Values:  -1 (see below)
Default:  -1
Applicable to: TechnoTypes:

AircraftTypes, BuildingTypes, InfantryTypes and VehicleTypes (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 ammo". This is also the default value for the flag.

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. This also means AircraftTypes require a declaration of Ammo= to work properly, and this number must be either -1 (for unlimited ammunition) or an integer greater than 0.


In addition, Ammo can be used to limit the number of times a Tech Building can deliver it's effect, meaning that a structure with Armory=yes and Ammo=20 could only promote infantry 20 times before becoming useless. This only applies to structures with Armory=yes and/or Hospital=yes.

The System in Detail

The ammo and reloading system is controlled by several INI flags:

  • Ammo, which controls the maximum amount of rounds a unit can carry.
  • InitialAmmo, which controls with how much ammo the unit will contain upon construction or spawning.
  • Reload, which controls the time delay between reloading a certain amount of ammo; is no other specification given, it simply reloads to full ammo straight away.
  • ReloadIncrement can be used to speed up (or slow down) the rate at which a unit will reload with each successive PipWrap set.
  • 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, unlike other TechnoTypes, 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 currently contains.

And also important are:

  • UnitReload, which gives buildings the ability to reload units with ManualReload=yes
  • 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 the player, 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, using the manual system.
  • Automatic reloading on aircraft does not appear to work.

Ammo on Vehicles

In Tiberian Sun

Ammo works on vehicles, but auto-reloading only works on units with NoMovingFire=yes and only when they are standing still. Furthermore, the time it takes to reload one ammo pip is hardcoded to 450 frames.

Manual reloading is possible via ManualReload.

In Red Alert 2 and Yuri's Revenge

Ammo and auto-reloading on VehicleTypes works perfectly, but manual reloading does not work without AI issues.

Ammo on Infantry

Ammo on Infantry does not work quite to design.
You can give Infantry ammo, but they will not auto-reload until they are damaged. If your soldier runs out of ammo, they will have to be attacked by something in order to kick-start the reloading mechanism. However, no matter what other flags you set, it will just restore the infantry to full ammo.

A partial solution to this problem is to use a "reloader" unit. I.e. a unit with a weapon that only inflicts one point of damage, uses the FireOnce, AttackCursorOnFriendlies and CloseRange tags in conjunction with a very low Range value. The resulting effect is then that the unit moves up close to your unit, and then the "attacked" unit will reload as they take the negligible amount of damage from the reloader's "weapon".

Also note that an infantry can only be reloaded when all of its ammo has been depleted, regardless of how much damage it takes. The reload mechanism will only fire once all of the unit's ammunition has been depleted.

Ammo on Buildings

In Red Alert and Tiberian Sun

Buildings with a weapon and Ammo fire all shots immediately, ignoring ROF between shots. Once all ammo has been expended, the building will fully reload instantly, however the building will wait for the duration of the weapon's ROF before firing again. Reload, if specified, is ignored.

In Red Alert 2 and Yuri's Revenge

Ammo on buildings is rather useless. While it does work, and even reloads, 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. Your structure won't even stop shooting while reloading.
In addition, if a building with ammo is used to force-fire somewhere, the ROF will be ignored, turning the structure's armament into a rapidly firing weapon.

Ammo on Tech Buildings

Tech Buildings are a special case for ammunition on structures. More specifically, this involves Tech Buildings that have the tag Armory=yes or Hospital=yes. The Ammo tag will then have a different function if one of these tags are present. In this instance, the Ammo tag will control the amount of uses the Tech Building has.

For example, you have a Tech Building with Armory=yes and Ammo=25. The structure will be able to promote infantry 25 times, and then can no longer promote any more infantry.

The EXE file contains a check for when a structure's ammo is depleted. Firstly, the game looks to see if the building has Armory=yes or Hospital=yes, if not its ammo is then simply reset to full.

If you were to give a base defense structre a weapon along with either Armory=yes or Hospital=yes, the structure will empty its clip and not do anything again.

Also note that Ammo is shared with between the structure's weapon, and any applicable Tech Building function. For example, if you have Ammo=5 on a structure with Armory=yes and a Primary weapon, you could perform 5 infantry promotions, or fire 5 rounds, or any combination of the two that totals up to 5.

Fixes in Ares

Version 0.1 of Ares fixes the Ammo logic for InfantryTypes and BuildingTypes; on the latter, Ammo is only reloaded if neither Armory nor Hospital=yes. No change was made on VehicleTypes and AircraftTypes (latter are still hardcoded to require manual reloading).

See also