Fixed Wolf Blood duration not applying without SKSE, added basic re-equipping

This commit is contained in:
Eddoursul 2024-02-14 07:17:21 +01:00
parent 629a8e3b1e
commit 00459d5b16
12 changed files with 161 additions and 68 deletions

Binary file not shown.

View File

@ -457,7 +457,7 @@ EndEvent
Event OnPlayerLoadGame()
_InitAchemyControl()
if aCreatedPotions.length == 0
if ! SKSE.GetVersion() || aCreatedPotions.length == 0
return
endif

View File

@ -89,7 +89,7 @@ int function _GetScriptVersion() Global
return 1
endFunction
Function Transform(int duration)
Function Transform(int duration = 0)
bool bWasParalyzed
Actor player = self.getActorReference()
@ -103,9 +103,21 @@ Function Transform(int duration)
EndIf
fPlayerScale = player.GetScale()
EquipementStorage.saveEquippedItems()
if SKSE.GetVersion()
EquipementStorage.saveEquippedItems()
else
EquipementStorage.saveEquippedItemsVanilla()
endif
float preTransformDmgResist = player.GetActorValue("damageResist")
_00E_Theriantrophist_WolfFormSP.setNthEffectDuration(0, duration)
if duration > 0
; Wolf Blood should dispel the wolf form on finish (as of 2.1)
; With SKSE, we equalize their duration. The 5 seconds offset serves as a failsafe in case the main effect ends without changing the race.
_00E_Theriantrophist_WolfFormSP.setNthEffectDuration(0, duration + 5)
endif
_00E_Theriantrophist_WolfFormSP.Cast(player)
WolfAttributes.SetInWolfForm(true)
player.additem(_00E_Theriantrophist_Claws, abSilent = true)
@ -131,7 +143,7 @@ Function TransformBack()
_00E_FS_Affinity_ScourgeOfTheWilds_TitanSP = Game.GetFormFromFile(0x0102F19E, "Enderal - Forgotten Stories.esm") as Spell
EndIf
MagicEffect _00E_FS_Affinity_ScourgeOfTheWilds_TitanME = Game.GetFormFromFile(0x0102F19F, "Enderal - Forgotten Stories.esm") as MagicEffect
;MagicEffect _00E_FS_Affinity_ScourgeOfTheWilds_TitanME = Game.GetFormFromFile(0x0102F19F, "Enderal - Forgotten Stories.esm") as MagicEffect
Actor PlayerREF = self.getActorReference()
@ -268,7 +280,15 @@ Function _InitStats(float preTransformDmgResist)
WolfAttributes.ModWolfHealth(fHealthMod)
WolfAttributes.ModWolfStamina(fStaminaMod)
float fClawDamage = boostFactor * _CalcWeaponSpellStrength(player) * (1 - BalancingDamageMalusPercent / 100.0)
float weaponStrength
if SKSE.GetVersion()
weaponStrength = _CalcWeaponSpellStrength(player)
else
weaponStrength = player.GetActorValue("OneHanded") / 2
endif
float fClawDamage = boostFactor * weaponStrength * (1 - BalancingDamageMalusPercent / 100.0)
float ClawDamageBonus = player.GetActorValue("LastBribedIntimidated")
WolfAttributes.ForceWolfUnarmedDmg(fClawDamage + ClawDamageBonus)

View File

