IFV Weapon System
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 [FV]. 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).
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 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.
This is set on the IFV itself and all this does is simply toggle the 'IFV' behaviour on and off. This may also be the flag responsible for causing additional logic related to the DeathWeapon set on an IFV, ensuring the weapon is only triggered if the current (Elite)WeaponX has Suicide set - ensuring it will only take effect (in unmodded Red Alert 2) if the vehicle is piloted by a Crazy Ivan or possibly Terrorist infantry unit. Note that the method of how the IFV's additional DeathWeapon logic is toggled and how it exactly works is poorly understood at the moment.
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 Nighthawk, there is a maximum of 15 turrets that can be loaded for any unit without causing issues. In Red Alert 2, it is not possible to actually use all 15 turrets because there are only 13 'swapping factors' present (see below). Yuri's Revenge adds four more swapping factors, making the full use of the TurretCount possible.
The YTurretWeapon and YTurretIndex settings control which turret is used in which weapon mode. According to the flag description in the rules(md).ini, the Y is substituted for a 'swapping factor'. The IFV's turret will change to the turret with the number specified in YTurretIndex when X-1 of the the IFV is equal to the YTurretWeapon with the same value of Y as the YTurretIndex. X in this case denotes the current weapon X used by the IFV.
In Red Alert 2, the Swapping Factors, 14 in number, are:
Yuri's Revenge adds the following additional swapping factors, bringing the count to 18:
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.
- In other words:
The YTurretWeapon that will correspond to an IFV mode is always set to the number of the mode. The WeaponX invoked by that mode however is always the number of the mode +1.
Bugs and Limitations
- It is possible to set multiple 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.
- It appears RocketTurretWeapon and RocketTurretIndex, 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.