[Papyrus] OnAnimationEvent not working

Post » Wed Jun 20, 2012 4:51 pm

Hello, first of all sorry for my poor English.

I manage to make my NPC playing lute/flute but there is no sound.
So I trying to using OnAnimationEvent to play the Lute music when ever IdleLuteStart is trigger.

But the OnAnimationEvent is never triggered. I know that I have to use RegisterForAnimationEvent and I already put that line into OnLoad event.
But it doesn't work.I have no idea what I did wrong.

This is my code, i didn't put lines to play the lute music because i want to make sure first that the event is work.
Scriptname testCustomChar01Lute extends ObjectReference{TestLute}EVENT onLoad()Debug.Trace("This object is loaded, playing animations should work now")Debug.MessageBox("aadasdasd")If (!RegisterForAnimationEvent(self, "idleLuteStart"))	Debug.Trace("Failed to register for event!") // never show up in log file, i assume that register event is fine.EndIfendEVENTEvent OnAnimationEvent(ObjectReference akSource, string asEventName)Debug.Trace("Event Fired!!") // never show up in log fileDebug.MessageBox(asEventName )  // same hereendEvent

I put this script in my NPC's Actor script.

PS. Onload event isn't work when I first loaded into the game, I have to use commands "Disable" and "Enable" to trigger Onload event.
User avatar
GRAEME
 
Posts: 3363
Joined: Sat May 19, 2007 2:48 am

Post » Thu Jun 21, 2012 1:23 am

http://www.gamesas.com/topic/1359143-quick-anim-event-question/page__view__findpost__p__20497234
User avatar
Dalton Greynolds
 
Posts: 3476
Joined: Thu Oct 18, 2007 5:12 pm

Post » Wed Jun 20, 2012 4:07 pm

^
Yeah, it seem like "idleLuteStart" event will never trigger.
Anyway, I found a way around but it's pretty nasty :(.
User avatar
Erika Ellsworth
 
Posts: 3333
Joined: Sat Jan 06, 2007 5:52 am

Post » Wed Jun 20, 2012 12:57 pm

There are many type of events. The event you mentioned: "IdleFluteStart" is a trigger event (which tells the actor to play the flute) . If trigger event does not 'notify' any event in behavior graph when fired, RegisterForAnimationEvent will not work.

And before you ask, trigger event cannot be the same as 'notify' event. It must be different event for RegisterForAnimationEvent to work
User avatar
Vicky Keeler
 
Posts: 3427
Joined: Wed Aug 23, 2006 3:03 am

Post » Wed Jun 20, 2012 6:31 pm

There are many type of events. The event you mentioned: "IdleFluteStart" is a trigger event (which tells the actor to play the flute) . If trigger event does not 'notify' any event in behavior graph when fired, RegisterForAnimationEvent will not work.

And before you ask, trigger event cannot be the same as 'notify' event. It must be different event for RegisterForAnimationEvent to work
Then what is notify events for playing flute? Or are they exist?

I'm not quite understand but is there have any workaround to get the trigger from that event?
For now, I have to use "On Begin idle event" in "AI packages" to add a script to play lute music.
But that only allow "Fragment Script", so it can't have functions/properties in that script, which really hard to use.

And with that I only can make NPC to play one type of musical instrument per AI package.
User avatar
tegan fiamengo
 
Posts: 3455
Joined: Mon Jan 29, 2007 9:53 am

Post » Wed Jun 20, 2012 1:57 pm

Then what is notify events for playing flute? Or are they exist?

I'm not quite understand but is there have any workaround to get the trigger from that event?
For now, I have to use "On Begin idle event" in "AI packages" to add a script to play lute music.
But that only allow "Fragment Script", so it can't have functions/properties in that script, which really hard to use.

And with that I only can make NPC to play one type of musical instrument per AI package.

Not specifically to flute, no. But I believe this might work:

RegisterForAnimationEvent(self, "AnimObjLoad")orRegisterForAnimationEvent(self, "AnimObjDraw")

Event:

AnimObjectUnequip - when stop playing any instrument (drum/flute/...etc)

I haven't tried this yet, but it might work for your case :D
User avatar
Ebou Suso
 
Posts: 3604
Joined: Thu May 03, 2007 5:28 am


Return to V - Skyrim