Problems with Actor.Resurrect() (Resurrecting the Player spe

Post » Mon Jun 18, 2012 2:59 am

I'm trying to bring the player back to life after he is killed. Referencing the player and using the Resurrect() function works however, I get some really strange behaviors upon doing so.

It seems that some functions seem to "die" with the player. First off the camera tends to face a really awkward angle (presumably the direction you were facing as you were dying). Ok I can fix that, I'll just use "Game.ForceFirstPerson()". While this works OK most of the time, sometimes the camera will spaz out of control and I'll be forced looking straight up for a while. Additionally, in the event I die again, my body does not go ragdoll and fall to the ground--he just stands there.

It's possible that animations aren't playing correctly either but to be honest I've been experimenting with different ways to manipulate the players death and so I don't really remember. I can test that again if needed, but my main goal is to see if anyone knows if there is a list of functions I should call to make sure the player is fully resurrected.

Another alternative to managing the players death I had, was to make him essential and simply run the "resurrection code" within his OnEnterBleedout() event. However, unlike OnDying(Actor akKiller) or OnDeath(Actor akKiller), OnEnterBleedout() does not generate an actor for the players "Killer". I need that reference, which is why I've opted to trying to fix the resurrection issues.

Anyone have any ideas? (I'm going to bed now though so I won't be able to check back here until I wake up.) Any help is appreciated!
User avatar
Nick Tyler
 
Posts: 3437
Joined: Thu Aug 30, 2007 8:57 am

Post » Mon Jun 18, 2012 4:49 am

Probably not possible, I know with Oblivion it wasn't ever quite possible without major hacks. Once the player is dead too many hard coded things happen that are usually not able to be reversed via any scripts.

Probably the best thing you could do is cheat it somehow, like fake the players death with a forced kill cam animation when they are at low health or something, then use scripted events to simulate a resurrection. You might have to buff the players health invisibly somehow so a one shot that would kill the player doesn't, then modify the health bar somehow to not show this invisible health buffer you create.
User avatar
sunny lovett
 
Posts: 3388
Joined: Thu Dec 07, 2006 4:59 am

Post » Mon Jun 18, 2012 6:48 am

Probably not possible, I know with Oblivion it wasn't ever quite possible without major hacks. Once the player is dead too many hard coded things happen that are usually not able to be reversed via any scripts.

Probably the best thing you could do is cheat it somehow, like fake the players death with a forced kill cam animation when they are at low health or something, then use scripted events to simulate a resurrection. You might have to buff the players health invisibly somehow so a one shot that would kill the player doesn't, then modify the health bar somehow to not show this invisible health buffer you create.

I see. Well like I said making the player essential works (and does simulate the death experience just fine) but it doesn't give me a reference to the person who "killed" the player, and I need that.
User avatar
Connor Wing
 
Posts: 3465
Joined: Wed Jun 20, 2007 1:22 am

Post » Mon Jun 18, 2012 5:50 am

I have a similar problem here. I want to resurrect the player after he had turned into a ragdoll:
- calling Resurrect() one time will force the player into a really strange position and none of the animations are played anymore.
- resurrecting him two times in a row (with Utility.Wait(0.01)) in the OnDeath() event works, but the player is standing right away

I looked at the ReanimateCorpse spell projectile, it uses Resurrect() as well, but the actors use an animation that has them stand up...

Making the player essential is a possibility, but I would prefer another solution because I never got killmoves when an enemy kills the essential player
User avatar
Jesus Lopez
 
Posts: 3508
Joined: Thu Aug 16, 2007 10:16 pm

Post » Mon Jun 18, 2012 3:49 am

@delfofthebla:
I'd recommend adding an http://www.creationkit.com/OnHit_-_ObjectReference block, in which you update a variable available to both this block and your http://www.creationkit.com/OnEnterBleedout_-_Actor event (which I assume you were using), and then just check that variable in your OnEnterBleedout event. This will be the thing that hit you last, so it's likely to be the right thing.

Note that, since both events will likely fire at the same time, you might want to do some stuff with states and latent functions to make sure that:
  • You don't use the variable before it gets updated
  • You don't use the variable after it's been updated from you being hit again after being "killed"
Cipscis
User avatar
le GraiN
 
Posts: 3436
Joined: Thu Mar 22, 2007 6:48 pm

Post » Mon Jun 18, 2012 4:58 am

@delfofthebla:
I'd recommend adding an http://www.creationkit.com/OnHit_-_ObjectReference block, in which you update a variable available to both this block and your http://www.creationkit.com/OnEnterBleedout_-_Actor event (which I assume you were using), and then just check that variable in your OnEnterBleedout event. This will be the thing that hit you last, so it's likely to be the right thing.

Note that, since both events will likely fire at the same time, you might want to do some stuff with states and latent functions to make sure that:
  • You don't use the variable before it gets updated
  • You don't use the variable after it's been updated from you being hit again after being "killed"
Cipscis
Just checked back here after a couple days, kind of forgot about the thread. My latest script does use OnHit to obtain a reference for the killer, but I do not have anything regarding states. I haven't really used states and to be honest I don't fully understand how I could use them. Do you think you could provide some sample code by any chance?

This is my script right now.
Scriptname PlayerLich02QuestAliasScript extends ReferenceAlias{This script starts the death control script for the Player assuming he is a Type02 Lich.}PlayerLich02QuestScript Property LichQuest AutoObjectReference Property LastAttacker AutoMagicEffect Property AbLich02Effect AutoMagicEffect Property AbLichSpiritFormEffect AutoEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)    LastAttacker = akAggressorEndEventEvent OnEnterBleedOut()    ; Debug.Messagebox("You're Bleeding Out!")    Game.GetPlayer().SetNoBleedoutRecovery(True)            ; Make it so that the Lich doesn't automatically regenerate his health upon bleedout.    ; If the Lich is a type 2 Lich and is not in spirit form, bring him back to life.    If Game.GetPlayer().HasMagicEffect(AbLich02Effect) && Game.GetPlayer().HasMagicEffect(AbLichSpiritFormEffect) == False        Utility.Wait(3.5)                                            ; Let the Lich's ragdoll hit the ground        LichQuest.Lich02Death((LastAttacker as Actor), 0)            ; Run the Death script    ElseIf Game.GetPlayer().HasMagicEffect(AbLich02Effect) && Game.GetPlayer().HasMagicEffect(AbLichSpiritFormEffect)        ; Sorry son, you ded for real this time        ; Actual death code is controlled within the "AbLichSpiritFormEffect" script. Go there if you wish to change the players spirit form death.    Else        Debug.Messagebox("Death Error: If you see this, please tell me exactly what you were doing and how it happened, because this should NEVER happen. Btw you're gonna die now.")        Game.GetPlayer().KillEssential()        ; This better only happen if you're brawling or I'ma be mad. I should probably account for this. Something to think about for later.        ; Also lol @ Lich losing a brawl. GET SOME MEAT ON YOUR BONES SON. PUN ENTIRELY INTENDED.    EndifEndEvent

As you see I use "LastAttacker" as the reference when executing my death script. It considers the last attacker as the "killer" of the Player.


EDIT: As a side note, there appears to be a function for actors called "ResetHealthAndLimbs()". It's possible that would alleviate my frozen animation issue, but to be honest what I have works, and I don't really feel like testing it. Just something for those who may be willing to try.
User avatar
Krista Belle Davis
 
Posts: 3405
Joined: Tue Aug 22, 2006 3:00 am


Return to V - Skyrim