
Action Based Reaction System(Modern)

Prerequisites
Make sure you have understood and have everything in the Fundamental Section Installed, everything described in this guide is under the context that you either already understand terms such as DAR, AMR, motion data or you have read about them in the fundamental section; if you aren’t aware of that Check it out Here :

Additional Prerequisites
These prerequisites are just base frameworks that do not require additional tweaking inside them, Simply Install through a mod manager PREFERABLY Mod Organizer 2. The customizations are done in the Gameplay changing Mods
Duffbeer’s Hit Animation Framework
These hit events are applied to all Humanoid Actors in the behaviors. Originally Skyrim Does not have basic hit events, specifically, data that can be detected by the behaviors upon every hit. This adds Specific Hit events based on how the attack is triggered, specifically via weapon type and Attack Type(Regular or Power attack)
Maxsu’s On Hit Animation Framework
Both Humanoid Actors and All Creatures can register these events, although it’s much more simple than Duff’s Hit framework that it only sends 1 event for all type of hits, In the Reaction Based Setup, I only applied these events for creatures so Humanoid can take full advantage of Duff’s Hit framework
*On why I haven’t fully moved to Duff’s Hit framework yet; Creature behaviors are tricky, there is no stable way to implement custom creature animations since the way they were made, there is a lot of overlap with behavior references for several creatures notably the 4 legged ones. For example, Sabrecats, Bears, Wolves and Skeevers have their own main behavior but for certain functions such as attacks, they all use “quadruped.hkx” With how nemesis works, wherein it converts the hkx to readable xmls this is not possible since we cannot have 2 folders of thesame name or 2 files of thesame name in one folder. Say if you insisted and made them, the problem would have been that skeevers would reference the new xml edits and would instantly crash since they have different bonedata than the other 4 legged creatures.
Meaning we literally cannot create new animation names since nemesis is out of the picture and are limited to just editing these behaviors, like retargetting and restructuring where certain staggers go towards. The effort isn’t worth it for it’s output. Therefor different reaction events based on attacktype or whatnot won’t really do much given the limited selection for animations.
Distance Based Combat By DuffBeer
The Current AI decision making we originally have were only determined by chances; how frequent certain attacks are which is all configured and put in each actor’s “Combat Style” This Prerequisite makes NPC ai make decisions based on their distance to their target actor.
Originally used for AI attack types but, because of how adaptive ai events are, This is used heavily on this whole ecosystem’s core mod which is Project Impact. The purpose of this mod for The reaction system is the decision the NPCs do when they decide to dodge out of the stagger.

The Rationale behind the Mod’s Structure
“Why can’t we just code AI to be smart?” “Why can’t we just have a simple reaction set?” “Why did the original devs leave out basic reaction events, they’re lazy”
So why do all these questions exist? Why did mods that really just have a very basic principle such as this have to be made? This is because balancing a reaction system is a hard ordeal. You can’t simply just say “Well just make NPCs smart” The question is not What to do but it’s How to do it.
Now Bethesda do have the conditions function in their CK, but utilizing that alone still gives us the problem that there would be too many animation filenames to be made.
But We now Dynamic Animation Replacer, We have solved this problem since we can dynamically replace the animations based on the game’s variable based conditions. Health/Level/Weapon Equipped, once there is a change in either of these, The animation is Swapped.
The one subtle but powerful condition DAR has is the Random() condition, you can literally give a percent chance to certain AI in specific conditions such as health reaching 50%, if their level is above 25 and many more conditions the options are limitless. This is literally how Game AI functions, and we are able to do this through simple folder manipulation.
So finally we arrive to the last question; why is the reaction system’s structure so large? Ultimately while it is a gameplay changing mod in itself, it is also a framework. There will be constant creations of new characters, enemies, bosses. The basic Principle is, for every hit = reaction, but it doesn’t end there, Due to another tool in the form of AMR, you can create special annotations per animation.
The formula is kept simple but by adding different factors, such as creating a folder for bosses to play a reaction with a “blockstart” annotation; you can give these enemies a chance to counter on very specific occasions. On why it has to be done in the folders and not in the code itself, we must remember that ALL HUMANOID ACTORS share thesame logic, if you apply it through code, ALL enemies would be smart, well not really a bad thing, however in designing certain levels we would want a form of hierarchy when it comes to difficulty. Via DAR all you need is folders, to type the rules in a text and place the animations you want, therefor you have unlimited possibilities for boss/enemy AI.

