• 认真地记录技术中遇到的坑!
  • 能摸鱼真是太好啦!嘿嘿嘿!

饥荒修改基础攻击力,死亡不删档,花狼mod定制Lua脚本

游戏 悠悠 5年前 (2019-11-02) 8587次浏览 0个评论

修改花狼人物mod

相关脚本文件夹: Steam\steamapps\common\dont_starve\mods\workshop-468347946

常用命令参考: http://uusama.com/934.html

修改升级速度

人物升级主要是靠soulheart,而soulheart是靠soulspirit积累来升级,原始值是1000个soulspirit升一级。

可以通过修改scripts\wharang_tuning.lua,调整T.SOULSPIRIT_MAX = 100的值,达到减小升级需要的最大soulspirit

相应的可以修改最大级别:T.SOULHEART_MAX = 1000

升级时,修改任务攻击力: scripts\wharang.luaWharang_Collection函数,设置任务的攻击力系数。

inst.components.combat.damagemultiplier = 10
inst.components.combat.areahitdamagepercent = 10
inst.components.combat.damagebonus = 10 
-- 修改攻击力方法
-- line 538
inst.basedamagemultiplier = 1

-- line 398, Wharang_Stats method
inst.components.combat.damagemultiplier = inst.basedamagemultiplier

-- line 71, add multiplier when soulheart is level up
inst.basedamagemultiplier = 1.1 + math.log(inst.soulheart)

需要注意Wharang_Stats方法种对damagemultiplier的重新赋值。

参考伤害计算方式:dont_starve\data\scripts\components\combat.luaCalcDamage方法。

修改击杀敌人处理逻辑

scripts\prefabs\wharang.luaWharang_OnKill函数,一般是调整获取soulspirit的随机范围。

local function Wharang_OnKill(inst, data)
    local time = data.inst.components.health.destroytime or 2
    local victim = data.inst
    -- update by uusama, radnom plus 30
    if IsValidVictim(victim) and data.cause == inst.prefab then
        if inst.soulheart < TUNING.SOULHEART_MAX then
            if data.inst:HasTag("epic") then
                inst.soulspirit = inst.soulspirit + 100
            elseif data.inst:HasTag("nightmarecreature") then
                inst.soulspirit = inst.soulspirit + math.random( 50, 80 )
            elseif data.inst:HasTag("worm") or data.inst:HasTag("WORM_DANGER") then
                inst.soulspirit = inst.soulspirit + math.random( 45, 60 )
            elseif data.inst:HasTag("shadowchesspiece") or data.inst:HasTag("tentacle_pillar") then
                inst.soulspirit = inst.soulspirit + math.random( 50, 70 )
            elseif data.inst:HasTag("largecreature") or data.inst:HasTag("mossling") then
                inst.soulspirit = inst.soulspirit + math.random( 40, 50 )
            elseif data.inst:HasTag("monster") or data.inst:HasTag("character") then
                inst.soulspirit = inst.soulspirit + math.random( 35, 40 )
            else
                -- inst.soulspirit = inst.soulspirit + math.random( 1, 5 )
                inst.soulspirit = inst.soulspirit + math.random( 20, 30 )
            end
            inst:DoTaskInTime(time, function() OnKill_FX(inst, data) end)

            --inst.components.talker:Say("("..(math.floor(inst.soulspirit/10)).."% "..(GetString(inst.prefab, "DESC_SOULCOLLECT_SPIRIT"))..")")
            Wharang_Collection(inst)
        end
    end
end

修改吃东西触发的处理逻辑

scripts\prefabs\wharang.luaWharang_OnEat, 随机获得好东西,并且能够随机获得spirit

