Forcing the essential NPC death animation?

Post » Mon Jun 18, 2012 10:37 pm

I'm kind of a complete newb to the whole animation aspect of modding, so bare with me here.

When an essential NPC dies, they play an animation that shows them falling to their knees, and then sitting there. I want to play that animation after a specific event on the player to give the impression that he is "collapsing from exhaustion". Is this possible? If so, how can it be done? If possible I'd like the paired "standing up" animation as well.
User avatar
kasia
 
Posts: 3427
Joined: Sun Jun 18, 2006 10:46 pm

Post » Tue Jun 19, 2012 12:49 am

After poking around the editor, I found out where animations were listed. After scrolling through the list, I found an assortment of "bleedout" animations. I'm assuming these are what I am looking for.


BleedOut_Backward.hkx
BleedOut_Forward.hkx
BleedOut_Idle.hkx
BleedOut_Left.hkx
BleedOut_Right.hkx
BleedOut_TransOut.hkx
BleedOut_TurnLeft.hkx
BleedOut_TurnRight.hkx
BleedOut_TransIn.hkx

I looked at the wiki, and apparently I can play a single animation in one of two ways, PlayAnimation and PlayAnimationAndWait.

The one I think I want is PlayAnimationAndWait, but I think simply using PlayAnimation would work as well. The problem is that when I try and test the code, nothing happens.

I've tried
Game.GetPlayer().PlayAnimation("BleedOut_TransIn", "done")
And
Game.GetPlayer().PlayAnimation("BleedOut_TransIn")

Neither seem to be working. I've also tried adding the .hkx at the end but that didn't work either. Am I just not using the right names or what..?
User avatar
Rob Davidson
 
Posts: 3422
Joined: Thu Aug 02, 2007 2:52 am

Post » Mon Jun 18, 2012 9:22 pm

After poking around the editor, I found out where animations were listed. After scrolling through the list, I found an assortment of "bleedout" animations. I'm assuming these are what I am looking for.




I looked at the wiki, and apparently I can play a single animation in one of two ways, PlayAnimation and PlayAnimationAndWait.

The one I think I want is PlayAnimationAndWait, but I think simply using PlayAnimation would work as well. The problem is that when I try and test the code, nothing happens.

I've tried
Game.GetPlayer().PlayAnimation("BleedOut_TransIn", "done")
And
Game.GetPlayer().PlayAnimation("BleedOut_TransIn")

Neither seem to be working. I've also tried adding the .hkx at the end but that didn't work either. Am I just not using the right names or what..?

PlayAnimation and PlayAnimationAndWait can't be called on Actors. You would need to use PlayIdle. Thing is, PlayIdle isn't really working for me either. Maybe the SKSE will add a function to force an animation event, no matter what.
User avatar
Stu Clarke
 
Posts: 3326
Joined: Fri Jun 22, 2007 1:45 pm

Post » Mon Jun 18, 2012 10:09 pm

PlayAnimation and PlayAnimationAndWait can't be called on Actors. You would need to use PlayIdle. Thing is, PlayIdle isn't really working for me either. Maybe the SKSE will add a function to force an animation event, no matter what.

Yeah I figured out some things since my last post. I've given up for now, but here's my code. (You can see the frustration within the comments.)
Int PlayCount = 0Int NoPlayCount = 0; HOLY [censored] WHY DOES THIS NOT WORK FOR [censored].; I POP A FLAG SO IT DOESNT LOOP BUT IT JUST KEEPS LOOPING AND LOOPING AND LOOPING.; IM NOT TELLING TO LOOP SO WHY IS IT LOOPING?Function CollapsePlayerANDLOOPREPEATEDLY()	Bool Played = False		If Player.PlayIdle(BleedOutStart) && Played == False		; Play bleedout animation and follow up with the player standing up.		PlayCount+= 1		Played = True		Debug.Notification("PlayCount: " + PlayCount)		Game.DisablePlayerControls()					; Don't let them move		Game.ForceThirdPerson()						; Put them in third person		Utility.Wait(3)							; Let the animation play out		Game.GetPlayer().PlayIdle(IdleStop_Loose)			; Stop the animation		Player.PlayIdle(BleedOutStop)					; Make them stand up		Utility.Wait(2)							; Let the animation play out		Game.GetPlayer().PlayIdle(IdleStop_Loose)			; Stop the animation		Game.EnablePlayerControls()					; Re-enable Controls	Else		; WHEN PLAYING IDLES ELSE APPARENTLY MEANS AND. BASICALLY, "DO THIS AS WELL AND THEN DO EVERYTHING AGAIN".		; OTHERWISE, "LOOP AND RUN THIS ANYWAYS". IF NOT THAT, "THEN LOOP AND RUN THIS ADDITIONALLY".	EndIf		Utility.Wait(6)		If Played == False		; If the animation doesn't properly play for some reason, give them a message instead.		NoPlayCount+= 1		Debug.Notification("NoPlayCount: " + NoPlayCount + " As your Magicka reserves deplete, you collapse to the ground and lose your disguise!")	EndIf	EndFunction

