SKSE-free pipe smoking

This commit is contained in:
Eddoursul 2024-02-08 16:51:58 +01:00
parent 91ca470ecf
commit 5ffd5d7e97
8 changed files with 78 additions and 44 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
Scriptname HealthBarManager Hidden Scriptname HealthBarManager Hidden
function Show(Actor akActor) global function Show(Actor akActor) global
if akActor if akActor && SKSE.GetVersion()
int handle = ModEvent.Create("Enderal_ShowActorHealth") int handle = ModEvent.Create("Enderal_ShowActorHealth")
if handle if handle
ModEvent.PushForm(handle, akActor) ModEvent.PushForm(handle, akActor)
@ -11,7 +11,7 @@ function Show(Actor akActor) global
endfunction endfunction
function Hide(Actor akActor) global function Hide(Actor akActor) global
if akActor if akActor && SKSE.GetVersion()
int handle = ModEvent.Create("Enderal_HideActorHealth") int handle = ModEvent.Create("Enderal_HideActorHealth")
if handle if handle
ModEvent.PushForm(handle, akActor) ModEvent.PushForm(handle, akActor)

View File

@ -2,21 +2,31 @@ Scriptname _00E_CameraControl Hidden
Function LockVanityCamera() Global Function LockVanityCamera() Global
float fCameraMaxDistance = Utility.GetIniFloat("fVanityModeMaxDist:Camera") Actor PlayerREF = Game.GetForm(0x14) as Actor
(Game.GetForm(0x14) as Actor).SetActorValue("Variable08", fCameraMaxDistance) float fMinDist = 150.0
Utility.SetINIFloat("fVanityModeMaxDist:Camera", Utility.GetIniFloat("fVanityModeMinDist:Camera"))
if SKSE.GetVersion()
float fCameraMaxDistance = Utility.GetIniFloat("fVanityModeMaxDist:Camera")
PlayerREF.SetActorValue("Variable08", fCameraMaxDistance)
fMinDist = Utility.GetIniFloat("fVanityModeMinDist:Camera")
else
PlayerREF.SetActorValue("Variable08", 600.0)
endif
Utility.SetINIFloat("fVanityModeMaxDist:Camera", fMinDist)
EndFunction EndFunction
Function UnlockVanityCamera() Global Function UnlockVanityCamera() Global
float fCameraMaxDistance = (Game.GetForm(0x14) as Actor).GetActorValue("Variable08") Actor PlayerREF = Game.GetForm(0x14) as Actor
float fCameraMaxDistance = PlayerREF.GetActorValue("Variable08")
if fCameraMaxDistance <= 0 if fCameraMaxDistance <= 0
fCameraMaxDistance = 600 fCameraMaxDistance = 600.0
endif endif
Utility.SetINIFloat("fVanityModeMaxDist:Camera", fCameraMaxDistance) Utility.SetINIFloat("fVanityModeMaxDist:Camera", fCameraMaxDistance)
(Game.GetForm(0x14) as Actor).SetActorValue("Variable08", 0) PlayerREF.SetActorValue("Variable08", 0)
EndFunction EndFunction

View File

@ -190,8 +190,10 @@ State RealPlayer
; Level up ; Level up
If iLevelUpsNeeded > 0 If iLevelUpsNeeded > 0
; Level up if not in combat, not in dialogue, activate controls enabled (not in a scene?) and, obviously, not dead ; Level up if not in combat, not in dialogue, activate controls enabled (not in a scene?) and, obviously, not dead
While !IsInCombat() && (SKSE.GetVersion() == 0 || UI.IsMenuOpen("Dialogue Menu") == False) && Game.IsActivateControlsEnabled() && !Player.IsDead() && (isdead == False) && (iLevelUpsNeeded > 0) While !IsInCombat() && Game.IsActivateControlsEnabled() && !Player.IsDead() && (isdead == False) && (iLevelUpsNeeded > 0)
levelUp() if SKSE.GetVersion() == 0 || UI.IsMenuOpen("Dialogue Menu") == False
levelUp()
endif
EndWhile EndWhile
EndIf EndIf

View File

