Proper usage of RegisterOnAnimationEvent :

Post » Sat Nov 17, 2012 8:35 am

In a magic effect script I need to intercept two animation events:
  • When the caster jumps
  • When the caster lands
Right now I have set up a script that looks something like this - paraphrased to some extent...


Event OnEffectStart(aCaster, aTarget)RegisterForAnimationEvent(aCaster, "Jump")EndEventEvent OnAnimationEvent(aCaster, sEvent)if (sEvent == "Jump");Do shizzleendifEndEvent


The script compiles fine and works, but, the animation event never fires. I've tried a few permutations... "Jump", "ActionJump" "EventJump" but to no effect - What are the ACTUAL event names I need to use for "jump" and "land", is there a list somewhere? - or is my syntax up the wazoo?
User avatar
Javaun Thompson
 
Posts: 3397
Joined: Fri Sep 21, 2007 10:28 am

Post » Sat Nov 17, 2012 5:12 pm

Try something like

if (sEvent == "Jump")	;Do shizzleelse	debug.notification("got a '" +sEvent+ '" instead")endif

Won't fix the code, but might tell you what to listen for :smile:
User avatar
Flesh Tunnel
 
Posts: 3409
Joined: Mon Sep 18, 2006 7:43 pm

Post » Sat Nov 17, 2012 4:39 am

I believe the problem is that a magic effect cannot send an animation event. It sends its own set of events (OnEffectStart, OnEffectFinish, and so on), but I think only actors send animation events.

You would probably need to create a Player alias, and have your spell (if your spell is an integral part of your mod) set a flag in a script attached to that alias when the spell is cast.

If you wanted to keep things purely event-based, you could... (just thinking out loud, don't know if this is the best idea...) force the player to silently equip a dummy item using your magic effect script. This will cause an OnObjectEquipped() event to be sent from your player alias and cause your alias script to fire. You can then do your Animation Event registration on the alias.
User avatar
James Smart
 
Posts: 3362
Joined: Sun Nov 04, 2007 7:49 pm

Post » Sat Nov 17, 2012 1:58 am

Clox: Ohhh, good idea. Thanks :smile:

UPDATE: Nah didn't work.



Chesko: Both those solutions seem rather long winded and round about.

Is there any other more direct solutions, like is there any other means to check if the player is jumping or otherwise airborne that can be checked from inside a magic effect or perk? (ie. something I can test inside an update event)
User avatar
Ebou Suso
 
Posts: 3604
Joined: Thu May 03, 2007 5:28 am

Post » Sat Nov 17, 2012 7:17 am

A magic effect on an actor ought to get all the events that the actor gets.

Maybe the problem is that you need to register the actor for events, but you can still listen with the effect
User avatar
Emmanuel Morales
 
Posts: 3433
Joined: Sat Oct 06, 2007 2:03 pm

Post » Sat Nov 17, 2012 6:08 am

Is there any other more direct solutions, like is there any other means to check if the player is jumping or otherwise airborne that can be checked from inside a magic effect or perk? (ie. something I can test inside an update event)

Have you check the: http://www.creationkit.com/List_of_Animation_Variables?

I've been able to directly check several caster related animation states successfully, and some not so :smile:

There's a call for each variable type:
http://www.creationkit.com/GetAnimationVariableBool_-_ObjectReference
http://www.creationkit.com/GetAnimationVariableInt_-_ObjectReference
http://www.creationkit.com/GetAnimationVariableFloat_-_ObjectReference
User avatar
jadie kell
 
Posts: 3497
Joined: Sat Jul 29, 2006 3:54 pm

Post » Sat Nov 17, 2012 8:44 am

Yea, after reading the CK page on this event, magic effects are valid recipients.

Are you positive that the effect is persisting long enough to receive the event? I had an issue in the past where I was never getting events sent from my magic effect that was solved by simply making sure the duration was long enough for me to actually catch it (I had "no duration" checked) ^^:

Aliases and quests will automatically unregister for this event when the quest stops. Active magic effects will automatically unregister when they are removed.
User avatar
Sebrina Johnstone
 
Posts: 3456
Joined: Sat Jun 24, 2006 12:58 pm

Post » Sat Nov 17, 2012 7:14 am

Don't you need to register the event to catch in order to get it to show up? - still having trouble getting the animation event block to actually fire altogether.

Using an update block to catch when the bJumpState flag is up though worked however, not as elegant (given either a slight delay, or the extra CPU overhead of running frequent an update block several times a second), but that'll have to stand a solution unless I figure out how to get the animation event capture to work.
User avatar
Chica Cheve
 
Posts: 3411
Joined: Sun Aug 27, 2006 10:42 pm

Post » Sat Nov 17, 2012 5:17 am

Don't you need to register the event to catch in order to get it to show up? - still having trouble getting the animation event block to actually fire altogether.

Using an update block to catch when the bJumpState flag is up though worked however, not as elegant (given either a slight delay, or the extra CPU overhead of running frequent an update block several times a second), but that'll have to stand a solution unless I figure out how to get the animation event capture to work.

I agree, having to check the animation variables is not the most effecient solution. As I mention in this thread: http://www.gamesas.com/index.php?act=findpost&pid=1394671, I tried to find an animation event that would fire when the spell caster had a spell ready. You can see in the spoiler how many events I tried to capture. Some did fire so I know I had everything working, but even though some of the animation events sounded exactly like what I needed, they didn't fire.
User avatar
kiss my weasel
 
Posts: 3221
Joined: Tue Feb 20, 2007 9:08 am

Post » Sat Nov 17, 2012 8:27 am

You can see in the spoiler how many events I tried to capture. Some did fire so I know I had everything working, but even though some of the animation events sounded exactly like what I needed, they didn't fire.

But how did you even know where to begin in what events to look for? - Random guesswork?
User avatar
ImmaTakeYour
 
Posts: 3383
Joined: Mon Sep 03, 2007 12:45 pm

Post » Sat Nov 17, 2012 10:22 am

But how did you even know where to begin in what events to look for? - Random guesswork?

Some are guesswork actually, but no, I went through the animation events. If you didn't know, you can find them in the CK Gameplay menu, then go down to Animations. Drill in to:
Actors\Character\Behaviors\0_Master.hkx

Then drill in to the Action nodes, and you'll see the Anim Event dialog enable. Open the Anim Dropdown and see the animation events. That's where I started.
User avatar
Sheila Reyes
 
Posts: 3386
Joined: Thu Dec 28, 2006 7:40 am

Post » Sat Nov 17, 2012 2:36 pm

Thanks, that's exactly the sort've information I was looking for :smile:

Managed to find a few working anim events there. oddly didn't get any response out of the jump events, but the falling and landing events work as expected


EDIT:@ Found some more jump related events, I'll test those first :P
User avatar
Britta Gronkowski
 
Posts: 3475
Joined: Mon Apr 09, 2007 3:14 pm

Post » Sat Nov 17, 2012 12:55 pm

I use them in magic effects all the time, however only some work as expected:



RegisterForAnimationEvent(akTarget, "JumpFall")
RegisterForAnimationEvent(akTarget, "JumpFallDirectional")
RegisterForAnimationEvent(akTarget, "JumpLandDirectional")
RegisterForAnimationEvent(akTarget, "JumpLandEnd")
RegisterForAnimationEvent(akTarget, "JumpUp")

All the other "jump" do not work.
User avatar
Lucie H
 
Posts: 3276
Joined: Tue Mar 13, 2007 11:46 pm

Post » Sat Nov 17, 2012 6:27 am

After further testing it seems JumpUp and JumpDown seem to be most reliable, far as I can tell they always fire (And I can throw in a couple landing examples for safety)

Thanks for all the help guys, this was exactly what I set out to achieve :happy:
User avatar
Benjamin Holz
 
Posts: 3408
Joined: Fri Oct 19, 2007 9:34 pm

Post » Sat Nov 17, 2012 4:10 am

I wonder if any new ones like for cross bow were add in the last update?
User avatar
Shelby Huffman
 
Posts: 3454
Joined: Wed Aug 08, 2007 11:06 am


Return to V - Skyrim