饥荒单机版实用(BT?)控制台脚本【减伤&发光&指定位置放置点燃的火药&点燃鼠标下的可燃实体】(控制台函数、无需添加mod,修改单个游戏文件即可)

1.给实体(如切斯特,自己)减伤(修改自c_findnext)

通过TheSim:FindEntities遍历范围内实体,根据传入的prefab(实体名称)找到对应的实体,用tarinst存下来,ratio1为减伤倍率,最后一个参数可不填

使用方式:将本函数插入.\Steam\steamapps\common\dont_starve\data\scripts\consolecommands.lua中后,重进游戏,站在切斯特附近打开控制台,输入c_setabsorb("chester", 0.99),即可给切斯特赋予99%的减伤

特殊:给自己减伤直接输入:GetPlayer().components.health:SetAbsorptionAmount(ratio1),无需对游戏文件做任何修改

ps.可以改成根据实体id分别赋予减伤的版本,但是我用不上,所以不写了(

pss.合订本中有给鼠标下实体减伤的版本(可以给石虾设置0减伤)

function c_setabsorb(prefab, ratio1, inst)
    inst = inst or GetPlayer()
    local ratio1 = ratio1 or .95
    local radius = 9001

    local trans = inst.Transform
    local found = false
    local tarinst = inst
    local foundlowestid = nil
    local reallowest = nil
    local reallowestid = nil

    print("Finding a ",prefab)

    local x,y,z = trans:GetWorldPosition()
    local ents = TheSim:FindEntities(x,y,z, radius)
    for k,v in pairs(ents) do
        if v ~= inst and v.prefab == prefab then
            print(v.GUID,lastfound,foundlowestid )
            found = true
            tarinst = v
            if not reallowestid or v.GUID < reallowestid then
                reallowest = v
                reallowestid = v.GUID
            end
        end
    end
    if found then
        tarinst.components.health:SetAbsorptionAmount(ratio1)
        tarinst.components.health:SetMinHealth(100)
    end
    lastfound = found.GUID
    return found

    -- inst.AnimState:PlayAnimation("hide_loop")
    -- found.components.health:StartRegen(TUNING.ROCKY_REGEN_AMOUNT, TUNING.ROCKY_REGEN_PERIOD)
end

2.超级机器人(手动过载【发光、加速】):【控制台直接输入c_mannualoverride()即可,再次输入时退出该模式】

local joy_lightmod = false
function c_mannualoverride()
    local inst = GetPlayer()
    joy_lightmod = not joy_lightmod
    local radius = 12
    local runspeed_bonus = .5
    local mintemp = 10
    if not joy_lightmod then
        radius = 3
        runspeed_bonus = 0
        mintemp = -20
    end
    
    inst.Light:Enable(joy_lightmod)
    inst.Light:SetRadius(radius)
    inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED*(1+runspeed_bonus)
    inst.components.temperature.mintemp = mintemp
end

 

修改自机器人被闪电劈中后的逻辑,除了调大了发光范围方便赶路,其他数值都是抄的

ps.radius为发光范围,20已经足够覆盖整个屏幕

image

 目前就这俩挺方便的,剩下上帝模式、创造模式饥荒wiki上面都有

 3.合订本

---you are the sun
---以自身为中心发光,加速,设置最低温度

local joy_lightmod = false
function c_mannualoverride()
    local inst = GetPlayer()
    joy_lightmod = not joy_lightmod
    local radius = 12
    local runspeed_bonus = .5
    local mintemp = 10
    if not joy_lightmod then
        radius = 3
        runspeed_bonus = 0
        mintemp = -20
    end
    
    inst.Light:Enable(joy_lightmod)
    inst.Light:SetRadius(radius)
    inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED*(1+runspeed_bonus)
    inst.components.temperature.mintemp = mintemp
end

------stronger!!!!
------不填参数默认给当前玩家0.99减伤
------第一个参数为减伤比例
------第二个参数为半径10范围内的指定名称的实体,不填则给玩家减伤


function c_setabsorb(ratio1, prefab)
    local inst = GetPlayer()
    local ratio1 = ratio1 or .99
    local radius = 10

    local trans = inst.Transform
    local found = false
    local tarinst = inst
    local foundlowestid = nil
    local reallowest = nil
    local reallowestid = nil
    if prefab then 
        print("Finding a ",prefab)

        local x,y,z = trans:GetWorldPosition()
        local ents = TheSim:FindEntities(x,y,z, radius)
        for k,v in pairs(ents) do
            if v ~= inst and v.prefab == prefab then
                print(v.GUID,lastfound,foundlowestid )
                found = true
                tarinst = v
                if not reallowestid or v.GUID < reallowestid then
                    reallowest = v
                    reallowestid = v.GUID
                end
            end
        end
    else found = true
    end
    if found then
        tarinst.components.health:SetAbsorptionAmount(ratio1)
        tarinst.components.health:SetMinHealth(100)
        print("give absorb to ", tarinst.prefab)
    end
    return found

    -- inst.AnimState:PlayAnimation("hide_loop")
    -- found.components.health:StartRegen(TUNING.ROCKY_REGEN_AMOUNT, TUNING.ROCKY_REGEN_PERIOD)
end

----- the grace from god
----- 给予鼠标下的实体以指定减伤,无参数则为0.99

function c_giveabsorb(ratio1)
    ratio1 = ratio1 or 0.99
    local inst = ConsoleWorldEntityUnderMouse()
    inst.components.health:SetAbsorptionAmount(ratio1)
    inst.components.health:SetMinHealth(100)
    SetDebugEntity(inst)
    print("give absorb to ", inst.prefab)
end

function c_fire()
    local inst = ConsoleWorldEntityUnderMouse()
    inst.components.burnable:SetFXLevel(3)
    inst.components.burnable:SetOnIgniteFn(DefaultBurnFn)
    inst.components.burnable:Ignite()
end



-----zhongmozhiyan
-----默认在鼠标处放20个火药并点燃
-----第一个参数传可燃物个数,第二个参数为非空字符串时是终末之书,不填为火药

function final_fire(count, prefab)
    count = count or 20
    if prefab then 
        prefab = "book_brimstone"
    else prefab = "gunpowder"
    end

    local inst = nil
    for i=1,count do
        inst = DebugSpawn(prefab)
        inst.Transform:SetPosition(TheInput:GetWorldPosition():Get())
        inst.components.burnable:SetFXLevel(3)
        inst.components.burnable:Ignite()
        
    end
    SetDebugEntity(inst)
    SuUsed("c_spawn_" .. prefab , true)
    return inst
end

合订本挖坑: 

游戏文件忘记保存了,只有截图下次打回来

1.冰冻范围内所有实体

 

image

 

==============

2-1.识别范围内有攻击性的实体(判断依据:combat类六项成员{defaultdamage,攻击间隔,上次发起攻击时间,上次攻击目标id,毒性伤害、瓦斯伤害} 非初始值 )【谁家好人改这些默认值】

image

 

2-2.识别范围内能生产生物的实体(判断依据:childspawner and not harvestable【增加工作次数、血量判断】)

image

 

2-3.对2-1的实体分别围间距的墙(127-133行逻辑修改为放墙【注意间距 或者 先控制再放墙】)、放置火药(141函数改为:分别放置更精确的火药(杀死生物(识别血量、爆炸减伤)且破坏围墙)并点燃

image

 

image

 

==============

3.地图全开

image

 

=============

4-1.给鼠标下的实体设置减伤(传参)

4-2.无参数默认给自身和切斯特设置减伤

image

image

 

=============

5-1.点燃(只保留285、288)

image

 

============

 

posted @ 2025-07-31 04:28  joy_gg  阅读(48)  评论(0)    收藏  举报