Talk:Resurrecting the Player
Try this one. It works fine for me. You have to put this script into the script window of the Base "player", which can be found under the "NPC" section.
ScriptName 000PlayerResurrectScript
short DoOnce
short init
short TimeIsOut
short BaseHealth
short CurrentHealth
short FixHealth
short ReducedHealth
short EnduranceModifier
short BaseFatigue
short Death
float timer
Begin GameMode
- Remember the original Base HitPoints
- and set the Endurance +10 to give the Player an Threshold of 50 extra BASE HitPoints
if (DoOnce != 1)
set BaseHealth to GetBaseActorValue Health
set EnduranceModifier to (GetBaseActorValue Endurance + 10)
SetActorValue Endurance EnduranceModifier
set DoOnce to 1
endif
- Check the PC HitPoints
- if they reach the 50 Points Threshold
- be sure that the HitPoints never fall below 50 Points
- Furthermore stop the enemys from attacking the Player
if (GetActorValue Health < 51)
set CurrentHealth to GetActorValue Health
StopCombatAlarmOnActor
if (CurrentHealth != 50)
set FixHealth to (50 - CurrentHealth)
ModActorValue Health FixHealth
endif
- Then set the Player to some kind of Death state by detracting his Fatigue
if (Death != 1)
SetGhost 1
ForceActorValue Fatigue -1000
set Death to 1
endif
- after some Time (here 300 Seconds)
- heal the Player up to 30% from his original Base HitPoints + the 50 Points Threshold
- and resurrect him by restoring his original Fatigue
if init == 0
set timer to 300.0
set init to 1
else
if timer > 0
set timer to timer - getSecondsPassed
else
SetGhost 0
set ReducedHealth to ((BaseHealth*0.3-CurrentHealth)+50)
ModActorValue Health ReducedHealth
set BaseFatigue to (GetBaseActorValue Fatigue)
ForceActorValue Fatigue BaseFatigue
set init to 0
set Death to 0
endif
endif
endif
End GameMode