diff --git a/ConjurableMaid.esp b/ConjurableMaid.esp index f11d290..da2ce94 100644 --- a/ConjurableMaid.esp +++ b/ConjurableMaid.esp @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bb3c62b3407b26a7dc9016cbe66b8243a954e459ed738b730ab6ae849d153b13 -size 68544 +oid sha256:c71a8fb4845d75d384f7131bc4129e5e435ad08759fe464cadd8b81335e89957 +size 70043 diff --git a/Scripts/FCMConjurableMaidScript.pex b/Scripts/FCMConjurableMaidScript.pex new file mode 100644 index 0000000..ffb347a --- /dev/null +++ b/Scripts/FCMConjurableMaidScript.pex @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7d2f2f4a7417f86f56e692659473e5fb80b85fa7d4e517112ae2cf92e1e2c54 +size 2765 diff --git a/Scripts/FCMMaidArmedScript.pex b/Scripts/FCMMaidArmedScript.pex new file mode 100644 index 0000000..f3055b6 --- /dev/null +++ b/Scripts/FCMMaidArmedScript.pex @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10c147f3cabf4786907affeb2d098b2621f4ee3b8ac856fe39388f3e315d5f5b +size 1753 diff --git a/Scripts/FCMSpectralMaidScript.pex b/Scripts/FCMSpectralMaidScript.pex index 4375bb4..89c5207 100644 --- a/Scripts/FCMSpectralMaidScript.pex +++ b/Scripts/FCMSpectralMaidScript.pex @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5d9a2a0cf108464e7cd6576576d12b6a233652847ae994fde9961b404e28116b -size 3848 +oid sha256:d9fb350f088402a9f6e9cdd6ccb6c10bdc924a70b7a4933ec148d7f19ae84e47 +size 1700 diff --git a/Scripts/FCMSummonMaidScript.pex b/Scripts/FCMSummonMaidScript.pex index 0b03f9b..6b0edeb 100644 --- a/Scripts/FCMSummonMaidScript.pex +++ b/Scripts/FCMSummonMaidScript.pex @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:67e438a173d614cdb430fb3495a716404b2c6a0f5b3fcc76ef47706a70595488 -size 1206 +oid sha256:9ee0af59d27626ee23eef15fa5fa1ec8ad4852348a7e4f2cecd5b652b370d1dd +size 1411 diff --git a/Scripts/TIF__05011623.pex b/Scripts/TIF__05011623.pex index 0ffb903..e41d26c 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:3ebc5d2a44174b99a242bd104f9eebb31dcbabb8746b778ea25f0dde914ba0cc -size 716 +oid sha256:8dfe962f93809e1ba1219fdc41709418ebf2fbb2c1ecc6195c2250674f8dcfd4 +size 665 diff --git a/Source/Scripts/FCMConjurableMaidScript.psc b/Source/Scripts/FCMConjurableMaidScript.psc new file mode 100644 index 0000000..22f9365 --- /dev/null +++ b/Source/Scripts/FCMConjurableMaidScript.psc @@ -0,0 +1,70 @@ +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 diff --git a/Source/Scripts/FCMMaidArmedScript.psc b/Source/Scripts/FCMMaidArmedScript.psc new file mode 100644 index 0000000..11b81d6 --- /dev/null +++ b/Source/Scripts/FCMMaidArmedScript.psc @@ -0,0 +1,53 @@ +Scriptname FCMMaidArmedScript extends Actor + +WEAPON Property BoundBow Auto + +WEAPON Property BoundBattleAxe Auto + +Ammo Property boundArrow Auto + +GlobalVariable Property ArmedFlag Auto + +Location Property HomeLocation Auto + +Bool Function TryAddBoundWeapons() + ArmedFlag.SetValue(1) + If(HasBoundWeapons()) + return False + Else + AddItem(BoundBow, 1) + AddItem(BoundBattleAxe, 1) + AddItem(BoundArrow, 1) + return True + EndIf +EndFunction + +Bool Function TryRemoveBoundWeapons() + ArmedFlag.SetValue(0) + If(HasBoundWeapons()) + RemoveItem(BoundBow, 1) + RemoveItem(BoundBattleAxe, 1) + RemoveItem(BoundArrow, 1) + return True + Else + return False + EndIf +EndFunction + +Bool Function HasBoundWeapons() + return GetItemCount(BoundBow) +EndFunction + +Function SetIsArmed(Bool b) + if(b) + TryAddBoundWeapons() + else + TryRemoveBoundWeapons() + endif +EndFunction + +Event OnLocationChange(Location oldLoc, Location newLoc) + If(newLoc == HomeLocation) + SetIsArmed(False) + EndIf +EndEvent \ No newline at end of file diff --git a/Source/Scripts/FCMSpectralMaidScript.psc b/Source/Scripts/FCMSpectralMaidScript.psc index bfb3014..27a024b 100644 --- a/Source/Scripts/FCMSpectralMaidScript.psc +++ b/Source/Scripts/FCMSpectralMaidScript.psc @@ -4,43 +4,16 @@ SPELL PROPERTY pGhostAbilityNew AUTO SPELL PROPERTY pGhostResistsAbility AUTO GlobalVariable Property pMaidSpectralFlag Auto -GlobalVariable Property pMaidMovingFlag Auto -ObjectReference Property pMaidHomeMarker Auto +Location Property HomeLocation 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) + AddSpectralAbilities() else pMaidSpectralFlag.SetValue(0) + RemoveSpectralAbilities() EndIf EndFunction @@ -52,79 +25,30 @@ Bool Function GetIsSpectral() endIF EndFunction -Bool Function GetIsMoving() - if (pMaidMovingFlag.getValue() == 1) - return True +Function AddSpectralAbilities() + addSpell(pGhostAbilityNew) + addSpell(pGhostResistsAbility) +EndFunction +Function RemoveSpectralAbilities() + removeSpell(pGhostAbilityNew) + removeSpell(pGhostResistsAbility) +EndFunction + +FUNCTION RestoreSpectralAbilities() + if (GetIsSpectral()) + AddSpectralAbilities() Else - Return False - EndIf + RemoveSpectralAbilities() + 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) + RestoreSpectralAbilities() ENDEVENT EVENT onLocationChange(Location akOldLoc, Location akNewLoc) - updateSpectralAbilities() -ENDEVENT - -EVENT OnDying(Actor killer) - TryReturn() -ENDEVENT + If(akNewLoc == HomeLocation) + SetIsSpectral(0) + EndIf +ENDEVENT \ No newline at end of file diff --git a/Source/Scripts/FCMSummonMaidScript.psc b/Source/Scripts/FCMSummonMaidScript.psc index 4f0c3dc..36f924e 100644 --- a/Source/Scripts/FCMSummonMaidScript.psc +++ b/Source/Scripts/FCMSummonMaidScript.psc @@ -2,10 +2,13 @@ Scriptname FCMSummonMaidScript extends activemagiceffect ObjectReference Property pMaidRef Auto Bool Property pIsSpectral Auto +Bool Property pIsArmed Auto Keyword Property pSummonMaidMagicKeyword Auto Event OnEffectStart(actor akTarget, actor akCaster) - (pMaidRef as FCMSpectralMaidScript).TryConjure(pIsSpectral) + (pMaidRef as FCMSpectralMaidScript).SetIsSpectral(pIsSpectral) + (pMaidRef as FCMMaidArmedScript).SetIsArmed(pIsArmed) + (pMaidRef as FCMConjurableMaidScript).TryConjure() EndEvent @@ -14,6 +17,6 @@ Event OnEffectFinish(actor akTarget, actor akCaster) Debug.Trace("Player still have return magic effect") else Debug.Trace("Start Returning") - (pMaidRef as FCMSpectralMaidScript).TryReturn() + (pMaidRef as FCMConjurableMaidScript).TryReturn() endif endEvent \ No newline at end of file diff --git a/Source/Scripts/TIF__05011623.psc b/Source/Scripts/TIF__05011623.psc index 8d52be2..cca479b 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 FCMMaidDialogueScript).TryReturn() +(akSpeaker as FCMConjurableMaidScript).TryReturn() ;END CODE EndFunction ;END FRAGMENT