Overview
In addition to weapon damage, there are a variety of additional weapon attributes that affect how a unit attacks.
This "Weapons Masterclass" guide covers the additional weapon attributes available in the Age of Empires IV Content Editor that were not covered in the previous examples working on a spearman.
Melee vs Ranged Attacks
When modifying the attacks of units, it is important to note that Melee and Ranged Attacks work differently.
Melee Attacks
Melee attacks are relatively simple, and can only occur when a unit is adjacent to another.
The attack speed of melee attacks are governed only by a combination of a unit's Aim time, their Wind Up/Wind Down time, and their Cooldown time.
Melee units typically have an Aim time of 0, so Aim is often not a factor for them.
Ranged Attscks
Ranged attacks are comparatively more complex, and can occur when a unit acquires a target within the range of their weapon.
The attack speed of ranged attacks are governed by a combination of a unit's Aim time, their Wind Up/Wind Down time, and their Reload time.
Almost all ranged units have an Aim time, with the exception of Mongolian horse archers which have an Aim time of 0, allowing them to move and shoot simultaneously.
Area of Effect Damage
Units that deal area of effect damage (AOE) can have their damage tuned to do less or more damage depending on the distance to the center of impact.
You can tune the distance of these areas in the area_effect > distance field, allowing units to have smaller or larger radii for their projectiles, as well as controlling the damage dealt within three distinct zones: Near, Mid, and Far.
The damage of the AOE attack dealt within these three zones is set under the damage field.
The size of these damage zones is set under the distance field, which defines the size of these zones from the center of impact in meters (each tile is 4 meters across).
- Near represents the distance from the center of impact out to the specified distance.
- Mid represents the middle of the AOE area.
- Far represents the outermost edge of the AOE.
The AOE damage values set for Near, Mid, and Far, are multipliers on the weapon's damage.
In the example showing a trebuchet below, you can see that trebuchets deal:
- 100% of their damage out to 0.4 metres from the center of impact
- 25% of their damage between 0.4 to 0.8 meters from the center of impact
- 10% of their damage between 0.8 to1.2 metres from the center of impact
Area of effect damage is also constrained by the outer_radius set under area_info. Think of this as a master override for the area of an AOE attack.
For example, If you set this value to 1 and then set the distance values to higher than 1, they will not have any effect beyond that range.
To make the above trebuchet's damage function as shown, the outer_radius would have to be set to 1.2 or higher.
Weapon Range
Weapon range is set in the range field.
Weapons can be tuned to have both a max and min range.
The max range indicates the maximum range the weapon can attack from, and the min range prevents attacks from being made at at targets within this zone.
In the example showing a trebuchet below, we can see that trebuchets have a:
- Maximum range of 64 metres.
- Minimum range of 11 metres.
Windup and Winddown
Most weapons in Age of Empires 4 have a wind_up and a wind_down time. These settings are found under the fire section.
The wind_up stat controls the amount of time between when a unit begins it's attack animation and when it deals its damage (melee), or launches its projectile (ranged).
The wind_down stat controls the amount of time it takes the unit to finish its attack animation after it has attacked.
Note that Windup and Windown, while they impact the total ranged attack speed of a unit, should be modified with caution. Particularly high or low values may cause the unit's attacks to fall out-of-sync with their attack animations.
Weapon Cooldown
Melee weapons use what is known as a cooldown to determine the amount of time between attacks.
Cooldown times are measured in seconds.
You can reduce a unit's cooldown to increase its attack speed, and increase it to slow a unit's attack speed.
In the example showing a spearman below, we can see spearmen has a .75 second period between attacks.
Aim Time
Ranged units have an extra stage in their attack called aim, which controls the amount of time it takes for them to acquire a target.
This stat is found under aim > fire_aim_time.
Aim times are usually low, but any value above 0 will prevent the unit firing while moving. Units with an aim time of 0 can fire while moving.
Aim time duration includes both a max and min value. This allows you to enter random variance in aim time. If these values are different, every time the unit aims, a randomly selected time between the max and the min will be used.
In standard Age of Empires 4 units there is no variance in aimtime and these entries are identical. In the example below you can see the archer's aim time is set to .25 seconds.
Reload Time
Ranged weapons use reload time to determine the amount of time between their attacks.
This stat can be found under reload.
To increase a unit's attack speed, reduce their reload time, and to reduce their attack speed the reload speed, increase their reload time.
Reload time duration includes both a max and min value. This allows you to enter random variance in reload time. If these values are different, every time the unit reloads, a randomly selected time between the max and the min will be used.
In standard Age of Empires 4 units there is no variance in reload time and these entries are identical. In the example below you can see the archer's reload speed is set to .75 seconds.
Projectiles
The projectiles in ranged attacks can be modified in a number of ways, including how they behave, track, and appear in-game.
To access the projectile qualities of a weapon, navigate to weapon bag > projectile > projectile
Then, Right-Click on projectile and select Go To Reference.
Once in the projectile file, open the projectile_ext node to access the majority of the projectile's core characteristics.
Bonus Damage
Weapons can be set to deal bonus damage to certain target types, found under target_type_table.
Bonus damage is calculated by an additive value. For example, a value of "5" would add 5 damage to each attack against the specified unit type.
To add damage against a specific unit type:
- Enter the bonus damage you wish the unit to do in the base_damage_multiplier field
- Add the file name of the unit you wish to activate that damage to in the unit_type field
The unit will then do the specified extra damage to units of the specified type
In the example below, archers are dealing 5 extra damage per shot to any targets flagged with "light_melee_infantry" (ie: the spearman). If you want to set bonus damage to be multiplicative instead of additive, tune the corresponding multipliers field.