Scriptname SuH_ae_essentialScript extends activemagiceffect  
;;; Set character as essential ghost character ,,,
;;; <>> Prevents actor harm and movement in acts ,,,

SexLabFramework property SexLab auto

Spell Property SuH_essential auto

actor char

int g

Event OnEffectStart(Actor akT, Actor akC)
	char = akT
	g = 0
	if char.IsGhost()
		g = 1
	else
		char.SetGhost(true)
	endIf
	RegisterForSingleUpdate(30.0)
endEvent

Event OnUpdate()
	if SexLab.IsValidActor(char)
		char.RemoveSpell(SuH_essential)
	else
		RegisterForSingleUpdate(30.0)
	endIf
endEvent

Event OnEffectFinish(Actor akT, Actor akC)
	if g == 0
		char.SetGhost(false)
	endIf
endEvent