From ccd719c04dc7f2fef599b8dce840236e5ec2ff25 Mon Sep 17 00:00:00 2001 From: fluo10 Date: Tue, 11 Mar 2025 07:17:10 +0900 Subject: [PATCH] Move Conjuration Script to Actor --- ConjurableMaid.esp | 4 +- Scripts/FCMSpectralMaidScript.pex | 4 +- Scripts/FCMSummonMaidScript.pex | 4 +- Scripts/TIF__05011623.pex | 4 +- Scripts/TIF__05011634.pex | 2 +- Source/Scripts/FCMSpectralMaidScript.psc | 109 +++++++++++++++++++++-- Source/Scripts/FCMSummonMaidScript.psc | 30 +------ Source/Scripts/TIF__05011623.psc | 2 +- 8 files changed, 117 insertions(+), 42 deletions(-) diff --git a/ConjurableMaid.esp b/ConjurableMaid.esp index 5bf688a..8058ba1 100644 --- a/ConjurableMaid.esp +++ b/ConjurableMaid.esp @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7bde32ee3213d4c424aa297404cde2e89df9eb9db119bc7a7748a9648761a8a3 -size 63006 +oid sha256:1290879186c314d3403dd72b52901a59ddc906597c49896e8c4f626e1b7cfd8a +size 67384 diff --git a/Scripts/FCMSpectralMaidScript.pex b/Scripts/FCMSpectralMaidScript.pex index c066514..c208e4d 100644 --- a/Scripts/FCMSpectralMaidScript.pex +++ b/Scripts/FCMSpectralMaidScript.pex @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d83687e8edc969f4e74858b5696cf8a7e0488613b97e029e906dc13876ea7599 -size 1128 +oid sha256:cf2c3a8e900864fc6a76bb61849b0c4ddcd1d7779f0d814dc6ad411c525ad9b5 +size 3730 diff --git a/Scripts/FCMSummonMaidScript.pex b/Scripts/FCMSummonMaidScript.pex index e11d881..fd16cdb 100644 --- a/Scripts/FCMSummonMaidScript.pex +++ b/Scripts/FCMSummonMaidScript.pex @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:635664e885356b01e3b95ae6396b21596f8a6cafb9fd3fd47ecb9373741e8471 -size 1723 +oid sha256:06fac8bb611d757020c6c880e77c61fa39f0110bad8af092ea5990e27b8e52c3 +size 865 diff --git a/Scripts/TIF__05011623.pex b/Scripts/TIF__05011623.pex index e39073d..d6f4cfb 100644 --- a/Scripts/TIF__05011623.pex +++ b/Scripts/TIF__05011623.pex @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c92eaf9dc6fb6328f5e7de0084109f1c8996904685e82b5f3e7b6d3d7fc40c4d -size 718 +oid sha256:102a2283c9131769a7c666d6478e249a5b7c78874c13a044bf54fe45281a1a60 +size 663 diff --git a/Scripts/TIF__05011634.pex b/Scripts/TIF__05011634.pex index 5fb1324..abb75e4 100644 --- a/Scripts/TIF__05011634.pex +++ b/Scripts/TIF__05011634.pex @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:26720a7d9c41f9b5f51a6d887516c716aadd100a31edcd27e658a49663b9d37c +oid sha256:8d09ed92d8a7334f51cbed1659f2a3967b8035ace100453d158916b8f7c754b8 size 609 diff --git a/Source/Scripts/FCMSpectralMaidScript.psc b/Source/Scripts/FCMSpectralMaidScript.psc index b50a88a..80a9398 100644 --- a/Source/Scripts/FCMSpectralMaidScript.psc +++ b/Source/Scripts/FCMSpectralMaidScript.psc @@ -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 \ No newline at end of file + updateSpectralAbilities() +ENDEVENT diff --git a/Source/Scripts/FCMSummonMaidScript.psc b/Source/Scripts/FCMSummonMaidScript.psc index 6329b50..190617c 100644 --- a/Source/Scripts/FCMSummonMaidScript.psc +++ b/Source/Scripts/FCMSummonMaidScript.psc @@ -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 \ No newline at end of file diff --git a/Source/Scripts/TIF__05011623.psc b/Source/Scripts/TIF__05011623.psc index 419b68c..608877c 100644 --- a/Source/Scripts/TIF__05011623.psc +++ b/Source/Scripts/TIF__05011623.psc @@ -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