The function itself seems to loop like, twice, maybe 3 times, not sure. If I use the REAL code that I want to use, this ends up looping indefinitely.
User avatar
Guinevere Wood
 
Posts: 3368
Joined: Mon Dec 04, 2006 3:06 pm

Post » Tue Jun 19, 2012 7:52 am

You could save the current health of the player, let him "die" so that he enters bleedout and restore the health after a few seconds.
User avatar
Bedford White
 
Posts: 3307
Joined: Tue Jun 12, 2007 2:09 am

Post » Mon Jun 18, 2012 9:01 pm

You could save the current health of the player, let him "die" so that he enters bleedout and restore the health after a few seconds.

Ehh, in a last case scenario perhaps. I don't really want to kill the player, just give the impression of exhaustion. I already manipulate the player's death in like 3 different ways through other scripts, and not triggering any of those situations while I'm trying to play this animation isn't really something I want to do. I'd just feel much more comfortable with the animation playing.
User avatar
mike
 
Posts: 3432
Joined: Fri Jul 27, 2007 6:51 pm

Post » Mon Jun 18, 2012 7:41 pm

Ehh, in a last case scenario perhaps. I don't really want to kill the player, just give the impression of exhaustion. I already manipulate the player's death in like 3 different ways through other scripts, and not triggering any of those situations while I'm trying to play this animation isn't really something I want to do. I'd just feel much more comfortable with the animation playing.

I just found out how to do this. This will work! All you have to do is use the "Anim Event", not the ID of the animation.

...Event OnEffectStart(Actor akTarget, Actor akCaster)		 Debug.SendAnimationEvent(akTarget, "BleedOutStart")EndEvent
User avatar
Paula Ramos
 
Posts: 3384
Joined: Sun Jul 16, 2006 5:43 am

Post » Mon Jun 18, 2012 11:57 pm



I just found out how to do this. This will work! All you have to do is use the "Anim Event", not the ID of the animation.

...Event OnEffectStart(Actor akTarget, Actor akCaster)		 Debug.SendAnimationEvent(akTarget, "BleedOutStart")EndEvent
Interesting. I'll give it a shot later, thanks!
User avatar
Nice one
 
Posts: 3473
Joined: Thu Jun 21, 2007 5:30 am

Post » Mon Jun 18, 2012 6:22 pm

Interesting. I'll give it a shot later, thanks!
Thanks Moopus. This does work. However, not every Idle's work with this function, which is strange. I tried to force a casting animation and none is played. But agan, "BleedOutStart" does work.
User avatar
IM NOT EASY
 
Posts: 3419
Joined: Mon Aug 13, 2007 10:48 pm

Post » Tue Jun 19, 2012 3:47 am

Event OnEffectStart(Actor akTarget, Actor akCaster)		 Debug.SendAnimationEvent(akTarget, "BleedOutStart")EndEvent
You can achieve the same with:
akTarget.PlayIdle(BleedOutStart)
where BleedOutStart is assigned to BleedOutStart Idle Anim in properties window.




However, not every Idle's work with this function, which is strange. I tried to force a casting animation and none is played. But agan, "BleedOutStart" does work.

It is not strange. SendAnimationEvent does exactly the same as PlayIdle with the exception that it bypasses those conditions set in Idle Animations window for those few entries there.
But both are still limited by conditions set in behavior files, which you can't edit at all in CK.
All casting animations are usually set there to work when character is in combat state and has some spells equipped.
User avatar
Samantha hulme
 
Posts: 3373
Joined: Wed Jun 21, 2006 4:22 pm

Post » Tue Jun 19, 2012 2:51 am

True.

If you set, let's say, a .sendanimationevent combat animation, it will only trigger under combat behavior etc.
User avatar
Judy Lynch
 
Posts: 3504
Joined: Fri Oct 20, 2006 8:31 am

Post » Mon Jun 18, 2012 11:06 pm

Thanks Moopus. This does work. However, not every Idle's work with this function, which is strange. I tried to force a casting animation and none is played. But agan, "BleedOutStart" does work.

I believe you can only play the Cast animation if your in an "alert" state (Weapon Drawn). So try:

...Event OnEffectStart(Actor akTarget, Actor akCaster)         akTarget.SetAlert()              Debug.SendAnimationEvent(akTarget, "CASTEVENT")EndEvent
User avatar
Rude Gurl
 
Posts: 3425
Joined: Wed Aug 08, 2007 9:17 am


Return to V - Skyrim