diff --git a/Enderal - Forgotten Stories.esm b/Enderal - Forgotten Stories.esm index 173bc8d7..eb8989dc 100644 Binary files a/Enderal - Forgotten Stories.esm and b/Enderal - Forgotten Stories.esm differ diff --git a/scripts/_00e_theriantrophist_alchemycontrol.pex b/scripts/_00e_theriantrophist_alchemycontrol.pex index 6d88cd9f..031ebd64 100644 Binary files a/scripts/_00e_theriantrophist_alchemycontrol.pex and b/scripts/_00e_theriantrophist_alchemycontrol.pex differ diff --git a/scripts/_00e_theriantrophist_playeraswerewolf.pex b/scripts/_00e_theriantrophist_playeraswerewolf.pex index 41f1a38e..423bb15d 100644 Binary files a/scripts/_00e_theriantrophist_playeraswerewolf.pex and b/scripts/_00e_theriantrophist_playeraswerewolf.pex differ diff --git a/scripts/_00e_theriantrophist_transformsc.pex b/scripts/_00e_theriantrophist_transformsc.pex index 70a59fa4..55a5c189 100644 Binary files a/scripts/_00e_theriantrophist_transformsc.pex and b/scripts/_00e_theriantrophist_transformsc.pex differ diff --git a/scripts/_00e_theriantrophist_transformstorage.pex b/scripts/_00e_theriantrophist_transformstorage.pex index bb6909cd..93c43498 100644 Binary files a/scripts/_00e_theriantrophist_transformstorage.pex and b/scripts/_00e_theriantrophist_transformstorage.pex differ diff --git a/scripts/_00e_theriantrophist_wolfformsc.pex b/scripts/_00e_theriantrophist_wolfformsc.pex index 02cafb96..fb9e36a5 100644 Binary files a/scripts/_00e_theriantrophist_wolfformsc.pex and b/scripts/_00e_theriantrophist_wolfformsc.pex differ diff --git a/source/scripts/_00e_theriantrophist_alchemycontrol.psc b/source/scripts/_00e_theriantrophist_alchemycontrol.psc index 3ccc53e9..df9cde6e 100644 --- a/source/scripts/_00e_theriantrophist_alchemycontrol.psc +++ b/source/scripts/_00e_theriantrophist_alchemycontrol.psc @@ -457,7 +457,7 @@ EndEvent Event OnPlayerLoadGame() _InitAchemyControl() - if aCreatedPotions.length == 0 + if ! SKSE.GetVersion() || aCreatedPotions.length == 0 return endif diff --git a/source/scripts/_00e_theriantrophist_playeraswerewolf.psc b/source/scripts/_00e_theriantrophist_playeraswerewolf.psc index 79038742..777f7a98 100644 --- a/source/scripts/_00e_theriantrophist_playeraswerewolf.psc +++ b/source/scripts/_00e_theriantrophist_playeraswerewolf.psc @@ -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) diff --git a/source/scripts/_00e_theriantrophist_transformsc.psc b/source/scripts/_00e_theriantrophist_transformsc.psc index 8f3f9139..cabaac70 100644 --- a/source/scripts/_00e_theriantrophist_transformsc.psc +++ b/source/scripts/_00e_theriantrophist_transformsc.psc @@ -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 + endif + + if (!playerWhileTransformedAlias.IsTransformed()) + _AddArcaneFever() + playerWhileTransformedAlias.ForceRefTo(akTarget) - 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) + int duration = 0 + if SKSE.GetVersion() + duration = GetDuration() as int endif - self.dispel() - + 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 diff --git a/source/scripts/_00e_theriantrophist_transformstorage.psc b/source/scripts/_00e_theriantrophist_transformstorage.psc index 0570d563..1ec231e4 100644 --- a/source/scripts/_00e_theriantrophist_transformstorage.psc +++ b/source/scripts/_00e_theriantrophist_transformstorage.psc @@ -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 diff --git a/source/scripts/_00e_theriantrophist_wolfformsc.psc b/source/scripts/_00e_theriantrophist_wolfformsc.psc index 2ae54656..57f1db03 100644 --- a/source/scripts/_00e_theriantrophist_wolfformsc.psc +++ b/source/scripts/_00e_theriantrophist_wolfformsc.psc @@ -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,28 +111,35 @@ 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() Game.EnablePlayerControls(true, true, false, true, true, true, true, true) @@ -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() diff --git a/strings/enderal - forgotten stories_english.strings b/strings/enderal - forgotten stories_english.strings index 4b611f98..2b73f962 100644 Binary files a/strings/enderal - forgotten stories_english.strings and b/strings/enderal - forgotten stories_english.strings differ