I have been writing a script for an ability, which counts the times you have hit the same actor, in case you hit another actor then the count is reset.
I thought about something like this.
if player.IsAttacking == 1 && player.IsCasting == 0 && player.IsPowerAttacking == 0 set rPlayerTarget to GetCrosshairRef ;Get your reference if rPlayerTarget.getdistance rPlayerTarget <= 100 if aaKSourceQ.[censored]2 == 1 set aaKSourceQ.[censored]2 to 0 if rPlayerTarget == rFocusedTarget ;Same reference? set sStackCount to sStackCount + 1 ;good to go. else if rPlayerTarget.IsActor == 1 ;not same ref, but wait it's the reference an actor? set rFocusedTarget to rPlayerTarget ;Not same reference, switch actors set sStackCount to 0 ;and clear stacks endif endif endif endifendif
Works good, added the actor check so the reference doesn't switch and clear the stacks if you aim a door or an object.
However sometimes the reference is lost (seems to happen when the actor staggers or recoils, this however is unconfirmed and may be pure coincidence) , i set the script so it prints to the console both references, and when this happens it prints
If anyone of you could give a hand or some advice, well that would be awesome indeed...
If the player manages to get say 10 stacks, it could randomly reset, and the player would need to start from 0 again, that's the main issue.
Thanks for any help and thank you for reading.
Until next time! or reply!.