Add spectral maid spell armored with bound weapons

This commit is contained in:
fluo10 2025-03-14 21:55:41 +09:00
parent c7b98ad5de
commit 92d518309e
11 changed files with 165 additions and 109 deletions

BIN
ConjurableMaid.esp (Stored with Git LFS)

Binary file not shown.

BIN
Scripts/FCMConjurableMaidScript.pex (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Scripts/FCMMaidArmedScript.pex (Stored with Git LFS) Normal file

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.

View file

@ -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

View file

@ -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

View file

@ -4,43 +4,16 @@ SPELL PROPERTY pGhostAbilityNew AUTO
SPELL PROPERTY pGhostResistsAbility AUTO SPELL PROPERTY pGhostResistsAbility AUTO
GlobalVariable Property pMaidSpectralFlag Auto GlobalVariable Property pMaidSpectralFlag Auto
GlobalVariable Property pMaidMovingFlag Auto Location Property HomeLocation 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) Function SetIsSpectral(Bool b)
if (b) if (b)
pMaidSpectralFlag.SetValue(1) pMaidSpectralFlag.SetValue(1)
AddSpectralAbilities()
else else
pMaidSpectralFlag.SetValue(0) pMaidSpectralFlag.SetValue(0)
RemoveSpectralAbilities()
EndIf EndIf
EndFunction EndFunction
@ -52,79 +25,30 @@ Bool Function GetIsSpectral()
endIF endIF
EndFunction EndFunction
Bool Function GetIsMoving() Function AddSpectralAbilities()
if (pMaidMovingFlag.getValue() == 1) addSpell(pGhostAbilityNew)
return True addSpell(pGhostResistsAbility)
EndFunction
Function RemoveSpectralAbilities()
removeSpell(pGhostAbilityNew)
removeSpell(pGhostResistsAbility)
EndFunction
FUNCTION RestoreSpectralAbilities()
if (GetIsSpectral())
AddSpectralAbilities()
Else Else
Return False RemoveSpectralAbilities()
EndIf Endif
EndFunction 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() EVENT onLoad()
SetPlayerTeammate() RestoreSpectralAbilities()
updateSpectralAbilities()
SetIsMoving(False)
ENDEVENT ENDEVENT
EVENT onLocationChange(Location akOldLoc, Location akNewLoc) EVENT onLocationChange(Location akOldLoc, Location akNewLoc)
updateSpectralAbilities() If(akNewLoc == HomeLocation)
ENDEVENT SetIsSpectral(0)
EndIf
EVENT OnDying(Actor killer)
TryReturn()
ENDEVENT ENDEVENT

View file

@ -2,10 +2,13 @@ Scriptname FCMSummonMaidScript extends activemagiceffect
ObjectReference Property pMaidRef Auto ObjectReference Property pMaidRef Auto
Bool Property pIsSpectral Auto Bool Property pIsSpectral Auto
Bool Property pIsArmed Auto
Keyword Property pSummonMaidMagicKeyword Auto Keyword Property pSummonMaidMagicKeyword Auto
Event OnEffectStart(actor akTarget, actor akCaster) 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 EndEvent
@ -14,6 +17,6 @@ Event OnEffectFinish(actor akTarget, actor akCaster)
Debug.Trace("Player still have return magic effect") Debug.Trace("Player still have return magic effect")
else else
Debug.Trace("Start Returning") Debug.Trace("Start Returning")
(pMaidRef as FCMSpectralMaidScript).TryReturn() (pMaidRef as FCMConjurableMaidScript).TryReturn()
endif endif
endEvent endEvent

View file

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