Weapon
At this point, we have a spawnable and controllable unit. But it can't do anything. Here modules come into action. First, let's create a weapon for our Unit. It'll be a data asset inherited from RTSWeapon. We have RTSWeapon for melee attacks and, surprise, RTSRangedWeapon for ranged attacks.
Give the new asset its proper name, example: W_UnitSword. Open it.
Weapon Name - Give your weapon a name. Currently this has no direct use case yet, but do it anyways so we don’t need to come back to it later.
Preattack Delay - Determines the time before a unit deals damage during the attack.
Delay Between Shots - Determines the delay before the unit can perform an attack again.
Firing Duration - Determines how long the attack itself lasts (animation).
Damage - Damage dealt by this weapon.
Damage Type - Type of damage caused by this weapon. For now, we can leave this on DAMAGE Default. More on damage types here.
Damage Exec Calc - Attacking is handled by the GAS system. We need to set this value to RTSDamageExecCalculation in order for the damage to register.
Damage Scalars - Map of entity types to damage multipliers - eg. 200% dmg vs monsters.
On Hit Data - Array of configs with special OnHit logic (e.g. buffs). This is additional logic for our current attack. More on this in Chapter 3 - ONHIT.
Animations - Attack animations of this weapon (so you set these here, this animation type isn’t part of the main EC config).
Can Fire While Moving - Can the unit attack while moving? For melee infantry attacks, the answer is almost always yes. But for example, archers or siege can’t.
Range - Range of this attack, in cm. Even melee attacks have a range, it will be about 100-200.
NOTE from Solethria: I don’t believe the following functions are functional yet. It was made before I joined.
Splash at Target - Whether the area damage has the attacker or the target as center.
Splash Radius - Area Damage Radius.
Splash Arc - Cone width in degrees, so we don’t hit enemies at the back.
Clip Size - How many attacks before reload is triggered. This does not apply to melee damage.
Auto Reloads Clip - Should reload automatically? Does not apply to melee.
Clip Reload Time - Different from Delay Between Shots.
Icon - The weapon icon. Currently has no function yet, it will be used for weapon switches.
Now we should set our new weapon in the Unit Entity Config:
And that's it, our Units are now able to fight!