Project Impact 2.0 The Working Principle (for all versions from 2.0 and above)

The main Difference about this vs the previous 1.0 version is that the reaction set is reduced to 3 from 5. It’s Also more branching than Linear compared to the 1.0 because of Duff’s New Hit framework.
A regular attack will Chain the reaction to the next numbered reaction type, a power attack will transition the reaction to a heavier stagger state.
For Consistency, the stagger doesn’t just go back to the default regular reactions.

Stagger 1 -> Hit 2
Inconsistency Without Continuous Branching states
Behaviors are mostly transition based. The only way out of a specific state is a transition. A transition is created by adding instructions in a state where you label an exit state that happens when triggered by an Event. The whole default behavior is one big state itself which all stagger states can go back to as soon as the animation is finished. The only way out of these staggers is whatever transition data is coded in that state.
We take this logic and translate it into a chainable reaction system, In order to keep consistency, 3 file types were necessary


Stagger 1 -> Staggerset1
With Dedicated Filetypes, You create consistent branching staggersets
another incentive to this system is the customization, With Attack Behavior Mods focusing on Combo Systems, You can Create whole consistent Reaction Sets that you want that complements with your attack moveset combos

Creating Your Own Animation Reactions
FOR ANIMATORS, So you want to make your own reactions, have joined or gotten into animating and grabbed the animation Rigs on the Skyrim Guild Discord or through one of the creators.
AMR Ready Rigs with Motion Data and Annotation Exports
For beginners Who are trying to get into animation, The best Rig to grab is the Distar AMR ready Rig, all you will have to worry about is to come up of your design and less about the exporting and annotation methods.
The Principle is Mostly thesame with any Rootmotion Animations. Create the action including the recovery to the Idle state. Do not just stop at the staggered pose, the game won’t make a transition for you, There is no Transition interval similar to attacks, It is highly important that these behaviors can transition to the next state as fast as possible so it is less floaty and more responsive to player inputs.

Animation File Nomenclature
Swords
Regular Reactions
1h_hit1.hkx
1h_hit2.hkx
1h_hit3.hkx
Stagger Reactions
* Reaction Set after the 1st Power attack
1H_1st_stagger.hkx
1H_1st_staggerset1.hkx
1H_1st_staggerset2.hkx
1H_1st_staggerset3.hkx
* Reaction Set after the 2nd Power attack
1H_2nd_stagger.hkx
1H_2nd_staggerset1.hkx
1H_2nd_staggerset2.hkx
1H_2nd_staggerset3.hkx
* Reaction Set after the 3rd Power attack
1H_3rd_stagger.hkx
1H_3rd_staggerset1.hkx
1H_3rd_staggerset2.hkx
1H_3rd_staggerset3.hkx
Daggers
Regular Reactions
1h_hit1_dagger.hkx
1h_hit2_dagger.hkx
1h_hit3_dagger.hkx
Stagger Reactions
* Reaction Set after the 1st Power attack
1H_1st_stagger_dagger.hkx
1H_1st_staggerset1_dagger.hkx
1H_1st_staggerset2_dagger.hkx
1H_1st_staggerset3_dagger.hkx
* Reaction Set after the 2nd Power attack
1H_2nd_stagger_dagger.hkx
1H_2nd_staggerset1_dagger.hkx
1H_2nd_staggerset2_dagger.hkx
1H_2nd_staggerset3_dagger.hkx
* Reaction Set after the 3rd Power attack
1H_3rd_stagger_dagger.hkx
1H_3rd_staggerset1_dagger.hkx
1H_3rd_staggerset2_dagger.hkx
1H_3rd_staggerset3_dagger.hkx
Axe
Regular Reactions
1h_hit1_axe.hkx
1h_hit2_axe.hkx
1h_hit3_axe.hkx
Stagger Reactions
* Reaction Set after the 1st Power attack
1H_1st_stagger_axe.hkx
1H_1st_staggerset1_axe.hkx
1H_1st_staggerset2_axe.hkx
1H_1st_staggerset3_axe.hkx
* Reaction Set after the 2nd Power attack
1H_2nd_stagger_axe.hkx
1H_2nd_staggerset1_axe.hkx
1H_2nd_staggerset2_axe.hkx
1H_2nd_staggerset3_axe.hkx
* Reaction Set after the 3rd Power attack
1H_3rd_stagger_axe.hkx
1H_3rd_staggerset1_axe.hkx
1H_3rd_staggerset2_axe.hkx
1H_3rd_staggerset3_axe.hkx
Maces
Regular Reactions
1h_hit1_mace.hkx
1h_hit2_mace.hkx
1h_hit3_mace.hkx
Stagger Reactions
* Reaction Set after the 1st Power attack
1H_1st_stagger_mace.hkx
1H_1st_staggerset1_mace.hkx
1H_1st_staggerset2_mace.hkx
1H_1st_staggerset3_mace.hkx
* Reaction Set after the 2nd Power attack
1H_2nd_stagger_mace.hkx
1H_2nd_staggerset1_mace.hkx
1H_2nd_staggerset2_mace.hkx
1H_2nd_staggerset3_mace.hkx
* Reaction Set after the 3rd Power attack
1H_3rd_stagger_mace.hkx
1H_3rd_staggerset1_mace.hkx
1H_3rd_staggerset2_mace.hkx
1H_3rd_staggerset3_mace.hkx

