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

The YR Combat System

From ModEnc
Revision as of 13:06, 12 March 2013 by Mevitar (talk | contribs) ('if' was not where it should be)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page describes in detail and with several examples the large number of flags and conditions governing what attacks what how in Yuri's Revenge. Flags used link to their explanations where possible, and several community sites provide detailed tutorials and further explanations should you be unfamiliar with something.

Introduction

The YR Combat System is, next to Generals, the single most complicated fighting system devised for C&C RTSs. It encompasses many facets and abilities not featured in prior installments. Some of the older portions no longer work as they are traditionally known and many of the newer functions are exclusive to this or Red Alert 2 proper.

The following is a list of items being discussed on this page:

Let's begin shall we?

Primary vs. Secondary Weapons

In all CnC games since Red Alert 1 the most basic of listing for where to list weapons on a unit is the Primary and Secondary tags. While in earlier installments, both were presented almost identically they have several differences in the RA2/YR system.

First off, unless the weapon itself is incapable of attacking land for whatever reason (more below) the Primary will always attack the terrain tiles first. The Secondary if not explicitly allowed to do so will be incapable. The Secondary weapon is more a fallback measure for objects the Primary cannot attack.

It should be noted that several effects depend on correct ordering of Primary/Secondary in your code. For example a Secondary weapon that is anti-air (see Projectile Projectiles section) will not gain any bonus from AirRangeBonus even if the bonus is defined in your code properly. That tag explicitly goes towards Primary weapons. More effects of this nature are described in the Special cases section below.

Warheads

Ahh Warheads, the part that actually makes things go boom in CnC. This element is by far the single strongest "general" tag applicable to any weapon. The following goes into great detail how Warheads affect combat.

In Combat the Warhead is checked as one of the first things (the others before it being the projectile settings for AA/AG/AN and LandTargeting/NavalTargeting) for comparison before the actual attack can commence. If the weapon has no restrictions prior to the Warhead, then the Warhead itself decides whether the weapon will attack a specific target or whether it will be passed on to the Secondary (if applicable).

This decision is done by the Verses. The Verses is a list of all applicable Armor types in YR in this order: none, flak, plate, light, medium, heavy, wood, steel, concrete, special_1, special_2. A realistic showing of how this is presented goes as follows:

[WarheadX]
Verses=100%,45%,30%,15%,10%,50%,80%,150%,10%,5%,5%

This means a weapon with this warhead will do 100% damage to Armor=none, 45% to Armor=flak, 30% to Armor=plate, 15% to Armor=light, 10% to Armor=medium, 50% to Armor=heavy, 80% to Armor=wood, 150% to Armor=steel, 10% to Armor=concrete, 5% to Armor=special_1, and 5% to Armor=special_2. Yes the Verses is the damage attenuator for YR in addition to deciding what weapon attacks what. This is done by special case.

The Verses contains several special cases that determine whether the warhead is allowed to attack another target under normal conditions. A Verses value greater than 3% will allow normal combat. A Verses of 2% according to documentation allows no passive acquire (even if allowed), however this effect is broken and 2% works like normal combat. A Verses of 1% disallows both passive acquiring and retaliation of a unit with this weapon assuming the Primary/Secondary opposite of this weapon cannot attack the target. A Verses value of 0% forbids any action from this weapon towards that particular armor type. Even force firing will not cause damage. The 0% in RA2/YR is the deciding factor whether a Primary/Secondary can attack the target given multiple targets of differing armor types on the same targeting plane (e.g. land, naval, air). A 0% will automatically pass the targeting over to the Secondary or another weapon if applicable.

Related Tags

Related tags for Warheads include:

