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

YN222-我是巨鹿(按键盘HOME键主角变身巨鹿,按END键还原)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二二二.我是巨鹿(按键盘HOME键主角变身巨鹿,按END键还原) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playercontroller")的下一行插入以下内容: 5 6TheInput:AddKeyUpHandler(KEY_HOME, function() 7 if inst.components.inventory:Has("goldnugget", 30) then 8 inst.components.inventory:ConsumeByName("goldnugget", 30) 9 inst.components.locomotor:Stop() 10 inst.components.playercontroller:Enable(false) 11 inst.AnimState:PlayAnimation("idle_shiver_pre") 12 inst.AnimState:PushAnimation("idle_shiver_loop") 13 inst.AnimState:PushAnimation("idle_shiver_pst", false) 14 inst:DoTaskInTime(1, function() 15 inst.AnimState:SetBank("deerclops") 16 inst.AnimState:SetBuild("deerclops_build") 17 inst:SetStateGraph("SGdeerclops") 18 inst.AnimState:PlayAnimation("idle_loop", true) 19 inst.Transform:SetScale(1.5,1.5,1.5) 20 shadow:SetSize( 6, 3.5 ) 21 local pos = GetPlayer():GetPosition() 22 GetSeasonManager():DoLightningStrike(pos) 23 inst.components.health:SetInvincible(true) 24 inst.components.hunger:Pause() 25 inst.components.combat:SetDefaultDamage(500) 26 inst.components.combat.hiteffectsymbol = "deerclops_body" 27 inst.components.combat.onhitotherfn = function() 28 inst.SoundEmitter:PlaySound("dontstarve/creatures/deerclops/attack") 29 inst.components.playercontroller:ShakeCamera(inst, "FULL", 0.5, 0.05, 2, 40) 30 end 31 inst.components.combat.playerdamagepercent = 0 32 inst.components.combat:SetAreaDamage(10, 1) 33 inst.components.temperature:SetTemp(20) 34 inst.components.playercontroller:Enable(true) 35 end ) 36 end 37end ) 38TheInput:AddKeyUpHandler(KEY_END, function() 39 inst.components.locomotor:Stop() 40 inst.components.playercontroller:Enable(false) 41 inst.AnimState:PlayAnimation("taunt") 42 inst:DoTaskInTime(1, function() 43 inst.AnimState:SetBank("wilson") 44 inst.AnimState:SetBuild(name) 45 inst:SetStateGraph("SGwilson") 46 inst.AnimState:PlayAnimation("idle") 47 inst.Transform:SetScale(1,1,1) 48 shadow:SetSize( 1.3, .6 ) 49 local pos = GetPlayer():GetPosition() 50 GetSeasonManager():DoLightningStrike(pos) 51 inst.components.health:SetInvincible(false) 52 inst.components.hunger:Resume() 53 inst.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE) 54 inst.components.combat.hiteffectsymbol = "torso" 55 inst.components.combat.onhitotherfn = nil 56 inst.components.combat:SetAreaDamage(0, 0) 57 inst.components.temperature:SetTemp(nil) 58 inst.components.playercontroller:Enable(true) 59 end ) 60end ) 61 62 即可在你深陷绝境之时,对电脑屏幕大喊“我是巨鹿”,并同时按下键盘HOME键,主角将变身无敌巨鹿(锁血、锁饥饿、不怕冷),对敌人展开恐怖的报复吧(按Ctrl + 鼠标左键攻击)。每次变身将消耗30个黄金,身上黄金数不足时不会变身。想要变回主角时,按键盘END键即可。注意,由于巨鹿变身时会招来闪电,并且本身具备大面积杀伤的能力,所以请远离基地变身,且尽量不要带同伴。修改过“神奇跳跃”的话,不要在变身巨鹿时跳跃

2025/04/23 · Bny

