Curious thing about IsBleedingOut

Post » Wed Aug 14, 2013 2:25 am

Hi,

I have a script that allows the player to perform a killmove on NPCs who are playing the bleedingOut animation. All the player has to do is activate the NPC who is bleeding out.

I noticed that my script works fine with NPCs who enter the bleedingOut animation as a result of the vanilla game telling them so (which can occur when their health is below 10%). However, if I force an NPC to play the bleedingOut animation by using:

Debug.SendAnimationEvent(Target, "bleedOutStart")

then my script doesn't work.

The script detects whether the NPC is playing the bleedOut animation by checking:

Event OnActivate(ObjectReference akActionRef)	 	akActionRef = PlayerRef	If(!Target.IsBleedingOut() || isNPC == 0)		return	Else                  ;code        EndIfEndEvent

So my understanding is that, for some reason, sending the relevant animation event is not enough for IsBleedingOut() to become true (which seems strange).

The only difference between the vanilla bleedingOut and the one resulting from the AnimationEvent is, as far as I know, that during the former the affected NPC recovers HP. Maybe that's the reason why it doesn't work?

I know the question is very specific but if anybody has any input/idea on how to make my script reconigze forced bleedouts, that would be great.

Thanks in advance.

User avatar
Charlie Ramsden
 
Posts: 3434
Joined: Fri Jun 15, 2007 7:53 pm

Post » Wed Aug 14, 2013 8:37 am

As stated on the http://www.creationkit.com/SendAnimationEvent_-_Debug this is a debug function and will mess up an actor's state when used. You cannot force a bleedout (or anything else) with this function.

IOW - he's not bleeding out because he's not bleeding out. You just forced him to play charades and look like he's bleeding out (and probably confused his AI and animation graph in the process).
User avatar
ANaIs GRelot
 
Posts: 3401
Joined: Tue Dec 12, 2006 6:19 pm

Post » Wed Aug 14, 2013 2:57 am

tinyLamp, IsBleedingOut() is almost certainly a "wrapper" function that just calls GetAnimationVariableBool("IsBleedingOut") and checks if it returns true. I'm assuming the game code sets that behavior variable when it sends the event "bleedOutStart" to the actors behavior graph. So if you are sending any animation events to an actor you should set the relevant behavior variables or you will experience oddities like this.

Basically, what I am saying is you should do this:

Spoiler
SomeEvent()     if Debug.SendAnimationEvent(ActorRef, "bleedOutStart")        RegisterForAnimationEvent(ActorRef, "bleedOut_TransOutEnd")  ;We need to listen for bleedoutexit and ragdoll animation events to reset the variable to false...        RegisterForAnimationEvent(ActorRef, "RemoveCharacterControllerFromWorld")        ActorRef.SetAnimationVariableBool("IsBleedingOut", True)    endIfEndEventEvent OnAnimationEvent(ObjectReference akSource, string asEventName)    if akSource == ActorRef        if asEventName == bleedOut_TransOutEnd || asEventName == RemoveCharacterControllerFromWorld            ActorRef.SetAnimationVariableBool("IsBleedingOut", False)            UnregisterForAnimationEvent(ActorRef, "bleedOut_TransOutEnd")            UnregisterForAnimationEvent(ActorRef, "RemoveCharacterControllerFromWorld")        endIf    endIfEndEvent  

That should fix your problem but there are other animation variables that record the actor's current state that you should probably change too. This is because the actor's AI code sends animation events but also sets animation variables because animation variables are used by the game to determine an actor's state and they are used in Havok behavior to condition transitions and change Havok class parameters at run-time.

Check my signature if you want to find out more about Havok Behavior, animation events and animation/behavior variables (they are the same thing).

@smkViper, thanks for including these functions in Papyrus. I have been able to access my custom animation variables and listen for my custom animation events as a result.

User avatar
scorpion972
 
Posts: 3515
Joined: Fri Mar 16, 2007 11:20 am

Post » Tue Aug 13, 2013 9:10 pm


This is not actually correct. Animation/AI isn't my area, so it's possible you might end up with the same (or similar) response depending on how they talk to each other, but IsBleedingOut doesn't know about animation at all.

In short - IsBleedingOut is going to catch every case where an actor is actually bleeding out. But isn't going to catch him simply playing an animation that looks like he's bleeding out.
User avatar
Add Meeh
 
Posts: 3326
Joined: Sat Jan 06, 2007 8:09 am

Post » Wed Aug 14, 2013 2:19 am


Oh, so does it sort of compare the actor's current health to their bleedout override percent?
User avatar
Emilie M
 
Posts: 3419
Joined: Fri Mar 16, 2007 9:08 am


Return to V - Skyrim