Tes4Mod:Resurrecting the Player

Overview
If a mod maker wishes to bring the player character back to life (bypassing the usual forced reload), there are several options. None is ideal, but a hybrid approach works reasonably well.

Resurrect
Surprisingly, it is possible to use the   on the player. This should be done fairly quickly (though it's not clear if it is necessary to do this in the pc death frame, or rather just before the load screen appears). However, there are substantial problems with ability spells and with camera location.

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.

Possible Fixes
Possibly, one might manually re-add birthsigns, etc. But that would require knowing which birthsigns and abilities the player has and refreshing them. 
Moreover, it needs to be kept in mind that birthsigns are handled differently from abilities added in game. PC birthsigns seem to be applied directly to the base player npc stats, rather than as a spell (although they appear in the spell list). Hence re-adding the birthsign might double the effect of the birthsign.
Fully detecting all birthsigns and abilities that are present (esp. from non Oblivion mods) would probably require OBSE functions.
Perhaps OBSE could be modified to actually patch the original Resurrect function (maybe fixing camera height as well).

Camera Problem Fix
The camera problem can be fixed, by saving, quitting and reloading. (It's not enough to just reload -- the player has to actually quit out of Oblivion entirely and then reload.)

Set Essential
It's also possible to use the   on the player. This approach does not cause problems with player stats or abilities, but has the same camera problems as the resurrect function.

Implementation
Call setEssential on the player base object. Note that setessential must be called on the base player record not the player reference. However, "player" is hardwired by TESCS to refer to the player reference, so you need to use the formid for the player (00000007) in calling setEssential.
When the player is knocked down they'll be knocked down for the  . Default value is 10 seconds, but some mods increase this value to a longer time. While the player is knocked down, some normal processing seems to be suspended. Specifically the move to function seems to not work immediately, but instead will be applied when the PC "wakes up".
On knockdown, PC health is apparently reset to 1/4 of maximum (and spells are cleared?). Specifically, it appears that player health will never be zero. However, you can test for player knockdown by using   on the player (test for GetKnockedState == 1). 
Note: Paralysis and negative fatigue based knockdowns also set getKnockedState to 1. Also immediately after these effects fade, the player is still in getKnockedState == 1.
I.e., you actually need to test for: getKnockedState == 1, not paralyzed, positive fatigue, with that condition lasting at least a second.

Pros
Birthsigns and abilities are handled correctly since player never really dies.

Cons
Same camera problems as Resurrect approach.
Knockdown period can result in annoying wait if user has it set to a (This can be partially fixed by changing the game setting value fEssentialDeathTime from its default 10-0 in which 'essential death' is effectively just a knockdown that lasts literally no time at all.  This prevents the death camera from going all the way down to the players feet, thus partially solving this issue.)

Health Threshold
Another approach is to fake user death by doing "death" handling once player health drops to certain level. E.g., once player health drops to 10% of normal, completely restore the player's health, clear active spells, etc. and move player to recovery zone. The limitation of this approach is that it may fail. 

Implementation
If the player suffers some set back on death (e.g, becomes a ghost, is moved to afterlife location, etc.), then the death detection threshold effectively cuts back on their usable hit points. This can be corrected for by adding a fortify health ability. E.g., if death is detected when health drops to 100, then compensate with a 100 point health fortify.

Pros
Avoid birthsign and camera problems.

Cons
May fail. Multiple large hits may kill the player before the death detection code has a chance to react.
Health bar will be inaccurate by threshold level. I.e., player will die before health is zero. Note that fixing this is a direct tradeoff with previous problem. If threshold is lowered in order to make health bar more accurate, then there's a higher chance that it will be exceeded, and player will really die.

Hybrid Solutions
Given the problems above, the best solution is probably a hybrid solution: Health Threshold + SetEssential. Using this approach, the Health Threshold will catch most deaths, while the SetEssential acts as fallback.

Implementation Notes
  should be used if the player is moved to another cell or turned into a ghost where he should be ignored by enemies.
  can be used to make the player invulnerable (in most ways). Note that this doesn't make the actor look like a ghost -- rather it just make them physically invulnerable.
  can be used to remove players items to a container. However, this won't move quest items. Alternatively, the player could be moved to a jail marker with an associated with StolenItems chest.

Examples
Shivering Isles uses the hybrid approach for Sheogorath's Protection, but 1) uses Resurrect instead of setEssential, and 2) does not use a fortify health buffer.

Molag Bal's Daedric quest uses a Health Threshold method to kill the player, and then be "saved" by the Daedric Lord.

  uses the hybrid approach.