@ -23,6 +23,7 @@ Sound Property _00E_FS_DecreaseArcaneFeverM Auto
Message Property _00E_AlchAmbrosia_sArcaneFeverDecreased Auto Message Property _00E_AlchAmbrosia_sArcaneFeverDecreased Auto
Actor Property PlayerRef Auto Actor Property PlayerRef Auto
bool bSKSE = true
;===================================================================================== ;=====================================================================================
@ -76,6 +77,11 @@ State Smoking
Event OnUpdate() Event OnUpdate()
_UpdateSmoking() _UpdateSmoking()
if ! bSKSE
Utility.Wait(2.5)
StopSmoking()
endif
EndEvent EndEvent
EndState EndState
@ -100,7 +106,7 @@ Int Property SMOKING_STAGE_SMOKING = 3 AutoReadOnly
Float Property SMOKING_ARCANE_FEVER_REDUCE = 1.0 AutoReadOnly Float Property SMOKING_ARCANE_FEVER_REDUCE = 1.0 AutoReadOnly
Int StoredCameraState = -1 bool bFirstPerson = true
Armor StoredEquippedShield Armor StoredEquippedShield
Armor StoredEquippedHelmet Armor StoredEquippedHelmet
Form[] EquippedTorches Form[] EquippedTorches
@ -121,12 +127,14 @@ Function StartSmoking()
EndFunction EndFunction
Function _TryStartSmoking() Function _TryStartSmoking()
bSKSE = (SKSE.GetVersion() > 0)
If TheriantrophistControlQuest.IsTransformed() If TheriantrophistControlQuest.IsTransformed()
_00E_PeaceweedSmoking_CantSmokeInWolfForm.Show() _00E_PeaceweedSmoking_CantSmokeInWolfForm.Show()
Return Return
EndIf EndIf
If (_00E_Meditate_Allowed.GetValueInt() == 0) || (PlayerRef.GetWorldSpace() == MQ07aDreamRealm) || PlayerRef.IsOnMount() || PlayerRef.IsSwimming() || (PlayerRef.GetSitState() != 0) || PlayerRef.IsInCombat() || PlayerREF.IsInLocation(_00E_ClassMenuLocation) If (_00E_Meditate_Allowed.GetValueInt() == 0) || (PlayerRef.GetWorldSpace() == MQ07aDreamRealm) || PlayerRef.IsOnMount() || (bSKSE && PlayerRef.IsSwimming()) || (PlayerRef.GetSitState() != 0) || PlayerRef.IsInCombat() || PlayerREF.IsInLocation(_00E_ClassMenuLocation)
_00E_PeaceweedSmoking_CantSmokeNow.Show() _00E_PeaceweedSmoking_CantSmokeNow.Show()
Return Return
EndIf EndIf
@ -149,12 +157,9 @@ Function _TryStartSmoking()
Game.SetInChargen(true, true, false) ; Forbid saving the game while smoking Game.SetInChargen(true, true, false) ; Forbid saving the game while smoking
Game.DisablePlayerControls(abMovement=true, abFighting=true, abCamSwitch=true, abLooking=false, abSneaking=true, abMenu=true, abActivate = true, abJournalTabs=true) Game.DisablePlayerControls(abMovement=true, abFighting=true, abCamSwitch=true, abLooking=false, abSneaking=true, abMenu=true, abActivate = true, abJournalTabs=true)
StoredCameraState = Game.GetCameraState() bFirstPerson = PlayerREF.GetAnimationVariableBool("IsFirstPerson")
Game.ForceThirdPerson() Game.ForceThirdPerson()
RefreshCancelKeys()
RegisterCancelKeys()
EquippedTorches = New Form[2] EquippedTorches = New Form[2]
Bool bTorchesUnequipping = _00E_TorchControl.UnequipTorches(EquippedTorches) Bool bTorchesUnequipping = _00E_TorchControl.UnequipTorches(EquippedTorches)
@ -179,7 +184,7 @@ Function _TryStartSmoking()
SmokingStage = SMOKING_STAGE_WARMUP SmokingStage = SMOKING_STAGE_WARMUP
; Unequip armor in the HEAD slot. Will work for most closed-face helmets, I hope. ; Unequip armor in the HEAD slot. Will work for most closed-face helmets, I hope.
StoredEquippedHelmet = PlayerRef.GetWornForm(0x00000001) as Armor StoredEquippedHelmet = PlayerRef.GetEquippedArmorInSlot(30) as Armor
If StoredEquippedHelmet If StoredEquippedHelmet
PlayerREF.UnequipItem(StoredEquippedHelmet, False, True) PlayerREF.UnequipItem(StoredEquippedHelmet, False, True)
EndIf EndIf
@ -191,24 +196,31 @@ Function _TryStartSmoking()
EndIf EndIf
Debug.SendAnimationEvent(PlayerRef, "IdleSitCrossLeggedEnter") Debug.SendAnimationEvent(PlayerRef, "IdleSitCrossLeggedEnter")
Utility.Wait(1.1) Utility.Wait(1.1)
_AdjustCameraPositionToSitting() _AdjustCameraPositionToSitting()
If (bQuitTutorialShown == False) && (_00E_DisableOtherTutorials.GetValueInt() == 0)
bQuitTutorialShown = True
Message.ResetHelpMessage("Empty")
If Game.UsingGamepad()
If _00E_PeaceweedSmoking_ExitTutorial_Console == None
_00E_PeaceweedSmoking_ExitTutorial_Console = Game.GetFormFromFile(0x000482F8, "Skyrim.esm") as Message
EndIf
_00E_PeaceweedSmoking_ExitTutorial_Console.ShowAsHelpMessage("Empty", 7, 30, 1)
Else
_00E_PeaceweedSmoking_ExitTutorial.ShowAsHelpMessage("Empty", 7, 30, 1)
EndIf
EndIf
if bSKSE
RefreshCancelKeys()
RegisterCancelKeys()
If (bQuitTutorialShown == False) && (_00E_DisableOtherTutorials.GetValueInt() == 0)
bQuitTutorialShown = True
Message.ResetHelpMessage("Empty")
If Game.UsingGamepad()
If _00E_PeaceweedSmoking_ExitTutorial_Console == None
_00E_PeaceweedSmoking_ExitTutorial_Console = Game.GetFormFromFile(0x000482F8, "Skyrim.esm") as Message
EndIf
_00E_PeaceweedSmoking_ExitTutorial_Console.ShowAsHelpMessage("Empty", 7, 30, 1)
Else
_00E_PeaceweedSmoking_ExitTutorial.ShowAsHelpMessage("Empty", 7, 30, 1)
EndIf
EndIf
RegisterForSingleUpdate(2.9)
else
RegisterForSingleUpdate(5.0)
endif
Utility.Wait(0.4) Utility.Wait(0.4)
RegisterForSingleUpdate(2.5)
Debug.SendAnimationEvent(PlayerRef, "pipesmokingcrossleggedstartblaze") Debug.SendAnimationEvent(PlayerRef, "pipesmokingcrossleggedstartblaze")
Debug.SendAnimationEvent(PlayerRef, "pipesmokingcrossleggedblazed") Debug.SendAnimationEvent(PlayerRef, "pipesmokingcrossleggedblazed")
EndFunction EndFunction
@ -249,14 +261,18 @@ Function ApplySmokingSideEffects(Ingredient peaceweedIngredient, Float fReduceFe
EndIf EndIf
; Teach ambrosia effect ; Teach ambrosia effect
Int Index = peaceweedIngredient.getNumEffects() if bSKSE
While Index > 0 Int Index = peaceweedIngredient.getNumEffects()
Index -= 1 While Index > 0
If peaceweedIngredient.getNthEffectMagicEffect(Index) == _00E_AlchReduceArcaneFever Index -= 1
peaceweedIngredient.LearnEffect(Index) If peaceweedIngredient.getNthEffectMagicEffect(Index) == _00E_AlchReduceArcaneFever
Index = 0 ; Break peaceweedIngredient.LearnEffect(Index)
EndIf Index = 0 ; Break
EndWhile EndIf
EndWhile
else
peaceweedIngredient.LearnEffect(1)
endif
EndFunction EndFunction
Function StopSmoking() Function StopSmoking()
@ -296,10 +312,9 @@ Function StopSmoking()
_00E_TorchControl.ReequipTorches(EquippedTorches) _00E_TorchControl.ReequipTorches(EquippedTorches)
If StoredCameraState == 0 If bFirstPerson
Game.ForceFirstPerson() Game.ForceFirstPerson()
EndIf EndIf
StoredCameraState = -1
_00E_Meditate_Allowed.SetValueInt(1) _00E_Meditate_Allowed.SetValueInt(1)
EndIf EndIf
@ -337,14 +352,21 @@ Float fStoredOverShoulderPosZ
Function _SetCameraPosition(Float x, Float z) Function _SetCameraPosition(Float x, Float z)
Utility.SetINIFloat("fOverShoulderPosX:Camera", x) Utility.SetINIFloat("fOverShoulderPosX:Camera", x)
Utility.SetINIFloat("fOverShoulderPosZ:Camera", z) Utility.SetINIFloat("fOverShoulderPosZ:Camera", z)
Game.UpdateThirdPerson() if bSKSE
Game.UpdateThirdPerson()
endif
EndFunction EndFunction
Function _AdjustCameraPositionToSitting() Function _AdjustCameraPositionToSitting()
If bStoredCameraPositions == False If bStoredCameraPositions == False
bStoredCameraPositions = True bStoredCameraPositions = True
fStoredOverShoulderPosX = Utility.GetINIFloat("fOverShoulderPosX:Camera") if bSKSE
fStoredOverShoulderPosZ = Utility.GetINIFloat("fOverShoulderPosZ:Camera") fStoredOverShoulderPosX = Utility.GetINIFloat("fOverShoulderPosX:Camera")
fStoredOverShoulderPosZ = Utility.GetINIFloat("fOverShoulderPosZ:Camera")
else
fStoredOverShoulderPosX = 30.0
fStoredOverShoulderPosZ = -10.0
endif
_00E_CameraControl.LockVanityCamera() _00E_CameraControl.LockVanityCamera()
EndIf EndIf