enderalse/scripts/source/_00e_stanceloadfailsafesc.psc

98 lines
4.5 KiB
Plaintext

Scriptname _00E_StanceLoadFailsafeSC extends Actor
{This script fixes the issue that the Stance won't work properly due to saving with a Stance activated.}
Import _00E_TalentLibrary
Import Math
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnPlayerLoadGame()
If PlayerREF.HasPerk(_00E_A1_SkaraggStanceResistPerk)
AdjustSkaraggStancePerk()
ElseIf PlayerREF.HasPerk(_00E_A1_QyranianStanceBlockPerk)
AdjustQyranianStancePerk()
EndIf
EndEvent
;=====================================================================================
; Functions
;=====================================================================================
Function AdjustSkaraggStancePerk()
int iIndexSkaraggianStance = GetPlayerTalentLevel(_00E_Class_Vandal_P04_Talent_SkaraggianStance_01, _00E_Class_Vandal_P04_Talent_SkaraggianStance_02, _00E_Class_Vandal_P04_Talent_SkaraggianStance_03)
float iResistMalus = abs((_00E_A1_SkaraggStanceSP.GetNthEffectMagnitude(iIndexSkaraggianStance)/100) + 1)
float iDamageBonus = abs((_00E_A1_SkaraggStanceSP.GetNthEffectMagnitude(iIndexSkaraggianStance + 3)/100) +1)
float iStaggerBonus = abs(_00E_A1_SkaraggStanceSP.GetNthEffectMagnitude(iIndexSkaraggianStance + 6))
_00E_A1_SkaraggStanceResistPerk.SetNthEntryValue(0, 0, iResistMalus)
_00E_A1_SkaraggStanceDamagePerk.SetNthEntryValue(0, 0, iDamageBonus)
_00E_A1_SkaraggStanceStaggerPerk.SetNthEntryValue(0, 0, iStaggerBonus)
EndFunction
Function AdjustQyranianStancePerk()
int iIndexQyranianStance = GetPlayerTalentLevel(_00E_Class_BladeDancer_P04_Talent_QyranianStance_01, _00E_Class_BladeDancer_P04_Talent_QyranianStance_02, _00E_Class_BladeDancer_P04_Talent_QyranianStance_03)
float iWPNSpeedBonus = abs((_00E_A1_QyraiStanceSP.GetNthEffectMagnitude(iIndexQyranianStance)/100) + 1)
float iBlockMalus = abs((_00E_A1_QyraiStanceSP.GetNthEffectMagnitude(iIndexQyranianStance + 3)/100) - 1)
float iEnemyCritChance = abs((_00E_A1_QyraiStanceSP.GetNthEffectMagnitude(iIndexQyranianStance + 6)/100) + 1)
float iSpeedBonus = abs((_00E_A1_QyraiStanceSP.GetNthEffectMagnitude(iIndexQyranianStance + 9)/100)) * (PlayerREF.GetActorValue("Speedmult"))
If PlayerREF.HasSpell(PerkBlutsrunst13) || PlayerREF.HasSpell(PerkBlutsrunst23)
If PlayerREF.GetEquippedItemType(1) == 5 || PlayerREF.GetEquippedItemType(1) == 6 && !PlayerREF.HasSpell(PerkBlutsrunst23)
iWPNSpeedBonus = iWPNSpeedBonus + 0.05
Elseif PlayerREF.GetEquippedItemType(1) == 5 || PlayerREF.GetEquippedItemType(1) == 6 && PlayerREF.HasSpell(PerkBlutsrunst23)
iWPNSpeedBonus = iWPNSpeedBonus + 0.10
EndIf
EndIf
If PlayerREF.HasSpell(PerkDualFlurry30)
If (PlayerREF.GetEquippedItemType(1) > 0 && PlayerREF.GetEquippedItemType(1) <= 4) && (PlayerREF.GetEquippedItemType(0) > 0 && PlayerREF.GetEquippedItemType(0) <= 4)
iWPNSpeedBonus = iWPNSpeedBonus + 0.15
EndIf
EndIf
_00E_A1_QyranianStanceBlockPerk.SetNthEntryValue(0, 0, iBlockMalus)
_00E_A1_QyranianStanceEnemyCritPerk.SetNthEntryValue(0, 0, iEnemyCritChance)
_00E_A1_QyraiStanceAb.SetNthEffectMagnitude(0, iWPNSpeedBonus)
_00E_A1_QyraiStanceAb.SetNthEffectMagnitude(1, iSpeedBonus)
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
_00E_QuestFunctions Property Levelsystem Auto
Actor Property PlayerREF Auto
Perk Property _00E_A1_QyranianStanceBlockPerk Auto
Perk Property _00E_A1_QyranianStanceEnemyCritPerk Auto
Perk Property _00E_A1_SkaraggStanceResistPerk Auto
Perk Property _00E_A1_SkaraggStanceDamagePerk Auto
Perk Property _00E_A1_SkaraggStanceStaggerPerk Auto
Perk Property _00E_Class_BladeDancer_P04_Talent_QyranianStance_01 Auto
Perk Property _00E_Class_BladeDancer_P04_Talent_QyranianStance_02 Auto
Perk Property _00E_Class_BladeDancer_P04_Talent_QyranianStance_03 Auto
Perk Property _00E_Class_Vandal_P04_Talent_SkaraggianStance_01 Auto
Perk Property _00E_Class_Vandal_P04_Talent_SkaraggianStance_02 Auto
Perk Property _00E_Class_Vandal_P04_Talent_SkaraggianStance_03 Auto
Spell Property _00E_A1_QyraiStanceSP Auto
Spell Property _00E_A1_QyraiStanceAb Auto
Spell Property PerkBlutsrunst23 Auto
Spell Property PerkBlutsrunst13 Auto
Spell Property PerkDualFlurry30 Auto
Spell Property _00E_A1_SkaraggStanceSP Auto