YN223-我是神龙(按键盘L键主角变身神龙,能吐火,再按L键变回人)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二二三.我是神龙(按键盘L键主角变身神龙,能吐火,再按L键变回人) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playercontroller")的下一行插入以下内容: 5 6TheInput:AddKeyUpHandler(KEY_L, function() 7 if not inst:HasTag("dragon") then 8 if inst.components.inventory:Has("goldnugget", 30) then 9 inst.components.inventory:ConsumeByName("goldnugget", 30) 10 inst.components.locomotor:Stop() 11 inst.components.playercontroller:Enable(false) 12 inst.AnimState:PlayAnimation("idle_shiver_pre") 13 inst.AnimState:PushAnimation("idle_shiver_loop") 14 inst.AnimState:PushAnimation("idle_shiver_pst", false) 15 inst:DoTaskInTime(1, function() 16 inst:AddTag("dragon") 17 inst.AnimState:SetBank("krampus") 18 inst.AnimState:SetBuild("krampus_build") 19 inst:SetStateGraph("SGkrampus") 20 inst.AnimState:PlayAnimation("idle", true) 21 inst.AnimState:Hide("SACK") 22 inst.AnimState:Show("ARM") 23 inst.Transform:SetScale(1.8,1.8,1.8) 24 shadow:SetSize( 6, 3.5 ) 25 local light = inst.entity:AddLight() 26 light:SetIntensity(.8) 27 light:SetRadius(20) 28 light:SetFalloff(.6) 29 light:Enable(true) 30 light:SetColour(255/255, 0/255, 0/255) 31 inst.components.locomotor.walkspeed = 10 32 inst.components.locomotor.runspeed = 15 33 local pos = GetPlayer():GetPosition() 34 GetSeasonManager():DoLightningStrike(pos) 35 inst.components.health:SetInvincible(true) 36 inst.components.hunger:Pause() 37 inst.components.combat:SetDefaultDamage(500) 38 inst.components.combat.hiteffectsymbol = "krampus_torso" 39 local pearl = SpawnPrefab("dragonfruit") 40 pearl.entity:AddSoundEmitter() 41 RemovePhysicsColliders(pearl) 42 pearl:AddTag("projectile") 43 pearl:AddTag("pearl") 44 pearl:RemoveComponent("edible") 45 pearl:RemoveComponent("stackable") 46 pearl:RemoveComponent("tradable") 47 pearl:RemoveComponent("perishable") 48 pearl:RemoveComponent("cookable") 49 pearl:RemoveComponent("bait") 50 pearl:RemoveComponent("plantable") 51 pearl:RemoveComponent("burnable") 52 pearl:RemoveComponent("propagator") 53 pearl:AddComponent("burnable") 54 pearl.components.burnable:SetFXLevel(3) 55 pearl.components.burnable:AddBurnFX("character_fire", Vector3(0,0,0) ) 56 pearl:AddComponent("weapon") 57 pearl.components.weapon:SetDamage(500) 58 pearl.components.weapon:SetRange(20, 25) 59 pearl:AddComponent("equippable") 60 pearl.components.equippable.equipslot = EQUIPSLOTS.HANDS 61 pearl.components.equippable:SetOnEquip(function(pearl) 62 pearl.components.burnable:Extinguish() 63 end ) 64 pearl:AddComponent("projectile") 65 pearl.components.projectile:SetSpeed(50) 66 pearl.components.projectile:SetOnHitFn(function(pearl, owner, target) 67 inst.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") 68 SpawnPrefab("collapse_small").Transform:SetPosition(target.Transform:GetWorldPosition()) 69 SpawnPrefab("explode_small").Transform:SetPosition(target.Transform:GetWorldPosition()) 70 inst.components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .5, 40) 71 if target.components.burnable then 72 target.components.burnable:Ignite() 73 end 74 owner.components.inventory:Equip(pearl) 75 end ) 76 pearl.components.projectile:SetOnMissFn(function(pearl, owner) 77 owner.components.inventory:Equip(pearl) 78 end ) 79 pearl:ListenForEvent("onthrown", function(pearl) 80 local pt = pearl:GetPosition() 81 pearl.Transform:SetPosition(pt.x, 2, pt.z) 82 pearl.SoundEmitter:PlaySound("dontstarve/common/blackpowder_explo") 83 pearl.components.burnable:Ignite(true) 84 end ) 85 inst.components.inventory:Equip(pearl) 86 inst.components.temperature:SetTemp(20) 87 inst.components.playercontroller:Enable(true) 88 end ) 89 end 90 else 91 inst.components.locomotor:Stop() 92 inst.components.playercontroller:Enable(false) 93 inst.AnimState:PlayAnimation("taunt") 94 inst:DoTaskInTime(1, function() 95 inst:RemoveTag("dragon") 96 inst.AnimState:SetBank("wilson") 97 inst.AnimState:SetBuild(name) 98 inst:SetStateGraph("SGwilson") 99 inst.AnimState:PlayAnimation("idle") 100 inst.Transform:SetScale(1,1,1) 101 shadow:SetSize( 1.3, .6 ) 102 inst.Light:Enable(false) 103 inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED 104 inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED 105 local pos = GetPlayer():GetPosition() 106 GetSeasonManager():DoLightningStrike(pos) 107 inst.components.health:SetInvincible(false) 108 inst.components.hunger:Resume() 109 inst.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE) 110 inst.components.combat.hiteffectsymbol = "torso" 111 local pos0 = Vector3(inst.Transform:GetWorldPosition()) 112 local ents = TheSim:FindEntities(pos0.x,pos0.y,pos0.z, 3000) 113 for k,v in pairs(ents) do 114 if v:HasTag("pearl") then 115 v:Remove() 116 end 117 end 118 inst.components.temperature:SetTemp(nil) 119 inst.components.playercontroller:Enable(true) 120 end ) 121 end 122end ) 123 124 即可在身上有30个黄金时,按键盘L键,主角随即变身神龙,将消耗30个黄金,身上黄金数不足时不会变身。变身神龙后,自动装备龙果,对敌人按鼠标左键,可发射龙果火球,如果卸载龙果,则改为近身格斗(按Ctrl + 鼠标左键攻击,或按住F键反击),防止点燃附近植物。神龙可夜视,不会饥饿,且锁血,对地上的物品点鼠标左键可捡起。想要变回主角时,再次按键盘L键即可,龙果将消失

