gezegond Posted February 1, 2015 Share Posted February 1, 2015 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 More sharing options...
Mattiewagg Posted February 1, 2015 Share Posted February 1, 2015 http://www.creationkit.com/OnAnimationEvent_-_Form Be sure to register for it (the function for registering is on that page). Put it on the player alias script. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 2, 2015 Share Posted February 2, 2015 (edited) @gezegondIn 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 February 2, 2015 by IsharaMeradin Link to comment Share on other sites More sharing options...
gezegond Posted February 2, 2015 Author Share Posted February 2, 2015 (edited) 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 February 2, 2015 by gezegond Link to comment Share on other sites More sharing options...
ArronDominion Posted February 2, 2015 Share Posted February 2, 2015 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 More sharing options...
IsharaMeradin Posted February 2, 2015 Share Posted February 2, 2015 Arron Dominion has it right. The OnObjectEquipped and OnObjectUnequipped events would be perfect candidates to register and unregister for either the animation event or the actor action event. Link to comment Share on other sites More sharing options...
gezegond Posted February 2, 2015 Author Share Posted February 2, 2015 Alright guys thanks. :thumbsup: Link to comment Share on other sites More sharing options...
Recommended Posts