Don't Starve Together

Don't Starve Together

[大狐狸][Millennium Fox][WhaRang]
【bug修复】铃铛消失问题。(铃铛在背包时进入地穴会消失,并再也无法找回)
建议回档,或你可以尝试如下解决方案:

来自三位热情的饥荒群众的bug修复:steamhappy:

在steam/steamapps/workshop/content下的某个文件夹中的1694540893(mod的id)文件夹下modmain.lua文件中的两个函数function _G.RedElementMo(inst)与function _G.IceElementMo(inst)前,加入如下的函数代码,然后在这两个函数中调用此函数,即CallBackMolibell(inst)。

添加代码后重新运行服务器,在切换狐狸形态之后就可以找回铃铛(背包必须留有空位)。


代码最终结果如下:

-- Call back the Monibell to your inventory. This func is used to solve -- bugs where Monibell may sometimes be lost. local function CallBackMolibell(inst) -- If no mihobell belongs to you, create one for you. if inst.mihobell == nil then print("create new mihobell") local mihobell = GLOBAL.SpawnPrefab("mihobell") if mihobell then mihobell.owner = inst inst.mihobell = mihobell inst.components.inventory.ignoresound = true inst.components.inventory:GiveItem(mihobell) inst.components.inventory.ignoresound = false mihobell.components.named:SetName(inst.name.."的小狐狸铃铛") end -- Or just call back to your inventory. else result = inst.components.inventory:FindItem(function(item) if item.prefab == "mihobell" then return true end end) if result == nil then print("No mihobell, return one") inst.components.inventory:GiveItem(inst.mihobell) end end end function _G.RedElementMo(inst) CallBackMolibell(inst) local st = TheWorld.state.temperature if inst.Min_Fire_Element < inst.Max_Fire_Element then -- inst.Min_Fire_Element = inst.Min_Fire_Element + emeoffset if st >= 20 then inst.Min_Fire_Element = inst.Min_Fire_Element + 1 + (inst.level / emeoffset + (st - 20) / 20) elseif st < 20 then inst.Min_Fire_Element = inst.Min_Fire_Element + 1 + (inst.level / emeoffset - (20 - st) / 30) end end if inst.Min_Fire_Element >= inst.Max_Fire_Element then inst.Min_Fire_Element = inst.Max_Fire_Element end end function _G.IceElementMo(inst) CallBackMolibell(inst) local st = TheWorld.state.temperature if inst.Min_Ice_Element < inst.Max_Ice_Element then -- inst.Min_Ice_Element = inst.Min_Ice_Element + emeoffset if st >= 20 then inst.Min_Ice_Element = inst.Min_Ice_Element + 1 + (inst.level / emeoffset - (st - 20) / 40) elseif st < 20 then inst.Min_Ice_Element = inst.Min_Ice_Element + 1 + (inst.level / emeoffset + (20 - st) / 12) end end if inst.Min_Ice_Element >= inst.Max_Ice_Element then inst.Min_Ice_Element = inst.Max_Ice_Element end end

后记:这个问题是因为铃铛的坐标位出现问题,但是本身却没有消失,因此狐狸箱子会追寻铃铛,继而消失。而这段代码可以在狐狸状态切换的时候,检查这一状况,强制召回到物品栏(包括背包)中,即使你有意放在其他地方。:steamhappy:
Last edited by SocialistDalao; 26 Oct, 2021 @ 9:35am
< >
Showing 1-4 of 4 comments
SocialistDalao 26 Oct, 2021 @ 9:36am 
乱码的中文为“的小狐狸铃铛”
1608003267 26 Oct, 2021 @ 10:45am 
:steamhappy:
ghon 26 Oct, 2021 @ 6:03pm 
:steamhappy::steamthumbsup:
SocialistDalao 26 Oct, 2021 @ 10:28pm 
更改代码运行之后还需要在游戏里切换一下狐狸的形态,等一会就有了。目前形态只支持红和冰两种,月和白不支持。
< >
Showing 1-4 of 4 comments
Per page: 1530 50