Jump to content

Simple Quest with Script(ATTENTION! Author is novice)


Recommended Posts

Oh of course, you have to check every time PC rad is >= 1000

 

Something like this:

Scriptname RadiationPlayerDeath extends Quest

import utility
import debug
import game

ActorValue property Rads auto const
ActorValue property HPs auto const
Actor property PlayerRef auto const
Perk property SurvivedMutant auto

int TimerID = 10
float fRad = 0.0
int i = 1
int Survive = 0
bool warned = false

Event OnInit()
    RegisterForRadiationDamageEvent(PlayerRef)
EndEvent

Event OnRadiationDamage(ObjectReference akTarget, bool abIngested)
	fRad = PlayerRef.GetValue(Rads) as float
	if fRad >= 1000
		PrepareToDie ()
	else
		RegisterForRadiationDamageEvent(PlayerRef)		
	endif
EndEvent
Function PrepareToDie()
	if !PlayerRef.IsDead ()
		if i == 2
			i += 1
			Notification(" DEADLY RAD-LEVEL! ")
			startTimer (2.0)
		elseif i == 3
			i += 1
			Notification(" PERFORM MEDICAL TREATMENT IMMEDIATELY! ")
			startTimer (5.0)
		elseif i == 4
			if PlayerRef.HasPerk(SurvivedMutant)
				Notification(" I am resisting to crawling radiation death... ")
				if !warned
					warned = true
					startTimer (10.0)
				else
					warned = false
					float fHP = (PlayerRef.GetValue(HPs) as float) * 0.1
					PlayerRef.DamageValue(HPS, fHP)
					Notification(" I am feeling really bad, should do something. ")
					i += 1
					PlayerRef.DamageValue(HPS, fHP)
					startTimer (10.0)
				endif
			else
				Notification(" I am feeling really bad, should do something. ")
				i += 1
				float fHP = (PlayerRef.GetValue(HPs) as float) * 0.1
				PlayerRef.DamageValue(HPS, fHP)
				startTimer (10.0)
			endif
		elseif i == 5
			Notification(" I am dying... ")	
			i += 1
			float fHP = (PlayerRef.GetValue(HPs) as float) * 0.1
			PlayerRef.DamageValue(HPS, fHP)
			startTimer (3.0)
		elseif i == 6
			float fHP = (PlayerRef.GetValue(HPs) as float) * 0.1
			PlayerRef.DamageValue(HPS, fHP)
			startTimer (0.1)
			Survive = 1
		else
			i += 1
			Notification(" PIP-BOY BLINKING ")
			startTimer (2.0)
		endif
	endif
EndFunction

Event OnTimer(int aiTimerID)
	fRad = PlayerRef.GetValue(Rads) as float
	if fRad >= 1000
		PrepareToDie ()
	else
		if Survive == 1
			if PlayerRef.HasPerk(SurvivedMutant)
				Notification(" I was so close to death... ")
			else
				PlayerRef.AddPerk(SurvivedMutant)
				MessageBox(" I was close to nuclear death, and now I able to survive under radiation pressure a little bit longer. ")
				Notification(" I am survived... ")
			endif
		endif
		i = 1
		Survive = 0
		warned = false
		RegisterForRadiationDamageEvent(PlayerRef)
	endif
EndEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...