SkyrimSE_ConjurableMaid/Source/Scripts/FCMConjurableMaidScript.psc

71 lines
1.7 KiB
Text
Raw Normal View History

Scriptname FCMConjurableMaidScript extends Actor
ObjectReference Property pMaidHomeMarker Auto
EffectShader Property ConjureEffect Auto
Activator property ConjureEffectActivator Auto
ImageSpaceModifier property ConjureImageSpace Auto
SPELL Property ConjureMaidSpell AUTO
SPELL PROPERTY ConjureSpectralMaidSpell AUTO
SPELL PROPERTY ConjureArmedMaidSpell AUTO
SPELL Property ConjurePermanentMaidSpell AUTO
Bool Function TryDispelPlayer()
Actor player = Game.GetPlayer()
return player.DispelSpell(ConjureMaidSpell) || player.DispelSpell(ConjureSpectralMaidSpell) || player.DIspelSpell(ConjureArmedMaidSpell) || player.DispelSpell(ConjurePermanentMaidSpell)
EndFunction
Bool Function TryConjure()
if (isNearPlayer())
PlayConjureEffect()
return False
EndIf
return TryMoveto(game.GetPlayer())
EndFunction
Bool Function TryReturn()
return tryDispelPlayer() && TryMoveTo(pMaidHomeMarker)
EndFunction
Bool Function TryMoveTo(ObjectReference target)
Disappear()
Moveto(target)
Appear()
EndFunction
Function PlayConjureEffect()
ConjureEffect.Play(Self, 1)
EndFunction
Function Appear()
StopCombat()
Enable()
If(IsNearPlayer())
placeAtMe(ConjureEffectActivator)
ConjureImageSpace.Apply()
ConjureEffect.Play(Self, 1)
EndIf
EndFunction
Function Disappear()
If(IsNearPlayer())
ConjureEffect.Play(Self, 1)
Disable(true)
utility.wait(1)
Else
Disable(True)
EndIf
StopCombat()
EndFunction
EVENT onLoad()
SetPlayerTeammate()
ENDEVENT
EVENT OnDying(Actor killer)
TryReturn()
ENDEVENT