2025/04/23 · Bny

YN224-我是龙卷风(按键盘U键主角变身龙卷风,掠过之处尽毁,敌人靠近会被冻伤,再按U键变回人)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二二四.我是龙卷风(按键盘U键主角变身龙卷风,掠过之处尽毁,敌人靠近会被冻伤,再按U键变回人) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playercontroller")的下一行插入以下内容: 5 6TheInput:AddKeyUpHandler(KEY_U, function() 7 if not inst:HasTag("windman") then 8 inst.components.locomotor:Stop() 9 inst.components.playercontroller:Enable(false) 10 inst.AnimState:PlayAnimation("idle_shiver_pre") 11 inst.AnimState:PushAnimation("idle_shiver_loop") 12 inst.AnimState:PushAnimation("idle_shiver_pst", false) 13 GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") 14 inst:DoTaskInTime(0.3, function() 15 inst:AddTag("windman") 16 inst.AnimState:SetBank("tornado") 17 inst.AnimState:SetBuild("tornado") 18 inst:SetStateGraph("SGtornado") 19 inst.AnimState:PlayAnimation("tornado_pre") 20 inst.AnimState:PushAnimation("tornado_loop") 21 inst.Transform:SetScale(1.8,1.8,1.8) 22 local light = inst.entity:AddLight() 23 light:SetIntensity(.8) 24 light:SetRadius(10) 25 light:SetFalloff(.6) 26 light:Enable(true) 27 light:SetColour(255/255,255/255,255/255) 28 inst.components.locomotor.walkspeed = 20 29 inst.components.locomotor.runspeed = 30 30 inst.components.health:SetInvincible(true) 31 inst.components.hunger:Pause() 32 inst.components.temperature:SetTemp(20) 33 inst.Physics:SetCollisionCallback(function(inst, other) 34 if other and other.components.health and other.components.combat then 35 if other.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == other or other:HasTag("monster") then 36 other.components.health:DoDelta(-100) 37 if other.components.freezable then 38 other.components.freezable:AddColdness(10) 39 other.components.freezable:SpawnShatterFX() 40 end 41 end 42 end 43 if other and other.components.workable and other.components.workable.workleft > 0 then 44 GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") 45 other.components.workable:Destroy(inst) 46 end 47 end ) 48 inst.components.playercontroller:Enable(true) 49 end ) 50 else 51 inst.components.locomotor:Stop() 52 inst.components.playercontroller:Enable(false) 53 GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") 54 inst.AnimState:PlayAnimation("tornado_pst") 55 inst:DoTaskInTime(0.3, function() 56 inst:RemoveTag("windman") 57 inst.AnimState:SetBank("wilson") 58 inst.AnimState:SetBuild(name) 59 inst:SetStateGraph("SGwilson") 60 inst.AnimState:PlayAnimation("idle") 61 inst.Transform:SetScale(1,1,1) 62 inst.Light:Enable(false) 63 inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED 64 inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED 65 inst.components.health:SetInvincible(false) 66 inst.components.hunger:Resume() 67 inst.components.temperature:SetTemp(nil) 68 inst.Physics:SetCollisionCallback( nil ) 69 inst.components.playercontroller:Enable(true) 70 end ) 71 end 72end ) 73 74 即可按键盘U键,主角变身龙卷风,掠过之处一切建筑、植物尽毁,敌人靠近将被冻伤。龙卷风可夜视,不会饥饿,且锁血,去席卷大陆吧。再次按键盘U键可变回人

2025/04/23 · Bny

