The Weapon asset represents the definition of a specific weapon of your game. From a simple Steel Sword to a Fire spellbound Battle Axe.
We'll divide this section of the documentation in three parts.
The Weapon properties is composed of three subsequent sections that define how the weapon behaves and what special effects it plays at certain situations
This section defines basic common parameters that differentiate this weapon from others.
The weapon Name and a Description, which can be localized to any language the game supports.
The Default Shield can reference a Shield Asset, which will be used when equipping the weapon without specifying a shield.
Character State and Character Mask lets you define a Character State asset that will be used when the character has equipped the current weapon.
The Weapon Model section defines the physical representation of the weapon the character wields and how it collides and deals damage onto enemies.
The Prefab field lets you reference a prefab game object that should contain the 3D model of the sword.
The Attachment field determines to which limb the prefab will be instantiated. Because the weapon can be slightly offset from the center of the limb, you can tweak the position and rotation of the sword using the Position Offset and Rotation Offset fields.
The Effects section lets you choose which sound effects are played at certain points when wielding the weapon, as well as which particle effects will be spawned.
The field names are quite self explanatory. Audio Draw and Audio Sheathe are the audio clips played when the character equips and unequips the current weapon.
Audio Impact Normal is an audio clip played when the sword hits something and Audio Impact Knockback is played when the player gets knocked-back.
Similarly, the Prefab Impact Normal and Prefab Knockback prefabs are game object prefabs that get instantiated when this weapon hits something or knocks-back something. This is meant to be used for particle and light effects where sparks appear from the clash.
Fighting games would be quite boring without proper combos. Each weapon can have its own set of combo attacks.
A typical combo is smashing the attack key stroke 3 times, and the player character will react executing three consecutive attacks.
The main difference between executing a combo attack after another attack is when this second attack starts.
We've already overviewed how an attack is structured: It has an anticipation phase first, where the character winds up its attack, an activation phase, where the weapon captures hits landed onto enemies, and a recovery phase, where the character follows through the attack due to its momentum.
However, a combo chain is supposed to take advantage of the current attack's motion and allow to follow up another one using the momentum of the current one.
This principle applies to the Combo System: If an attack is marked as a follow-up attack of another one, the Recovery phase of the first attack will be skipped and replaced with the beginning of the next attack.
This is the main principle to having a smooth combat system. If a combo waits until the previous attack is complete to follow up the next one, it will always start from an idle position and making attacks feel powerless.
Melee's Combo Creator is always evaluated from top to bottom. As soon as it finds a clip that matches the input and conditions it will stop looking up for an attack and execute the selected one.
Take for example the screenshot from above, which represents a 3-hit combo. A Combo entry is composed of 4 fields:
Combo Input: Determines the combo sequence needed to execute the attack.
Condition: Special conditions that need to be met in order to execute the attack.
Melee Clip: The Melee Clip asset that contains the information of the attack.
Is Enabled: Whether the attack is available by default.
The Conditions dropdown allows to define a condition before the attack is executed. These conditions are:
None: No condition is required (default)
On Air: The character is airborne
After Block: The followup attack will be executed after blocking an attack
After Perfect Block: The followup attack requires to have perfectly blocked an attack
Running Forward: Requires the character to be running forward
Running Backwards: Requires the character to be running backwards
Input Forward: The forward key button must be pressed
Input Backwards: The backwards key button must be pressed
The Weapon asset does not only deal with attacking an enemy, but also how attacks affect him/her. The Hits Reaction section allows to configure an arbitrary amount of reactions depending on different situations, but there should be at least one in each case.
You can set any amount of reaction clips at each list. Every time the character has to play a reaction animation, it will scrub through the list and randomly pick one from the corresponding list.
As an example, and using the image above, if the player receives an attack coming in front of him/her, it will pick a random reaction from the first list called Hit Reaction - Grounded & Front, which can be any of the 4 different clips attached.
However, if the player gets hit from behind while being grounded, it will always play the same reaction, because there's only one reaction listed under the Hit Reaction - Grounded & Behind list.