UnregisterForAnimationEvent and manual furniture exit

Post » Thu Nov 28, 2013 10:01 pm

If a player uses an object like a wood chopping block or a mine and exit the resource gathering manually the "UnregisterForAnimationEvent" will not properly work regardless where you trigger it in the script.

I've found that using for example a wood chopping block and letting the script automatically do an IdleFurnitureExit after gathering the 6 default firewood the UnRegisterForAnimationEvent properly triggers and the object stop watching for Anim events. It is possible to delete the object at this point via the script.

However if the player use the block and manually exit early while chopping wood - the UnRegister event triggers but it is impossible to delete the object, seemingly because the object seems to still watch for AnimEvents even if it should not.

Anyone that has found any workaround for this or had a similar experience?

User avatar
tannis
 
Posts: 3446
Joined: Sat Dec 09, 2006 11:21 pm

Post » Fri Nov 29, 2013 6:29 am

the furnitureexit only works if that's actually the ani that particular furniture is playing when exited, other anis need their specific names registered.

and you can register for anything, but not everything fires. for pickaxing furniture for example, "AddToInventory" would be one that fires

User avatar
Rhysa Hughes
 
Posts: 3438
Joined: Thu Nov 23, 2006 3:00 pm

Post » Fri Nov 29, 2013 5:37 am

Yes, the wood chopping block basically registers two animation events, one for the "AddToInventory" and one for "idleFurnitureExit". If the "AddToInventory" is triggered it will start a counter and once it hit 6 (default max resources per activation) it will throw the player out of the animation. It will also UnRegister all animation events. And it works fine.

The "idleFurnitureExit" event will be triggered if the player manually exist the object. This also UnRegisters all animation events the exact same way as the "AddToInventory".

The difference is that the UnRegistration when existing the object manually seem to still leave the object watching for further animation events and it can't be deleted using objRef.Delete() anymore. Deleting the object works fine if you let the script throw the player out of the animation.

User avatar
Melissa De Thomasis
 
Posts: 3412
Joined: Tue Feb 27, 2007 6:52 pm

Post » Fri Nov 29, 2013 5:11 am

hm best OnAnimationEvent also unregister for the event just to be sure,

and maybe DeleteWhenAble () does the trick when Delete () doesn't

and also disable before delete

User avatar
Anthony Diaz
 
Posts: 3474
Joined: Thu Aug 09, 2007 11:24 pm

Post » Thu Nov 28, 2013 11:17 pm

Thanks for your reply. I do disable the object before I finally delete it. In the Creation Kit Wiki it states the following about the UnRegisterForAnimationEvent :

  • This function doesn't work if called within an http://www.creationkit.com/OnAnimationEvent_-_Form unless there is a http://www.creationkit.com/Wait_-_Utility preceding it.

I have tried using Utility.Wait as well as calling the UnRegister function from other parts of the code when I am sure the object is not being used but it simply never seems to stop watching for Animation Events if the player exists the object manually.

I've also tried to use the DeleteWhenAble() but it is never able to do so.

User avatar
Jonathan Egan
 
Posts: 3432
Joined: Fri Jun 22, 2007 3:27 pm


Return to V - Skyrim