GreatSwords
Regular Reactions
2h_hit1.hkx
2h_hit2.hkx
2h_hit3.hkx
Stagger Reactions
* Reaction Set after the 1st Power attack
2H_1st_stagger.hkx
2H_1st_staggerset1.hkx
2H_1st_staggerset2.hkx
2H_1st_staggerset3.hkx
* Reaction Set after the 2nd Power attack
2H_2nd_stagger.hkx
2H_2nd_staggerset1.hkx
2H_2nd_staggerset2.hkx
2H_2nd_staggerset3.hkx
* Reaction Set after the 3rd Power attack
2H_3rd_stagger.hkx
2H_3rd_staggerset1.hkx
2H_3rd_staggerset2.hkx
2H_3rd_staggerset3.hkx
BattleAxe
Regular Reactions
2h_hit1_axe.hkx
2h_hit2_axe.hkx
2h_hit3_axe.hkx
Stagger Reactions
* Reaction Set after the 1st Power attack
2H_1st_stagger_axe.hkx
2H_1st_staggerset1_axe.hkx
2H_1st_staggerset2_axe.hkx
2H_1st_staggerset3_axe.hkx
* Reaction Set after the 2nd Power attack
2H_2nd_stagger_axe.hkx
2H_2nd_staggerset1_axe.hkx
2H_2nd_staggerset2_axe.hkx
2H_2nd_staggerset3_axe.hkx
* Reaction Set after the 3rd Power attack
2H_3rd_stagger_axe.hkx
2H_3rd_staggerset1_axe.hkx
2H_3rd_staggerset2_axe.hkx
2H_3rd_staggerset3_axe.hkx

Creating Balance
NPC AI is actually quite harder to balance than the player. But because of DAR and it’s feature to add a percentage chance, to interrupt the stagger and let the AI perform counter decisions, Staggerlocking is prevented and leads to more engaging gameplay
Interruption Transitions
Adding the Blockstart annotation Instructs AI to transition to the Block State ending the reaction Chain
DBC Automatically Gives AI a chance to dodge out of Staggers when they are lightly staggered with weak reactions
Use Special Annotation Patches from project impact to perform Counter Attacks
PI_Hogan to trigger attacks
PI_BlockSignal to Trigger Defensive Decisions e.g. Block/Dodge

