scn SEOrderPriest1ResurrectSCRIPT
float resurrectTimer ; used to time resurrection
short resurrecting ; set to 1 when when dead and resurrecting
; set to 2 when really dead (obelisk is shut down)
short SpellRemove ; flag for if spell is removed because spell removal is not immediate
ref myParent ; parent obelisk
ref mySelf ; myself
begin OnLoad
set myParent to GetParentRef
set mySelf to GetSelf
if resurrecting == 1
; I'm not really dead
pms SEPriestResurrectShader
endif
; make sure he doesn't drop his staff when he dies
equipItem SEObeliskPriestStaff01 1 ; so he doesn't drop it when he dies
equipItem SEObeliskPriestStaff02 1 ; so he doesn't drop it when he dies
equipItem SEObeliskPriestStaff03 1 ; so he doesn't drop it when he dies
equipItem SEObeliskPriestStaff04 1 ; so he doesn't drop it when he dies
equipItem SEObeliskPriestStaff05 1 ; so he doesn't drop it when he dies
equipItem SEObeliskPriestStaff06 1 ; so he doesn't drop it when he dies
end
begin OnDeath
end
begin OnActivate
if isActionRef player == 1
; I'm not really dead
if resurrecting == 1
; don't touch me, I'm ELECTRIFIED!
[COLOR="Red"]; move marker to player and cast from it -- hack because dead actors can't cast spells[/COLOR]
[COLOR="Lime"] [B]SEOrderPriestCastingMarker.moveto player
SEOrderPriestCastingMarker.cast StandardShockDamageTarget1Novice player[/B][/COLOR]
else
Activate
endif
else
Activate
endif
end
begin gamemode
; don't run script if disabled or really dead
if getdisabled == 1 || resurrecting == 2
return
endif
if resurrecting == 0
if getDead == 1
; NOTE: priest faction used to indicate that obelisk is deactivated
if myParent != 0 && myParent.isOwner SEOrderPriestFaction == 0
; I'm not really dead
pms SEPriestResurrectShader
set resurrecting to 1
set resurrectTimer to SEOrderPriestResurrectTimer
else
; I'm really dead
setownership
set resurrecting to 2
endif
endif
endif
if resurrecting == 1
if resurrectTimer > 0
set resurrectTimer to resurrectTimer - getsecondsPassed
else
sms SEPriestResurrectShader
; NOTE: priest faction used to indicate that obelisk is deactivated
if myParent != 0 && myParent.isOwner SEOrderPriestFaction == 0
set resurrecting to 0
; start resurrection
pme REAN
; myParent.cast StandardShockDamageTarget1Novice mySelf
resurrect 1
; reequip staff
equipItem SEObeliskPriestStaff01 1 ; so he doesn't drop it when he dies
equipItem SEObeliskPriestStaff02 1 ; so he doesn't drop it when he dies
equipItem SEObeliskPriestStaff03 1 ; so he doesn't drop it when he dies
equipItem SEObeliskPriestStaff04 1 ; so he doesn't drop it when he dies
equipItem SEObeliskPriestStaff05 1 ; so he doesn't drop it when he dies
equipItem SEObeliskPriestStaff06 1 ; so he doesn't drop it when he dies
else
set resurrecting to 2
endif
endif
endif
; add power if obelisk is active, remove it if inactive
if myParent != 0
; if I have the spell, and obelisk is deactivated, remove it
if SpellRemove == 0 && myParent.isOwner SEOrderPriestFaction == 1
pme RFLC
Set SpellRemove to 1
; TODO: modify model?
; while we're at it, check package to see if I should be going to Find obelisk
if getiscurrentpackage SEOrderPriestActivateObelisk1 == 0
if myParent != 0 && myParent.isOwner SEOrderPriestFaction == 1
if getitemcount SEOrderPriestWidget == 0
additem SEOrderPriestWidget 1
modav aggression -100
evp
else
stopcombat
endif
endif
endif
; if I don't have the spell, and obelisk is activated, add it
elseif SpellRemove == 1 && myParent.isOwner SEOrderPriestFaction == 0 && getdead == 0
pme RFLC
Set SpellRemove to 0
; TODO: modify model?
; while we're at it, check package to see if I'm still on the Find obelisk
if getiscurrentpackage SEOrderPriestActivateObelisk1 == 1
evp
endif
endif
endif
end
begin OnHit
if myParent != 0 && myParent.isOwner SEOrderPriestFaction == 1
if getiscurrentpackage SEOrderPriestActivateObelisk1 == 0
evp
else
; 20% chance to drop out of combat and go for the obelisk with each hit
if getrandompercent <= 20
stopcombat
endif
endif
endif
end
begin OnStartCombat
if myParent != 0 && myParent.isOwner SEOrderPriestFaction == 1
if getiscurrentpackage SEOrderPriestActivateObelisk1 == 0
evp
endif
endif
end