YN225-荒野之狼(吃蜗牛龟粘液变成狼,打败别的狼成为领袖)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二二五.荒野之狼(吃蜗牛龟粘液变成狼,打败别的狼成为领袖) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/slurtleslime.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function item_oneaten(inst, eater) 7 if eater:HasTag("player") then 8 local pos = GetPlayer():GetPosition() 9 GetSeasonManager():DoLightningStrike(pos) 10 eater.components.locomotor:Stop() 11 eater.components.playercontroller:Enable(false) 12 eater:DoTaskInTime(1, function() 13 eater.AnimState:SetBank("hound") 14 eater.AnimState:SetBuild("hound_red") 15 eater.AnimState:PlayAnimation("idle") 16 eater:SetStateGraph("SGhound") 17 eater:RemoveTag("scarytoprey") 18 eater:AddTag("monster") 19 local light = eater.entity:AddLight() 20 light:SetFalloff(1) 21 light:SetIntensity(.8) 22 light:SetRadius(20) 23 light:Enable(true) 24 light:SetColour(0/255, 255/255, 0/255) 25 eater:ListenForEvent("attacked", function(eater) 26 local pt = eater:GetPosition() 27 eater.Transform:SetPosition(pt.x+(math.random(5)-math.random(5)), 0, pt.z+(math.random(5)-math.random(5))) 28 end ) 29 eater.components.locomotor.runspeed = 25 30 eater.components.sanity:DoDelta(eater.components.sanity.max) 31 eater.components.sanity.ignore = true 32 eater.components.health:StartRegen(100, 10) 33 eater.components.combat:SetDefaultDamage(500) 34 eater.components.combat:SetAttackPeriod(0.1) 35 eater.components.eater:SetCarnivore() 36 eater.components.temperature:SetTemp(20) 37 eater.components.playercontroller:Enable(true) 38 GetPlayer().HUD.controls.crafttabs:Hide() 39 GetPlayer().HUD.controls.inv:Hide() 40 GetPlayer().HUD.controls.mapcontrols.minimapBtn:Hide() 41 local head = GetPlayer().components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD) 42 GetPlayer().components.inventory:DropItem(head) 43 local hands = GetPlayer().components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) 44 GetPlayer().components.inventory:DropItem(hands) 45 local body = GetPlayer().components.inventory:GetEquippedItem(EQUIPSLOTS.BODY) 46 GetPlayer().components.inventory:DropItem(body) 47 eater.components.playeractionpicker.leftclickoverride = function(eater, target_ent, pos) 48 if eater.components.combat:CanTarget(target_ent) then 49 return eater.components.playeractionpicker:SortActionList({ACTIONS.ATTACK}, target_ent, nil) 50 end 51 if target_ent and target_ent.components.edible and eater.components.eater:CanEat(target_ent) then 52 return eater.components.playeractionpicker:SortActionList({ACTIONS.EAT}, target_ent, nil) 53 end 54 end 55 eater:DoPeriodicTask(3, function(eater) 56 if math.random() < 0.05 then 57 if eater.components.hunger:GetPercent() > 0.995 then 58 local pt1 = eater:GetPosition() 59 local wolf = SpawnPrefab("slurtleslime") 60 wolf.Transform:SetPosition(pt1.x+(math.random(10)-math.random(10)), 0, pt1.z+(math.random(10)-math.random(10))) 61 wolf.AnimState:SetBank("hound") 62 wolf.AnimState:SetBuild("hound") 63 wolf.AnimState:PlayAnimation("idle") 64 wolf.Transform:SetFourFaced() 65 local sound = wolf.entity:AddSoundEmitter() 66 local shadow = wolf.entity:AddDynamicShadow() 67 shadow:SetSize( 2.5, 1.5 ) 68 MakeCharacterPhysics(wolf, 10, .5) 69 wolf:AddComponent("locomotor") 70 wolf.components.locomotor.runspeed = 25 71 wolf:SetStateGraph("SGhound") 72 local brain = require "brains/frogbrain" 73 wolf:SetBrain(brain) 74 wolf:RemoveComponent("stackable") 75 wolf:RemoveComponent("fuel") 76 wolf:RemoveComponent("inventoryitem") 77 wolf:RemoveComponent("explosive") 78 wolf:RemoveComponent("burnable") 79 wolf:RemoveComponent("propagator") 80 wolf:RemoveComponent("edible") 81 wolf:AddComponent("follower") 82 wolf:AddComponent("knownlocations") 83 wolf:AddComponent("lootdropper") 84 wolf.components.lootdropper:SetLoot({"meat", "meat"}) 85 wolf:AddComponent("health") 86 wolf.components.health:SetMaxHealth(2000) 87 wolf.components.health:StartRegen(100, 10) 88 wolf:AddComponent("combat") 89 wolf.components.combat:SetDefaultDamage(20) 90 wolf.components.combat:SetAttackPeriod(0.1) 91 wolf.components.combat:SetTarget(eater) 92 wolf.AnimState:SetMultColour(255/255,0/255,0/255,1) 93 wolf.components.combat:SetRetargetFunction(1, function(wolf) 94 if not wolf.components.health:IsDead() then 95 return FindEntity(wolf, 300, function(guy) 96 return guy:HasTag("player") 97 end ) 98 end 99 end ) 100 wolf.components.combat:SetKeepTargetFunction(function(wolf, target) return target and target:IsValid() end ) 101 wolf.task = wolf:DoPeriodicTask(1, function(customer) 102 if wolf.components.health.currenthealth < 1000 then 103 wolf.components.combat:SetTarget(nil) 104 wolf:RemoveTag("goodbye") 105 local brain = require "brains/abigailbrain" 106 wolf:SetBrain(brain) 107 wolf:RestartBrain() 108 wolf.components.follower:SetLeader(GetPlayer()) 109 wolf.AnimState:SetMultColour(255/255,255/255,255/255,1) 110 wolf.components.combat:SetRetargetFunction(2, function(wolf) 111 if not wolf.components.health:IsDead() then 112 return FindEntity(wolf, 20, function(guy) 113 if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("wolfs") then 114 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy 115 end 116 end ) 117 end 118 end ) 119 wolf.components.combat:SetKeepTargetFunction(function(wolf, target) return target and target:IsValid() end ) 120 if wolf.task then wolf.task:Cancel() wolf.task = nil end 121 end 122 end ) 123 wolf:AddTag("monster") 124 wolf:AddTag("wolfs") 125 wolf:AddTag("goodbye") 126 end 127 end 128 end ) 129 end ) 130 end 131end 132 inst:AddComponent("edible") 133 inst.components.edible:SetOnEatenFn(item_oneaten) 134 inst.components.edible.hungervalue = 1 135 inst.components.edible.foodtype = "VEGGIE" 136local function onsave(inst, data) 137 if inst:HasTag("wolfs") then 138 data.wolfs = true 139 end 140 if inst:HasTag("goodbye") then 141 data.goodbye = true 142 end 143end 144local function onload(inst, data) 145 if data and data.goodbye then 146 inst:Remove() 147 end 148 if data and data.wolfs then 149 inst.AnimState:SetBank("hound") 150 inst.AnimState:SetBuild("hound") 151 inst.AnimState:PlayAnimation("idle") 152 inst.Transform:SetFourFaced() 153 local sound = inst.entity:AddSoundEmitter() 154 local shadow = inst.entity:AddDynamicShadow() 155 shadow:SetSize( 2.5, 1.5 ) 156 MakeCharacterPhysics(inst, 10, .5) 157 inst:AddComponent("locomotor") 158 inst.components.locomotor.runspeed = 25 159 inst:SetStateGraph("SGhound") 160 inst:RemoveComponent("stackable") 161 inst:RemoveComponent("fuel") 162 inst:RemoveComponent("inventoryitem") 163 inst:RemoveComponent("explosive") 164 inst:RemoveComponent("burnable") 165 inst:RemoveComponent("propagator") 166 inst:RemoveComponent("edible") 167 inst:AddComponent("follower") 168 inst:AddComponent("knownlocations") 169 inst:AddComponent("lootdropper") 170 inst.components.lootdropper:SetLoot({"meat", "meat"}) 171 inst:AddComponent("health") 172 inst.components.health:SetMaxHealth(2000) 173 inst.components.health:StartRegen(100, 10) 174 inst:AddComponent("combat") 175 inst.components.combat:SetDefaultDamage(20) 176 inst.components.combat:SetAttackPeriod(0.1) 177 local brain = require "brains/abigailbrain" 178 inst:SetBrain(brain) 179 inst.components.follower:SetLeader(GetPlayer()) 180 inst.components.combat:SetRetargetFunction(2, function(inst) 181 if not inst.components.health:IsDead() then 182 return FindEntity(inst, 20, function(guy) 183 if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("wolfs") then 184 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy 185 end 186 end ) 187 end 188 end ) 189 inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) 190 inst:AddTag("monster") 191 inst:AddTag("wolfs") 192 end 193end 194 inst.OnSave = onsave 195 inst.OnLoad = onload 196 197 即可吃蜗牛龟粘液让主角变成狼,体验野生动物的生活。可喜的是,你将拥有强大的生命力(自动回血),超快的跑动速度和恐怖的咬合能力,黑夜也不会影响你看清前方,甚至由于没有了人的味道,一些小动物将无法躲避你。可悲的是,你必须告别之前所有的伙伴,连“新移民”都会主动攻击你,离开人类的生活,流浪在荒郊野外。战斗中,由于你的体重变轻,被打时会被甩出去,因此要学会扬长避短,发挥速度和攻击力的优势,跑过去咬上一口就躲,千万不要与敌人原地肉搏。当你进食到最饱时,有一定概率出现别的狼(全身红色)挑战你,打败它(它身上不再呈红色),则将成为你的小弟,用锋利的牙齿发展起你的狼群吧。如果实在受不了荒野的生活了,存档退出再读档,即可变回人,但狼小弟将继续跟随你。使用大力士、伍迪作主角时,不适用此项,不要与“变身传奇”、“饥饿的儿童”一同修改。蜗牛龟粘液可打蜗牛龟和蜗牛窝获得

