长时间休息 Bug修复

长时间休息 Bug修复

当进行长时间休息时,你的角色有时会陷入睡眠状态而无法醒来,这个模组提供了一种解决方案。

游戏玩法

需要脚本扩展器!

如果您已经睡觉了,模组就无法生效,请加载一个长休息之前的存档。

注意事项:如果你遇到了长休bug,请不要跳过显示队伍休息的过场动画,否则脚本将无法运行,你会一直卡住。根据一位用户的反馈,首次进入山隘时,此bug在你的存档中有可能被修复。因此,建议你在山隘的强制夜间事件结束后禁用该模组,看看bug是否已为你修复。

另外,请将错误报告提交到“错误”标签页,而不是“帖子”标签页。

如果有人好奇,这是模组脚本:

展开查看
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 Fix: Party still resting, brute forcing...")
      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 Fix: Long Rest Finished!")
    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)