Spread 
Controls the radius affected by the warhead in pixels. No longer functional in RA2/YR.
Wall 
Can this Warhead affect walls? (Default no)
WallAbsoluteDestroyer 
Will this Warhead deal "killing" damage to a wall? (Default no)
Wood 
Can this Warhead affect wooden objects such as trees, wood fences and bridges? (Default no)
Fire 
Does this Warhead simulate heat and thusly affect ice tiles? (Default no) Not applicable to stock RA2/YR.
Radiation 
Does this Warhead create a radiation field upon impact? (Default no) Certain things can be made immune to this effect.
Tiberium 
Does this Warhead damage/destroy Tiberium/Ore tiles? (Default no)
Sparky 
Does this Warhead cause residual flames? (Default no) Note: This tag is wonky and needs work before you can use it.
Conventional 
Does this Warhead make a splash literally? (As in make a splash in water) (Default no)
Rocker 
Can this Warhead jostle units around? (As in rock them from side to side or turn over) (Default no) Note: this affects only voxel units.
AnimList 
List of applicable animations for impacts. The further right in the list the higher the weapon damage needs to be. The more entries the shorter the damage interval between anims. Note: damage intervals between anims cannot be reliably predicted.
InfDeath 
Style of death for infantry.
Deform 
Percent chance this Warhead will deform terrain a la Tiberian Sun. Not applicable to stock RA2/YR.
DeformThreshhold 
Minimum damage needed to cause deformation of terrain. Not applicable to stock RA2/YR.
Particle 
Particle effect upon impact.
ProneDamage 
Damage multiplier for "prone" infantry units. This is applied AFTER the Verses.
Bright 
Does this Warhead produce a light flash upon impact? (Default no) This is overridden by a similar tag for Weapons.
CombatLightSize 
Percent of max size. Value greater than 0 forces the size of light effects rather than being controlled by damage.
Bullets 
Is this warhead a bunch of bullet-like projectiles? (Default no) Note: Actual effect (IFV name uses Tip:MachineGun) does not appear to work properly in YR.
CellSpread 
Value in cells the Warhead can affect in area. Overrides the now obsolete Spread. Values below 1 affect only a single target.
CellInset 
Use this to tell autodeploy how much inside CellSpread we need to get before autodeploying. (Used on Desolator)
PercentAtMax 
Maximum damage percent at the fringes of a particular CellSpread. For values greater than 1 this is at the edge of the affect. For CellSpread values less than 1, this appears to have a damage multiplier effect on BuildingTypes.
Sonic 
Is this a sonic Warhead? (Default no) This removes Parasite units.
EMEffect 
Can this Warhead disable objects instead of harm them? Time controlled by damage. No longer functional in RA2/YR.
PenetratesBunker 
Will this Warhead transfer damage to units inside a bunker object (such as the Yuri Tank Bunker). (Default no)
Parasite 
Is this Warhead controlled by parasitic actions? (Like Terror Drones and Attack Dogs) (Default no)
Culling 
Does this Warhead insta-kill when target gets in the red? (Default no)
Paralyzes 
Does this Warhead "paralyze" targets in place? (Used on giant squid and controlled by internal code)
MindControl 
Does this Warhead have mind-control properties? (Default no)
PsychicDamage 
Is this a psychic weapon? (Default no) Units can be made immune to this tag via ImmuneToPsionics.
AffectsAllies 
Will this Warhead affect friendlies in the target area? (Default yes)
IvanBomb 
Sabotage effect used by Crazy Ivan style attacks.
CausesDelayKill 
Links up with EligibleForDelayKill effects. (Default no)
DelayKillFrames 
Time in frames between impact and DelayKill effects.
DelayKillAtMax 
Multiply by DelayKillFrames to get DelayKill time at a specific CellSpread.
NukeMaker 
Used on Nuclear Missile superweapon. Causes weapon to shoot straight up then come back down via house targeting.
Temporal 
Is this a temporal weapon? (Used on Chrono Legionnaire)
IsLocomotor 
Is this a locomotor derived weapon? (Used on Chrono Legionnaire and Magnetron)
Airstrike 
Is this an airstrike weapon? Used by Boris in stock YR. Triggers the BorisAirstrike ability.
MinDebris 
Debris spawned by this weapon's impact. (Minimum value) Debris spawned is apparently random.
MaxDebris 
Debris spawned by this weapon's impact. (Maximum value) Debris spawned is apparently random.
BombDisarm 
Disarms the effect of IvanBomb style weapons and warheads. (Default no)
ShakeXlo 
Screen shake value X direction. (Lower limit)
ShakeXhi 
Screen shake value X direction. (Upper limit)
ShakeYlo 
Screen shake value Y direction. (Lower limit)
ShakeYhi 
Screen shake value Y direction. (Upper limit)
MakesDisguise 
Can this Warhead cause the disguise effect? (SHP only)
CLDisableBlue 
Disable the blue effects of RGB? (Used on Mirage Tank to ensure the color of impact)
CLDisableGreen 
Disable the green effects of RGB?
CLDisableRed 
Disable the red effects of RGB?

This list was compiled from a runthrough of Rules(md).ini and may not have absolutely everything. Many of these tags directly affect combat, hence their listing here.

Projectiles

Projectiles in the YR combat system are how the damage travels to the target. Without defining one, the game will hate you since it would be forced to use defaults. Get it wrong and it won't behave how you want it.

How this relates to determining what shoots what is simple and comes down to 3 settings. AA, AG, AN. AA controls whether the projectile can attack air, AG controls whether the projectile can attack ground, and AN controls whether it can attack submersibles. Without defining these as you need there are no assurances your weapon will behave properly or choose the right one in the first place.

It should also be noted that AN (and other tags like AS) are wholly redundant in RA2/YR. AG will handle naval units just as easily as it handles ground.

To explain this better here is a very basic demonstration:

[Unit]
Primary=GroundGun
Secondary=AirGun

[GroundGun]
Projectile=GroundProjectile

[AirGun]
Projectile=AirProjectile

[GroundProjectile]
AG=yes
AA=no

[AirProjectile]
AA=yes
AG=yes

With this the Primary weapon will shoot everything on the ground. The Secondary weapon can also shoot ground but is overridden by the Primary/Secondary order of operation described earlier. (Unless one of the warheads has a 0%) Now, the Primary cannot shoot air in this case but the Secondary can, therefore all things being equal the Secondary will attack the aerial unit that the Primary is forbidden from doing.

Apart from these, everything else in Projectiles (sans a limitation described below) is just aesthetic for the most part. None of it will affect the determination of which weapon to use.

Land Targeting