2025/04/23 · Bny

YN226-遁形术(按键盘I键主角变身随机小动物,敌人会失去攻击目标,再按I键变回人)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二二六.遁形术(按键盘I键主角变身随机小动物,敌人会失去攻击目标,再按I键变回人) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playercontroller")的下一行插入以下内容: 5 6TheInput:AddKeyUpHandler(KEY_I, function() 7 if not inst:HasTag("chameleon") then 8 inst.components.locomotor:Stop() 9 inst.components.talker:ShutUp() 10 inst.components.playercontroller:Enable(false) 11 local head = GetPlayer().components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD) 12 GetPlayer().components.inventory:DropItem(head) 13 local hands = GetPlayer().components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) 14 GetPlayer().components.inventory:DropItem(hands) 15 local body = GetPlayer().components.inventory:GetEquippedItem(EQUIPSLOTS.BODY) 16 GetPlayer().components.inventory:DropItem(body) 17 inst.components.health:SetInvincible(true) 18 inst.components.hunger:Pause() 19 inst.components.sanity.ignore = true 20 inst.components.temperature:SetTemp(20) 21 SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition()) 22 inst:DoTaskInTime(0.3, function() 23 inst:AddTag("chameleon") 24 inst.chameleon = inst:DoPeriodicTask(.5, function() 25 local pos = Vector3(inst.Transform:GetWorldPosition()) 26 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 25) 27 for k,v in pairs(ents) do 28 if v.components.combat and v.components.combat.target and v.components.combat.target == inst then 29 v.components.combat:SetTarget(nil) 30 end 31 end 32 end ) 33 if math.random()<.18 then 34 inst.AnimState:SetBank("rabbit") 35 inst.AnimState:SetBuild("rabbit_build") 36 inst.AnimState:PlayAnimation("idle") 37 local rabbitsounds = { scream = "dontstarve/rabbit/scream", hurt = "dontstarve/rabbit/scream_short", } 38 inst.sounds = rabbitsounds 39 inst.data = {} 40 inst:SetStateGraph("SGrabbit") 41 shadow:SetSize( 1, .75 ) 42 elseif math.random()<.36 then 43 inst.AnimState:SetBank("perd") 44 inst.AnimState:SetBuild("perd") 45 inst.AnimState:PlayAnimation("idle_loop") 46 inst:SetStateGraph("SGperd") 47 shadow:SetSize( 1.5, .75 ) 48 elseif math.random()<.54 then 49 inst.AnimState:SetBank("frog") 50 inst.AnimState:SetBuild("frog") 51 inst.AnimState:PlayAnimation("idle") 52 inst:SetStateGraph("SGfrog") 53 shadow:SetSize( 1.5, .75 ) 54 elseif math.random()<.72 then 55 inst.AnimState:SetBank("butterfly") 56 inst.AnimState:SetBuild("butterfly_basic") 57 inst.AnimState:PlayAnimation("idle") 58 inst:SetStateGraph("SGbutterfly") 59 shadow:SetSize( .8, .5 ) 60 else 61 inst.AnimState:SetBank("bee") 62 inst.AnimState:SetBuild("bee_build") 63 inst.AnimState:PlayAnimation("idle") 64 local workersounds = { takeoff = "dontstarve/bee/bee_takeoff", attack = "dontstarve/bee/bee_attack", buzz = "dontstarve/bee/bee_fly_LP", hit = "dontstarve/bee/bee_hurt", death = "dontstarve/bee/bee_death", } 65 inst.sounds = workersounds 66 inst:SetStateGraph("SGbee") 67 shadow:SetSize( .8, .5 ) 68 end 69 inst.components.playercontroller:Enable(true) 70 end ) 71 else 72 inst.components.locomotor:Stop() 73 inst.components.talker:ShutUp() 74 inst.components.playercontroller:Enable(false) 75 SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition()) 76 inst:DoTaskInTime(0.3, function() 77 inst:RemoveTag("chameleon") 78 if inst.chameleon then inst.chameleon:Cancel() inst.chameleon = nil end 79 inst.AnimState:SetBank("wilson") 80 inst.AnimState:SetBuild(name) 81 inst.AnimState:PlayAnimation("idle") 82 inst:SetStateGraph("SGwilson") 83 shadow:SetSize( 1.3, .6 ) 84 inst.components.health:SetInvincible(false) 85 inst.components.hunger:Resume() 86 inst.components.sanity.ignore = false 87 inst.components.temperature:SetTemp(nil) 88 inst.components.playercontroller:Enable(true) 89 end ) 90 end 91end ) 92 93 即可在被敌人追得穷途末路时,大声喊出咒语“哎呀妈呀”(请使用东北口音),并按键盘I键,主角随机变身为兔子、火鸡、青蛙、蝴蝶、蜜蜂等小动物,敌人会被迷惑,从而失去攻击目标,让你可以成功脱身。每种小动物各有特色,火鸡可以快速采摘植物、蜜蜂可以蛰敌人等,体验一下作小动物的感觉吧。运用遁形术变身时,血、饥饿、脑会锁死,穿戴的装备会掉在地上,不想让其掉落,就提前卸下。再次按键盘I键,可变回主角