local function Wharang_OnEat(inst, food)
    -- update by uusama , prank *= 10,  condition /= 10
    inst.soulspirit = inst.soulspirit + math.random( 30, 60 )

    local prank_1 = 11/100
    local prank_2 = 15/100
    local prank_3 = 14/100
    local prank_4 = 12/100
    local prank_5 = 11/100

    local prank = 40/100

    if food and food.components.edible.foodtype == "MEAT" and math.random() < prank then
        local pos = Vector3(inst.Transform:GetWorldPosition());pos.z = pos.z + math.random();pos.x = pos.x + math.random()
        local item = {
            "pigskin", -- 猪皮
            "cutstone", -- 石砖
            "boards", -- 木板
        }
        local randomitem = item[math.random(#item)]
        SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition())
        SpawnPrefab(randomitem).Transform:SetPosition(pos:Get())
        if math.random() < prank_1 then
            local mane_item = {
                "nightmarefuel", -- 噩梦燃料
                "deerclops_eyeball", -- 眼球
                "gears", -- 齿轮
                "transistor", -- 电器元件
                "houndstooth", -- 狗牙
                "manrabbit_tail", -- 兔人尾巴
            }
            SpawnPrefab(mane_item[math.random(#mane_item)]).Transform:SetPosition(pos:Get())
        end
    end
end

修改释放特殊技能时的消耗的san值

花狼释放特殊技能时,原始值是100级以后,每放一次技能减少50san值。

可以修改常量定义文件:scripts\wharang_tuning.lua,调整释放技能的值

  • 释放技能需要的san值: TUNING.SOULHEART_FIREWORK_DELTA_SAN = -5
  • 释放技能需要的最小san值: TUNING.SOULHEART_FIREWORK_NEEDS_SAN = 5

修改一些人物基础数值

通过修改modmain.lua文件里面的一些常量(在1036行以后),改变人物的一些数值:

  • 基础生命值: TUNING.WHARANG_HEALTH_S
  • 基础饱食度: TUNING.WHARANG_HUNGER_S
  • 基础san值: TUNING.WHARANG_SANITY_S
  • 升级增加的生命值: TUNING.WHARANG_HEALTH_PLUS
  • 升级增加的饱食度: TUNING.WHARANG_HUNGER_PLUS
  • 升级增加的san值: TUNING.WHARANG_HUNGER_PLUS

另外在scripts\wharangwharang_tuning.lua文件中有一些数值常量也可以修改:

  • 行走速度: T.WHARANG_WALKSPEED = 10
  • 奔跑速度: T.WHARANG_RUNSPEED = 12

去掉开始游戏时预加载

有可能加载游戏出现异常,此时看Lua异常track。

            -- inst.HUD.controls.status.heart:PulseGreen()
            -- inst.HUD.controls.status.stomach:PulseGreen()
            -- inst.HUD.controls.status.brain:PulseGreen()

            -- inst.HUD.controls.status.brain:ScaleTo(1.3,1,.7)
            -- inst.HUD.controls.status.heart:ScaleTo(1.3,1,.7)
            -- inst.HUD.controls.status.stomach:ScaleTo(1.3,1,.7)

饥荒死亡不删档的方法

首先修改dont_starve\data\scripts\gamelogic.lua脚本,224行左右。注释掉函数SaveGameIndex:EraseCurrent

        wilson.profile:Save(function()
            -- SaveGameIndex:EraseCurrent(function() 
                    scheduler:ExecuteInTime(3, function() 
                        TheFrontEnd:PushScreen(DeathScreen(days_survived, start_xp, nil, capped))
                    end)
            --  end)
            end)

然后打开dont_starve\data\scripts\screens\deathscreen.lua文件,注释掉SaveGameIndex:DeleteSlot相关的函数。

        -- line 209
        local slot = SaveGameIndex:GetCurrentSaveSlot()
        --SaveGameIndex:DeleteSlot(slot, function()
                    TheFrontEnd:Fade(false, 2, function ()
                        DoReload()
                    end )
                --end, true)

        -- line 237
        -- SaveGameIndex:DeleteSlot(SaveGameIndex:GetCurrentSaveSlot(), function()
                StartNextInstance()
        --     end)

死亡自动读档方法: 修改dont_starve\data\DLC0001\scripts\gamelogic.lua文件

-- line 205
local playtime = GetTimePlaying()
        playtime = math.floor(playtime*1000)
        SetTimingStat("time", "scenario", playtime)
        SendTrackingStats()
        local days_survived, start_xp, reward_xp, new_xp, capped = CalculatePlayerRewards(wilson)

        ProfileStatsSet("xp_gain", reward_xp)
        ProfileStatsSet("xp_total", new_xp)
        SubmitCompletedLevel() --close off the instance

        wilson.components.health.invincible = true

        wilson.profile:Save(function()
            SaveGameIndex:EraseCurrent(function() 
                    scheduler:ExecuteInTime(3, function() 
                        TheFrontEnd:PushScreen(DeathScreen(days_survived, start_xp, nil, capped))
                    end)
                end)
            end)

--> 修改为
StartNextInstance({reset_action=RESET_ACTION.LOAD_SLOT, save_slot = SaveGameIndex:GetCurrentSaveSlot()}, true)

修改基础攻击力

如果开了巨人的统治DLC,则需要修改dont_starve\data\DLC0001\scripts\tuning.lua,否则修改dont_starve\data\scripts\tuning.lua,修改里面的一些常量定义。

  • 攻击力: wilson_attack
  • 血量: wilson_health

设置玩家攻击力比率: inst.components.combat.damagemultiplier = damage_mult

设置默认攻击力: inst.components.combat:SetDefaultDamage(40)

修改采集速度

data\DLC0001\scripts\actions.lua文件。

  • BUILD = Action(0, true), 快速建造
  • COOK = Action(0, true), 快速烹调
  • EAT = Action(0, true), 快速吃食物
  • GIVE = Action(0, true), 快速给予
  • PICK = Action(0, true), 快速采摘
  • DEPLOY = Action(0, true), 快速种植
  • FERTILIZE = Action(0, true), 快速施肥
  • HARVEST = Action(0, true) 快速收获
  • DIG = Action(0,true), 快速挖掘
  • TERRAFORM = Action(0,true), 快速叉子挖地皮
  • READ = Action(0, true) 快速阅读
  • DEPLOY = Action(0, true), 快速建造墙
  • SEW = Action(0, true), 快速缝

喜欢 (12)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址