Difference between revisions of "Talk:Resurrecting the Player"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Althir
(New page: 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. <code>ScriptName 000PlayerResu...)
 
imported>Haama
m (It's 'pre', not 'code')
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:




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


short DoOnce
short DoOnce
Line 34: Line 34:
;if they reach the 50 Points Threshold
;if they reach the 50 Points Threshold
;be sure that the HitPoints never fall below 50 Points
;be sure that the HitPoints never fall below 50 Points
;Furthermore stop the enemys from attacking the Player


if (GetActorValue Health < 51)
if (GetActorValue Health < 51)
set CurrentHealth to GetActorValue Health
set CurrentHealth to GetActorValue Health
StopCombatAlarmOnActor
if (CurrentHealth != 50)
if (CurrentHealth != 50)
set FixHealth to (50 - CurrentHealth)  
set FixHealth to (50 - CurrentHealth)  
Line 46: Line 43:
endif
endif


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


if (Death != 1)
if (Death != 1)
StopCombatAlarmOnActor
SetGhost 1
SetGhost 1
ForceActorValue Fatigue -1000
ForceActorValue Fatigue -1000
Line 70: Line 69:
set BaseFatigue to (GetBaseActorValue Fatigue)  
set BaseFatigue to (GetBaseActorValue Fatigue)  
ForceActorValue Fatigue BaseFatigue
ForceActorValue Fatigue BaseFatigue
set init to 0
set init to 0
                        set Death to 0
set Death to 0
         endif
         endif
endif
endif
Line 77: 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