Jump to content

Detect Weapon Swing


gezegond

Recommended Posts

Hello. I would like to fire off a script whenever the player swings a certain weapon, regardless of it hitting anything or not. Is that possible to do using the animation functions? I noticed weapons don't have any useful events associated with them unfortunately...

Link to comment
Share on other sites

@gezegond

In the BETA release of SKSE we have these functions & events.

Function RegisterForActorAction(int actionType) native
Function UnregisterForActorAction(int actionType) native

; ActionTypes
; 0 - Weapon Swing (Melee weapons that are swung, also barehand)
; 1 - Spell Cast (Spells and staves)
; 2 - Spell Fire (Spells and staves)
; 3 - Voice Cast
; 4 - Voice Fire
; 5 - Bow Draw
; 6 - Bow Release
; 7 - Unsheathe Begin
; 8 - Unsheathe End
; 9 - Sheathe Begin
; 10 - Sheathe End
; Slots
; 0 - Left Hand
; 1 - Right Hand
; 2 - Voice
Event OnActorAction(int actionType, Actor akActor, Form source, int slot)
EndEvent

I suspect an actiontype of 0 would be what you want.

 

It does have the drawback of requiring a BETA version of SKSE. But I can attest that this particular set of functions & event work and work well.

 

EDIT: Forgot to mention that these are from the Form Script.

Edited by IsharaMeradin
Link to comment
Share on other sites

Thank you both for your replies. The problem with both of these is that they don't just run on a specific weapon, they run on all weapons.

 

Basically, I want to have a special axe that destroys shacks in my mod. I have the destruction working as a spell right now, but thought it would make more sense from gameplay and immersiveness perspectives for it to be an axe rather than a spell.

 

But since this is a rarely used ability, I wouldn't want to run a script for all player weapon swings for it. Guess I'll just stick with the spell.

 

Again, thank you for your replies. They might come handy at a later time. :smile:

Edited by gezegond
Link to comment
Share on other sites

With Matthiaswagg's event within Player Alias Script, use it in conjunction with OnObjectEquipped(). Within OnObjectEquipped, register for the animation even of a weapon swing if the equipped weapon is the special axe. Have OnObjectUnequipped() to unregister for the animation event when the axe is removed.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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