2025/04/23 · Bny

YN227-人工降水(开关雨量计夏天下雨、冬天下雪,可以灭火)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二二七.人工降水(开关雨量计夏天下雨、冬天下雪,可以灭火) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/rainometer.lua文件,将inst:AddComponent("inspectable")替换为以下内容: 5 6function firefn(inst) 7 local range = 3000 8 local pos = Vector3(inst.Transform:GetWorldPosition()) 9 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, range) 10 for k,v in pairs(ents) do 11 local pt = v:GetPosition() 12 if v.components.burnable and v.components.burnable:IsBurning() then 13 if v.prefab == "grass" then 14 v:Remove() 15 SpawnPrefab("grass").Transform:SetPosition(pt.x, pt.y, pt.z) 16 end 17 if v.prefab == "sapling" then 18 v:Remove() 19 SpawnPrefab("sapling").Transform:SetPosition(pt.x, pt.y, pt.z) 20 end 21 if v.prefab == "reeds" then 22 v:Remove() 23 SpawnPrefab("reeds").Transform:SetPosition(pt.x, pt.y, pt.z) 24 end 25 if v.prefab == "berrybush" then 26 v:Remove() 27 SpawnPrefab("berrybush").Transform:SetPosition(pt.x, pt.y, pt.z) 28 end 29 if v.prefab == "marsh_bush" then 30 v:Remove() 31 SpawnPrefab("marsh_bush").Transform:SetPosition(pt.x, pt.y, pt.z) 32 end 33 if v.prefab == "flower_cave_triple" then 34 v:Remove() 35 SpawnPrefab("flower_cave_triple").Transform:SetPosition(pt.x, pt.y, pt.z) 36 end 37 if v.prefab == "lichen" then 38 v:Remove() 39 SpawnPrefab("lichen").Transform:SetPosition(pt.x, pt.y, pt.z) 40 end 41 end 42 end 43end 44local function GetStatus(inst, viewer) 45 if GetWorld().components.seasonmanager.precip then 46 GetWorld().components.seasonmanager:StopPrecip() 47 if inst.fire then inst.fire:Cancel() inst.fire = nil end 48 else 49 GetWorld().components.seasonmanager:ForcePrecip() 50 inst.fire = inst:DoPeriodicTask(8, function() firefn(inst) end) 51 end 52end 53 inst:AddComponent("inspectable") 54 inst.components.inspectable.getstatus = GetStatus 55 56 即可在雨量计上按鼠标左键开始降水,再按一次鼠标左键停止降水,夏天下雨、冬天下雪。可以浇灭大部分植物着的火,包括草、树枝、芦苇、果树丛、尖刺灌木、三朵洞穴花、苔藓

