Way to detect Power Attacking in a script?

Post » Mon Nov 19, 2012 5:16 pm

I spent 2 hours last night trying various ways to detect when an actor is power attacking in a script. The only way I could find was to use a spell with conditions and then check if the spell was effecting the actor. However a lot of the time this process was two slow (conditions are only checked once ever 1000 milliseconds) and would not catch the power attack “state” before the attack connected.


Has anyone found ANY other way to detect a power attack in a script? There is getAnimationVariableint("Isattacking") so we at can detect if the actor is attacking but no IsPowerAttacking function.


I even tried HasKeyword(PowerAttackForward) but as would be expected that did not work (proper use is GetAttackType = keyword PowerAttackForward and only for use in conditions).


I thought about putting some kind of result script on the dialogue/voice effect for power attacking, but even if that would work that should be a LAST resort.

I wish the perk system had a way to change a variable (actor faction, global or script or even and actor value) as the perk conditions detect changes IMMEDIATELY unlike the conditions in spells. Giving an actor an ability via the perk system would do the trick EXCEPT that there are NO conditions for perks in the abilities. As soon as you pick the perk you get the ability (no condition check). :wallbash:


Edit: to clarify: What I mean is that under perks, the tab that gives the spell or ability to the perk owner has no conditions. So there would be no detection for the power attack. The moment you pick the perk the spell/ability is given to you.... :mad:
User avatar
Taylor Bakos
 
Posts: 3408
Joined: Mon Jan 15, 2007 12:05 am

Post » Mon Nov 19, 2012 5:20 am

I know that the http://www.creationkit.com/OnHit_-_ObjectReference event has an abPowerAttack argument that can be used to detect this within an OnHit event, but that won't help you detect it beforehand.

Isn't there a perk that slows down time if the player is blocking while their opponent it power attacking? I don't have access to the Creation Kit at the moment, but if I'm remembering that perk correctly you might be able to find something useful by taking a look at it.

Cipscis

EDIT:

Ah, just saw your comment about perk conditions (not sure how I missed it the first time). Perhaps there's some other way to cause a perk to run code? If I remember correctly (again, no CK access right now) there's a type of perk that sets a quest stage, perhaps that could be used along with a quest stage result fragment?

Cipscis
User avatar
Wane Peters
 
Posts: 3359
Joined: Tue Jul 31, 2007 9:34 pm

Post » Mon Nov 19, 2012 7:45 am

Well, there is the condition function IsPowerAttacking. I know you can't use it in a script, but then I found this gem:
http://www.creationkit.com/Passing_Conditions_to_Papyrus
User avatar
Michelle davies
 
Posts: 3509
Joined: Wed Sep 27, 2006 3:59 am

Post » Mon Nov 19, 2012 7:50 am

Well, there is the condition function IsPowerAttacking. I know you can't use it in a script, but then I found this gem:
http://www.creationkit.com/Passing_Conditions_to_Papyrus

He already stated that this only way he is doing it. It's just that the delay is too big, a second is already too slow for combat mod


@spookyfx:
I thought I gave you the event awhile back, didn't I? did I? Maybe not :P
Anyway, here it is

RegisterForAnimationEvent(actor, "weaponSwing")Event OnAnimationEvent(ObjectReference akSource, string asEventName)if(akSource == actor && asEventName == "weaponSwing")  bool pAttack = actor.GetAnimationVariableBool("bAllowRotation")  if(pAttack)   Debug.MessageBox("Power Attack")  endifendifEndEvent
User avatar
i grind hard
 
Posts: 3463
Joined: Sat Aug 18, 2007 2:58 am

Post » Mon Nov 19, 2012 2:10 pm

The approach suggested by http://www.gamesas.com/user/419274-rongphale/ seems to be correct one. I detect attacks that way but never tried detecting only power attacks. I think there is some perk that slows time when you block and someone is making power attack agains you. It slows down time for a second. Worth investigeting.
User avatar
Gemma Woods Illustration
 
Posts: 3356
Joined: Sun Jun 18, 2006 8:48 pm

Post » Mon Nov 19, 2012 4:21 pm

That is interesting ---> bool pAttack = actor.GetAnimationVariableBool("bAllowRotation")

mmmmm.... will try it, but this forward leaping power attack I am trying to detect is not a rotation type animation... hey but THANKS for getting me out of a dead end and giving me someting to try!

he he... time to boot up the CK....


He already stated that this only way he is doing it. It's just that the delay is too big, a second is already too slow for combat mod


@spookyfx:
I thought I gave you the event awhile back, didn't I? did I? Maybe not :tongue:
Anyway, here it is

RegisterForAnimationEvent(actor, "weaponSwing")Event OnAnimationEvent(ObjectReference akSource, string asEventName)if(akSource == actor && asEventName == "weaponSwing")  bool pAttack = actor.GetAnimationVariableBool("bAllowRotation")  if(pAttack)   Debug.MessageBox("Power Attack")  endifendifEndEvent
User avatar
kitten maciver
 
Posts: 3472
Joined: Fri Jun 30, 2006 2:36 pm

Post » Mon Nov 19, 2012 5:30 pm

:ohmy: omg...that ......THAT FREAKING WORKED!


( You are like some kind of GetAnimationVariable Deity!)

:bowdown: ---,--'-@ RONGPHALE @-;-'--,-


Do you have any idea WHY the power attacks use this ("bAllowRotation") variable even if it is not a rotating animation?
I wonder is the bAllowRotation referring to how power attacks will not allow you to "walk" your actor around as you attack?
I would have thought that bAllowRotation = false then... for power attacks because the actor cannot walk or run independent of the power attack animation unlike normal attacks
User avatar
Natalie Harvey
 
Posts: 3433
Joined: Fri Aug 18, 2006 12:15 pm

Post » Mon Nov 19, 2012 8:32 pm


Do you have any idea WHY the power attacks use this ("bAllowRotation") variable even if it is not a rotating animation?
I wonder is the bAllowRotation referring to how power attacks will not allow you to "walk" your actor around as you attack?

If I knew for sure then I wouldn't be here making mods, but sitting in Bethesda Studio making games :D

One can only speculate.
My theory is, when character is moving, the lower half body (from waist down) moves/rotates in the direction of character's movements while the upper half kinda stands still.
You don't want upper half body rotate while doing awesome power strike animation, yes?

Anyway, I'm glad it worked for you. I am no deity or anything :P, just digging it out of behavior files
User avatar
Bethany Watkin
 
Posts: 3445
Joined: Sun Jul 23, 2006 4:13 pm


Return to V - Skyrim