Scriptname _00E_FS_Affinity_SpectralWarriorSC extends activemagiceffect _FS_Phasmalist_AffinityControlQuest Property AffinityControlQuest Auto _FS_Phasmalist_ControlQuest Property ControlQuest Auto Perk Property _00E_A1_QyraniStancePerk Auto Perk Property _00E_A1_SkaraggStancePerk Auto MiscObject Property _00E_Phasmalist_UpdateInventoryItem auto float Property QyraiStanceBoostApparationSpeed = 20 AutoReadOnly float Property SkaraggStanceBoostApparationAttackDmgMult = 0.2 AutoReadOnly Event OnEffectStart(Actor akTarget, Actor akCaster) AffinityControlQuest.registerForSpectralWarriorEvents(Self) RegisterForEvents() Endevent Function RegisterForEvents() RegisterForModEvent("Phasmalist_ApparationSummon", "OnApparationSummoned") Endfunction Function OnLoadGame() RegisterForEvents() EndFunction Event OnEffectFinish(Actor akTarget, Actor akCaster) AffinityControlQuest.unRegisterForSpectralWarriorEvents() unRegisterForModEvent("Phasmalist_ApparationSummon") Endevent Event OnApparationSummoned(string eventName, string strArg, float numArg, Form sender) if Game.GetPlayer().HasPerk(_00E_A1_QyraniStancePerk) TestForApplyBoost("qyrai") elseif Game.GetPlayer().HasPerk(_00E_A1_SkaraggStancePerk) TestForApplyBoost("skaragg") Endif Endevent Function OnStanceBegin(string stanceName) TestForApplyBoost(stanceName) EndFunction Function OnStanceEnd(string stanceName) if stanceName == "qyrai" RemoveQyranianBoost() elseif stanceName == "skaragg" RemoveSkaraggBoost() Endif EndFunction Function TestForApplyBoost(string stanceName) Actor apparation = ControlQuest.apparationAlias.GetActorReference() if stanceName == "qyrai" && apparation apparation.modAV("SpeedMult", QyraiStanceBoostApparationSpeed) apparation.additem(_00E_Phasmalist_UpdateInventoryItem) apparation.removeitem(_00E_Phasmalist_UpdateInventoryItem) elseif stanceName == "skaragg" && apparation apparation.modAV("AttackDamageMult", SkaraggStanceBoostApparationAttackDmgMult) Endif Endfunction Function RemoveQyranianBoost() Actor apparation = ControlQuest.apparationAlias.GetActorReference() if apparation apparation.modAV("SpeedMult", -QyraiStanceBoostApparationSpeed) apparation.additem(_00E_Phasmalist_UpdateInventoryItem) apparation.removeitem(_00E_Phasmalist_UpdateInventoryItem) Endif EndFunction Function RemoveSkaraggBoost() Actor apparation = ControlQuest.apparationAlias.GetActorReference() if apparation apparation.modAV("AttackDamageMult", SkaraggStanceBoostApparationAttackDmgMult) Endif EndFunction