2025/04/23 · Bny

YN228-人工换季(鼠标左键点寒冬温度计切换季节)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二二八.人工换季(鼠标左键点寒冬温度计切换季节) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/winterometer.lua文件,将inst:AddComponent("inspectable")替换为以下内容: 5 6local function GetStatus(inst, viewer) 7 if GetWorld().components.seasonmanager:IsWinter() then 8 GetWorld().components.seasonmanager:StartSpring() 9 elseif GetWorld().components.seasonmanager:IsSpring() then 10 GetWorld().components.seasonmanager:StartSummer() 11 elseif GetWorld().components.seasonmanager:IsSummer() then 12 GetWorld().components.seasonmanager:StartAutumn() 13 else 14 GetWorld().components.seasonmanager:StartWinter() 15 end 16 GetWorld().components.seasonmanager:UpdateSegs() 17end 18 inst:AddComponent("inspectable") 19 inst.components.inspectable.getstatus = GetStatus 20 21 即可鼠标左键点寒冬温度计切换季节,每按一次切换到下个季节

2025/04/23 · Bny

YN229-光阴似箭(对指南针按右键跳到下个时段)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二二九.光阴似箭(对指南针按右键跳到下个时段) 3 4 用MT管理器打开游戏目录/assets/scripts/prefabs/compass.lua文件,在local function GetStatus(inst, viewer)的下一行插入GetClock():NextPhase() 5 6 即可对指南针按右键跳到下个时段,即白天变傍晚、傍晚变黑夜、黑夜变白天,采蘑菇、捉萤火虫等有时段要求的事情,无须再等待了

