0 of 0

File information

Last updated

Original upload

Created by

Varnion

Uploaded by

VarnionMeretar

Virus scan

Safe to use

About this mod

When taking a long rest, sometimes your characters can get stuck in sleep and never wake up, this mod is a workaround for that.

Requirements
Permissions and credits
REQUIRES SCRIPT EXTENDER!

THE MOD DOES NOT WORK IF YOU ARE ALREADY SLEEPING, LOAD A SAVE BEFORE THE LONG REST.

NOTES:
If you are experiencing the long rest bug, do not skip the cutscenes that show the party sleeping, as this will cause the script to not run and you will remain stuck.b According to one user, it seems that there is a chance that the bug will be fixed in your save when first entering the Mountain Pass. Therefore, you may want to disable the mod after the forced night events on Mountain Pass to see if the bug was fixed for you.

And please, report bugs in the bugs tab, not the posts tab.

If anyone is curious, this is the mod script:
Spoiler:  
Show

local first_fade = ""
local first_try = true
local brute_force = false
local interrupted_by_dialog = false

Ext.Osiris.RegisterListener("ScreenFadeDone", 2, "after", function(_, fade)
  if Osi.HasActiveStatus(Osi.GetHostCharacter(), "LONG_REST") == 1 then
    if (fade == "CampNightFade_NightToMorning"
    or fade == "CAMP_SleepCutscene_69f925cf-1afd-4680-9532-8e80221aa93a"
    or fade == "CAMP_FARM_SleepCutscene_8a3df1b7-0ecf-a20f-922b-dbb4a54242f1"
    or fade == "CAMP_SLUMS_SleepCutscene_7ae7f235-e8a0-3478-628a-1a7529a4b1a8"
    or fade == "CAMP_ELFSONG_SleepCutscene_e48d2f0b-a1c8-67be-10cd-cd3457e5f8be"
    or fade == "CAMP_AstarionHunger_SCO_Companion_359981f9-d660-96e2-3e94-218e92d5e479"
    or fade == "CAMP_BurningUpForYou_CFM_ROM_a5177ed5-add2-f4f2-18b1-18d134d8aab6"
    or fade == "CAMP_GoblinHuntCelebration_SD_ROM_NightWithAstarion_f1f9ad82-3973-9307-7a9d-35c014ee2d68"
    or fade == "CAMP_GoblinHuntCelebration_SC_NightWithLaezel_1f65b94b-252d-b56e-e812-478a7ff803a8"
    or fade == "CAMP_GoblinHuntCelebration_SD_ROM_NightWithShadowheart_924fb8e6-8622-bc02-43c8-77c80ddc1d3e"
    or fade == "CAMP_GoblinHuntCelebration_SD_ROM_NightWithDrow_0166176a-2eb4-db38-81b9-003dde80485b")
    and first_try == true then
      first_fade = fade
      Osi.TimerLaunch("LongRestBugfix_Wait", 1000)
    elseif first_try == false and fade ~= "LongRestBugfix_LongRestFade" then
      first_try = true
      Osi.PROC_Camp_EveryoneWakeup()
      Osi.PROC_Camp_TryLeaveNightMode(Osi.GetHostCharacter())
      Osi.TimerLaunch("LongRestBugfix_InstantLongRest", 400)
    end
  end
end)

Ext.Osiris.RegisterListener("TimerFinished", 1, "after", function(timer)
  if timer == "LongRestBugfix_Wait" then
    if Osi.HasActiveStatus(Osi.GetHostCharacter(), "LONG_REST") == 1 then
      Osi.PROC_Camp_LongRestFinishForAllPlayers()
      Osi.TimerLaunch("LongRestBugfix_Wakeup", 600)
    else
      interrupted_by_dialog = false
    end
  elseif timer == "LongRestBugfix_Wakeup" then
    if Osi.HasActiveStatus(Osi.GetHostCharacter(), "LONG_REST") == 1 then
      _P("Long Rest Bugfix: The party is still sleeping, starting brute-force...")
      brute_force = true
      first_try = false
      if interrupted_by_dialog == false then
        Osi.ScreenFadeTo(Osi.GetHostCharacter(), 0, 0, "LongRestBugfix_LongRestFade")
      end
      if first_fade == "CampNightFade_NightToMorning" then
        Osi.PROC_Camp_FadeOutForRest()
      else
        Osi.PROC_Camp_SleepUntilMorning()
      end
    else
      interrupted_by_dialog = false
    end
  elseif timer == "LongRestBugfix_InstantLongRest" and interrupted_by_dialog == false then
    Osi.PROC_Camp_InstantLongRest()
    Osi.TimerLaunch("LongRestBugfix_ClearLongRestFade", 6000)
  elseif timer == "LongRestBugfix_ClearLongRestFade" then
    _P("Long Rest Bugfix: Long Rest completed!")
    brute_force = false
    Osi.ClearScreenFade(Osi.GetHostCharacter(), 0, "LongRestBugfix_LongRestFade")
    Osi.ClearScreenFade(Osi.GetHostCharacter(), 0, "LongRestBugfix_SleepUntilMorning")
  end
end)

Ext.Osiris.RegisterListener("DialogEnded", 2, "after", function(dialog, _)
  if dialog == "CAMP_GoblinHuntCelebration_SD_SelectNight_750df06d-5a74-8f6b-cd1f-947055afbc2e" then
    interrupted_by_dialog = true
  elseif brute_force == true and dialog ==
"CAMP_GoblinHuntCelebration_SCO_HalsinMorningAfter_3c5a0a46-7927-6692-d353-fc8270b47631"
then
    interrupted_by_dialog = false
    Osi.ScreenFadeTo(Osi.GetHostCharacter(), 0, 0, "LongRestBugfix_LongRestFade")
    Osi.TimerLaunch("LongRestBugfix_InstantLongRest", 400)
  end
end)