This reeling effect can happen in classic Daggerfall whenever player takes a substantial amount of damage (not sure of actual %). I'm pretty sure I've seen it happen when surviving big falls as well, not just from enemy damage. I'd have to check, but I think it also freezes the ability of the player to move for a moment.
Rather than add a property to EnemyAttack, a better solution might be to sample the state of the player's health and fire head swaying after a significant loss. For example, do something like this in your HeadSwayer component.
Code: Select all
// Fields
int previousPlayerHealth;
// Update()
const float triggerSwayOnHealthPercentLost = 0.15f;
int maxPlayerHealth = GameManager.Instance.PlayerEntity.MaxHealth;
int currentPlayerHealth = GameManager.Instance.PlayerEntity.CurrentHealth;
if (currentPlayerHealth < previousPlayerHealth - maxPlayerHealth * triggerSwayOnHealthPercentLost)
{
// Perform head-sway methods - pass in total % loss if using this to inform severity of sway
}
previousPlayerHealth = currentPlayerHealth;
That would allow effect to fire after other big hits as well, not just from enemy damage. I recommend spending some time with classic to observe its handling of this and try to implement as close to classic as possible. It would also be nice to have another toggle setting for this so users can disable if preferred (e.g. if it makes them feel motion-related discomfort).
MeteoricDragon wrote: ↑Sun Apr 01, 2018 6:17 pm
Also, I think I could script the player falling to the ground.
Can you elaborate on falling to the ground in this context? The only time I'm familiar with player falling to ground is after death, which is already in place.