enderalse/scripts/source/_00e_apparitionfxscript.psc
2021-10-06 00:59:59 +02:00

50 lines
1.5 KiB
Plaintext

Scriptname _00E_ApparitionFXScript extends activemagiceffect
Actor Property PlayerREF Auto
EffectShader Property _00E_Phasmalist_ApparitionShaderFXS Auto
Keyword Property _00E_Phasmalist_NoSummonLocationTown Auto
Perk Property _00E_Class_Phasmalist_P08_B_PhasmalicVeil Auto
Sound Property MAGAlterationInvisibilityIn Auto
Sound Property MAGAlterationInvisibilityOut Auto
Actor Target
Bool bTownMode
Float Property TOWN_ALPHA = 0.1 AutoReadOnly
Float Property WILDERNESS_ALPHA = 0.6 AutoReadOnly
Event OnEffectStart(Actor akTarget, Actor akCaster)
If akCaster == None || akCaster == PlayerREF
Dispel()
Return
EndIf
Target = akCaster
Target.SetAlpha(WILDERNESS_ALPHA) ; For visual reasons, want to set any alpha ASAP, before bTownMode is figured out
bTownMode = IsInTownMode(Target.GetCurrentLocation())
If bTownMode
Target.SetAlpha(TOWN_ALPHA)
EndIf
_00E_Phasmalist_ApparitionShaderFXS.Play(Target)
EndEvent
Event OnLocationChange(Location akOldLoc, Location akNewLoc)
Bool bNewTownMode = IsInTownMode(akNewLoc)
If bNewTownMode != bTownMode
bTownMode = bNewTownMode
If bTownMode
MAGAlterationInvisibilityIn.Play(Target)
Target.SetAlpha(TOWN_ALPHA, True)
Else
MAGAlterationInvisibilityOut.Play(Target)
Target.SetAlpha(WILDERNESS_ALPHA, True)
EndIf
EndIf
EndEvent
Bool Function IsInTownMode(Location loc)
Return (loc && loc.HasKeyword(_00E_Phasmalist_NoSummonLocationTown) && PlayerREF.HasPerk(_00E_Class_Phasmalist_P08_B_PhasmalicVeil))
EndFunction