Implementing Balance
DAR Conditions
The Best Way to Create the balance you prefer is to decide between 3 things:
-Actor Proficiency
-Actor Health Level
-Percent Chance of Usage
Looking for actor form IDs can be quite the work, the main focus is health Level and Chance to Occur
The best code for the health condition is: “ NOT IsActorValuePercentageLessThan(24, 0.xx) “ just copy this code in your _conditions.txt file and edit the “xx” to whatever percentage, always add the AND then edit the Random(0.XX) condition accordingly
When Creating different Conditions per health level
For more organization, Separate your reaction files per Weapon Type, You will only really need one folder to house all the main Reactions. It is in the counter reaction sets that you might make several since you’re using the randomizer function that only gives a % chance occurrence and for more dynamic gameplay, change the % chance based on health levels.
Since the condition is a positive( NOT IsActorValuePercentageLessThan(24, 0.xx)) and health usually starts full then is depleted to 0, the higher levels have to take priority. Because by this logic, the lower levels are always true. If High levels are on the bottom, you will never trigger the chances and animations inside those folders as the low level folders would play all the time. To make sure this dynamic system based on health level is flawless and consistent, High Health Folders should have higher numbers, because when health gets lowered and the conditions no longer meet with in game levels, the logic starts to go to the next highest rated folder, therefor gradually reading your folder conditions consistently in a descending manner.
Here’s an Example, if you have Played Elden Ring, the first Boss, Margitt the Fell Omen starts pulling his Hammer when you put him around 55-60% health, this can be done in Skyrim by using Project Impact 2.0, creating a folder with Reactions with the counter annotations and putting these conditions:
NOT IsActorValuePercentageLessThan(24, 0.55) AND
IsActorValuePercentageLessThan(24, 0.60) AND
Random(1)
what this condition means is that once the enemy goes down to 55-60% health, there’s a 100% chance that the counter reaction files inside this fodler plays. Many More combinations can be added through this. In a way, this is How AI is done, but through Folder manipulation instead of having to learn C++ code. Project Impact Streamlines this for us and the condition combinations are limitless

Reactions for the Player
Players By Design Share the same System when it comes to the Reactions
Any Unguarded basic attack Causes Players to Flinch. Unguarded Power attack Causes Players to stagger much more distinctively. When in the reaction state, if the Player gets hit again, the stagger gradually gets heavier. Like all other NPCs, the player is Subject to getting Combo Chained to, “but how are we supposed to deal with Staggerlocking?” The balance will be tackled on later on this thread.
Punishment through Heavier Staggers
The punishment is important in this system as it ensures Players that being cautionary is Still highly important in Action Games. Also it makes sure the tempo of Combat isn’t just on One Actor, the tempo can shift especially with careless decisions such as Randomly just spamming attacks
Punishment through heavier staggers can happen in three ways:
-the Actor gets chained by Several Attacks
-the Actor gets chained or Hit by a Power attack
-the actor gets interrupted by a bash, a charge or a counter attack.
The Player’s stagger behavior or Animation also gradually changes. So you won’t see them getting pushed immediately, it usually starts off as a heavy stagger and only gets gradually more impactful once the decisive hits land

BALANCING PLAYER STAGGERS
The one Annoyance and Fear most users and modders think about is balancing. People come up of all kinds of mechanics on when the stagger is triggered, but the problem was never the trigger, The problem is the options and the next steps for you once you’re in that state. There were never options to beat the staggers or have a percent chance to fight against it. So Staggerlocking became prominent especially in big fights and one versus many fights
Using the behavior states concept
Many different input systems can be created purely in the behaviors, We have created combo systems for attacks purely just through behaviors such as “Light + Light + Heavy”.
Another system that can be created was a “tap rapidly to recover” system. How this was implemented is When you press any action button such as BLOCK, ATTACK, CROUCH and a dedicated RECOVER input, these are events that you can use to code transition rules in the behavior states, pressing one can transition you to another state, so the intention was to make sure to tap several times to attain recovery.
To make this happen, the first few transition codes were ruled to transition to a shorter staggered state, then gradually the next succeeding states are enumerators which gives you a random chance for the recovery to play, the more states you transition to, the greater the chance for recovery.
Then this system’s number of required transitions change depending on what Stagger you started pressing the recovery buttons
TAPPING RECOVERY BUTTONS ON A SMALL STAGGER
In smaller staggers, you will only have to rapidly tap the recovery buttons for a short amount of time in order for the player to recuperate to default State.
TAPPING RECOVERY BUTTONS ON A HEAVY STAGGER
In heavy staggers, you’ll need to tap the recovery buttons more before your player fully recuperates
With all these concepts combined, you get a much fairer balance of gameplay. You can put enemies in different states based on your customization of their reaction sets, but you are also not fully safe, and can get punished. But even as you do, if you think fast enough and make quick enough decisions, you’re able to fight it off and have a chance to recover. The combination of these elements brings much more interactivity to the gameplay.

