[分享]饥荒联机版,支持局域网联机。

YN310-疯狂躲避球(用浣熊尾巴种躲避球场,在圈内60秒不被球打到,赢50个黄金)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2三一0.疯狂躲避球(用浣熊尾巴种躲避球场,在圈内60秒不被球打到,赢50个黄金) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/coontail.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function makecourt(inst) 7 local pt = inst:GetPosition() 8 local caddie = SpawnPrefab("coontail") 9 caddie.Transform:SetPosition(pt.x, pt.y, pt.z) 10 caddie.AnimState:SetBank("wilson") 11 caddie.AnimState:SetBuild("wes") 12 caddie.AnimState:OverrideSymbol("swap_hat", "hat_football", "swap_hat") 13 caddie.AnimState:OverrideSymbol("swap_body", "armor_sweatervest", "swap_body") 14 caddie.AnimState:Show("HAT") 15 caddie.AnimState:Show("HAT_HAIR") 16 caddie.AnimState:Hide("HAIR_NOHAT") 17 caddie.AnimState:Hide("HAIR") 18 caddie.AnimState:Hide("ARM_carry") 19 caddie.AnimState:Show("ARM_normal") 20 caddie.Transform:SetFourFaced() 21 caddie.AnimState:PlayAnimation("idle") 22 caddie:RemoveComponent("inventoryitem") 23 caddie:RemoveComponent("stackable") 24 caddie:RemoveComponent("deployable") 25 caddie:RemoveTag("cattoy") 26 caddie:AddComponent("workable") 27 caddie.components.workable:SetWorkAction(ACTIONS.HAMMER) 28 caddie.components.workable:SetWorkLeft(1) 29 caddie.components.workable:SetOnFinishCallback(function(caddie) 30 SpawnPrefab("collapse_big").Transform:SetPosition(caddie.Transform:GetWorldPosition()) 31 GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") 32 GetPlayer().SoundEmitter:KillSound("beavermusic") 33 local pos = Vector3(caddie.Transform:GetWorldPosition()) 34 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10) 35 for k,v in pairs(ents) do 36 if v:HasTag("border") or v:HasTag("landmine") then 37 SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition()) 38 v:Remove() 39 end 40 end 41 caddie:Remove() 42 end ) 43 caddie:AddComponent("named") 44 caddie.components.named:SetName("Pitcher") 45 caddie:AddComponent("talker") 46 caddie:AddComponent("trader") 47 caddie.components.trader:SetAcceptTest(function(caddie, item) 48 if not caddie:HasTag("startgame") then 49 if GetPlayer().components.inventory:Has("goldnugget", 10) then 50 if item.prefab == "goldnugget" then 51 return true 52 end 53 end 54 end 55 return false 56 end ) 57 caddie.components.trader.onaccept = function(caddie, giver, item) 58 caddie:AddTag("startgame") 59 GetPlayer().components.inventory:ConsumeByName("goldnugget", 9) 60 GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") 61 caddie.components.talker:Say("Are you ready ?", 3, false) 62 GetPlayer().SoundEmitter:PlaySound("dontstarve/music/music_hoedown", "beavermusic") 63 for k = 1, 10 do 64 local landmine = SpawnPrefab("coontail") 65 landmine.Transform:SetPosition(pt.x+(math.random(7)-math.random(7)), 0, pt.z+(math.random(7)-math.random(7))) 66 landmine.AnimState:SetBank("bee_mine") 67 landmine.AnimState:SetBuild("bee_mine") 68 landmine.AnimState:PlayAnimation("idle") 69 landmine.Transform:SetScale(1.2, 1.2, 1.2) 70 landmine.AnimState:SetMultColour(255/255,105/255,0/255,1) 71 landmine.AnimState:SetBloomEffectHandle("shaders/anim.ksh") 72 landmine:RemoveComponent("inventoryitem") 73 landmine:RemoveComponent("stackable") 74 landmine:RemoveComponent("deployable") 75 landmine:RemoveTag("cattoy") 76 landmine.persists = false 77 landmine:DoPeriodicTask(0.01, function() 78 local pos0 = Vector3(landmine.Transform:GetWorldPosition()) 79 local ents0 = TheSim:FindEntities(pos0.x,pos0.y,pos0.z, 1) 80 for k,v in pairs(ents0) do 81 if v and v:HasTag("player") and not v:HasTag("pain")then 82 v:AddTag("pain") 83 v.sg:GoToState("hit") 84 if v.components.health then v.components.health:DoDelta(-3) end 85 v:DoTaskInTime(0.5, function() v:RemoveTag("pain") end ) 86 end 87 end 88 end ) 89 landmine:AddTag("landmine") 90 end 91 caddie:DoTaskInTime(3, function() 92 caddie.components.talker:Say("Go !", 1, false) 93 GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") 94 caddie.task = caddie:DoPeriodicTask(0.4, function(caddie) 95 local target = FindEntity(caddie, 9, function(guy) 96 return guy:HasTag("player") 97 end ) 98 if target then 99 caddie.Transform:SetRotation(GetPlayer().Transform:GetRotation() - 180) 100 caddie.AnimState:PlayAnimation("give") 101 local dodgeball = SpawnPrefab("coontail") 102 dodgeball.AnimState:SetBank("bulb") 103 dodgeball.AnimState:SetBuild("bulb") 104 dodgeball.AnimState:PlayAnimation("idle") 105 dodgeball.Transform:SetPosition(pt.x, 0, pt.z) 106 dodgeball:RemoveComponent("inventoryitem") 107 dodgeball:RemoveComponent("stackable") 108 dodgeball:RemoveComponent("deployable") 109 dodgeball:RemoveTag("cattoy") 110 dodgeball.persists = false 111 dodgeball:AddComponent("complexprojectile") 112 dodgeball.components.complexprojectile.yOffset = 1 113 if math.random()<.5 then 114 local targetpos = target:GetPosition() 115 dodgeball.components.complexprojectile:Launch(targetpos) 116 else 117 dodgeball.components.complexprojectile:Launch(Point(pt.x+(math.random(9)-math.random(9)), 0, pt.z+(math.random(9)-math.random(9)))) 118 end 119 dodgeball.components.complexprojectile:SetOnHit(function() 120 SpawnPrefab("small_puff").Transform:SetPosition(dodgeball.Transform:GetWorldPosition()) 121 dodgeball:Remove() 122 end ) 123 dodgeball:DoPeriodicTask(0.01, function() 124 local pos = Vector3(dodgeball.Transform:GetWorldPosition()) 125 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 1) 126 for k,v in pairs(ents) do 127 if v and v:HasTag("player") then 128 v.sg:GoToState("hit") 129 if caddie.task then caddie.task:Cancel() caddie.task = nil end 130 if caddie.task2 then caddie.task2:Cancel() caddie.task2 = nil end 131 caddie.Transform:SetRotation( 0 ) 132 caddie.AnimState:PlayAnimation("idle_onemanband1_loop",true) 133 caddie:DoTaskInTime(2, function() caddie.AnimState:PlayAnimation("idle") end ) 134 caddie.components.talker:Say("Game over !", 3, false) 135 GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") 136 GetPlayer().SoundEmitter:KillSound("beavermusic") 137 SpawnPrefab("collapse_small").Transform:SetPosition(dodgeball.Transform:GetWorldPosition()) 138 dodgeball:Remove() 139 local pos1 = Vector3(caddie.Transform:GetWorldPosition()) 140 local ents1 = TheSim:FindEntities(pos1.x,pos1.y,pos1.z, 10) 141 for k,v in pairs(ents1) do 142 if v:HasTag("landmine") then 143 v:Remove() 144 end 145 end 146 caddie:RemoveTag("startgame") 147 end 148 end 149 end ) 150 else 151 if caddie.task then caddie.task:Cancel() caddie.task = nil end 152 if caddie.task2 then caddie.task2:Cancel() caddie.task2 = nil end 153 caddie.Transform:SetRotation( 0 ) 154 caddie.AnimState:PlayAnimation("idle_onemanband1_loop",true) 155 caddie:DoTaskInTime(2, function() caddie.AnimState:PlayAnimation("idle") end ) 156 caddie.components.talker:Say("Game over !", 3, false) 157 GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") 158 GetPlayer().SoundEmitter:KillSound("beavermusic") 159 local pos1 = Vector3(caddie.Transform:GetWorldPosition()) 160 local ents1 = TheSim:FindEntities(pos1.x,pos1.y,pos1.z, 10) 161 for k,v in pairs(ents1) do 162 if v:HasTag("landmine") then 163 v:Remove() 164 end 165 end 166 caddie:RemoveTag("startgame") 167 end 168 end ) 169 end ) 170 caddie.task2 = caddie:DoTaskInTime(63, function() 171 if caddie:HasTag("startgame") then 172 if caddie.task then caddie.task:Cancel() caddie.task = nil end 173 if caddie.task2 then caddie.task2:Cancel() caddie.task2 = nil end 174 caddie.Transform:SetRotation( 0 ) 175 caddie.AnimState:PlayAnimation("give") 176 caddie.components.talker:Say("You win !", 3, false) 177 GetPlayer().SoundEmitter:KillSound("beavermusic") 178 caddie:StartThread(function() 179 for k = 1, 10 do 180 GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") 181 Sleep(0.15) 182 end 183 end ) 184 for k = 1, 50 do 185 local goldnugget = SpawnPrefab("goldnugget") 186 GetPlayer().components.inventory:GiveItem(goldnugget) 187 end 188 local pos1 = Vector3(caddie.Transform:GetWorldPosition()) 189 local ents1 = TheSim:FindEntities(pos1.x,pos1.y,pos1.z, 10) 190 for k,v in pairs(ents1) do 191 if v:HasTag("landmine") then 192 v:Remove() 193 end 194 end 195 caddie:RemoveTag("startgame") 196 end 197 end ) 198 end 199 caddie:AddTag("caddie") 200 for k = 1, 50 do 201 local result_offset = FindValidPositionByFan(1 * 2 * PI, 8.5, 50, function(offset) 202 local x,y,z = (pt + offset):Get() 203 local ents = TheSim:FindEntities(x,y,z , 1) 204 return not next(ents) 205 end) 206 if result_offset then 207 local border = SpawnPrefab("coontail") 208 border.Transform:SetPosition((pt + result_offset):Get()) 209 border.AnimState:SetBank("bulb") 210 border.AnimState:SetBuild("bulb") 211 border.AnimState:PlayAnimation("idle") 212 border.Transform:SetScale(1.2, 1.2, 1.2) 213 border.AnimState:SetMultColour(255/255,0/255,0/255,1) 214 border.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround ) 215 border.AnimState:SetLayer( LAYER_BACKGROUND ) 216 border.AnimState:SetSortOrder( 1 ) 217 border:RemoveComponent("inventoryitem") 218 border:RemoveComponent("stackable") 219 border:RemoveComponent("deployable") 220 border:RemoveTag("cattoy") 221 border:DoPeriodicTask(2, function(shopsign) 222 border.AnimState:SetMultColour(0/255,255/255,0/255,1) 223 border:DoTaskInTime(1, function() border.AnimState:SetMultColour(255/255,0/255,0/255,1) end ) 224 end ) 225 border:AddTag("NOCLICK") 226 border:AddTag("border") 227 end 228 end 229end 230local function OnDeploy (inst, pt) 231 makecourt(inst) 232 inst.components.stackable:Get():Remove() 233end 234 inst:AddComponent("deployable") 235 inst.components.deployable.ondeploy = OnDeploy 236local function onsave(inst, data) 237 if inst:HasTag("caddie") then 238 data.caddie = true 239 end 240 if inst:HasTag("border") then 241 data.border = true 242 end 243end 244local function onload(inst, data) 245 if data and data.caddie then 246 makecourt(inst) 247 inst:Remove() 248 end 249 if data and data.border then 250 inst:Remove() 251 end 252end 253 inst.OnSave = onsave 254 inst.OnLoad = onload 255 256 即可在空旷的地上,用浣熊尾巴种躲避球场(拿着1个浣熊尾巴对地面点鼠标右键,如果拿着多个,则不会种出来)。给投手10个黄金玩一次(拿着黄金对投手点鼠标左键),他会不断向你扔球,在不跑出圆圈边界、不被砸到的情况下,坚持60秒,就可赢得50个黄金的奖励。球场内会随机出现障碍物,碰到会被扎伤(减3点血),绕着点跑吧。不想要躲避球场了,用锤子砸投手即可

