Move Conjuration Script to Actor

This commit is contained in:
fluo10 2025-03-11 07:17:10 +09:00
parent 4244bbee10
commit ccd719c04d
8 changed files with 117 additions and 42 deletions

BIN
ConjurableMaid.esp (Stored with Git LFS)

Binary file not shown.

BIN
Scripts/FCMSpectralMaidScript.pex (Stored with Git LFS)

Binary file not shown.

BIN
Scripts/FCMSummonMaidScript.pex (Stored with Git LFS)

Binary file not shown.

BIN
Scripts/TIF__05011623.pex (Stored with Git LFS)

Binary file not shown.

BIN
Scripts/TIF__05011634.pex (Stored with Git LFS)

Binary file not shown.

View file

@ -4,8 +4,107 @@ SPELL PROPERTY pGhostAbilityNew AUTO
SPELL PROPERTY pGhostResistsAbility AUTO
GlobalVariable Property pMaidSpectralFlag Auto
GlobalVariable Property pMaidMovingFlag Auto
ObjectReference Property pMaidHomeMarker Auto
FUNCTION UpdateSpectralState()
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)
@ -17,10 +116,10 @@ EndFUNCTION
EVENT onLoad()
updateSpectralState()
updateSpectralAbilities()
SetIsMoving(False)
ENDEVENT
EVENT onLocationChange(Location akOldLoc, Location akNewLoc)
updateSpectralState()
ENDEVENT
updateSpectralAbilities()
ENDEVENT

View file

@ -1,36 +1,12 @@
Scriptname FCMSummonMaidScript extends activemagiceffect
ObjectReference Property MaidRef Auto
ObjectReference Property MaidHomeMarker Auto
EffectShader Property ConjureEffect Auto
;; Scene Property DLC2DremoraScene Auto
;; GlobalVariable Property DLC2DremoraForceGreet Auto
Bool Property IsSpectral Auto
Activator property ConjureEffectActivator Auto
ImageSpaceModifier property ConjureImageSpace Auto
Event OnEffectStart(actor akTarget, actor akCaster)
if (IsSpectral)
pSpectralFlag.SetValue(1)
endif
(MaidRef as actor).StopCombat()
MaidRef.Moveto(game.GetPlayer())
MaidRef.placeAtMe(ConjureEffectActivator)
ConjureImageSpace.Apply()
ConjureEffect.Play(MaidRef, 1)
(MaidRef as FCMSpectralMaidScript).TryConjure(isSpectral)
EndEvent
Event OnEffectFinish(actor akTarget, actor akCaster)
pSpectralFlag.SetValue(0)
ConjureEffect.Play(MaidRef, 1)
MaidRef.Disable(true)
utility.wait(1)
MaidRef.MoveTo(MaidHomeMarker)
(MaidRef as actor).StopCombat()
MaidRef.Enable()
EndEvent
GlobalVariable Property pSpectralFlag Auto
(MaidRef as FCMSpectralMaidScript).TryReturn()
EndEvent

View file

@ -6,7 +6,7 @@ Scriptname TIF__05011623 Extends TopicInfo Hidden
Function Fragment_0(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE
(GetOwningQuest() as FCMMaidDialogueQuestScript).Dispel()
(akSpeaker as FCMSpectralMaidScript).TryReturn()
;END CODE
EndFunction
;END FRAGMENT