2025/04/23 · Bny

YN230-五彩木箱(找东西直接看木箱颜色,木箱可搬动)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二三0.五彩木箱(找东西直接看木箱颜色,木箱可搬动) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/treasurechest.lua文件,将下列内容: 5 6 inst.OnSave = onsave 7 inst.OnLoad = onload 8 9 替换为: 10 11local colours= 12{ 13 {198/255,43/255,43/255}, 14 {79/255,153/255,68/255}, 15 {35/255,105/255,235/255}, 16 {233/255,208/255,69/255}, 17 {109/255,50/255,163/255}, 18 {222/255,126/255,39/255}, 19} 20local function onequip(inst, owner) 21 owner.AnimState:OverrideSymbol("swap_body", "swap_backpack", "swap_body") 22end 23local function onunequip(inst, owner) 24 owner.AnimState:ClearOverrideSymbol("swap_body") 25end 26local function turnon(inst) 27 inst.components.machine.ison = true 28 if inst.prefab == "treasurechest" then 29 inst:AddComponent("inventoryitem") 30 end 31end 32local function turnoff(inst) 33 inst.components.machine.ison = false 34 if inst.prefab == "treasurechest" then 35 inst:RemoveComponent("inventoryitem") 36 end 37end 38local function onsave2(inst, data) 39 data.num = inst.balloon_num 40 data.colour_idx = inst.colour_idx 41end 42local function onload2(inst, data) 43 if data then 44 if data.num then 45 inst.balloon_num = data.num 46 inst.AnimState:OverrideSymbol("swap_balloon", "balloon_shapes", "balloon_" .. tostring(inst.balloon_num)) 47 end 48 if data.colour_idx then 49 inst.colour_idx = math.min(#colours, data.colour_idx) 50 inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1) 51 end 52 end 53end 54 inst:AddComponent("machine") 55 inst.components.machine.turnonfn = turnon 56 inst.components.machine.turnofffn = turnoff 57 inst:AddComponent("equippable") 58 inst.components.equippable:SetOnEquip( onequip ) 59 inst.components.equippable:SetOnUnequip( onunequip ) 60 inst.colour_idx = math.random(#colours) 61 inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1) 62 inst.OnSave = onsave2 63 inst.OnLoad = onload2 64 65 即可使木箱具备不同颜色,找东西直接看颜色,再也不用翻箱倒柜了。木箱可搬动,对地上的木箱按鼠标右键,可拿起木箱。将木箱放在地上后,对其按鼠标右键,可以锁定在地上

2025/04/23 · Bny

YN231-随笔涂鸦(用蓝魔杖为物品涂上色彩)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二三一.随笔涂鸦(用蓝魔杖为物品涂上色彩) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/staff.lua文件,在local inst = commonfn("blue")的下一行插入以下内容: 5 6local function cancreatecolour(staff, caster, target, pos) 7 return true 8end 9local function createcolour(staff, target, pos) 10 local caster = staff.components.inventoryitem.owner 11 if caster.components.sanity then 12 caster.components.sanity:DoDelta(5) 13 end 14 local colours= { {198/255,43/255,43/255}, {79/255,153/255,68/255}, {35/255,105/255,235/255}, {233/255,208/255,69/255}, {109/255,50/255,163/255}, {222/255,126/255,39/255}, } 15 inst.colour_idx = math.random(#colours) 16 target.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1) 17end 18 inst:AddComponent("spellcaster") 19 inst.components.spellcaster:SetSpellFn(createcolour) 20 inst.components.spellcaster:SetSpellTestFn(cancreatecolour) 21 inst.components.spellcaster.canuseontargets = true 22 inst.components.spellcaster.canusefrominventory = false 23 24 即可用蓝魔杖右键点任何物品,为其涂上随机色彩,存档退出后消失。每涂鸦一次补脑5点。将你涂好的缤纷世界截下图片,给朋友秀秀吧

2025/04/23 · Bny