How to detect when an actor is in the ragdoll state?

Post » Thu Jun 21, 2012 4:29 pm

Is there a way to detect when an actor is in the ragdoll state, when they are being effected by Havok and not animations?

In Oblivion this could be detected by (getanimplaying + getidleplaying) == 0

But Skyrim does to seem to have both this time.
And getknockedstate will not work.
User avatar
Alisia Lisha
 
Posts: 3480
Joined: Tue Dec 05, 2006 8:52 pm

Post » Thu Jun 21, 2012 5:30 am

For the last 4 hours I have tried all the Animation var tests available such as :


getAnimationVariableBool("bMotionDriven")

getAnimationVariableBool("bAnimationDriven")

None of these trigger when the player is getting up from the ground or is in the rag-doll state.

I guess if nobody has any other ideas I will ask the SKSE guys if they can save the day again...
User avatar
Pat RiMsey
 
Posts: 3306
Joined: Fri Oct 19, 2007 1:22 am

Post » Thu Jun 21, 2012 1:09 pm

RegisterForAnimationEvent(pPlayer, "GetUpEnd")

This will tell you when player finishes getting up from ragdoll mode
User avatar
naome duncan
 
Posts: 3459
Joined: Tue Feb 06, 2007 12:36 am

Post » Thu Jun 21, 2012 5:51 am

That only works AFTER the problem has happen and will not work when they are dead.
I need to detect the ragdoll state before this to prevent issuing conflicting commands while the actor is IN the rag-doll state.

I found a work around for this problem by resetting the actors animation data at the same time I issue the "problem" commands.

But thanks anyway.

WE still need a "IsInHavok command or IsInAir (That made that one for Oblivion) , maybe the SKSE team can help with that eventually.


RegisterForAnimationEvent(pPlayer, "GetUpEnd")

This will tell you when player finishes getting up from ragdoll mode
User avatar
Lucy
 
Posts: 3362
Joined: Sun Sep 10, 2006 4:55 am

Post » Thu Jun 21, 2012 4:56 am

You have some of the hardest questions/requests out there, you know :P

RegisterForAnimationEvent(pPlayer, "RemoveCharacterControllerFromWorld")

This will work 100%. It will fire the moment you enter ragdoll mode.
If you use Debug.Notification, you will NOT see the message, as when player enter ragdoll mode, most menus will be disable.

To test this, here is what I did
RegisterForAnimationEvent(pPlayer, "RemoveCharacterControllerFromWorld")if (akSource == pPlayer) && (asEventName == "RemoveCharacterControllerFromWorld")  ;Debug.Notification("Enter Ragdoll")  <--- This will not be seen  pPlayer.SetGhost(1)endif

As soon as you enter console command "player.pushactoraway player 1", wait a 0.1 sec, then reopen console menu. Click on player and type "getIsGhost". If it returns 1, then it works
User avatar
Kim Bradley
 
Posts: 3427
Joined: Sat Aug 18, 2007 6:00 am

Post » Thu Jun 21, 2012 10:02 am

:woot: WOW!

Even if that only works for the player that would be VERY useful. But before I found my work around I would have needed it to work for NPC as well.
Because of the kind of modding I am doing, with almost ALL the features I make (extremely few exceptions) they must work for both the NPC and the player.

But I can't wait to try this out!

T H A N K S !



You have some of the hardest questions/requests out there, you know :tongue:

RegisterForAnimationEvent(pPlayer, "RemoveCharacterControllerFromWorld")

This will work 100%. It will fire the moment you enter ragdoll mode.
If you use Debug.Notification, you will NOT see the message, as when player enter ragdoll mode, most menus will be disable.

To test this, here is what I did
RegisterForAnimationEvent(pPlayer, "RemoveCharacterControllerFromWorld")if (akSource == pPlayer) && (asEventName == "RemoveCharacterControllerFromWorld")  ;Debug.Notification("Enter Ragdoll")  <--- This will not be seen  pPlayer.SetGhost(1)endif

As soon as you enter console command "player.pushactoraway player 1", wait a 0.1 sec, then reopen console menu. Click on player and type "getIsGhost". If it returns 1, then it works
User avatar
Ash
 
Posts: 3392
Joined: Tue Jun 13, 2006 8:59 am

Post » Thu Jun 21, 2012 10:43 am

Glad to hear :D

I don't know if it works for other NPC, most likely yes, as thou I haven't tried yet...
I just look at the behavior file, apparently there is no branch/condition for NPC... So I guess it should work for any Actor...
User avatar
Felix Walde
 
Posts: 3333
Joined: Sat Jun 02, 2007 4:50 pm

Post » Thu Jun 21, 2012 2:10 pm

so I wonder if :



Event OnAnimationEvent(ObjectReference akSource, string asEventName)

if (akSource == me) && (asEventName == "RemoveCharacterControllerFromWorld")
utility.wait(2)
endif

endevent


Will prevent an ON Hit event in the same script if the hit happens within 2 seconds?
I wonder how long a script that is "waiting" for its turn to run before it waits too long to get things like on hit events?

Or will these events like ON HIT be sent to the waiting script no matter HOW long it takes to run whether it is waiting because of a utility.wait command or waiting because the game put the script to the back of the line....

Say I used wait(30)
If this starts to wait and 5 seconds later the actor is hit and then another 25 seconds later will that "on hit" still trigger in the script?


The above is just me thinking out loud, but I do have a question for you, how do you then detect that the actor is Not in rag doll anymore? I guess another Event OnAnimationEvent to see if the actor is running the get up animation would work, but that seems crude for some reason. On the other hand all actors do run this (I think) even the chicken so I guess it should work without any problem right?
User avatar
Amanda Furtado
 
Posts: 3454
Joined: Fri Dec 15, 2006 4:22 pm

Post » Thu Jun 21, 2012 3:36 am

Not that I've done any testing, but from experience, I would say that using "Utility.Wait()" that way would only cause the script to use multiple threads. Instead, you should use states.
User avatar
Jamie Moysey
 
Posts: 3452
Joined: Sun May 13, 2007 6:31 am

Post » Thu Jun 21, 2012 1:52 pm

I tend to agree with Ranomnoob on that topic, since OnHit() is a separate event, it will fire independantly of anything inside the OnAnimationEvent() event. So you would need to use states, which shouldn't be too hard. Something like go to busy state when the animation event occurs, wait(2.0), then go back to ready state after. Then put your Onhit() stuff in the ready state but not the busy state.

Alternatively, you could use a boolean, like

bRunOnHit == false
Utility.Wait(2.0)
bRunOnHit == true

inside the onanimationevent(),

Then

If bRunOnHit
;dostuff
EndIf

In the onhit event. But I have heard this is less reliable than states for some reason.


Definitely not an expert on this kind of thing so I could be completely wrong about this, but I will bookmark this thread as I have with many others to use it as a reference, some juicy stuff in here that will likely prove useful in the future when I get into messing with melee combat. Hopefully we can get something similar that works on NPCs and not just the player?
User avatar
Jhenna lee Lizama
 
Posts: 3344
Joined: Wed Jun 06, 2007 5:39 am


Return to V - Skyrim