THE CONTENTS OF PROJECT IMPACT
Meshes - Contains all the Animations Inside
Nemesis_Engine - Contains the Behavior Patch
SKSE - Contains the the configuration text file for the recovery button

Inside the Meshes Folder
Once you navigate to this Directory
Another Thing about DAR is the option to have two of thesame animation file names in the game, and is dynamically switched through conditions, the files in the animations folder are just the base animations, which you need for the behaviors to initially recognize, once there, you can then on create your reaction and animation packs inside the DAR folders
Now we move to the first section of the DAR folder which is the Catalog, These folders are undetected by the game, they’re include so you have an initial selection of animations you can use to replace the active ones if you want if you don’t want to create your own
NEXT is the CACHE Folders, these are just all the Files inside the main animations folder, which are re-added inside DAR to make them load faster in game, since DAR is much more quick to cache these animations than waiting for nemesis to load
NEXT is the core folders which are the reaction sets, technically since they are all different filenames per weapon type, you can put them all in one folder, however, it is better to separate them so navigate them is easier when doing customization.
Separating Each Reaction type per folder makes it much easier to add the balancing/counter attack chances later on. Here you see you can add folders in between the reaction types. you can add more reaction sets in the sword for example, for variety or you can mainly do it so that you have a cleaner way to implement the counter attack chances.
FOR EXAMPLE IN THE ILLUSTRATION ABOVE, THE FOLDERS WITH NUMBERS ENDING IN “53” ARE COUNTER REACTION CHANCES FOR ALL BOSSES OF THE MOD VIGILANT
THIS IS THE REASON FOR THE FOLDER SETS INSTEAD OF A HARD CODE SINCE YOU CAN CREATE THE DISTINCTION BETWEEN A BOSS AN NPC OR JUST FOR SOME SPECIFIC ACTOR
You can create a new folder for example something that ends in “54” just above the vigilant boss folders, for a specific actor of your choice.
here is a template of the DAR reactions folder for you to experiment on creating your own reaction sets

Inside the SKSE Folder
There is an INI file containing the configuration to change the recover button, other buttons such as attack/block/crouch also serve as a recovery button but. Jump couldn’t be utilized due to the hard code behavior of the jumprootkey to implement the z-axis movement everytime it was pressed.
“staggerdodgestart’ is just the name of the animation event or the event to trigger the recovery in the behaviors
what you want to edit is the key, it has to be typed in keycode, the keycodes are on that link provided in the notes.
INSIDE THE NEMESIS BEHAVIOR FOLDER
The 0_master behavior is the main behavior for all actors, this is active during the default, unsheathed, idle jumping and swimming behaviors, why I did not put the player behaviors there is to make sure the player staggers only happen in Unsheathed mode in combat. Especially since 1 vs many combat is more common and Multiple cutscenes in the game have players go through certain staggers. This prevents Project Impact events from conflicting with these cutscenes as well as make sure no unwanted staggers happen pre-combat.
IF YOU ARE INTERESTED IN GETTING INTO BEHAVIOR MODDING, HERE IS THE BEHAVIOR RESOURCE FOR PROJECT IMPACT SHOULD YOU WANT A REFERENCE

NOTES on Conflicts and Possible Issues
Problems with the mod : Zxlice Backstab and Pary due to how both utilize a hit event every time an attack successfully lands. The problem is the zxlice mod fails to send the events it needs so it will revert to the default state, there’s no known fix and there’s no Resource to this behavior project so I cant find a way to Fix it
With regards to the 2021 Anniversary Edition Support, it will mostly work since all the requirements and prerequisites have the versions for it, but the built in dll for this mod was made for SSE and plans to update it may take a while. The dll was only for the recovery input though so you can still use the other recovery buttons like attack/block/crouch