Difference between revisions of "Talk:Resurrecting the Player"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Althir
imported>Haama
m (It's 'pre', not 'code')
 
Line 5: Line 5:




<code>ScriptName 000PlayerResurrectScript
<pre>ScriptName 000PlayerResurrectScript


short DoOnce
short DoOnce
Line 76: Line 76:
endif
endif


End GameMode</code>
End GameMode</pre>

Latest revision as of 23:11, 29 August 2007

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

if (GetActorValue Health < 51)
	set CurrentHealth to GetActorValue Health
	
	if (CurrentHealth != 50)
		set FixHealth to (50 - CurrentHealth) 
		ModActorValue Health FixHealth 
	endif

;Stop the enemys from attacking the Player
;Then set the Player to some kind of Death state by detracting his Fatigue 

	if (Death != 1)
		StopCombatAlarmOnActor
		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