Jump to content

IFV Weapon System: Difference between revisions

From ModEnc²
en>NCoder
Rain-Islet (talk | contribs)
m [bot] Batch update {{Bugs}} templates.
 
(24 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The following page should give an overview over the workings of the '''IFV''' system. First, note that the game is hardcoded to display IFV behaviour as expected ONLY with the unit that has the ID <tt>[FV]</tt>. This means that while it is possible to alter the existing IFV a great deal, it is NOT possible to create other units with this system (save for using .EXE modifications such as NPatch, RockPatch and Ares).
{{Guideheader
|ra2=yes
|yr=yes
}}
==IFV Overview==
First thing to note is that {{ra2}} is hardcoded to IFV behaviour for the unit named [FV] in {{ini|rules}}. This means that while it is possible to alter the existing IFV a great deal, it is not possible to create other IFV units with this system, without using an engine extension such as Ares (for YR).


===Flags involved===
==IFVMode==
* [[IFVMode]]
This tag applied to [[InfantryTypes|infantry]] and determines into which weapon/turret 'mode' the IFV will spring when the concerned infantry (or vehicle) enters it. Note that the mode of the IFV is determined by the passenger in the 'Gunner' slot of the IFV. If an IFV is set to have more than one passenger, the Gunner slot will be represented by a "pip" on the Passenger {{Tt|[[PipScale]]}} that will be seperated from the rest of the scale and is usually filled with the first passenger to enter the vehicle when it's empty.
* [[Gunner]]
* '''Note:''' IFVMode, like {{Tt|YTurretWeapon}} and {{Tt|YTurretIndex}} (see below) is floored at 0. That means that IFV mode 0 (the default mode of an IFV when empty) will use {{Tt|[[WeaponX|Weapon1]]}}, mode 1 will use weapon 2, etc. <tt>IFVMode=0</tt> is also the default of this flag when it is omitted, meaning such infantry will not cause any change to the IFV mode when entering it.
* [[TurretCount]]
* '''Note:''' If the IFV has more than one passenger, the Gunner position also has to be vacated seperately - if other passengers are inside the vehicle, normally unloading the vehicle will unload the other passenger slots first, while the Gunner will remain inside the vehicle and can only be unloaded by unloading the vehicle AGAIN after all other passenger slots have been cleared.
** [[WeaponX]]
 
* YTurretWeapon
==Gunner==
* YTurretIndex
IFV behaviour for the unit is specified using {{f|Gunner|yes|link}}. This may also activate additional logic related to the {{Tt|[[DeathWeapon]]}} set on an IFV, ensuring it is only triggered if the current [[WeaponX|weapon]] or [[EliteWeaponX|elite weapon]] has {{f|Suicide|yes|link}} set. Perhaps ensuring it will only take effect if the vehicle is piloted by a Crazy Ivan or possibly Terrorist infantry unit. Note that the method of how the IFV {{Tt|DeathWeapon}} logic is implemented is poorly understood at the moment.
 
==Turrets==
[[TurretCount]] determines how many turrets the engine will load for the unit. In order for proper IFV behaviour, this setting must be present and greater than zero. However, since the turret types are reference by name and hardcoded, {{Tt|TurretCount}} must be less than or equal to what the game comes hardcoded with, 13 for RA2, and 17 for YR.


==={{Tt|[[IFVMode]]}}===
The {{Tt|YTurretWeapon}} and {{Tt|YTurretIndex}} settings control which turret and weapon is used by which {{Tt|IFVMode}}. The IFV turret will switch to the turret art specified in {{Tt|YTurretIndex}}, associated with {{Tt|YTurretWeapon}} with the same value of <tt>Y</tt>, where the {{Tt|IFVMode}} matches the {{Tt|YTurretWeapon}} value.
This is the only flag involved which is not set on the IFV proper. Instead, it is applied to infantry types (it ''can'' be applied to vehicle types as well, apparently, however there are various issues with this - see Bugs and Limitations) and determines into which weapon/turret 'mode' the IFV will spring when the concerned infantry (or vehicle) enters it. Note that the mode of the IFV is determined by the passenger in the 'Gunner' slot of the IFV. If an IFV is set to have more than one passenger, the Gunner slot will be represented by a "pip" on the Passenger {{Tt|[[PipScale]]}} that will be seperated from the rest of the scale and is usually filled with the first passenger to enter the vehicle when it's empty.
 
* '''Note:''' If the IFV has more than one passenger, the Gunner position also has to be vacated seperately - if other passengers are inside the vehicle, normally unloading the vehicle will unload the other passenger slots first, while the Gunner will remain inside the vehicle and can only be unloaded by unloading the vehicle AGAIN after all other passenger slots have been cleared.
The available IFV turrets in {{ra2}}:
<tt>'''Normal'''TurretIndex
'''Normal'''TurretWeapon
'''Repair'''TurretIndex
'''Repair'''TurretWeapon
'''MachineGun'''TurretIndex
'''MachineGun'''TurretWeapon
'''Sniper'''TurretIndex
'''Sniper'''TurretWeapon
'''Explode'''TurretIndex
'''Explode'''TurretWeapon
'''TerroristExplode'''TurretIndex
'''TerroristExplode'''TurretWeapon
'''Chrono'''TurretIndex
'''Chrono'''TurretWeapon
'''Pistol'''TurretIndex
'''Pistol'''TurretWeapon
'''BrainBlast'''TurretIndex
'''BrainBlast'''TurretWeapon
'''Flak'''TurretIndex
'''Flak'''TurretWeapon
'''Shock'''TurretIndex
'''Shock'''TurretWeapon
'''RadCannon'''TurretIndex
'''RadCannon'''TurretWeapon
'''Cow'''TurretIndex
'''Cow'''TurretWeapon</tt>
 
The additional IFV turrets in {{yr}}:
<tt>'''Initiate'''TurretIndex
'''Initiate'''TurretWeapon
'''Virus'''TurretIndex
'''Virus'''TurretWeapon
'''YuriPrime'''TurretIndex
'''YuriPrime'''TurretWeapon
'''Guardian'''TurretIndex
'''Guardian'''TurretWeapon</tt>
 
==Summary==
<tt>[FV]<br>...<br>MachineGunTurretIndex=1<br>MachineGunTurretWeapon=8<br>[E1]<br>...<br>IFVMode=8</tt>


==={{Tt|[[Gunner]]}}===
Now, when our little GI (<tt>E1</tt>) enters the IFV, the IFV will spring into 'Mode 8', and will use {{Tt|Weapon9}}. The game then subtracts -1 from the number of the currently-used weapon (9), and checks which {{Tt|YTurretIndex}} is equal to the result of the calculation (8). {{Tt|MachineGunTurretWeapon}} qualifies, as it is set to 8. The 'swapping factor', the {{Tt|Y}} of the {{Tt|YTurretWeapon}}, here is {{Tt|MachineGun}}, so the game looks for the corresponding {{Tt|YTurretIndex}} with an equal value of {{Tt|Y}}, and finds it in {{Tt|'''MachineGun'''TurretIndex}}. It then checks the number specified in that index - which is 1 - and changes the turret to the turret with that number - <tt>FVTUR1</tt>.
This is set on the IFV itself and all this does is simply toggle the 'IFV' behaviour on and off.
Now, you may be wondering why <tt>MachineGunTurretWeapon='''7'''</tt> springs in effect when the IFV is using  {{Tt|Weapon'''9'''}}. This is because (as detailed above), the {{Tt|YTurretWeapon}} and {{Tt|YTurretIndex}} settings are floored at 0, whereas the modes and {{Tt|WeaponX}} are floored at 1, so that the {{Tt|WeaponX}} the IFV gets when entered by the GI is {{Tt|Weapon8}}, however in {{Tt|YTurretWeapon}}, it is counted as 'Weapon 7'. {{Tt|Weapon1}} would be counted as 0, {{Tt|Weapon2}} as 1, {{Tt|Weapon3}} as 2, etc. Always one less than the acctual {{Tt|WeaponX}}.
* Note the {{Tt|YTurretWeapon}} will correspond to an {{Tt|IFVMode}}, but the {{Tt|WeaponX}} invoked by that mode is always +1 higher.


==={{Tt|[[TurretCount]]}}===
=={{bugs}}==
{{Tt|[[TurretCount]]}} determines how many turrets the engine will load for the unit. In order for proper IFV behaviour, this setting must be present and set to >0. According to [[User:Nighthawk200|Nighthawk]], there is a maximum of 15 turrets that can be loaded for any unit without causing issues[http://cncguild.net/item-187?apage=174#page]. In ''Red Alert 2'', it is not possible to actually use all 15 turrets because there are only 14 '<tt>swapping factors</tt>' present (see below). ''Yuri's Revenge'' adds four more <tt>swapping factors</tt>, making the full use of the {{Tt|TurretCount}} possible.
Erratic behaviour may result from setting multiple {{Tt|YTurretIndex}} to the same number.  


==={{Tt|[[YTurretWeapon]]}} and {{Tt|[[YTurretIndex]]}}===
While VehicleTypes can have an IFVMode set and enter the IFV, [[Size]] and [[SizeLimit]] permitting, and can even change its weapon and turret, the tooltip will always display "Rocket IFV" when hovering over it. UseOwnName might be a workaround for this.
The {{Tt|YTurretWeapon}} and {{Tt|YTurretIndex}} settings control which turret is used in which weapon mode. According to the flag description in the rules(md).ini, the {{Tt|Y}} is substituted for a 'swapping factor'. The IFV's turret will change to the turret with the number specified in {{Tt|YTurretIndex}} when <tt>X-1</tt> of the the IFV is equal to the {{Tt|YTurretWeapon}} with the same value of <tt>Y</tt> as the {{Tt|YTurretIndex}}. <tt>X</tt> in this case denotes the current weapon <tt>X</tt> used by the IFV.


In ''Red Alert 2'', the '''<tt>Swapping Factors</tt>''', 14 in number, are: <tt>
If the IFV has a TurretCount value higher than the available turrets, and is entered by infantry with an IFVMode using one of those high values, it may cause the IFV and/or its turret to be completely invisible in-game.
* '''Normal'''TurretIndex<br>'''Normal'''TurretWeapon
* '''Repair'''TurretIndex<br>'''Repair'''TurretWeapon
* '''MachineGun'''TurretIndex<br>'''MachineGun'''TurretWeapon
* '''Rocket'''TurretIndex<br>'''Rocket'''TurretWeapon
* '''Sniper'''TurretIndex<br>'''Sniper'''TurretWeapon
* '''Explode'''TurretIndex<br>'''Explode'''TurretWeapon
* '''TerroristExplode'''TurretIndex<br>'''TerroristExplode'''TurretWeapon
* '''Chrono'''TurretIndex<br>'''Chrono'''TurretWeapon
* '''Pistol'''TurretIndex<br>'''Pistol'''TurretWeapon
* '''BrainBlast'''TurretIndex<br>'''BrainBlast'''TurretWeapon
* '''Flak'''TurretIndex<br>'''Flak'''TurretWeapon
* '''Shock'''TurretIndex<br>'''Shock'''TurretWeapon
* '''RadCannon'''TurretIndex<br>'''RadCannon'''TurretWeapon
* '''Cow'''TurretIndex<br>'''Cow'''TurretWeapon</tt>


''Yuri's Revenge'' adds the following additional swapping factors, bringing the count to 18: <tt>
* Ares can enable any vehicle to become an IFV with Gunner=yes, and will allow up to 127 turrets/weapons for it.
* '''Initiate'''TurretIndex<br>'''Initiate'''TurretWeapon
* '''Virus'''TurretIndex<br>'''Virus'''TurretWeapon
* '''YuriPrime'''TurretIndex<br>'''YuriPrime'''TurretWeapon
* '''Guardian'''TurretIndex<br>'''Guardian'''TurretWeapon</tt>


'''For example:'''<br>
==See Also==
<tt>[FV]<br>...<br>MachineGunTurretIndex=1<br>MachineGunTurretWeapon=7<br>[E1]<br>...<br>IFVMode=8</tt>
[[IFVMode]]


Now, when our little GI (<tt>E1</tt>) enters the IFV, the IFV will spring into 'Mode 8', and will use {{Tt|Weapon8}}. The game then subtracts -1 from the number of the currently-used weapon (8), and checks which {{Tt|YTurretIndex}} is equal to the result of the calculation (7). {{Tt|MachineGunTurretWeapon}} qualifies, as it is set to 7. The 'swapping factor', the {{Tt|Y}} of the {{Tt|YTurretWeapon}}, here is {{Tt|MachineGun}}, so the game looks for the corresponding {{Tt|YTurretIndex}} with an equal value of {{Tt|Y}}, and finds it in {{Tt|'''MachineGun'''TurretIndex}}. It then checks the number specified in that index - which is 1 - and changes the turret to the turret with that number - <tt>FVTUR1</tt>.
[[Gunner]]
Now, you may be wondering why <tt>MachineGunTurretWeapon='''7'''</tt> springs in effect when the IFV is in 'Mode 8'. This is because (as detailed above), the {{Tt|YTurretWeapon}} and {{Tt|YTurretIndex}} settings are floored at 0, whereas the modes and {{Tt|WeaponX}} are floored at 1, so that the {{Tt|WeaponX}} the IFV gets when entered by the GI is {{Tt|Weapon8}}, however in {{Tt|YTurretWeapon}}, it is counted as 'Weapon 7'. {{Tt|Weapon1}} would be counted as 0, {{Tt|Weapon2}} as 1, {{Tt|Weapon3}} as 2, etc. Always one less than the acctual {{Tt|WeaponX}}.


===Bugs and Limitations===
[[TurretCount]]
* It is possible to set multiple {{Tt|[[YTurretIndex]]}} to the same number. One is likely to get bugs or undesired behaviour when this happens, as the game, in the process detailed above, will find ''multiple'' turrets it should switch to when the IFV gets into that mode.
* While vehicles 'can' enter the IFV (proper Size and SizeLimit settings required) and can even change its weapon and turret, the tooltip will always display "Rocket IFV" when over such an IFV. UseOwnName might work around this.
* A common error that will occur is that both the vehicle and turret are completely invisible in-game on an IFV. There are likely multiple causes for this bug, one of them being a TurretCount set higher than the acctual number of loadable turrets for the voxel.


===Notes===
[[WeaponX]]
* It appears <tt>RocketTurretWeapon</tt> and <tt>RocketTurretIndex</tt>, while present in the unmodded rules.ini of ''Red Alert 2'', do not represent valid swapping factors, bringing the count of usable swapping factors to 13 (RA2) and 17 (YR), respectively.
* Even without a valid swapping factor attached to a weapon, the IFV will change into that weapon mode flawlessly. It's the turret part, not the weapon part, that will not work; no turret will be displayed for a weapon that has not been attached to a valid swapping factor.


===See also===
[http://cncguild.net/item-187?apage=174#page IFV Turret Tutorial by Nighthawk]
* [http://cncguild.net/item-187?apage=174#page IFV Turret Tutorial by Nighthawk]


[[Category:Tutorials]]
[[Category:Tutorials]]

Latest revision as of 17:27, 2 July 2025

Tiberian Dawn Red Alert Tiberian Sun Firestorm Red Alert 2 Yuri's Revenge

IFV Overview

First thing to note is that Red Alert 2 is hardcoded to IFV behaviour for the unit named [FV] in rules(md).ini. This means that while it is possible to alter the existing IFV a great deal, it is not possible to create other IFV units with this system, without using an engine extension such as Ares (for YR).

IFVMode

This tag applied to infantry and determines into which weapon/turret 'mode' the IFV will spring when the concerned infantry (or vehicle) enters it. Note that the mode of the IFV is determined by the passenger in the 'Gunner' slot of the IFV. If an IFV is set to have more than one passenger, the Gunner slot will be represented by a "pip" on the Passenger PipScale that will be seperated from the rest of the scale and is usually filled with the first passenger to enter the vehicle when it's empty.

  • Note: IFVMode, like YTurretWeapon and YTurretIndex (see below) is floored at 0. That means that IFV mode 0 (the default mode of an IFV when empty) will use Weapon1, mode 1 will use weapon 2, etc. IFVMode=0 is also the default of this flag when it is omitted, meaning such infantry will not cause any change to the IFV mode when entering it.
  • Note: If the IFV has more than one passenger, the Gunner position also has to be vacated seperately - if other passengers are inside the vehicle, normally unloading the vehicle will unload the other passenger slots first, while the Gunner will remain inside the vehicle and can only be unloaded by unloading the vehicle AGAIN after all other passenger slots have been cleared.

Gunner

IFV behaviour for the unit is specified using Gunner=yes. This may also activate additional logic related to the DeathWeapon set on an IFV, ensuring it is only triggered if the current weapon or elite weapon has Suicide=yes set. Perhaps ensuring it will only take effect if the vehicle is piloted by a Crazy Ivan or possibly Terrorist infantry unit. Note that the method of how the IFV DeathWeapon logic is implemented is poorly understood at the moment.

Turrets

TurretCount determines how many turrets the engine will load for the unit. In order for proper IFV behaviour, this setting must be present and greater than zero. However, since the turret types are reference by name and hardcoded, TurretCount must be less than or equal to what the game comes hardcoded with, 13 for RA2, and 17 for YR.

The YTurretWeapon and YTurretIndex settings control which turret and weapon is used by which IFVMode. The IFV turret will switch to the turret art specified in YTurretIndex, associated with YTurretWeapon with the same value of Y, where the IFVMode matches the YTurretWeapon value.

The available IFV turrets in Red Alert 2:

NormalTurretIndex
NormalTurretWeapon
RepairTurretIndex
RepairTurretWeapon
MachineGunTurretIndex
MachineGunTurretWeapon
SniperTurretIndex
SniperTurretWeapon
ExplodeTurretIndex
ExplodeTurretWeapon
TerroristExplodeTurretIndex
TerroristExplodeTurretWeapon
ChronoTurretIndex
ChronoTurretWeapon
PistolTurretIndex
PistolTurretWeapon
BrainBlastTurretIndex
BrainBlastTurretWeapon
FlakTurretIndex
FlakTurretWeapon
ShockTurretIndex
ShockTurretWeapon
RadCannonTurretIndex
RadCannonTurretWeapon
CowTurretIndex
CowTurretWeapon

The additional IFV turrets in Yuri's Revenge:

InitiateTurretIndex
InitiateTurretWeapon
VirusTurretIndex
VirusTurretWeapon
YuriPrimeTurretIndex
YuriPrimeTurretWeapon
GuardianTurretIndex
GuardianTurretWeapon

Summary

[FV]
...
MachineGunTurretIndex=1
MachineGunTurretWeapon=8
[E1]
...
IFVMode=8

Now, when our little GI (E1) enters the IFV, the IFV will spring into 'Mode 8', and will use Weapon9. The game then subtracts -1 from the number of the currently-used weapon (9), and checks which YTurretIndex is equal to the result of the calculation (8). MachineGunTurretWeapon qualifies, as it is set to 8. The 'swapping factor', the Y of the YTurretWeapon, here is MachineGun, so the game looks for the corresponding YTurretIndex with an equal value of Y, and finds it in MachineGunTurretIndex. It then checks the number specified in that index - which is 1 - and changes the turret to the turret with that number - FVTUR1. Now, you may be wondering why MachineGunTurretWeapon=7 springs in effect when the IFV is using Weapon9. This is because (as detailed above), the YTurretWeapon and YTurretIndex settings are floored at 0, whereas the modes and WeaponX are floored at 1, so that the WeaponX the IFV gets when entered by the GI is Weapon8, however in YTurretWeapon, it is counted as 'Weapon 7'. Weapon1 would be counted as 0, Weapon2 as 1, Weapon3 as 2, etc. Always one less than the acctual WeaponX.

  • Note the YTurretWeapon will correspond to an IFVMode, but the WeaponX invoked by that mode is always +1 higher.

Bugs/Side-Effects/Unexpected Limitations

Erratic behaviour may result from setting multiple YTurretIndex to the same number.

While VehicleTypes can have an IFVMode set and enter the IFV, Size and SizeLimit permitting, and can even change its weapon and turret, the tooltip will always display "Rocket IFV" when hovering over it. UseOwnName might be a workaround for this.

If the IFV has a TurretCount value higher than the available turrets, and is entered by infantry with an IFVMode using one of those high values, it may cause the IFV and/or its turret to be completely invisible in-game.

  • Ares can enable any vehicle to become an IFV with Gunner=yes, and will allow up to 127 turrets/weapons for it.

See Also

IFVMode

Gunner

TurretCount

WeaponX

IFV Turret Tutorial by Nighthawk