饥荒手机版状态显示修改 手机版mod移植,状态显示mod对于饥荒玩家是个极其便利的模组,今天小编跟大家分享下手机版饥荒移植状态显示mod的教程,希望能对玩家们有所帮助。
首先玩家要在手机里安装mt管理器2.0,百度搜索下就有,然后使用mt管理器按照下面教程操作:
一.mt管理器打开储存盘/android/obb/com.kleientertainment.doNotStarvePocket/main.19.com.kleientertainment.doNotStarvePocket.obb文件,打开方式选zip查看
打开scripts/widgets/badge.lua用XML编辑
1.找到self:SetScale(1,1,1)
替换为self:SetScale(0.9,0.9,0.9)
嫌大可以全改0.8或者更小
2.找到
local usedLanguage = TheSim:GetUsedLanguage()
if usedLanguage == "korean" or usedLanguage == "simplified_chinese" or usedLanguage == "traditional_chinese" or usedLanguage == "japanese" then
self.num = self:AddChild(Text(NUMBERFONT, 33))
else
self.num = self:AddChild(Text(BODYTEXTFONT, 33))
end
self.num:SetHAlign(ANCHOR_MIDDLE)
self.num:SetPosition(5, 0, 0)
self.num:Hide()
替换为
self.num = self:AddChild(Text(BODYTEXTFONT, 28))
self.num:SetHAlign(ANCHOR_MIDDLE)
self.num:SetScale(1,.8,1)
self.num:SetPosition(0, -40.5, 0)
self.num:Show()
以上两步是修改字体大小,可改可不改,也可以根据自己的喜好调整。
3.找到
function Badge:OnGainFocus()
Badge._base.OnGainFocus(self)
self.num:Show()
end
function Badge:OnLoseFocus()
Badge._base.OnLoseFocus(self)
self.num:Hide()
end
替换为
--function Badge:OnGainFocus()
-- Badge._base.OnGainFocus(self)
-- self.num:Show()
--end
--function Badge:OnLoseFocus()
-- Badge._base.OnLoseFocus(self)
-- self.num:Hide()
--end
或直接删除
4.最后的return Badge
替换为
function Badge:SetTemperature(val)
self.num:SetString("温度:"..tostring(math.ceil(val/2)))
end
function Badge:SetNaughty(val, max)
self.num:SetString(tostring(val).."/"..tostring(max))
end
return Badge
退出保存,更新选是。
二.打开DLC0001/scripts/components/kramped.lua
1.文首插入
local naughtyness = 0
local limit = 0
改完记得换行
2.找到
self.actions = 0
self.threshold = nil
替换为
self.actions = 0
self.threshold = 30
naughtyness = self.actions --mod
limit = self.threshold --mod
有些语录后面的--mod代表数显mod加入的内容,方便你们学习跟修改
3.找到
function Kramped:OnLoad(data)
self.actions = data.actions or self.actions
self.threshold = data.threshold or self.threshold
end
替换为
function Kramped:OnLoad(data)
self.actions = data.actions or self.actions
self.threshold = data.threshold or self.threshold
naughtyness = self.actions --mod
limit = self.threshold --mod
end
4.找到
function Kramped:OnUpdate(dt)
if self.actions > 0 then
self.timetodecay = self.timetodecay - dt
if self.timetodecay < 0 then
self.timetodecay = TUNING.KRAMPUS_NAUGHTINESS_DECAY_PERIOD
self.actions = self.actions - 1
end
end
end
替换为
function Kramped:OnUpdate(dt)
if self.actions > 0 then
self.timetodecay = self.timetodecay - dt
if self.timetodecay < 0 then
self.timetodecay = TUNING.KRAMPUS_NAUGHTINESS_DECAY_PERIOD
self.actions = self.actions - 1
naughtyness = self.actions --mod
self:DoDelta() --mod
end
end
end
5.找到
function Kramped:OnNaughtyAction(how_naughty)
if TUNING.KRAMPUS_INCREASE_RAMP < 1 or TUNING.KRAMPUS_THRESHOLD_VARIANCE < 1 then return end
if self.threshold == 30 then
self.threshold = TUNING.KRAMPUS_THRESHOLD + math.random(TUNING.KRAMPUS_THRESHOLD_VARIANCE)
end
self.actions = self.actions + (how_naughty or 1)
self.timetodecay = TUNING.KRAMPUS_NAUGHTINESS_DECAY_PERIOD
if self.actions >= self.threshold and self.threshold > 0 then
local day = GetClock().numcycles
local num_krampii = 1
self.threshold = TUNING.KRAMPUS_THRESHOLD + math.random(TUNING.KRAMPUS_THRESHOLD_VARIANCE)
self.actions = 0
if day > TUNING.KRAMPUS_INCREASE_LVL1 then
num_krampii = num_krampii + math.random(TUNING.KRAMPUS_INCREASE_RAMP)
elseif day > TUNING.KRAMPUS_INCREASE_LVL2 then
num_krampii = num_krampii + 1 + math.random(TUNING.KRAMPUS_INCREASE_RAMP)
end
for k = 1, num_krampii do
self:MakeAKrampus()
end
else
self.inst:DoTaskInTime(1 + math.random()*2, function()
local snd = CreateEntity()
snd.entity:AddTransform()
snd.entity:AddSoundEmitter()
snd.persists = false
local theta = math.random() * 2 * PI
local radius = 15
local offset = Vector3(self.inst.Transform:GetWorldPosition()) + Vector3(radius * math.cos( theta ), 0, -radius * math.sin( theta ))
snd.Transform:SetPosition(offset.x,offset.y,offset.z)
local left = self.threshold - self.actions
if left < 5 then
snd.SoundEmitter:PlaySound("dontstarve/creatures/krampus/beenbad_lvl3")
elseif left < 15 then
snd.SoundEmitter:PlaySound("dontstarve/creatures/krampus/beenbad_lvl2")
elseif left < 20 then
snd.SoundEmitter:PlaySound("dontstarve/creatures/krampus/beenbad_lvl1")
end
snd:Remove()
end)
end
end
替换为
function Kramped:OnNaughtyAction(how_naughty)
if TUNING.KRAMPUS_INCREASE_RAMP < 1 or TUNING.KRAMPUS_THRESHOLD_VARIANCE < 1 then return end
if self.threshold == 30 then
self.threshold = TUNING.KRAMPUS_THRESHOLD + math.random(TUNING.KRAMPUS_THRESHOLD_VARIANCE)
end
self.actions = self.actions + (how_naughty or 1)
self.timetodecay = TUNING.KRAMPUS_NAUGHTINESS_DECAY_PERIOD
naughtyness = self.actions --mod
if self.actions >= self.threshold and self.threshold > 0 then
local day = GetClock().numcycles
local num_krampii = 1
self.threshold = TUNING.KRAMPUS_THRESHOLD + math.random(TUNING.KRAMPUS_THRESHOLD_VARIANCE)
self.actions = 0
limit = self.threshold --mod
naughtyness = self.actions --mod
if day > TUNING.KRAMPUS_INCREASE_LVL1 then
num_krampii = num_krampii + math.random(TUNING.KRAMPUS_INCREASE_RAMP)
elseif day > TUNING.KRAMPUS_INCREASE_LVL2 then
num_krampii = num_krampii + 1 + math.random(TUNING.KRAMPUS_INCREASE_RAMP)
end
for k = 1, num_krampii do
self:MakeAKrampus()
end
else
self.inst:DoTaskInTime(1 + math.random()*2, function()
local snd = CreateEntity()
snd.entity:AddTransform()
snd.entity:AddSoundEmitter()
snd.persists = false
local theta = math.random() * 2 * PI
local radius = 15
local offset = Vector3(self.inst.Transform:GetWorldPosition()) + Vector3(radius * math.cos( theta ), 0, -radius * math.sin( theta ))
snd.Transform:SetPosition(offset.x,offset.y,offset.z)
local left = self.threshold - self.actions
if left < 5 then
snd.SoundEmitter:PlaySound("dontstarve/creatures/krampus/beenbad_lvl3")
elseif left < 15 then
snd.SoundEmitter:PlaySound("dontstarve/creatures/krampus/beenbad_lvl2")
elseif left < 20 then
snd.SoundEmitter:PlaySound("dontstarve/creatures/krampus/beenbad_lvl1")
end
snd:Remove()
end)
end
self:DoDelta() --mod
end
6.文尾return Kramped前一行
插入
function Kramped:GetNaughtyness()
return naughtyness
end
function Kramped:GetLimit()
return limit
end
function Kramped:DoDelta()
self.inst:PushEvent("naughtydelta")
end
退出保存更新选是.
三.打开DLC0001/scripts/widgets/statusdisplays.lua
1.找到local MoistureMeter = require "widgets/moisturemeter"
后面插入一行
local Badge = require "widgets/badge"
local kramped = require "components/kramped"
local NaughtyBadge = Class(Badge, function(self, owner)
Badge._ctor(self, "naughty", owner)
end)
local TemperatureBadge = Class(Badge, function(self, owner)
Badge._ctor(self, "temperature", owner)
end)
2.找到self.heart:SetPercent(self.owner.components.health:GetPercent(), self.owner.components.health.maxhealth, self.owner.components.health:GetPenaltyPercent())
后面插入一行
self.naughty = self:AddChild(NaughtyBadge(owner))
self.naughty:SetPosition(-110,15,0)
self.naughty:SetNaughty(self.owner.components.kramped:GetNaughtyness(), self.owner.components.kramped:GetLimit())
self.temperature = self:AddChild(TemperatureBadge(owner))
self.temperature:SetPosition(30,15,0)
self.temperature:SetTemperature(self.owner.components.temperature:GetCurrent())
3.找到
if GetWorld() and GetWorld():IsCave() then
self.brain:SetPosition(30, -0,0)
self.stomach:SetPosition(-110, -0,0)
self.heart:SetPosition(-40, -0,0)
self.moisturemeter:SetPosition(30, -70,0)
end
替换为
if GetWorld() and GetWorld():IsCave() then
self.brain:SetPosition(30, -40,0)
self.stomach:SetPosition(-110, -40,0)
self.heart:SetPosition(-40, -70,0)
self.moisturemeter:SetPosition(-40, 0,0)
end
这里是修改进入洞穴后几个槽的位置,同样是可改可不改,而且我改的也不好,位置有点不对,建议自己调整
4.找到
self.inst:ListenForEvent("sanitydelta", function(inst, data) self:SanityDelta(data) end, self.owner)
后面插入一行
self.inst:ListenForEvent("temperaturedelta", function(inst, data) self.temperature:SetTemperature(self.owner.components.temperature:GetCurrent()) end, self.owner)
self.inst:ListenForEvent("naughtydelta", function(inst) self.naughty:SetNaughty(self.owner.components.kramped.GetNaughtyness(), self.owner.components.kramped.GetLimit()) end, self.owner)
退出保存更新,进入游戏数据显示即修改完成。
ps:修改还是有风险的,如何不成功有可能损坏数据包,当进入游戏后,系统会提示玩家在重新下载数据包,所以在试之前建议先备份下数据包。
好了以上就是小编给大家带来的饥荒手机版状态显示修改 手机版mod移植。