Resurrect player

From Nexus Mods Wiki
Jump to: navigation, search

Overview

This will teach you how to resurrect the player in the right way , without side effects.

The Theory

[1]

From the UESP wiki :

Implementation It's probably necessary to implement this as a quest script, since 1) it's not a good idea to script the player directly, and 2) script effect spell might be voided on death of pc. In the quest script, wait until player health is less than or equal to zero and then use resurrect on player. (It's probably desirable to use the AnimateFlag == 1.) Pros: Relatively easy to implement. Seems like the way it should be done. Resurrection clears all attack spells that were acting on player and restores health, etc. to normal state.

Cons: Resets the player, causing loss of birthsigns, abilities and some important statistics. This by itself pretty much ruins this as an approach. Moves camera down to feet of player. When player dies, the player camera repositions to be centered on player's feet. This is not corrected on resurrect. Looking at the dirt would be bad enough, but the camera often actually clips under the ground surface. Problem exists in vanity view as well, since the vanity zooms in whenever something is between its zero point and the camera position, and with the zero point under the ground, it seems that the ground mesh itself interferes and causes the camera to zoom all the way in.


My Way

In my research I have found a way that : -player doesn't lose birthsign or other statistics -camera is not centered on player's feet


The Method

When the player dies , the camera will start to go lower as the player's center closes to the ground. Right before that , the script will resurrect the player (we use "resurrect 1" because it doesn't reset the actor) Because the player will still be on the ground , the script resurrects the player again.

Since there are 4 seconds (by default) until the Load Menu shows up , there is plenty of time for the script to run.

But to be sure , we can edit that time from CS >> Gameplay>> Settings by setting fPlayerDeathReloadTime to x (I use 60) - where x is float.

The Script

scn aaaresurrectscript

float fQuestDelayTime

float heal

begin gamemode

set fQuestDelayTime to .01

if player.getdead==1

player.resurrect 1

player.resurrect 1

autosave

end

The Quest

Create a new quest

e.g aaaresurrect

Priority : 60

Start Game Enabled : YES

Script : aaaresurrectscript

Notes

it doesn't work if fPlayerDeathReloadTime passed. looking for a solution.

To make things easier , I have added "autosave" at the end of the script.

Therefore , the next time you'll die (after the fPlayerDeathReloadTime interval) you'll be able to load the last checkpoint.

References

[2] - Tes4Mod:Resurrecting the Player