2025/04/23 · Bny

YN311-快速孵化高鸟蛋(游戏中1小时孵出小高鸟)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2三一一.快速孵化高鸟蛋(游戏中1小时孵出小高鸟) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/tuning.lua文件,将SMALLBIRD_HATCH_TIME = total_day_time * 3, -- must be content for this amount of cumulative time to hatch替换为以下内容: 5 6SMALLBIRD_HATCH_TIME = seg_time*1, 7 8 即可在游戏中1小时孵出小高鸟

2025/04/23 · Bny

YN312-青年高鸟不长大,增加血量及攻击力,喂食可重新认人

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2三一二.青年高鸟不长大,增加血量及攻击力,喂食可重新认人 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/smallbird.lua文件, 5 6 1.在--print("smallbird - OnGetItemFromPlayer")的下一行插入以下内容: 7 8 local player = GetPlayer() 9 if player and player.components.leader then 10 player.components.leader:AddFollower(inst) 11 end 12 13 14 2.将inst.components.combat:SetDefaultDamage(TUNING.TEENBIRD_DAMAGE)替换为inst.components.combat:SetDefaultDamage(TUNING.TEENBIRD_DAMAGE*5) 15 16 17 3.将return TUNING.TEENBIRD_GROW_TIME替换为return TUNING.TEENBIRD_GROW_TIME*1000 18 19 20 4.将inst.components.health:SetMaxHealth(TUNING.TEENBIRD_HEALTH)替换为inst.components.health:SetMaxHealth(TUNING.TEENBIRD_HEALTH*100) 21 22 即可让青年高鸟18000天不长大,血量30000,攻击力180,如果不认主角了,喂食即可重新认人

