The Reaction assets allow characters to react to different stimulus, such as being hit, blocking an attack, being the victim of a takedown, etc... It allows to define a list of Animation Clips and one of them is picked based on different conditions.
For example, a character being attacked from the front might play a random flinch animation, but the same attack hitting its back might make it stumble or even get knocked down.
The Reaction Asset¶
To create a new Reaction asset, right click on the Project Panel and select Create → Game Creator → Melee → Reaction.
The Reaction asset has a Transition In and a Transition Out field that define how long it takes for a character to blend in and out the selected animation from the reaction. It is recommended to have small values, such as 0.1 up to 0.5 seconds.
The Use Root Motion checkbox defines whether the animation being played takes over the character's locomotion and will use the animation clip's root motion to move the character. In most cases, this checkbox should be checked.
The Speed field is a coefficient that is used to speed up or down the animation played. By default it's set to 1, which indicates that the animation will play at its original velocity. Setting a value of 2 means the animation will play twice as fast, and a value of 0.5 will play the animation in slow-motion.
Clicking on the Add Reaction button creates a new entry, of which you can create as many as needed.
When a Reaction decides which animation is played, it starts checking all entries, from top to bottom. If the conditions of an entry are successful, then the animation played is picked randomly between the ones provided by that entry.
The Min Power checkbox determines whether the entry requires a minimum power in order to be considered successful. Upon ticking the toggle, a decimal field appears on the right side, which is used to define the minimum power threshold.
Power from Skills
The power is provided by the attacker's Skill. This allows to play different hit reactions depending on the power of the attack received, and playing a knock-back animation when the strength of the attack taken is higher than a certain value.
The Direction field allows to execute a particular entry only if the direction of the attack received matches the direction of the attack. The From Any option ignores the direction of the skill.
On top of these conditions, you can also specify visual scripting Conditions such as checking stats, and other kinds of data from both the attacker and the victim.
Self and Target
When checking Conditions the Self value references the character attempting to play a Reaction and the Target the attacker character.
The Cancel Time toggle allows to define a maximum time at which the character playing the Reaction can cancel the reaction and play another Skill, dash or do any other action.
A Stun Lock is what happens when all attacks of an attacker character are faster than the reaction animation of its victim. If the aggressor constantly attacks a character, it can't break free because each new attack locks it in a new flinching animation.
To avoid that, try ticking the Cancel Time checkbox and give it a small threshold time. This will allow characters to attempt dashing out of the way after being hit but won't allow them to move during the reaction time.
This is especially useful for the player character.
The Rotation field allows the character to either look away from the attack direction, towards the attack direction or not rotate the character at all. This is usually useful when all your animations are frontal ones and you don't want to create directional animations.
Gravity determines the influence this reaction entry will have on the character's own gravity. This is mostly used when doing airborne hit reactions, where the character stays up in the air while playing the hit animation.
The Avatar Mask allows to play the entry animation clips on just a few bones.
The Animation Clip list below determines all animation clips that are part of this Reaction Entry. If the conditions are successful, a random clip will be picked (without repetition) from the list.
A Reaction asset also allows to execute Instructions upon starting and/or exiting the animation. These instructions are guaranteed to be executed, even if the Reaction being played is canceled.
- The On Enter instructions play as soon as the animation starts playing.
- The On Exit instructions play as soon as the animation stops, or the reaction is canceled.
At any given point a Reaction can be forced on a character using the Play Melee Reaction instruction.
All you need to specify is the character that's going to play the Reaction and information necessary for the correct selection of the entry.