Jump to content

[LE] Fastest way to catch a weapon swing by script


iamzip

Recommended Posts

I'm trying to catch via script when the player swings their weapon. I've tried OnActorAction (action 0, weapon swing), OnAnimationEvent (weaponSwing and PowerAttack_Start_End), and OnKeyDown (registering for the attack left and attack right keys), and so far each of these fires roughly when the swing would make contact with an enemy rather than at the beginning of the swing. Is there a better way to go about catching a swing earlier in the animation without OnUpdate loops checking animbools? I really would rather have this be event driven.

 

And as a secondary question, how do I collect the weapon speed of unarmed? I've tried the usual methods and it returns 0 for speed since I'm assuming it's not seeing unarmed as a weapon.

Edited by iamzip
Link to comment
Share on other sites

Unfortunately, you cannot catch the 'Animation' at the beginning, there is no way that the game engine can know what you are about to do.

The "RegisterForAnimationEvent" will fire only when the animation it's been executed or when it has finish been executed.


"Is there a better way to go about catching a swing earlier in the animation without OnUpdate loops checking animbools"

No, well to be more precise, i couldn't find any workaround to this, and i did bother with it for quite some time, since it was a "must" for 1 of my mod's equipment's ideas, but because of this it was never materialize...


"OnUpdate loops" won't help you either with this, since the "OnUpdate" will again fire much later than the "RegisterForAnimationEvent", when the 'Animation' has already been executed.


For your second question i can't help you, i've never use / experiment with it, i have an idea on how to do it but it's better to get the opinion from someone that has done it or 100% knows.

Edited by maxarturo
Link to comment
Share on other sites

Unfortunately, you cannot catch the 'Animation' at the beginning, there is no way that the game engine can know what you are about to do.

The "RegisterForAnimationEvent" will fire only when the animation it's been executed or when it has finish been executed.

Interesting, reading the CK description of the animation events, specifically the "weaponSwing", it read as though the event fired at the start of the animation rather than the end. I might revisit onactoraction to see if maybe my code's logic was the problem. Thanks for the response.

Link to comment
Share on other sites

Don't take for granted everything you read on CK's page, there are so many inaccurate descriptions, papyrus functions bugs not mentioned and so many other issues not documented.

You can only be sure after you have tested those functions through a number of different scenarios and / or circumstances.

Link to comment
Share on other sites

I would think that OnKeyDown would be fastest, as theoretically it fires as soon as you press the key. The problem with Skyrim's script engine though is that if there are too many scripts running at once, it can create script lag. Testing of course is the only way to be sure.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...