@ -16,46 +16,55 @@ Topic Property CaliaDialogue_ForgottenStories_Theriantrophist_CommentsTopic Auto
Event OnEffectStart(Actor akTarget, Actor akCaster)
if akTarget == Game.GetPlayer()
if akTarget != Game.GetForm(0x14)
Dispel()
return
endif
if !akTarget.HasPerk(_00E_Class_Theriantrophist_P01_StrongBlood)
_00E_Theriantrophist_CannotDrinkPotion.Show()
_00E_Theriantrophist_PoisonOnWerewolfPotion.Cast(akTarget)
self.dispel()
if !akTarget.HasPerk(_00E_Class_Theriantrophist_P01_StrongBlood)
_00E_Theriantrophist_CannotDrinkPotion.Show()
_00E_Theriantrophist_PoisonOnWerewolfPotion.Cast(akTarget)
Dispel()
return
Endif
_00E_Theriantrophist_PlayerAsWerewolf playerWhileTransformedAlias = controlQuest.playerWhileTransformed
if _00E_FS_Theriantrophist_AllowTemporaryTransform.GetValueInt() == 0
if !playerWhileTransformedAlias.CanBeTransformed(akTarget.getCurrentLocation())
if EnderalFunctions.IsDLLLoaded()
Debug.Notification(_00E_Theriantrophist_ForceTransformBackMessage.getName())
_RestorePotion()
else
; TODO: Replace the string with a localizable message.
Debug.Notification("You cannot transform here.")
endif
Dispel()
return
Endif
_00E_Theriantrophist_PlayerAsWerewolf playerWhileTransformedAlias = controlQuest.playerWhileTransformed
if _00E_FS_Theriantrophist_AllowTemporaryTransform.GetValueInt() == 0
if !playerWhileTransformedAlias.CanBeTransformed(akTarget.getCurrentLocation())
if EnderalFunctions.IsDLLLoaded()
Debug.Notification(_00E_Theriantrophist_ForceTransformBackMessage.getName())
_RestorePotion()
else
; TODO: Replace the string with a localizable message.
Debug.Notification("You cannot transform here.")
endif
self.dispel()
return
Endif
endif
if (!playerWhileTransformedAlias.IsTransformed())
_AddArcaneFever()
playerWhileTransformedAlias.ForceRefTo(akTarget)
playerWhileTransformedAlias.Transform(self.getDuration() as int)
Endif
If _00E_MC_CaliaREF.GetDistance(Game.GetPlayer()) <= 700
_00E_MC_CaliaREF.Say(CaliaDialogue_ForgottenStories_Theriantrophist_CommentsTopic)
ElseIf _00E_MC_JesparREF.GetDistance(Game.GetPlayer()) <= 700
_00E_MC_JesparREF.Say(JesparDialogue_ForgottenStories_Theriantrophist_CommentsTopic)
endif
self.dispel()
endif
if (!playerWhileTransformedAlias.IsTransformed())
_AddArcaneFever()
playerWhileTransformedAlias.ForceRefTo(akTarget)
int duration = 0
if SKSE.GetVersion()
duration = GetDuration() as int
endif
playerWhileTransformedAlias.Transform(duration)
Endif
If _00E_MC_CaliaREF.GetDistance(Game.GetPlayer()) <= 700
_00E_MC_CaliaREF.Say(CaliaDialogue_ForgottenStories_Theriantrophist_CommentsTopic)
ElseIf _00E_MC_JesparREF.GetDistance(Game.GetPlayer()) <= 700
_00E_MC_JesparREF.Say(JesparDialogue_ForgottenStories_Theriantrophist_CommentsTopic)
endif
Endevent
Event OnEffectFinish(Actor akTarget, Actor akCaster)
controlQuest.playerWhileTransformed.TransformBack()
endevent

View File

@ -76,9 +76,64 @@ int Function GetWeaponDamage(Weapon weapID)
EndFunction
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
Function saveEquippedItems()
Actor PlayerRef = Game.GetPlayer()
Actor PlayerRef = Game.GetForm(0x14) as Actor
EquippedItemLeft = PlayerRef.GetEquippedObject(0)
EquippedItemRight = PlayerRef.GetEquippedObject(1)
@ -164,7 +219,7 @@ Function equipeItems()
if whatKindRight == 2
PlayerRef.EquipSpell(EquippedItemRight as Spell, 1)
elseif PlayerRef.GetItemCount(EquippedItemRight) > 0
elseif EquippedItemRight && PlayerRef.GetItemCount(EquippedItemRight) > 0
if SKSE.GetVersion()
PlayerRef.EquipItemEx(EquippedItemRight, 1)
else
@ -174,7 +229,7 @@ Function equipeItems()
if whatKindLeft == 2
PlayerRef.EquipSpell(EquippedItemLeft as Spell, 0)
elseif PlayerRef.GetItemCount(EquippedItemLeft) > 0
elseif EquippedItemLeft && PlayerRef.GetItemCount(EquippedItemLeft) > 0
if SKSE.GetVersion()
PlayerRef.EquipItemEx(EquippedItemLeft, 2)
else

View File

