130 lines
2.8 KiB
Text
130 lines
2.8 KiB
Text
Scriptname FCMSpectralMaidScript extends Actor
|
|
|
|
SPELL PROPERTY pGhostAbilityNew AUTO
|
|
SPELL PROPERTY pGhostResistsAbility AUTO
|
|
|
|
GlobalVariable Property pMaidSpectralFlag Auto
|
|
GlobalVariable Property pMaidMovingFlag Auto
|
|
ObjectReference Property pMaidHomeMarker Auto
|
|
|
|
EffectShader Property ConjureEffect Auto
|
|
|
|
Activator property ConjureEffectActivator Auto
|
|
ImageSpaceModifier property ConjureImageSpace Auto
|
|
|
|
SPELL Property pConjureMaidSpell AUTO
|
|
SPELL PROPERTY pConjureSpectralMaidSpell AUTO
|
|
|
|
Bool Function TryDispelPlayer()
|
|
Actor player = Game.GetPlayer()
|
|
return player.DispelSpell(pConjureMaidSpell) || player.DispelSpell(pConjureSpectralMaidSpell)
|
|
EndFunction
|
|
|
|
Bool Function TryConjure(Bool isSpectral)
|
|
if (isNearPlayer())
|
|
return False
|
|
EndIf
|
|
if (IsSpectral)
|
|
SetIsSpectral(True)
|
|
endif
|
|
return TryMoveto(game.GetPlayer())
|
|
EndFunction
|
|
|
|
Bool Function TryReturn()
|
|
|
|
return tryDispelPlayer() && TryMoveTo(pMaidHomeMarker)
|
|
|
|
EndFunction
|
|
|
|
Function SetIsSpectral(Bool b)
|
|
if (b)
|
|
pMaidSpectralFlag.SetValue(1)
|
|
else
|
|
pMaidSpectralFlag.SetValue(0)
|
|
EndIf
|
|
EndFunction
|
|
|
|
Bool Function GetIsSpectral()
|
|
if (pMaidSpectralFlag.getValue() == 1)
|
|
return True
|
|
Else
|
|
Return False
|
|
endIF
|
|
EndFunction
|
|
|
|
Bool Function GetIsMoving()
|
|
if (pMaidMovingFlag.getValue() == 1)
|
|
return True
|
|
Else
|
|
Return False
|
|
EndIf
|
|
EndFunction
|
|
|
|
Function SetIsMoving(Bool b)
|
|
If (b)
|
|
pMaidMovingFlag.SetValue(1)
|
|
Else
|
|
pMaidMovingFlag.SetValue(0)
|
|
endIf
|
|
EndFunction
|
|
|
|
|
|
Bool Function TryMoveTo(ObjectReference target)
|
|
If(GetIsMoving())
|
|
return False
|
|
Else
|
|
SetIsMoving(True)
|
|
Disappear()
|
|
Moveto(target)
|
|
Appear()
|
|
SetIsMoving(False)
|
|
Return True
|
|
EndIf
|
|
EndFunction
|
|
|
|
Function Appear()
|
|
StopCombat()
|
|
Enable()
|
|
If(IsNearPlayer())
|
|
placeAtMe(ConjureEffectActivator)
|
|
ConjureImageSpace.Apply()
|
|
ConjureEffect.Play(Self, 1)
|
|
EndIf
|
|
EndFunction
|
|
|
|
Function DisAppear()
|
|
SetIsSpectral(false)
|
|
If(IsNearPlayer())
|
|
ConjureEffect.Play(Self, 1)
|
|
Disable(true)
|
|
utility.wait(1)
|
|
Else
|
|
Disable(True)
|
|
EndIf
|
|
StopCombat()
|
|
EndFunction
|
|
|
|
FUNCTION UpdateSpectralAbilities()
|
|
if (pMaidSpectralFlag.getValue() == 1)
|
|
SELF.addSpell(pGhostAbilityNew)
|
|
SELF.addSpell(pGhostResistsAbility)
|
|
else
|
|
SELF.removeSpell(pGhostAbilityNew)
|
|
SELF.removeSpell(pGhostResistsAbility)
|
|
endIF
|
|
EndFUNCTION
|
|
|
|
|
|
EVENT onLoad()
|
|
SetPlayerTeammate()
|
|
updateSpectralAbilities()
|
|
SetIsMoving(False)
|
|
ENDEVENT
|
|
|
|
EVENT onLocationChange(Location akOldLoc, Location akNewLoc)
|
|
updateSpectralAbilities()
|
|
ENDEVENT
|
|
|
|
EVENT OnDying(Actor killer)
|
|
TryReturn()
|
|
ENDEVENT
|