2021-10-05 22:15:58 +00:00
|
|
|
Scriptname _00E_Theriantrophist_TransformStorage extends Quest
|
|
|
|
|
|
|
|
Form EquippedItemLeft
|
|
|
|
Form EquippedItemRight
|
|
|
|
|
|
|
|
Armor[] wornArmor
|
|
|
|
|
|
|
|
Int whatKindLeft
|
|
|
|
Int whatKindRight
|
|
|
|
|
|
|
|
Float armorRating
|
|
|
|
Float weaponDamageSpeed
|
|
|
|
|
|
|
|
Float Property DualWieldLeftHandMalus = 4.0 Autoreadonly Hidden
|
|
|
|
{The damage of a the left hand weapon is divided by this to avoid exploitation}
|
|
|
|
|
|
|
|
Perk Property _00E_Class_BladeDancer_P01_Mercenary_01 Auto ;8
|
|
|
|
Perk Property _00E_Class_BladeDancer_P01_Mercenary_02 Auto ;7
|
|
|
|
Perk Property _00E_Class_Vandal_P01_Barbarian_01 Auto ; 12
|
|
|
|
Perk Property _00E_Class_Vandal_P01_Barbarian_02 Auto ; 10
|
|
|
|
Perk Property _00E_Class_Trickster_P01_StrongBowstring_01 Auto ; 12
|
|
|
|
Perk Property _00E_Class_Trickster_P01_StrongBowstring_02 Auto ; 10
|
|
|
|
|
|
|
|
ObjectReference Property _00E_TransformStorageREF Auto
|
|
|
|
|
|
|
|
int Function GetWeaponDamage(Weapon weapID)
|
|
|
|
|
|
|
|
int iDamage
|
|
|
|
String scalingAV
|
|
|
|
float fPerkMod
|
|
|
|
|
|
|
|
Actor akplayer = Game.GetPlayer()
|
|
|
|
|
|
|
|
if weapID.IsBattleaxe() || weapID.IsGreatsword()
|
|
|
|
scalingAV = "TwoHanded"
|
|
|
|
elseif weapID.IsBow()
|
|
|
|
scalingAV = "Marksman"
|
|
|
|
else
|
|
|
|
scalingAV = "OneHanded"
|
|
|
|
endif
|
|
|
|
|
|
|
|
if scalingAV == "TwoHanded"
|
|
|
|
|
|
|
|
if akplayer.HasPerk(_00E_Class_Vandal_P01_Barbarian_01)
|
|
|
|
fPerkMod += 12
|
|
|
|
endif
|
|
|
|
|
|
|
|
if akplayer.HasPerk(_00E_Class_Vandal_P01_Barbarian_02)
|
|
|
|
fPerkMod += 10
|
|
|
|
endif
|
|
|
|
|
|
|
|
elseif scalingAV == "Marksman"
|
|
|
|
|
|
|
|
if akplayer.HasPerk(_00E_Class_Trickster_P01_StrongBowstring_01)
|
|
|
|
fPerkMod += 12
|
|
|
|
endif
|
|
|
|
|
|
|
|
if akplayer.HasPerk(_00E_Class_Trickster_P01_StrongBowstring_02)
|
|
|
|
fPerkMod += 10
|
|
|
|
endif
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
if akplayer.HasPerk(_00E_Class_BladeDancer_P01_Mercenary_01)
|
|
|
|
fPerkMod += 8
|
|
|
|
endif
|
|
|
|
|
|
|
|
if akplayer.HasPerk(_00E_Class_BladeDancer_P01_Mercenary_02)
|
|
|
|
fPerkMod += 7
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2023-12-08 02:45:53 +00:00
|
|
|
iDamage = ((weapID.GetBaseDamage()*weapID.getSpeed())*(1+((akplayer.GetActorValue(scalingAV)*0.55)/100))*(1+(fPerkMod/100))) as Int
|
2021-10-05 22:15:58 +00:00
|
|
|
return iDamage
|
|
|
|
|
|
|
|
EndFunction
|
|
|
|
|
2024-02-14 06:17:21 +00:00
|
|
|
function saveEquippedItemsVanilla()
|
|
|
|
|
|
|
|
Actor PlayerRef = Game.GetForm(0x14) as Actor
|
|
|
|
|
|
|
|
EquippedItemLeft = PlayerRef.GetEquippedWeapon(true) as Form
|
|
|
|
if ! EquippedItemLeft
|
|
|
|
EquippedItemLeft = PlayerRef.GetEquippedSpell(0) as Form
|
|
|
|
endif
|
|
|
|
|
|
|
|
EquippedItemRight = PlayerRef.GetEquippedWeapon(false) as Form
|
|
|
|
if ! EquippedItemRight
|
|
|
|
EquippedItemRight = PlayerRef.GetEquippedSpell(1) as Form
|
|
|
|
endif
|
|
|
|
|
|
|
|
If !EquippedItemRight
|
|
|
|
whatKindRight = 0
|
|
|
|
ElseIf (EquippedItemRight as Weapon)
|
|
|
|
;weaponDamageSpeed += GetWeaponDamage(EquippedItemRight as Weapon)
|
|
|
|
whatKindRight = 1
|
|
|
|
ElseIf (EquippedItemRight as Spell)
|
|
|
|
whatKindRight = 2
|
|
|
|
Else
|
|
|
|
whatKindRight = 1
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
If !EquippedItemLeft
|
|
|
|
whatKindLeft = 0
|
|
|
|
ElseIf (EquippedItemLeft as Weapon)
|
|
|
|
;GetWeaponDamage(EquippedItemLeft as Weapon)
|
|
|
|
whatKindLeft = 1
|
|
|
|
ElseIf (EquippedItemLeft as Spell)
|
|
|
|
whatKindLeft = 2
|
|
|
|
Else
|
|
|
|
whatKindLeft = 1
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
wornArmor = new Armor[15]
|
|
|
|
wornArmor[0] = PlayerRef.GetEquippedArmorInSlot(30) as Armor
|
|
|
|
wornArmor[1] = PlayerRef.GetEquippedArmorInSlot(31) as Armor
|
|
|
|
wornArmor[2] = PlayerRef.GetEquippedArmorInSlot(32) as Armor
|
|
|
|
wornArmor[3] = PlayerRef.GetEquippedArmorInSlot(33) as Armor
|
|
|
|
wornArmor[4] = PlayerRef.GetEquippedArmorInSlot(34) as Armor
|
|
|
|
wornArmor[5] = PlayerRef.GetEquippedArmorInSlot(35) as Armor
|
|
|
|
wornArmor[6] = PlayerRef.GetEquippedArmorInSlot(36) as Armor
|
|
|
|
wornArmor[7] = PlayerRef.GetEquippedArmorInSlot(37) as Armor
|
|
|
|
wornArmor[8] = PlayerRef.GetEquippedArmorInSlot(38) as Armor
|
|
|
|
wornArmor[9] = PlayerRef.GetEquippedArmorInSlot(39) as Armor
|
|
|
|
wornArmor[10] = PlayerRef.GetEquippedArmorInSlot(40) as Armor
|
|
|
|
wornArmor[11] = PlayerRef.GetEquippedArmorInSlot(41) as Armor
|
|
|
|
wornArmor[12] = PlayerRef.GetEquippedArmorInSlot(42) as Armor
|
|
|
|
wornArmor[13] = PlayerRef.GetEquippedArmorInSlot(43) as Armor
|
|
|
|
wornArmor[13] = PlayerRef.GetEquippedArmorInSlot(47) as Armor ; backpack
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
2021-10-05 22:15:58 +00:00
|
|
|
Function saveEquippedItems()
|
|
|
|
|
2024-02-14 06:17:21 +00:00
|
|
|
Actor PlayerRef = Game.GetForm(0x14) as Actor
|
2021-10-05 22:15:58 +00:00
|
|
|
|
|
|
|
EquippedItemLeft = PlayerRef.GetEquippedObject(0)
|
|
|
|
EquippedItemRight = PlayerRef.GetEquippedObject(1)
|
|
|
|
weaponDamageSpeed = 0
|
|
|
|
|
|
|
|
If !EquippedItemRight
|
|
|
|
whatKindRight = 0
|
|
|
|
ElseIf (EquippedItemRight as Weapon)
|
|
|
|
weaponDamageSpeed += GetWeaponDamage(EquippedItemRight as Weapon)
|
|
|
|
whatKindRight = 1
|
|
|
|
ElseIf (EquippedItemRight as Spell)
|
|
|
|
whatKindRight = 2
|
|
|
|
Else
|
|
|
|
whatKindRight = 1
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
|
|
|
|
If !EquippedItemLeft
|
|
|
|
whatKindLeft = 0
|
|
|
|
ElseIf (EquippedItemLeft as Weapon)
|
|
|
|
GetWeaponDamage(EquippedItemLeft as Weapon)
|
|
|
|
whatKindLeft = 1
|
|
|
|
ElseIf (EquippedItemLeft as Spell)
|
|
|
|
whatKindLeft = 2
|
|
|
|
Else
|
|
|
|
whatKindLeft = 1
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
wornArmor = new Armor[15]
|
|
|
|
wornArmor[0] = PlayerRef.GetWornForm(0x00000001) as Armor
|
|
|
|
wornArmor[1] = PlayerRef.GetWornForm(0x00000002) as Armor
|
|
|
|
wornArmor[2] = PlayerRef.GetWornForm(0x00000004) as Armor
|
|
|
|
wornArmor[3] = PlayerRef.GetWornForm(0x00000008) as Armor
|
|
|
|
wornArmor[4] = PlayerRef.GetWornForm(0x00000010) as Armor
|
|
|
|
wornArmor[5] = PlayerRef.GetWornForm(0x00000020) as Armor
|
|
|
|
wornArmor[6] = PlayerRef.GetWornForm(0x00000040) as Armor
|
|
|
|
wornArmor[7] = PlayerRef.GetWornForm(0x00000080) as Armor
|
|
|
|
wornArmor[8] = PlayerRef.GetWornForm(0x00000100) as Armor
|
|
|
|
wornArmor[9] = PlayerRef.GetWornForm(0x00000200) as Armor
|
|
|
|
wornArmor[10] = PlayerRef.GetWornForm(0x00000400) as Armor
|
|
|
|
wornArmor[11] = PlayerRef.GetWornForm(0x00000800) as Armor
|
|
|
|
wornArmor[12] = PlayerRef.GetWornForm(0x00001000) as Armor
|
|
|
|
wornArmor[13] = PlayerRef.GetWornForm(0x00002000) as Armor
|
|
|
|
wornArmor[13] = PlayerRef.GetWornForm(0x00004000) as Armor
|
|
|
|
wornArmor[14] = PlayerRef.GetWornForm(0x00020000) as Armor
|
|
|
|
|
|
|
|
armorRating = 0
|
|
|
|
Int i = 0
|
|
|
|
while (i < wornArmor.length)
|
|
|
|
if (wornArmor[i] != None)
|
|
|
|
armorRating += wornArmor[i].getArmorRating()
|
|
|
|
Endif
|
|
|
|
i += 1
|
|
|
|
Endwhile
|
|
|
|
endFunction
|
|
|
|
|
|
|
|
Float Function getArmorRating()
|
|
|
|
return armorRating
|
|
|
|
Endfunction
|
|
|
|
|
|
|
|
Float Function getWeaponDamageSpeed()
|
|
|
|
return weaponDamageSpeed
|
|
|
|
Endfunction
|
|
|
|
|
|
|
|
bool Function isEquippedItemRightSpell()
|
|
|
|
return whatKindRight == 2
|
|
|
|
Endfunction
|
|
|
|
|
|
|
|
bool Function isEquippedItemLeftSpell()
|
|
|
|
return whatKindLeft == 2
|
|
|
|
Endfunction
|
|
|
|
|
|
|
|
Spell Function getEquippedSpellRight()
|
|
|
|
return EquippedItemRight as Spell
|
|
|
|
EndFunction
|
|
|
|
|
|
|
|
Spell Function getEquippedSpellLeft()
|
|
|
|
return EquippedItemLeft as Spell
|
|
|
|
EndFunction
|
|
|
|
|
|
|
|
Function equipeItems()
|
|
|
|
Actor PlayerRef = Game.GetPlayer()
|
2024-08-01 11:04:59 +00:00
|
|
|
bool bSKSE = SKSE.GetVersion() as bool
|
2021-10-05 22:15:58 +00:00
|
|
|
|
|
|
|
if whatKindRight == 2
|
|
|
|
PlayerRef.EquipSpell(EquippedItemRight as Spell, 1)
|
2024-02-14 06:17:21 +00:00
|
|
|
elseif EquippedItemRight && PlayerRef.GetItemCount(EquippedItemRight) > 0
|
2024-08-01 11:04:59 +00:00
|
|
|
if bSKSE
|
2024-02-13 09:10:11 +00:00
|
|
|
PlayerRef.EquipItemEx(EquippedItemRight, 1)
|
|
|
|
else
|
2024-08-01 11:04:59 +00:00
|
|
|
PlayerRef.EquipItem(EquippedItemRight, false, true)
|
2024-02-13 09:10:11 +00:00
|
|
|
endif
|
2021-10-05 22:15:58 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
if whatKindLeft == 2
|
|
|
|
PlayerRef.EquipSpell(EquippedItemLeft as Spell, 0)
|
2024-02-14 06:17:21 +00:00
|
|
|
elseif EquippedItemLeft && PlayerRef.GetItemCount(EquippedItemLeft) > 0
|
2024-08-01 11:04:59 +00:00
|
|
|
if bSKSE
|
2024-02-13 09:10:11 +00:00
|
|
|
PlayerRef.EquipItemEx(EquippedItemLeft, 2)
|
|
|
|
else
|
2024-08-01 11:04:59 +00:00
|
|
|
PlayerRef.EquipItem(EquippedItemLeft, false, true)
|
2024-02-13 09:10:11 +00:00
|
|
|
endif
|
2021-10-05 22:15:58 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
Int index = wornArmor.length
|
|
|
|
while index > 0
|
|
|
|
index -= 1
|
|
|
|
If wornArmor[index] && PlayerRef.GetItemCount(wornArmor[index]) > 0
|
2024-08-01 11:04:59 +00:00
|
|
|
if bSKSE
|
|
|
|
; EquipItemEx triggers OnEquipped properly
|
|
|
|
PlayerRef.EquipItemEx(wornArmor[index], 0, false, false)
|
|
|
|
else
|
|
|
|
;removing and readding items fixes the issue that set bonuses wouldn't apply properly after re-transforming
|
|
|
|
PlayerRef.RemoveItem(wornArmor[index], 1, true, _00E_TransformStorageREF)
|
|
|
|
_00E_TransformStorageREF.RemoveItem(wornArmor[index], 1, true, PlayerRef)
|
|
|
|
PlayerRef.EquipItem(wornArmor[index], false, true)
|
|
|
|
endif
|
2021-10-05 22:15:58 +00:00
|
|
|
EndIf
|
|
|
|
Endwhile
|
2024-08-01 11:04:59 +00:00
|
|
|
endFunction
|