2025/04/23 · Bny

YN313-喂自养高鸟产便便

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2三一三.喂自养高鸟产便便 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/smallbird.lua文件,在local function OnEat(inst, food)的下一行插入以下内容: 5 6 if food.components.edible then 7 local poo = SpawnPrefab("poop") 8 poo.Transform:SetPosition(inst.Transform:GetWorldPosition()) 9 end 10 11 即可喂自养高鸟产便便

2025/04/23 · Bny

YN314-自养高鸟不用喂食

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2三一四.自养高鸟不用喂食 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/smallbird.lua文件,在inst:AddComponent("hunger")的下一行插入以下内容: 5 6 inst.components.hunger.burning = false 7 8 即可让自养高鸟不用喂食,因为它不会自动掉饥饿值,除非受伤才须靠喂食补血

2025/04/23 · Bny

YN315-牙齿陷阱不伤害自养高鸟

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2三一五.牙齿陷阱不伤害自养高鸟 3 4 用MT管理器打开游戏目录/assets/scripts/prefabs/trap_teeth.lua文件,将if target then替换为if target and not target:HasTag("smallbird") then 5 6 即可让牙齿陷阱不伤害自养高鸟

2025/04/23 · Bny

YN316-主角带肉不被兔人攻击

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2三一六.主角带肉不被兔人攻击 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/bunnyman.lua文件,将if guy:HasTag("player")替换为if guy:HasTag("monster") 5 6 即可让兔人不攻击带肉的主角,注意替换的只是一句中的一部分,语句其他部分不要动

