Timed Directional Attacks
For OpenMW 0.48.0+
-- Solthas, 20230121

Time your attacks well to get a buff depending on which directional attack you use. Attack again too soon, and you'll fumble. Wait a little longer for a double buff.

[RECOMMENDATIONS]
This mod supercedes and replaces my Directional Attack Stat Buffs. Probably do not use both together.

My other weapon-combat-buff mods may be used with this one! Weighty Charged Attacks in particular is highly recommended.
Weighty Charged Attacks: Get extra weighty charged attacks, slowing you while you charge up, in order to get grounded accuracy buffs, or jumping strength buffs.
Charge Attack Parry: Turn your weighty charged attacks into backpedaling blocks or sidestepping dodge attacks.
Staff-Spell Stat Buffs: Get spellcasting bonuses if you use a staff when you start spellcasting. Or at least have one equipped.

[INSTALLATION]
Note: This mod only works with 0penMW 0.48+, and is only tested on OpenMW 0.48.0.

Unzip the mod subdirectory wherever you put your mods, or on a datapath listed in openmw.cfg (default Windows location C:\Users\...\Documents\My Games\OpenMW), and check the checkbox in OpenMW Launcher > Data Files > SolTimedDirAttacks.omwscripts

[DESCRIPTION]
This mod uses what Lua API hooks currently exist for OpenMW 0.48 to... start a timer when you release an attack. Then, when you start charging your next attack, depending on how long you waited, and depending on which directional attack you chose, you'll get a different buff or debuff.

As it stands, the way it works is as follows:
	Charge and release your first attack. Nothing happens, but a timer starts ticking when you release the attack. 
	The timer interval is essentially 1/(weaponSpeed*AttackTimerMultiplier), so a faster weapon and a higher timer multiplier will cause the timer to progress through its stages faster. (For example, let's use a 100% speed weapon with a 1.0 timer multiplier. This will have a timer progressing through one stage per second.)
	Stage 0 (atk again between 0-1 s) (before a single interval has passed). You fumble the attack, losing some fatigue, and losing speed for a few seconds, to drive the impact home. Both of these are configurable in settings.
	Stage 1 (atk again between 1-2 s). You get a buff depending on which directional attack you use. Agility for Thrust. Weapon skill for Chop. Defense for Slash. 
	Stage 2 (atk again between 2-3 s). You get 2x that buff.
	Stage 3 (atk again any time after 3 s). No buffs or anything. It's just a normal attack.
	
[IMPLEMENTATION]
Every frame, the script checks whether you're using the use action. If so, then the very first frame of that, it checks if you've got the correct weapon setup. If so, then, when you release the use key, on the first frame of that, starts a timer and waits for you to trigger your next attack. 

Lua API can't detect which directional attack you use, so I have tied it to the default controls. If you attack while standing still or moving diagonally, you "Chop". If you attack while moving forward or backward, you "Thrust". If you attack while moving sideways, you "Slash".

The timer interval and buff duration both depend on your weapon's speed and the configurable Attack Timer Multiplier (paceMult) setting. The buff/debuff duration should be slightly longer than the time it takes for the timer to reset to the "no buff" state for your next attack. If you trigger a new buff state before then, the current buff will be removed, and a new buff with a new timer will be applied.

[CONFLICTS]
I hope there aren't any. I've set this mod up so that it doesn't change any values absolutely, and so that it tracks its state internally. I suppose it'll conflict with mods that change how you charge attacks.

[CREDITS]
Me. JohnnyHostile and Danca for discussion and design feedback.