LandTargeting is a bit of a useful function in the RA2/YR combat system. It provides a check against things attacking stuff they shouldn't. (Such as AI controlled SAM sites attacking tanks) In addition it can provide a level of control for units (usually naval) as per which weapon you want to attack per a particular target.

Like its cousin NavalTargeting described below, LandTargeting will supersede all other considerations for what attacks what excepting air units. (Such as Warhead or Projectile)

The following constants describe how the system works in relation to established rules.

LAND_OKAY = 0
LAND_NOT_OKAY = 1
LAND_SECONDARY = 2

This means that a unit/building with LandTargeting=1 will be expressly forbidden from shooting at the ground at all regardless of the AG setting. Likewise if two weapons can both attack ground but LandTargeting=2 is in effect, only the Secondary will attack ground targets. LandTargeting=0 is simply the default and reverts to normal combat rules.

Naval Targeting

NavalTargeting is very much like LandTargeting in form and function. Only it applies to the naval setting (anything on or cloaked in water) and has more constants for use. Consider it a reverse LandTargeting.

Like LandTargeting, NavalTargeting will supersede all other considerations for what attacks what except for air units. (Such as Warhead or Projectile)

The following constants describe how the system works in relation to established rules.

UNDERWATER_NEVER = 0
UNDERWATER_SECONDARY = 1
UNDERWATER_ONLY = 2
ORGANIC_SECONDARY = 3
SEAL_SPECIAL = 4
NAVAL_ALL = 5
NAVAL_NONE = 6
NAVAL_PRIMARY = 7

This means a unit with NavalTargeting=6 will not be able to attack any naval based unit or structure at all even if it can attack land. Likewise, a unit with NavalTargeting=4 will use its Secondary weapon against naval targets. (Just like the SEAL from RA2/YR) NavalTargeting=7 will shoot absolutely everything with the Primary. The default value of NavalTargeting is 0 and only forbids underwater units from being attacked directly.

Special Cases

There are some instances where normal combat logic is either not needed by design or outright fails to behave as predicted, this is where the special cases come in. (Assuming no errors in code.)

Some of these such as Verses and AirRangeBonus have been described already. Then there are others which either suspend the typical order of operation or defy it such as Gunner and IsGattling logic.

Gunner logic such as the original IFV behaves by suspending typical Primary/Secondary ordering in favor of the WeaponX listing. When triggered correctly, the Gunner logic will activate the weapon associated with a particular slot listed on the parent unit. This weapon then becomes the Primary in essence and then follows most of the rules of normal combat (LandTargeting, Warhead, etc.)

IsGattling is a bit of a defiance towards the rules. It simply increments weapons over time. Only very specific cases (such as a 0% on a warhead or LandTargeting=1) will cause a weapon to fail to attack it's target during firing. Even then it will just move to the next weapon in the list.

One other case is IsChargeTurret. This suspends the Primary/Secondary ordering in much the same vein as Gunner logic only it does so just to get an animated turret. It's possible (though unlikely) that with IsChargeTurret, an indefinite number of weapons can be attached to a single object.

Some other things also modify the rules of combat as well. Spawner on the unit coupled with Warhead=Special turns the unit into a spawn-maker. Examples of this logic are seen on the Allied Aircraft Carrier and the V3. Warhead=Special really is a special case, as it is neither defined nor needs to be and will attack any armor type possible only pausing in regard to LandTargeting/NavalTargeting and AG/AA=no.

Limitations/Bugs/Side Effects

  • It must be noted that a Secondary weapon will not fire until the ROF of the Primary has finished. The same is true for Primary if the Secondary attacked first. This is done to prevent ROF abuse of certain weapons.
  • Projectiles that fire in Arcing=true patterns behave badly when done via AA=yes weapons. The weapon will fire according to proper rules but the projectile will never reach the target. Such projectiles fly up approximately 300 leptons and then come back down. It is unknown why this happens.
  • Unless a weapon has a cursor sabotage effect like C4 or MigAttackCursor, even a Verses value of 1% will not force a swap to another weapon. Additionally, cursor sabotage effects overriding previous weapons is also denied by CanC4=no, thus if a weapon is Versed at 0% against a target to get the weapon that has a cursor sabotage effect, it will be denied completely if the target has CanC4=no. Special care needs to be done in these instances.
  • When using CellSpread on warheads, be aware that damage is applied per cell for buildings. That means, if, for example, a 3x3 building is entirely within the CellSpread range of a given warhead, it will take damage 9 times - once for each cell in the CellSpread of the warhead.
    This is, of course, subject to flags like PercentAtMax, but changes the amount of damage taken by buildings drastically as size increases. A Damage=100 weapon with a CellSpread of 1.5 at 100% Verses and PercentAtMax=1 will do 100 damage on a small 1x1 defense building, but 900 damage on a 3x3 building. With the Construction Yard only having a Strength of 1000, one can see the effect on balance this has.

Hierarchy

As a reminder, weapon selection/targeting hierarchy is summarized as follows (further left denotes greater importance):

Land/Naval Targeting → Warheads → Projectiles → Primary/Secondary order.

See also

Weapon c4.png Armament System related Flags on ModEnc