2025/04/23 · Bny

YN317-快速刷兔人(兔人死后兔房立刻生新兔人)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2三一七.快速刷兔人(兔人死后兔房立刻生新兔人) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/rabbithouse.lua文件,将inst.components.spawner:Configure( "bunnyman", TUNING.TOTAL_DAY_TIME)替换为inst.components.spawner:Configure( "bunnyman", TUNING.TOTAL_DAY_TIME*0) 5 6 即可打死一个兔人,兔房就立刻重生一个

2025/04/23 · Bny

YN318-快速刷猪人(猪死后猪房立刻生新猪)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2三一八.快速刷猪人(猪死后猪房立刻生新猪) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/pighouse.lua文件,将inst.components.spawner:Configure( "pigman", TUNING.TOTAL_DAY_TIME*4)替换为inst.components.spawner:Configure( "pigman", TUNING.TOTAL_DAY_TIME*0) 5 6 即可打死一个猪人,猪房就立刻重生一个

2025/04/23 · Bny

YN319-猪人永久跟随

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2三一九.猪人永久跟随 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/pigman.lua文件, 5 6 1.将inst.components.follower:AddLoyaltyTime(item.components.edible:GetHunger() * TUNING.PIG_LOYALTY_PER_HUNGER)替换为--inst.components.follower:AddLoyaltyTime(item.components.edible:GetHunger() * TUNING.PIG_LOYALTY_PER_HUNGER) 7 8 9 2.将inst.components.follower.maxfollowtime = TUNING.PIG_LOYALTY_MAXTIME替换为--inst.components.follower.maxfollowtime = TUNING.PIG_LOYALTY_MAXTIME 10 11 即可让猪人永久跟随,饿了也不会离开。但晚上一样需要给它点火,它会呆在火旁,到白天继续跟随

2025/04/23 · Bny