@ -92,7 +92,7 @@ Function Transform()
Game.DisablePlayerControls(true, true, true, false, true, true, true)
If PlayerREF == None
PlayerREF = Game.GetPlayer()
PlayerREF = Game.GetForm(0x14) as Actor
EndIf
_00E_FS_Theriantrophist_PotionM.Play(PlayerREF)
@ -111,27 +111,34 @@ Function Transform()
explosionMarker.SetPosition(PlayerREF.GetPositionX(), PlayerREF.GetPositionY(), (PlayerREF.GetPositionZ() + 100.0))
explosionMarker.PlaceAtMe(_00E_FS_Theriantrophist_TransEXP)
_00E_FS_Theriantrophist_TransformIMOD.Apply()
PlayerREF.UnequipAll()
if SKSE.GetVersion()
; Re-equipping is fully working with SKSE
PlayerREF.UnequipAll()
endif
PlayerREF.SetRace(_00E_Theriantrophist_PlayerWerewolfRace)
if PlayerREF.HasSpell(_00E_FS_Affinity_AbBrute)
Player.SetSkin(_00E_FS_Theriantrophist_Skin_Brute)
elseif PlayerREF.HasSpell(_00E_FS_Affinity_AbDrifter)
Player.SetSkin(_00E_FS_Theriantrophist_Skin_Drifter)
elseif PlayerREF.HasSpell(_00E_FS_Affinity_AbDruid)
Player.SetSkin(_00E_FS_Theriantrophist_Skin_Druid)
elseif PlayerREF.HasSpell(_00E_FS_Affinity_AbNightwolf)
Player.SetSkin(_00E_FS_Theriantrophist_Skin_Nightwolf)
elseif PlayerREF.HasSpell(_00E_FS_Affinity_AbRavager)
Player.SetSkin(_00E_FS_Theriantrophist_Skin_Ravager)
elseif PlayerREF.HasSpell(_00E_FS_Affinity_AbScourge)
Player.SetSkin(_00E_FS_Theriantrophist_Skin_Scourge)
elseif PlayerREF.HasSpell(_00E_FS_Affinity_AbSoulcaller)
Player.SetSkin(_00E_FS_Theriantrophist_Skin_Soulcaller)
else
Player.SetSkin(Player.GetRace().GetSkin())
if SKSE.GetVersion()
if PlayerREF.HasSpell(_00E_FS_Affinity_AbBrute)
Player.SetSkin(_00E_FS_Theriantrophist_Skin_Brute)
elseif PlayerREF.HasSpell(_00E_FS_Affinity_AbDrifter)
Player.SetSkin(_00E_FS_Theriantrophist_Skin_Drifter)
elseif PlayerREF.HasSpell(_00E_FS_Affinity_AbDruid)
Player.SetSkin(_00E_FS_Theriantrophist_Skin_Druid)
elseif PlayerREF.HasSpell(_00E_FS_Affinity_AbNightwolf)
Player.SetSkin(_00E_FS_Theriantrophist_Skin_Nightwolf)
elseif PlayerREF.HasSpell(_00E_FS_Affinity_AbRavager)
Player.SetSkin(_00E_FS_Theriantrophist_Skin_Ravager)
elseif PlayerREF.HasSpell(_00E_FS_Affinity_AbScourge)
Player.SetSkin(_00E_FS_Theriantrophist_Skin_Scourge)
elseif PlayerREF.HasSpell(_00E_FS_Affinity_AbSoulcaller)
Player.SetSkin(_00E_FS_Theriantrophist_Skin_Soulcaller)
else
Player.SetSkin(Player.GetRace().GetSkin())
endif
PlayerREF.QueueNiNodeUpdate()
endif
PlayerREF.QueueNiNodeUpdate()
_00E_Theriantrophist_TransformShader.Stop(PlayerREF)
explosionMarker.Delete()
@ -163,7 +170,7 @@ EndFunction
Function GoBackToNormal()
{Transforms the player back to human, but does not calculate stats, unlock perks, ... and does not check if a transformation is legal}
If PlayerREF == None
PlayerREF = Game.GetPlayer()
PlayerREF = Game.GetForm(0x14) as Actor
EndIf
;PlayerREF.GetActorBase().SetSkin(SkinNakedWerewolfBeast)
@ -185,8 +192,10 @@ Function GoBackToNormal()
PlayerREF.SetRace(originalRace)
PlayerREF.PlayIdle(_00E_IdleStomp)
Player.SetSkin(Player.GetRace().GetSkin())
PlayerREF.QueueNiNodeUpdate()
if SKSE.GetVersion()
Player.SetSkin(Player.GetRace().GetSkin())
PlayerREF.QueueNiNodeUpdate()
endif
Game.EnablePlayerControls()