Jump to content

[LE] "KillMoveStart" AnimationEvent


Recommended Posts

Trying to detect the player entering a KillCam move I came across this reddit thread. I used that approach in my mod for the following script:

 

Scriptname MyScript extends Quest

Actor Property PlayerRef Auto

Event OnInit()
  RegisterForAnimationEvent(PlayerRef, "KillMoveStart")
  RegisterForAnimationEvent(PlayerRef, "KillMoveEnd")
EndEvent


Event OnAnimation(ObjectReference akSource, string asEventName)
  If (akSource == PlayerRef && asEventName == "KillMoveStart")
    Debug.Trace("KillMove started")
  ElseIf (akSource == PlayerRef && asEventName == "KillMoveEnd")
    Debug.Trace("KillMove ended")
  EndIf
EndEvent

Function Stop()
  UnregisterForAnimationEvent(PlayerRef, "KillMoveStart")
  UnregisterForAnimationEvent(PlayerRef, "KillMoveEnd")
EndFunction

I'm fairly certain this script worked for me at some point but it no longer registers Kill Moves properly (I'm using the latest Skyrim Special Edition with SKSE). I've tried replacing OnAnimation with OnAnimationEvent but that didn't work either.

 

I tried to find documentation on the KillMoveStart and KillMoveEnd events, but the only thing I could find was a list from some user on the FO4 wiki that listed them in a Weapons Behavior list and some old skyrim forum posts.

 

The two events are not listed on the Creation Kit Wiki. Were they removed from the game at some point? Is there another way to detect Kill Moves?

Edited by MateDeVita
Link to comment
Share on other sites

You have to check for 2_KillMoveStart and NPCKillMoveStart (and similar for KillmoveEnd). These are the ones which are raised when the Killmoves play.

 

KillMoveStart and KillMoveEnd exist, but they are only used to activate the animations, and can therefore not be caught.

Link to comment
Share on other sites

First off, thank you for the reply.


I tried registering for those but it still didn't work. I'm testing on a completely new game, with only my mod, Alternate Start LAL, and SKSE enabled (I've tried it without ASLAL as well and it still didn't work, I just use ASLAL to speed up the start of a new game).


Maybe I'm doing something wrong with my script placement in the creation kit. I have two mods that need to detect kill cams and I use two different approaches (neither of which work currently):



  1. Create a Quest with Start Game Enabled and Run Once checked. In the Scripts tab add the script I posted above. This is the approach I used when I made the first mod (this was still back on Skyrim LE), although I don't remember where I found it.
  2. Create a Quest with Start Game Enabled and Run Once checked. In the Quest Aliases tab add a new Reference Alias. In it set the Fill Type to Specific Reference, click on Set Forced Reference and select Cell: (any), Reference: PlayerRef ('Player'). In the Scripts part of the Reference Alias window add the desired scripts. This is the approach I found in a tutorial for something else and I don't quite understand how exactly it works or why the extra steps are required/better than the above approach, but I decided to follow that tutorial exactly. And when it seemed to be working I slapped on the above KillCam detection script as well (the Reference Alias has 2 other scripts unrelated to KillCams). The only difference is the script now extends ReferenceAlias rather than Quest.


As mentioned, neither of these approaches work, regardless of which events (KillMoveStart, 2_KillMoveStart, NPCKillMoveStart) I register for.

Edited by MateDeVita
Link to comment
Share on other sites

Oh, my response was only related to the animation events that you can use, I didn't look at the rest. And I cannot go into the details of your implementation. Just a couple of things:

  1. The name is OnAnimationEvent, not OnAnimation. I don't know what the latter is.
  2. OnAnimationEvent can only be used in ActiveMagicEffect Script, Alias Script, and Form Script. Not in a Quest script. See the CK Wiki.
  3. And it can only be applied in the reference alias or form script of the actor it applies to.

I'm using OnAnimationEvent a lot in an Actor script. Including the check for an animatrion event "2_pairedStop" which is often called in parallel to "2_KillMoveEnd"

Link to comment
Share on other sites

Hmm, the wiki has a sample script where it uses OnAnimationEvent in a Quest script. Probably since Quest inherits from Form, it's OK. In any case, my second mod uses a ReferenceAlias script anyway.

 

Yeah I tried changing OnAnimation to OnAnimationEvent, forgot to mention that. I'm not sure where I found OnAnimation, maybe it was called that back in LE, or maybe I accidentally changed it at some point. But changing it to OnAnimationEvent still didn't fix my issue.

 

I'll try another way of applying the script with a perk or an ability instead of a quest, I'll see if I can make that work.

Link to comment
Share on other sites

I doubt that this Wiki example can work. Every actor type has it's own animation events. How can a quest script check them all? And I have this lise of scripts where it works directly from the Wiki itself. And I remember running into that problem myself trying to check for animationevents in the quest script.

 

I would only try the player reference alias. Have you checked if that works by other means? For example by using an event OnPlayerLoadGame(). That always works.

Link to comment
Share on other sites

I doubt that this Wiki example can work. Every actor type has it's own animation events. How can a quest script check them all?

 

Well, RegisterForAnimationEvent takes an actor ObjectReference (in my case PlayerRef) as its first argument, so you're only registering for events of one actor. So conceivably it could work, even if attached to a quest.

 

 

I would only try the player reference alias. Have you checked if that works by other means? For example by using an event OnPlayerLoadGame(). That always works.

 

You mean register for events in OnPlayerLoadGame() instead of in OnInit()? Because that may actually help if I can do it, because registering in OnInit() seems to be precisely the cause of the problem. I was looking at RegisterForAnimationEvent and noticed the function had a return value specifying if the registration was successful, since apparently it's possible for the animation graph to not be loaded yet (I haven't yet read up on what the animation graph is). I edited OnInit() in my script to

Event OnInit()
  If !RegisterForAnimationEvent(PlayerRef, "2_KillMoveStart")  ; (and similar for "NPCKillMoveStart", "KillMoveStart", ...)
    Debug.Trace("Failed to register for animation event.")
  EndIf
EndEvent

and upon starting a new game I indeed got the message in my log that the registration failed. So it seems I'm registering for events too early and will have to find another way to make it work. I'll see what I can figure out tomorrow.

Link to comment
Share on other sites

 

Well, RegisterForAnimationEvent takes an actor ObjectReference (in my case PlayerRef) as its first argument, so you're only registering for events of one actor. So conceivably it could work, even if attached to a quest.

 

As I said, the CK Wiki itself doesn't list quest scripts. And my experience. Only this one example. And I doubt that many of the examples are really tested in-game.

 

 

The problem for me is that I can't help you about WHERE it works, and where it doesn't. I only can tell WHAT works (with respect to animation events). In my test mod I use a lot of animation event checking for different purposes. But they are all in an Actor script, registered either for the NPC it is attached to, are for the player.

Link to comment
Share on other sites

I've changed the OnInit() event handler to:

Event OnInit()
  While !RegisterForAnimationEvent(PlayerRef, "KillMoveStart")
    Utility.Wait(1)
  EndWhile
EndEvent

and now after a single failed registration it now registers correctly and both mods' OnAnimationEvent methods work as expected.

 

Thank you for your help fore.

Edited by MateDeVita
Link to comment
Share on other sites

  • Recently Browsing   0 members

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