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

YN190-近卫军(主角受攻击自动出现机械护卫,不要与“菩萨低眉”一同修改)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2一九0.近卫军(主角受攻击自动出现机械护卫,不要与“菩萨低眉”一同修改) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst.Transform:SetFourFaced()的下一行插入以下内容: 5 6local function OnAttacked(inst, data) 7 local spawn = "" 8 if math.random()<.1 then 9 spawn = "rook_nightmare" 10 elseif math.random()<.5 then 11 spawn = "bishop_nightmare" 12 else 13 spawn = "knight_nightmare" 14 end 15 SpawnAt("maxwell_smoke",inst) 16 local it = SpawnAt(spawn,inst) 17 if it.components.follower then 18 it.components.follower:SetLeader(GetPlayer()) 19 end 20end 21 inst:ListenForEvent("attacked", OnAttacked) 22 23 即可在主角受到攻击时,自动产生机械兵(共三种)保护主角。如果主角强制攻击(按Ctrl + 鼠标左键)其中一个机械兵,则其他机械兵会帮主角清理门户

2025/04/23 · Bny

YN191-火炬召唤亡灵(阿比盖尔)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2一九一.火炬召唤亡灵(阿比盖尔) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/torch.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function cancreatelight(staff, caster, target, pos) 7 local ground = GetWorld() 8 if ground and pos then 9 local tile = ground.Map:GetTileAtPoint(pos.x, pos.y, pos.z) 10 return tile ~= GROUND.IMPASSIBLE and tile < GROUND.UNDERGROUND 11 end 12 return false 13end 14local function createlight(staff, target, pos) 15 local light = SpawnPrefab("abigail") 16 light.Transform:SetPosition(pos.x, pos.y, pos.z) 17end 18 inst:AddComponent("spellcaster") 19 inst.components.spellcaster:SetSpellFn(createlight) 20 inst.components.spellcaster:SetSpellTestFn(cancreatelight) 21 inst.components.spellcaster.canuseonpoint = true 22 inst.components.spellcaster.canusefrominventory = false 23 24 即可在装备火炬时,在空地上按鼠标右键召唤亡灵,亡灵会保护你。想取消亡灵,召唤两个以上(一个追不上它),对其中一个按ctrl + 鼠标左键,即可取消全部亡灵。不要与“我的小伙伴”一同修改

2025/04/23 · Bny

YN192-毒龙兵团(装备暗影剑召唤坎普斯士兵)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2一九二.毒龙兵团(装备暗影剑召唤坎普斯士兵) 3 4 1.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/nightsword.lua文件,将inst.components.equippable.dapperness = TUNING.CRAZINESS_MED替换为以下内容: 5 6local function cancreatelight(staff, caster, target, pos) 7 local ground = GetWorld() 8 if ground and pos then 9 local tile = ground.Map:GetTileAtPoint(pos.x, pos.y, pos.z) 10 return tile ~= GROUND.IMPASSIBLE and tile < GROUND.UNDERGROUND 11 end 12 return false 13end 14local function createlight(staff, target, pos) 15 local light = SpawnPrefab("krampus") 16 light.Transform:SetPosition(pos.x, pos.y, pos.z) 17 local caster = staff.components.inventoryitem.owner 18end 19 inst:AddComponent("spellcaster") 20 inst.components.spellcaster:SetSpellFn(createlight) 21 inst.components.spellcaster:SetSpellTestFn(cancreatelight) 22 inst.components.spellcaster.canuseonpoint = true 23 inst.components.spellcaster.canusefrominventory = false 24 25 26 2.用MT管理器打开游戏目录/assets/scripts/prefabs/krampus.lua文件,将下列内容: 27 28local function OnAttacked(inst, data) 29 inst.components.combat:SetTarget(data.attacker) 30 --inst.components.combat:ShareTarget(data.attacker, SEE_DIST, function(dude) return dude:HasTag("hound") and not dude.components.health:IsDead() end, 5) 31end 32 33 替换为: 34 35local function Retarget(inst) 36 local newtarget = FindEntity(inst, 20, function(guy) 37 return guy.components.combat and 38 inst.components.combat:CanTarget(guy) and 39 (guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy) 40 end) 41 return newtarget 42end 43local function OnAttacked(inst, data) 44 local attacker = data.attacker 45 if attacker and attacker:HasTag("player") then 46 inst.components.health:SetVal(0) 47 else 48 inst.components.combat:SetTarget(attacker) 49 end 50end 51 52 53 3.将local brain = require "brains/krampusbrain"替换为local brain = require "brains/abigailbrain" 54 55 56 4.将下列内容: 57 58 inst:AddComponent("sleeper") 59 inst:AddComponent("health") 60 inst.components.health:SetMaxHealth(TUNING.KRAMPUS_HEALTH) 61 62 inst:AddComponent("combat") 63 inst.components.combat.hiteffectsymbol = "krampus_torso" 64 inst.components.combat:SetDefaultDamage(TUNING.KRAMPUS_DAMAGE) 65 inst.components.combat:SetAttackPeriod(TUNING.KRAMPUS_ATTACK_PERIOD) 66 67 替换为: 68 69 inst:AddComponent("health") 70 inst.components.health:SetMaxHealth(TUNING.KRAMPUS_HEALTH*10) 71 inst:AddComponent("follower") 72 inst:AddComponent("combat") 73 inst.components.combat.hiteffectsymbol = "krampus_torso" 74 inst.components.combat:SetDefaultDamage(TUNING.KRAMPUS_DAMAGE*10) 75 inst.components.combat:SetAttackPeriod(TUNING.KRAMPUS_ATTACK_PERIOD*.1) 76 inst.components.combat:SetRetargetFunction(3, Retarget) 77 inst.AnimState:Hide("SACK") 78 inst.AnimState:Show("ARM") 79 80 即可装备暗影剑时,在空地上按鼠标右键召唤坎普斯士兵。坎普斯经过了深度改造,不会偷东西,只会为主角浴血奋战。不想要坎普斯跟随时,杀死它即可,它虽然强悍,但主角对它一击毙命

2025/04/23 · Bny

YN193-我的小伙伴(用火炬召唤其他主角一起工作战斗)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2一九三.我的小伙伴(用火炬召唤其他主角一起工作战斗) 3 4 1.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/torch.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function cancreatelight(staff, caster, target, pos) 7 local ground = GetWorld() 8 if ground and pos then 9 local tile = ground.Map:GetTileAtPoint(pos.x, pos.y, pos.z) 10 return tile ~= GROUND.IMPASSIBLE and tile < GROUND.UNDERGROUND 11 end 12 return false 13end 14local function createlight(staff, target, pos) 15 local light = SpawnPrefab("shadowwaxwell") 16 light.Transform:SetPosition(pos.x, pos.y, pos.z) 17 local caster = staff.components.inventoryitem.owner 18 light.components.follower:SetLeader(caster) 19end 20 inst:AddComponent("spellcaster") 21 inst.components.spellcaster:SetSpellFn(createlight) 22 inst.components.spellcaster:SetSpellTestFn(cancreatelight) 23 inst.components.spellcaster.canuseonpoint = true 24 inst.components.spellcaster.canusefrominventory = false 25 26 27 2.用MT管理器打开游戏目录/assets/scripts/prefabs/shadowwaxwell.lua文件,将下列内容: 28 29 anim:SetBuild("waxwell_shadow_mod") 30 anim:PlayAnimation("idle") 31 32 anim:Hide("ARM_carry") 33 anim:Hide("hat") 34 anim:Hide("hat_hair") 35 36 inst:AddTag("scarytoprey") 37 inst:AddTag("NOCLICK") 38 39 inst:AddComponent("colourtweener") 40 inst.components.colourtweener:StartTween({0,0,0,.5}, 0) 41 42 inst:AddComponent("locomotor") 43 inst.components.locomotor:SetSlowMultiplier( 0.6 ) 44 inst.components.locomotor.pathcaps = { ignorecreep = true } 45 inst.components.locomotor.runspeed = TUNING.SHADOWWAXWELL_SPEED 46 47 inst:AddComponent("combat") 48 inst.components.combat.hiteffectsymbol = "torso" 49 -- inst.components.combat:SetRetargetFunction(1, Retarget) 50 inst.components.combat:SetKeepTargetFunction(KeepTarget) 51 inst.components.combat:SetAttackPeriod(TUNING.SHADOWWAXWELL_ATTACK_PERIOD) 52 inst.components.combat:SetRange(2, 3) 53 inst.components.combat:SetDefaultDamage(TUNING.SHADOWWAXWELL_DAMAGE) 54 55 inst:AddComponent("health") 56 inst.components.health:SetMaxHealth(TUNING.SHADOWWAXWELL_LIFE) 57 inst.components.health.nofadeout = true 58 inst:ListenForEvent("death", ondeath) 59 60 inst:AddComponent("inventory") 61 inst.components.inventory.dropondeath = false 62 63 inst:AddComponent("sanityaura") 64 inst.components.sanityaura.penalty = TUNING.SHADOWWAXWELL_SANITY_PENALTY 65 66 替换为: 67 68 local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"} 69 inst.animname = names[math.random(#names)] 70 anim:SetBuild(inst.animname) 71 anim:PlayAnimation("idle") 72 anim:Hide("ARM_carry") 73 anim:Hide("hat") 74 anim:Hide("hat_hair") 75 inst:AddComponent("locomotor") 76 inst.components.locomotor.pathcaps = { ignorecreep = true } 77 inst.components.locomotor.runspeed = TUNING.SHADOWWAXWELL_SPEED*2 78 inst:AddComponent("combat") 79 inst.components.combat.hiteffectsymbol = "torso" 80 inst.components.combat:SetKeepTargetFunction(KeepTarget) 81 inst.components.combat:SetAttackPeriod(TUNING.SHADOWWAXWELL_ATTACK_PERIOD*.1) 82 inst.components.combat:SetRange(2, 3) 83 inst.components.combat:SetDefaultDamage(TUNING.SHADOWWAXWELL_DAMAGE*10) 84 inst:AddComponent("health") 85 inst.components.health:SetMaxHealth(TUNING.SHADOWWAXWELL_LIFE*10) 86 inst.components.health.nofadeout = true 87 inst:AddComponent("inventory") 88 inst.components.inventory.dropondeath = false 89 90 即可装备火炬在空地上点鼠标右键,随机召唤其他主角,一起砍树、开矿、战斗。不想要伙伴时,对其按Ctrl + 鼠标左键杀掉即可,不杀掉几天后其也会自然死去,想要就再召唤吧。不要与“火炬召唤亡灵”一同修改,使用麦斯威尔作主角时不要修改本条

2025/04/23 · Bny

YN194-宠物双子星(用齿轮种宠物狗,用海象牙种宠物海狸)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2一九四.宠物双子星(用齿轮种宠物狗,用海象牙种宠物海狸) 3 4 1.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/gears.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function OnDeploy (inst, pt) 7 local dog = SpawnPrefab("teenbird") 8 dog.Transform:SetPosition(pt.x, pt.y, pt.z) 9 dog.AnimState:SetBank("hound") 10 dog.AnimState:SetBuild("hound_ice") 11 dog:SetStateGraph("SGhound") 12 dog.components.follower:SetLeader(GetPlayer()) 13 dog.Transform:SetScale(0.6, 0.6, 0.6) 14 dog:AddTag("dogs") 15 dog.components.health:SetMaxHealth(10000) 16 dog.components.locomotor.runspeed = 20 17 dog:RemoveComponent("growable") 18 inst.components.stackable:Get():Remove() 19end 20 inst:AddComponent("deployable") 21 inst.components.deployable.ondeploy = OnDeploy 22 23 24 2.用MT管理器打开游戏目录/assets/scripts/prefabs/walrus_tusk.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 25 26local function OnDeploy (inst, pt) 27 local beaver = SpawnPrefab("teenbird") 28 beaver.Transform:SetPosition(pt.x, pt.y, pt.z) 29 beaver.AnimState:SetBank("werebeaver") 30 beaver.AnimState:SetBuild("werebeaver_build") 31 beaver:SetStateGraph("SGwerebeaver") 32 beaver.components.follower:SetLeader(GetPlayer()) 33 beaver.Transform:SetScale(0.6, 0.6, 0.6) 34 beaver:AddTag("beavers") 35 beaver.components.eater:SetVegetarian() 36 beaver.components.health:SetMaxHealth(10000) 37 beaver.components.locomotor.runspeed = 20 38 beaver:RemoveComponent("growable") 39 inst.components.stackable:Get():Remove() 40end 41 inst:AddComponent("deployable") 42 inst.components.deployable.ondeploy = OnDeploy 43 44 45 3.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/smallbird.lua文件,在Asset("ANIM", "anim/smallbird_basic.zip"),的下一行插入以下内容: 46 47 Asset("ANIM", "anim/werebeaver_build.zip"), 48 Asset("ANIM", "anim/werebeaver_basic.zip"), 49 50 51 4.在inst:AddTag("teenbird")的下一行插入以下内容: 52 53local function onsave(inst, data) 54 if inst:HasTag("dogs") then 55 data.dogs = true 56 end 57 if inst:HasTag("beavers") then 58 data.beavers = true 59 end 60end 61local function onload(inst, data) 62 if data.dogs then 63 inst.AnimState:SetBank("hound") 64 inst.AnimState:SetBuild("hound_ice") 65 inst:SetStateGraph("SGhound") 66 inst.components.follower:SetLeader(GetPlayer()) 67 inst.Transform:SetScale(0.6, 0.6, 0.6) 68 inst.components.health:SetMaxHealth(10000) 69 inst.components.locomotor.runspeed = 20 70 inst:RemoveComponent("growable") 71 inst:AddTag("dogs") 72 end 73 if data.beavers then 74 inst.AnimState:SetBank("werebeaver") 75 inst.AnimState:SetBuild("werebeaver_build") 76 inst:SetStateGraph("SGwerebeaver") 77 inst.components.follower:SetLeader(GetPlayer()) 78 inst.Transform:SetScale(0.6, 0.6, 0.6) 79 inst.components.health:SetMaxHealth(10000) 80 inst.components.eater:SetVegetarian() 81 inst.components.locomotor.runspeed = 20 82 inst:RemoveComponent("growable") 83 inst:AddTag("beavers") 84 end 85end 86 inst.OnSave = onsave 87 inst.OnLoad = onload 88 89 即可用齿轮种宠物狗,用海象牙种宠物海狸,它们可以陪伴你,帮你打怪,是活力十足的小淘气。宠物需要喂食,不然会咬你(轻轻的),宠物狗喜欢吃肉,宠物海狸喜欢吃蔬菜,通过喂食可以为它们补血。最好在家的角落里扔一些食物,让它们随饿随吃

2025/04/23 · Bny

YN195-口袋猴子(用蜂蜜绷带种猴子,帮你活捉兔子、鸟、鼹鼠等小动物)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2一九五.口袋猴子(用蜂蜜绷带种猴子,帮你活捉兔子、鸟、鼹鼠等小动物) 3 4 用MT管理器打开游戏目录/assets/scripts/prefabs/bandage.lua文件,在inst:AddComponent("inventoryitem")的下一行插入以下内容: 5 6local function OnDeploy (inst, pt) 7 local helper = SpawnPrefab("bandage") 8 helper.Transform:SetPosition(pt.x, pt.y, pt.z) 9 helper.AnimState:SetBank("kiki") 10 helper.AnimState:SetBuild("kiki_basic") 11 helper.AnimState:PlayAnimation("idle_loop", true) 12 helper.Transform:SetFourFaced() 13 helper.Transform:SetScale(0.8, 0.8, 0.8) 14 helper:RemoveComponent("stackable") 15 helper:RemoveComponent("healer") 16 local sound = helper.entity:AddSoundEmitter() 17 helper.soundtype = "" 18 local brain = require "brains/abigailbrain" 19 helper:SetBrain(brain) 20 helper:AddComponent("locomotor") 21 helper.components.locomotor:SetTriggersCreep(false) 22 helper.components.locomotor.pathcaps = { ignorecreep = false } 23 helper.components.locomotor.walkspeed = 12 24 helper:SetStateGraph("SGmonkey") 25 helper:AddComponent("follower") 26 GetPlayer().components.leader:AddFollower(helper) 27 helper:AddComponent("combat") 28 helper.components.combat.hiteffectsymbol = "torso" 29 helper.components.combat:SetRetargetFunction(1, function(helper) 30 if not helper.components.health:IsDead() then 31 return FindEntity(helper, 20, function(guy) 32 if guy.components.health and not guy.components.health:IsDead() then 33 return guy.prefab == "crow" or guy.prefab == "robin" or guy.prefab == "robin_winter" or guy.prefab == "bee" or guy.prefab == "killerbee" or guy.prefab == "rabbit" or guy.prefab == "butterfly" or guy.prefab == "mole" 34 end 35 end) 36 end 37 end ) 38 helper.components.combat:SetKeepTargetFunction(function(helper, target) return target and target:IsValid() end ) 39 helper.components.combat:SetAttackPeriod(1) 40 helper.components.combat:SetRange(1, 2) 41 helper.components.combat:SetDefaultDamage(1) 42 helper.components.combat.onhitotherfn = function(helper, other, damage) 43 if other.prefab == "crow" then 44 local prey = SpawnPrefab("crow") 45 GetPlayer().components.inventory:GiveItem(prey) 46 end 47 if other.prefab == "robin" then 48 local prey = SpawnPrefab("robin") 49 GetPlayer().components.inventory:GiveItem(prey) 50 end 51 if other.prefab == "robin_winter" then 52 local prey = SpawnPrefab("robin_winter") 53 GetPlayer().components.inventory:GiveItem(prey) 54 end 55 if other.prefab == "bee" then 56 local prey = SpawnPrefab("bee") 57 GetPlayer().components.inventory:GiveItem(prey) 58 end 59 if other.prefab == "killerbee" then 60 local prey = SpawnPrefab("killerbee") 61 GetPlayer().components.inventory:GiveItem(prey) 62 end 63 if other.prefab == "rabbit" then 64 local prey = SpawnPrefab("rabbit") 65 GetPlayer().components.inventory:GiveItem(prey) 66 end 67 if other.prefab == "butterfly" then 68 local prey = SpawnPrefab("butterfly") 69 GetPlayer().components.inventory:GiveItem(prey) 70 end 71 if other.prefab == "mole" then 72 local prey = SpawnPrefab("mole") 73 GetPlayer().components.inventory:GiveItem(prey) 74 end 75 other:Remove() 76 end 77 helper:AddComponent("health") 78 helper.components.health:SetMaxHealth(1000) 79 helper.components.health:SetInvincible(true) 80 helper.components.health.nofadeout = true 81 helper.components.inventoryitem:ChangeImageName("cave_banana") 82 helper:AddComponent( "playerprox" ) 83 helper.components.playerprox:SetDist(3,5) 84 helper.components.playerprox:SetOnPlayerNear(function(helper) helper.components.locomotor.walkspeed = 5 end ) 85 helper.components.playerprox:SetOnPlayerFar(function(helper) helper.components.locomotor.walkspeed = 12 end ) 86 helper:AddTag("helpers") 87 inst.components.stackable:Get():Remove() 88end 89 inst:AddComponent("deployable") 90 inst.components.deployable.ondeploy = OnDeploy 91 92local function onsave(inst, data) 93 if inst:HasTag("helpers") then 94 data.helpers = true 95 end 96end 97local function onload(inst, data) 98 if data and data.helpers then 99 inst.AnimState:SetBank("kiki") 100 inst.AnimState:SetBuild("kiki_basic") 101 inst.AnimState:PlayAnimation("idle_loop", true) 102 inst.Transform:SetFourFaced() 103 inst.Transform:SetScale(0.8, 0.8, 0.8) 104 inst:RemoveComponent("stackable") 105 inst:RemoveComponent("healer") 106 local sound = inst.entity:AddSoundEmitter() 107 inst.soundtype = "" 108 local brain = require "brains/abigailbrain" 109 inst:SetBrain(brain) 110 inst:AddComponent("locomotor") 111 inst.components.locomotor:SetTriggersCreep(false) 112 inst.components.locomotor.pathcaps = { ignorecreep = false } 113 inst.components.locomotor.walkspeed = 12 114 inst:SetStateGraph("SGmonkey") 115 inst:AddComponent("follower") 116 GetPlayer().components.leader:AddFollower(inst) 117 inst:AddComponent("combat") 118 inst.components.combat.hiteffectsymbol = "torso" 119 inst.components.combat:SetRetargetFunction(1, function(inst) 120 if not inst.components.health:IsDead() then 121 return FindEntity(inst, 20, function(guy) 122 if guy.components.health and not guy.components.health:IsDead() then 123 return guy.prefab == "crow" or guy.prefab == "robin" or guy.prefab == "robin_winter" or guy.prefab == "bee" or guy.prefab == "killerbee" or guy.prefab == "rabbit" or guy.prefab == "butterfly" or guy.prefab == "mole" 124 end 125 end) 126 end 127 end ) 128 inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) 129 inst.components.combat:SetAttackPeriod(1) 130 inst.components.combat:SetRange(1, 2) 131 inst.components.combat:SetDefaultDamage(1) 132 inst.components.combat.onhitotherfn = function(inst, other, damage) 133 if other.prefab == "crow" then 134 local prey = SpawnPrefab("crow") 135 GetPlayer().components.inventory:GiveItem(prey) 136 end 137 if other.prefab == "robin" then 138 local prey = SpawnPrefab("robin") 139 GetPlayer().components.inventory:GiveItem(prey) 140 end 141 if other.prefab == "robin_winter" then 142 local prey = SpawnPrefab("robin_winter") 143 GetPlayer().components.inventory:GiveItem(prey) 144 end 145 if other.prefab == "bee" then 146 local prey = SpawnPrefab("bee") 147 GetPlayer().components.inventory:GiveItem(prey) 148 end 149 if other.prefab == "killerbee" then 150 local prey = SpawnPrefab("killerbee") 151 GetPlayer().components.inventory:GiveItem(prey) 152 end 153 if other.prefab == "rabbit" then 154 local prey = SpawnPrefab("rabbit") 155 GetPlayer().components.inventory:GiveItem(prey) 156 end 157 if other.prefab == "butterfly" then 158 local prey = SpawnPrefab("butterfly") 159 GetPlayer().components.inventory:GiveItem(prey) 160 end 161 if other.prefab == "mole" then 162 local prey = SpawnPrefab("mole") 163 GetPlayer().components.inventory:GiveItem(prey) 164 end 165 other:Remove() 166 end 167 inst:AddComponent("health") 168 inst.components.health:SetMaxHealth(1000) 169 inst.components.health:SetInvincible(true) 170 inst.components.health.nofadeout = true 171 inst.components.inventoryitem:ChangeImageName("cave_banana") 172 inst:AddComponent( "playerprox" ) 173 inst.components.playerprox:SetDist(3,5) 174 inst.components.playerprox:SetOnPlayerNear(function(inst) inst.components.locomotor.walkspeed = 5 end ) 175 inst.components.playerprox:SetOnPlayerFar(function(inst) inst.components.locomotor.walkspeed = 12 end ) 176 inst:AddTag("helpers") 177 end 178end 179 inst.OnSave = onsave 180 inst.OnLoad = onload 181 182 即可用蜂蜜绷带种猴子,鼠标左键点猴子,可将其放入物品栏(显示为香蕉的图标)。在附近有兔子、鸟、蜜蜂、杀人蜂、蝴蝶、鼹鼠等小动物时,可将猴子放在地上,会为你捕捉小动物,如果同时修改了“网上宠宠店”,就可以将捉到的小动物卖掉换黄金。如果不想要猴子了,在物品栏中对其按鼠标右键即可。蜂蜜绷带在生存选项(画着绳套)下,用1张纸、2个蜂蜜制造

2025/04/23 · Bny

YN196-口袋浣熊(用纸种口袋浣熊,捕猎、战斗好帮手,喂鱼变身超级浣熊)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2一九六.口袋浣熊(用纸种口袋浣熊,捕猎、战斗好帮手,喂鱼变身超级浣熊) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/papyrus.lua文件,在inst:AddComponent("inventoryitem")的下一行插入以下内容: 5 6local function OnDeploy (inst, pt) 7 local coon = SpawnPrefab("papyrus") 8 coon.Transform:SetPosition(pt.x, pt.y, pt.z) 9 coon.AnimState:SetBank("catcoon") 10 coon.AnimState:SetBuild("catcoon_build") 11 coon.AnimState:PlayAnimation("idle_loop") 12 coon.Transform:SetFourFaced() 13 coon.Transform:SetScale(0.8, 0.8, 0.8) 14 coon.entity:AddSoundEmitter() 15 local shadow = coon.entity:AddDynamicShadow() 16 shadow:SetSize(2,0.75) 17 coon:RemoveComponent("stackable") 18 coon:RemoveComponent("fuel") 19 coon:RemoveComponent("tradable") 20 coon:RemoveComponent("burnable") 21 coon:RemoveComponent("propagator") 22 coon:RemoveComponent("deployable") 23 coon:RemoveTag("cattoy") 24 coon.components.inventoryitem:ChangeImageName("catcoonhat") 25 coon:AddComponent("named") 26 coon.components.named:SetName("Catcoon") 27 coon:AddComponent("follower") 28 coon.components.follower:SetLeader(GetPlayer()) 29 coon:AddComponent("locomotor") 30 coon.components.locomotor.walkspeed = 12 31 coon:SetStateGraph("SGcatcoon") 32 local brain = require "brains/abigailbrain" 33 coon:SetBrain(brain) 34 coon:AddComponent("health") 35 coon.components.health:SetMaxHealth(3000) 36 coon:AddComponent("lootdropper") 37 coon.components.lootdropper:SetLoot({"smallmeat"}) 38 coon:AddComponent("combat") 39 coon.components.combat:SetDefaultDamage(50) 40 coon.components.combat:SetRange(4) 41 coon.components.combat:SetAttackPeriod(0.5) 42 coon.components.combat:SetHurtSound("dontstarve_DLC001/creatures/catcoon/hurt") 43 coon.components.combat.battlecryinterval = 20 44 coon.components.combat:SetRetargetFunction(1, function(coon) 45 if not coon.components.health:IsDead() then 46 return FindEntity(GetPlayer(), 20, function(guy) 47 if guy.components.health and not guy.components.health:IsDead() then 48 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") or guy:HasTag("smallcreature") 49 end 50 end) 51 end 52 end ) 53 coon.components.combat:SetKeepTargetFunction(function(coon, target) return target and target:IsValid() end ) 54 coon:ListenForEvent("attacked", function(coon, data) 55 if data.attacker ~= GetPlayer() then 56 coon.components.combat:SetTarget(data.attacker) 57 else 58 coon.components.health:Kill() 59 end 60 end ) 61 coon:AddComponent( "playerprox" ) 62 coon.components.playerprox:SetDist(3,5) 63 coon.components.playerprox:SetOnPlayerNear(function(coon) coon.components.locomotor.walkspeed = 5 end ) 64 coon.components.playerprox:SetOnPlayerFar(function(coon) coon.components.locomotor.walkspeed = 12 end ) 65 coon:AddComponent("trader") 66 coon.components.trader:SetAcceptTest(function(coon, item) 67 if not coon:HasTag("supercoon") then 68 if item.prefab == "fish" then 69 return true 70 end 71 if item.prefab == "smallmeat" then 72 return coon.components.health:GetPercent() < 1 73 end 74 end 75 return false 76 end ) 77 coon.components.trader.onaccept = function(coon, giver, item) 78 if item.prefab == "fish" then 79 coon:AddTag("supercoon") 80 coon.components.named:SetName("SuperCatcoon") 81 SpawnPrefab("collapse_big").Transform:SetPosition(coon.Transform:GetWorldPosition()) 82 coon.AnimState:SetBloomEffectHandle("shaders/anim.ksh") 83 coon.Transform:SetScale(1.3, 1.3, 1.3) 84 coon.components.inventoryitem.canbepickedup = false 85 coon.components.health:SetInvincible(true) 86 coon.components.combat:SetDefaultDamage(500) 87 coon:DoTaskInTime(60, function(coon) 88 coon:RemoveTag("supercoon") 89 coon.components.named:SetName("Catcoon") 90 SpawnPrefab("collapse_big").Transform:SetPosition(coon.Transform:GetWorldPosition()) 91 coon.AnimState:SetBloomEffectHandle("") 92 coon.Transform:SetScale(0.8, 0.8, 0.8) 93 coon.components.inventoryitem.canbepickedup = true 94 coon.components.health:SetInvincible(false) 95 coon.components.combat:SetDefaultDamage(50) 96 end ) 97 end 98 if item.prefab == "smallmeat" then 99 coon.components.health:DoDelta(1000) 100 end 101 end 102 coon:AddTag("coons") 103 inst.components.stackable:Get():Remove() 104end 105 inst:AddComponent("deployable") 106 inst.components.deployable.ondeploy = OnDeploy 107local function onsave(inst, data) 108 if inst:HasTag("coons") then 109 data.coons = true 110 end 111end 112local function onload(inst, data) 113 if data and data.coons then 114 inst.AnimState:SetBank("catcoon") 115 inst.AnimState:SetBuild("catcoon_build") 116 inst.AnimState:PlayAnimation("idle_loop") 117 inst.Transform:SetFourFaced() 118 inst.Transform:SetScale(0.8, 0.8, 0.8) 119 inst.entity:AddSoundEmitter() 120 local shadow = inst.entity:AddDynamicShadow() 121 shadow:SetSize(2,0.75) 122 inst:RemoveComponent("stackable") 123 inst:RemoveComponent("fuel") 124 inst:RemoveComponent("tradable") 125 inst:RemoveComponent("burnable") 126 inst:RemoveComponent("propagator") 127 inst:RemoveComponent("deployable") 128 inst:RemoveTag("cattoy") 129 inst.components.inventoryitem:ChangeImageName("catcoonhat") 130 inst:AddComponent("named") 131 inst.components.named:SetName("Catcoon") 132 inst:AddComponent("follower") 133 inst.components.follower:SetLeader(GetPlayer()) 134 inst:AddComponent("locomotor") 135 inst.components.locomotor.walkspeed = 12 136 inst:SetStateGraph("SGcatcoon") 137 local brain = require "brains/abigailbrain" 138 inst:SetBrain(brain) 139 inst:AddComponent("health") 140 inst.components.health:SetMaxHealth(3000) 141 inst:AddComponent("lootdropper") 142 inst.components.lootdropper:SetLoot({"smallmeat"}) 143 inst:AddComponent("combat") 144 inst.components.combat:SetDefaultDamage(50) 145 inst.components.combat:SetRange(4) 146 inst.components.combat:SetAttackPeriod(0.5) 147 inst.components.combat:SetHurtSound("dontstarve_DLC001/creatures/catcoon/hurt") 148 inst.components.combat.battlecryinterval = 20 149 inst.components.combat:SetRetargetFunction(1, function(inst) 150 if not inst.components.health:IsDead() then 151 return FindEntity(GetPlayer(), 20, function(guy) 152 if guy.components.health and not guy.components.health:IsDead() then 153 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") or guy:HasTag("smallcreature") 154 end 155 end) 156 end 157 end ) 158 inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) 159 inst:ListenForEvent("attacked", function(inst, data) 160 if data.attacker ~= GetPlayer() then 161 inst.components.combat:SetTarget(data.attacker) 162 else 163 inst.components.health:Kill() 164 end 165 end ) 166 inst:AddComponent( "playerprox" ) 167 inst.components.playerprox:SetDist(3,5) 168 inst.components.playerprox:SetOnPlayerNear(function(inst) inst.components.locomotor.walkspeed = 5 end ) 169 inst.components.playerprox:SetOnPlayerFar(function(inst) inst.components.locomotor.walkspeed = 12 end ) 170 inst:AddComponent("trader") 171 inst.components.trader:SetAcceptTest(function(inst, item) 172 if not inst:HasTag("supercoon") then 173 if item.prefab == "fish" then 174 return true 175 end 176 if item.prefab == "smallmeat" then 177 return inst.components.health:GetPercent() < 1 178 end 179 end 180 return false 181 end ) 182 inst.components.trader.onaccept = function(inst, giver, item) 183 if item.prefab == "fish" then 184 inst:AddTag("supercoon") 185 inst.components.named:SetName("SuperCatcoon") 186 SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition()) 187 inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") 188 inst.Transform:SetScale(1.3, 1.3, 1.3) 189 inst.components.inventoryitem.canbepickedup = false 190 inst.components.health:SetInvincible(true) 191 inst.components.combat:SetDefaultDamage(500) 192 inst:DoTaskInTime(60, function(inst) 193 inst:RemoveTag("supercoon") 194 inst.components.named:SetName("Catcoon") 195 SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition()) 196 inst.AnimState:SetBloomEffectHandle("") 197 inst.Transform:SetScale(0.8, 0.8, 0.8) 198 inst.components.inventoryitem.canbepickedup = true 199 inst.components.health:SetInvincible(false) 200 inst.components.combat:SetDefaultDamage(50) 201 end ) 202 end 203 if item.prefab == "smallmeat" then 204 inst.components.health:DoDelta(1000) 205 end 206 end 207 inst:AddTag("coons") 208 end 209end 210 inst.OnSave = onsave 211 inst.OnLoad = onload 212 213 即可用纸种口袋浣熊,帮你捕猎、战斗。鼠标左键点浣熊,可将其放入物品栏(显示为浣熊帽的图标)。喂浣熊小肉,可为其补血(3块可补满),如果喂浣熊鱼,则变身超级浣熊,不会受伤,攻击力提高10倍,60秒后变回来。在超级浣熊状态下,口袋浣熊无法被拿起,也不接受食物。不想要口袋浣熊了,在物品栏中对其按鼠标右键即可。纸在精炼选项(画着白色宝石)下,用4个芦苇制造

2025/04/23 · Bny

YN197-吸地牛(用大理石种吸地牛,地面物品自动吸入肚中,可开矿、砍树)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2一九七.吸地牛(用大理石种吸地牛,地面物品自动吸入肚中,可开矿、砍树) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/inv_marble.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local slotpos = {} 7for y = 4, 0, -1 do 8 for x = 0, 14 do 9 table.insert(slotpos, Vector3(75*x-75*2+75, 75*y-75*2+75,0)) 10 end 11end 12local sounds = 13{ 14 walk = "dontstarve/beefalo/walk", 15 grunt = "dontstarve/beefalo/grunt", 16 yell = "dontstarve/beefalo/yell", 17 swish = "dontstarve/beefalo/tail_swish", 18 curious = "dontstarve/beefalo/curious", 19 angry = "dontstarve/beefalo/angry", 20} 21local function OnDeploy (inst, pt) 22 local bull = SpawnPrefab("marble") 23 bull.Transform:SetPosition(pt.x, pt.y, pt.z) 24 bull.AnimState:SetBank("beefalo") 25 bull.AnimState:SetBuild("beefalo_build") 26 bull.AnimState:PlayAnimation("idle_loop", true) 27 bull.Transform:SetFourFaced() 28 bull.Transform:SetScale(0.8, 0.8, 0.8) 29 local sound = bull.entity:AddSoundEmitter() 30 bull.sounds = sounds 31 local shadow = bull.entity:AddDynamicShadow() 32 shadow:SetSize( 3, 1.25 ) 33 MakeCharacterPhysics(bull, 100, 1.5) 34 bull:AddTag("bull") 35 bull:AddTag("companion") 36 bull:AddComponent("locomotor") 37 bull.components.locomotor.walkspeed = 1.5 38 bull.components.locomotor.runspeed = 15 39 bull:SetStateGraph("SGBeefalo") 40 bull:AddComponent("follower") 41 bull:AddComponent("knownlocations") 42 bull.components.container.canbeopened = true 43 bull:AddComponent("combat") 44 bull:AddComponent("health") 45 bull.components.health:SetMaxHealth(10000) 46 bull.components.health:SetInvincible(true) 47 bull.components.health.nofadeout = true 48 bull:RemoveComponent("stackable") 49 bull:RemoveComponent("inventoryitem") 50 bull:RemoveComponent("bait") 51 bull:RemoveTag("molebait") 52 bull:AddComponent("workable") 53 bull.components.workable:SetWorkAction(ACTIONS.CHOP) 54 bull.components.workable:SetWorkLeft(3) 55 bull.components.workable:SetOnFinishCallback(function(bull) 56 bull.AnimState:PlayAnimation("death") 57 bull.SoundEmitter:PlaySound("dontstarve/beefalo/yell") 58 bull:DoTaskInTime(1.5, function() bull.components.container:DropEverything() bull:Remove() end) 59 end ) 60 bull:DoPeriodicTask(1, function(bull) 61 if not bull.components.container:Has("cutgrass", 1) then 62 bull.components.locomotor:Stop() 63 bull:SetBrain(nil) 64 bull.components.follower:SetLeader(nil) 65 bull:RemoveTag("letgo") 66 else 67 local brain = require "brains/chesterbrain" 68 bull:SetBrain(brain) 69 bull:RestartBrain() 70 bull.components.follower:SetLeader(GetPlayer()) 71 bull:AddTag("letgo") 72 end 73 end ) 74 bull:DoPeriodicTask(180, function(bull) 75 if bull.components.container:Has("cutgrass", 1) then 76 bull.components.container:ConsumeByName("cutgrass", 1) 77 bull.AnimState:PlayAnimation("graze_loop") 78 end 79 end ) 80 bull:DoPeriodicTask(.1, function(bull) 81 if bull:HasTag("letgo") then 82 local pos = Vector3(bull.Transform:GetWorldPosition()) 83 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 15) 84 for k,v in pairs(ents) do 85 local pt1 = v:GetPosition() 86 if v.components.inventoryitem and v.components.inventoryitem.canbepickedup and v.components.inventoryitem.cangoincontainer 87 and not v.components.inventoryitem:IsHeld() and not v:HasTag("trap") and not v:HasTag("light") and not v:HasTag("blowdart") 88 and not v:HasTag("projectile") and not v:HasTag("helpers") then 89 if not bull.components.container:IsFull() then 90 SpawnPrefab("small_puff").Transform:SetPosition(pt1.x, pt1.y, pt1.z) 91 bull.components.container:GiveItem(v) 92 bull.SoundEmitter:PlaySound("dontstarve/HUD/research_available") 93 end 94 end 95 end 96 end 97 end ) 98 bull.Physics:SetCollisionCallback(function(bull, other) 99 if other and other.components.workable and other.components.workable.workleft > 0 and not other:HasTag("bull") then 100 SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get()) 101 other.components.workable:Destroy(bull) 102 end 103 end) 104 inst.components.stackable:Get():Remove() 105end 106 inst:AddComponent("deployable") 107 inst.components.deployable.ondeploy = OnDeploy 108local function onsave(inst, data) 109 if inst:HasTag("bull") then 110 data.bull = true 111 end 112end 113local function onload(inst, data) 114 if data and data.bull then 115 inst.AnimState:SetBank("beefalo") 116 inst.AnimState:SetBuild("beefalo_build") 117 inst.AnimState:PlayAnimation("idle_loop", true) 118 inst.Transform:SetFourFaced() 119 inst.Transform:SetScale(0.8, 0.8, 0.8) 120 local sound = inst.entity:AddSoundEmitter() 121 inst.sounds = sounds 122 local shadow = inst.entity:AddDynamicShadow() 123 shadow:SetSize( 3, 1.25 ) 124 MakeCharacterPhysics(inst, 100, 1.5) 125 inst:AddTag("bull") 126 inst:AddTag("companion") 127 inst:AddComponent("locomotor") 128 inst.components.locomotor.walkspeed = 1.5 129 inst.components.locomotor.runspeed = 15 130 inst:SetStateGraph("SGBeefalo") 131 inst:AddComponent("follower") 132 inst:AddComponent("knownlocations") 133 inst.components.container.canbeopened = true 134 inst:AddComponent("combat") 135 inst:AddComponent("health") 136 inst.components.health:SetMaxHealth(10000) 137 inst.components.health:SetInvincible(true) 138 inst.components.health.nofadeout = true 139 inst:RemoveComponent("stackable") 140 inst:RemoveComponent("inventoryitem") 141 inst:RemoveComponent("bait") 142 inst:RemoveTag("molebait") 143 inst:AddComponent("workable") 144 inst.components.workable:SetWorkAction(ACTIONS.CHOP) 145 inst.components.workable:SetWorkLeft(3) 146 inst.components.workable:SetOnFinishCallback(function(inst) 147 inst.AnimState:PlayAnimation("death") 148 inst.SoundEmitter:PlaySound("dontstarve/beefalo/yell") 149 inst:DoTaskInTime(1.5, function() inst.components.container:DropEverything() inst:Remove() end) 150 end ) 151 inst:DoPeriodicTask(1, function(inst) 152 if not inst.components.container:Has("cutgrass", 1) then 153 inst.components.locomotor:Stop() 154 inst:SetBrain(nil) 155 inst.components.follower:SetLeader(nil) 156 inst:RemoveTag("letgo") 157 else 158 local brain = require "brains/chesterbrain" 159 inst:SetBrain(brain) 160 inst:RestartBrain() 161 inst.components.follower:SetLeader(GetPlayer()) 162 inst:AddTag("letgo") 163 end 164 end ) 165 inst:DoPeriodicTask(180, function(inst) 166 if inst.components.container:Has("cutgrass", 1) then 167 inst.components.container:ConsumeByName("cutgrass", 1) 168 inst.AnimState:PlayAnimation("graze_loop") 169 end 170 end ) 171 inst:DoPeriodicTask(.1, function(inst) 172 if inst:HasTag("letgo") then 173 local pos = Vector3(inst.Transform:GetWorldPosition()) 174 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 15) 175 for k,v in pairs(ents) do 176 local pt1 = v:GetPosition() 177 if v.components.inventoryitem and v.components.inventoryitem.canbepickedup and v.components.inventoryitem.cangoincontainer 178 and not v.components.inventoryitem:IsHeld() and not v:HasTag("trap") and not v:HasTag("light") and not v:HasTag("blowdart") 179 and not v:HasTag("projectile") and not v:HasTag("helpers") then 180 if not inst.components.container:IsFull() then 181 SpawnPrefab("small_puff").Transform:SetPosition(pt1.x, pt1.y, pt1.z) 182 inst.components.container:GiveItem(v) 183 inst.SoundEmitter:PlaySound("dontstarve/HUD/research_available") 184 end 185 end 186 end 187 end 188 end ) 189 inst.Physics:SetCollisionCallback(function(inst, other) 190 if other and other.components.workable and other.components.workable.workleft > 0 and not other:HasTag("bull") then 191 SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get()) 192 other.components.workable:Destroy(inst) 193 end 194 end) 195 end 196end 197 inst.OnSave = onsave 198 inst.OnLoad = onload 199 inst:AddComponent("container") 200 inst.components.container:SetNumSlots(#slotpos) 201 inst.components.container.widgetslotpos = slotpos 202 inst.components.container.widgetpos = Vector3(-300,200,0) 203 inst.components.container.side_align_tip = 160 204 inst.components.container.canbeopened = false 205 inst:AddTag("fridge") 206 207 即可用大理石种吸地牛,鼠标左键点它可开启格子,放入草后会跟随你,吸取沿路所有物品(吸进肚中的格子里,鼠标左键点击可拿取)。拿出草后即停止跟随,在原地等待。吸地牛会消化肚中的草,每天消化2-3根,如果格子中的草被吃完了,就不会跟随你,直到再给它草为止。吸地牛可撞碎石头、撞倒树,并将掉落物品直接吸入肚中,带着它去开矿、砍树吧。不要让吸地牛靠近你的建筑物,它会将其撞毁,除非你想用它拆迁。不想要吸地牛时,用斧子砍它三下即可,肚中物品会掉在地上

2025/04/23 · Bny

YN198-找矿蜗牛(用蜗牛龟盔甲种找矿蜗牛,为你勘探新石矿)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2一九八.找矿蜗牛(用蜗牛龟盔甲种找矿蜗牛,为你勘探新石矿) 3 4 用MT管理器打开游戏目录/assets/scripts/prefabs/armor_snurtleshell.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function OnDeploy (inst, pt) 7 local snail = SpawnPrefab("armorsnurtleshell") 8 snail.Transform:SetPosition(pt.x, pt.y, pt.z) 9 snail.AnimState:SetBank("slurtle") 10 snail.AnimState:SetBuild("slurtle") 11 snail.AnimState:PlayAnimation("idle", true) 12 snail.Transform:SetFourFaced() 13 local sound = snail.entity:AddSoundEmitter() 14 local brain = require "brains/leifbrain" 15 snail:SetBrain(brain) 16 snail:AddComponent("locomotor") 17 snail.components.locomotor.walkspeed = 7 18 snail:SetStateGraph("SGslurtle") 19 local minimap = snail.entity:AddMiniMapEntity() 20 minimap:SetIcon( "slurtle_den.png" ) 21 snail.components.inventoryitem:ChangeImageName("armorsnurtleshell") 22 snail:RemoveComponent("armor") 23 snail:RemoveComponent("equippable") 24 snail:RemoveComponent("useableitem") 25 snail:RemoveComponent("deployable") 26 snail:RemoveTag("shell") 27 snail:RemoveComponent("inventoryitem") 28 snail:AddComponent("combat") 29 snail:AddComponent("health") 30 snail.components.health:SetMaxHealth(1000) 31 snail.components.health:SetInvincible(true) 32 snail.components.health.nofadeout = true 33 snail.task = snail:DoPeriodicTask(math.random(8,12), function(snail) 34 local pt1 = snail:GetPosition() 35 local rocks = {"rock1","rock2","rock_flintless","rock_ice"} 36 local rock = rocks[math.random(#rocks)] 37 local newrock = SpawnPrefab(rock) 38 newrock.Transform:SetPosition(pt1.x, 0, pt1.z) 39 newrock.Physics:SetActive(false) 40 newrock:DoTaskInTime(3, function(newrock) newrock.Physics:SetActive(true) end ) 41 SpawnPrefab("splash_ocean").Transform:SetPosition(pt1.x, 0, pt1.z) 42 snail.SoundEmitter:PlaySound("dontstarve/wilson/rock_break") 43 GetPlayer().components.playercontroller:ShakeCamera(snail, "FULL", 0.2, 0.02, .25, 40) 44 end ) 45 snail:AddComponent("inventoryitem") 46 snail.components.inventoryitem:SetOnPutInInventoryFn(function(snail) 47 snail:RemoveTag("sports") 48 snail.components.locomotor:Stop() 49 snail:SetBrain(nil) 50 if snail.task then snail.task:Cancel() snail.task = nil end 51 end ) 52 snail.components.inventoryitem:SetOnDroppedFn(function(snail) 53 snail:AddTag("sports") 54 local brain = require "brains/leifbrain" 55 snail:SetBrain(brain) 56 snail:RestartBrain() 57 snail.task = snail:DoPeriodicTask(math.random(8,12), function(snail) 58 local pt1 = snail:GetPosition() 59 local rocks = {"rock1","rock2","rock_flintless","rock_ice"} 60 local rock = rocks[math.random(#rocks)] 61 local newrock = SpawnPrefab(rock) 62 newrock.Transform:SetPosition(pt1.x, 0, pt1.z) 63 newrock.Physics:SetActive(false) 64 newrock:DoTaskInTime(3, function(newrock) newrock.Physics:SetActive(true) end ) 65 SpawnPrefab("splash_ocean").Transform:SetPosition(pt1.x, 0, pt1.z) 66 snail.SoundEmitter:PlaySound("dontstarve/wilson/rock_break") 67 GetPlayer().components.playercontroller:ShakeCamera(snail, "FULL", 0.2, 0.02, .25, 40) 68 end ) 69 end ) 70 snail:AddTag("sports") 71 snail:AddTag("companion") 72 snail:AddTag("snails") 73 inst:Remove() 74end 75 inst:AddComponent("deployable") 76 inst.components.deployable.ondeploy = OnDeploy 77 78local function onsave(inst, data) 79 if inst:HasTag("snails") then 80 data.snails = true 81 end 82 if inst:HasTag("sports") then 83 data.sports = true 84 end 85end 86local function onload(inst, data) 87 if data and data.snails then 88 inst.AnimState:SetBank("slurtle") 89 inst.AnimState:SetBuild("slurtle") 90 inst.AnimState:PlayAnimation("idle", true) 91 inst.Transform:SetFourFaced() 92 local sound = inst.entity:AddSoundEmitter() 93 inst:AddComponent("locomotor") 94 inst.components.locomotor.walkspeed = 7 95 inst:SetStateGraph("SGslurtle") 96 local minimap = inst.entity:AddMiniMapEntity() 97 minimap:SetIcon( "slurtle_den.png" ) 98 inst.components.inventoryitem:ChangeImageName("armorsnurtleshell") 99 inst:RemoveComponent("armor") 100 inst:RemoveComponent("equippable") 101 inst:RemoveComponent("useableitem") 102 inst:RemoveComponent("deployable") 103 inst:RemoveTag("shell") 104 inst:RemoveComponent("inventoryitem") 105 inst:AddComponent("combat") 106 inst:AddComponent("health") 107 inst.components.health:SetMaxHealth(1000) 108 inst.components.health:SetInvincible(true) 109 inst.components.health.nofadeout = true 110 inst:AddComponent("inventoryitem") 111 inst.components.inventoryitem:SetOnPutInInventoryFn(function(inst) 112 inst:RemoveTag("sports") 113 inst.components.locomotor:Stop() 114 inst:SetBrain(nil) 115 if inst.task then inst.task:Cancel() inst.task = nil end 116 end ) 117 inst.components.inventoryitem:SetOnDroppedFn(function(inst) 118 inst:AddTag("sports") 119 local brain = require "brains/leifbrain" 120 inst:SetBrain(brain) 121 inst:RestartBrain() 122 inst.task = inst:DoPeriodicTask(math.random(8,12), function(inst) 123 local pt1 = inst:GetPosition() 124 local rocks = {"rock1","rock2","rock_flintless","rock_ice"} 125 local rock = rocks[math.random(#rocks)] 126 local newrock = SpawnPrefab(rock) 127 newrock.Transform:SetPosition(pt1.x, 0, pt1.z) 128 newrock.Physics:SetActive(false) 129 newrock:DoTaskInTime(3, function(newrock) newrock.Physics:SetActive(true) end ) 130 SpawnPrefab("splash_ocean").Transform:SetPosition(pt1.x, 0, pt1.z) 131 inst.SoundEmitter:PlaySound("dontstarve/wilson/rock_break") 132 GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40) 133 end ) 134 end ) 135 inst:AddTag("companion") 136 inst:AddTag("snails") 137 end 138 if data and data.sports then 139 local brain = require "brains/leifbrain" 140 inst:SetBrain(brain) 141 inst:RestartBrain() 142 inst.task = inst:DoPeriodicTask(math.random(8,12), function(inst) 143 local pt1 = inst:GetPosition() 144 local rocks = {"rock1","rock2","rock_flintless","rock_ice"} 145 local rock = rocks[math.random(#rocks)] 146 local newrock = SpawnPrefab(rock) 147 newrock.Transform:SetPosition(pt1.x, 0, pt1.z) 148 newrock.Physics:SetActive(false) 149 newrock:DoTaskInTime(3, function(newrock) newrock.Physics:SetActive(true) end ) 150 SpawnPrefab("splash_ocean").Transform:SetPosition(pt1.x, 0, pt1.z) 151 inst.SoundEmitter:PlaySound("dontstarve/wilson/rock_break") 152 GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40) 153 end ) 154 inst:AddTag("sports") 155 local pt2 = GetPlayer():GetPosition() 156 inst.Transform:SetPosition(pt2.x+1, 0, pt2.z+1) 157 end 158end 159 inst.OnSave = onsave 160 inst.OnLoad = onload 161 162 即可用蜗牛龟盔甲种找矿蜗牛,鼠标左键点蜗牛,可将其放入物品栏(显示为蜗牛龟盔甲的图标)。在空旷的地上放下找矿蜗牛,它会为你勘探出新的石矿,石头从此成为可再生资源。找矿蜗牛只会专注于找矿,不会跟随你,别把它弄丢了,如果真找不到了,存档退出后再读档,它会出现在你身边。不想要找矿蜗牛时,在物品栏中对其按鼠标右键即可。蜗牛龟盔甲可在地下一层打蜗牛龟时获得,如果修改了“巨型超市”,也可以花9-11个黄金购买

2025/04/23 · Bny

YN199-人工女友(用蜂刺种三个女友之一,可背东西、做饭、换衣帽)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2一九九.人工女友(用蜂刺种三个女友之一,可背东西、做饭、换衣帽) 3 4 用MT管理器打开游戏目录/assets/scripts/prefabs/stinger.lua文件, 5 6 1.在Asset("ANIM", "anim/stinger.zip"),的下一行插入以下内容: 7 8 Asset("ANIM", "anim/wathgrithr.zip"), 9 Asset("SOUND", "sound/wathgrithr.fsb"), 10 11 12 2.在inst:AddComponent("inspectable")的下一行插入以下内容: 13 14local slotpos = {} 15for y = 5, 0, -1 do 16 for x = 0, 2 do 17 table.insert(slotpos, Vector3(75*x-75*2+75, 75*y-75*2+75,0)) 18 end 19end 20local widgetbuttoninfo = { 21 text = "Do", 22 position = Vector3(68, 361, 0), 23 fn = function(inst) 24 GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") 25 if not inst:HasTag("withme") then 26 inst:AddTag("withme") 27 local brain = require "brains/chesterbrain" 28 inst:SetBrain(brain) 29 inst:RestartBrain() 30 inst.components.follower:SetLeader(GetPlayer()) 31 else 32 inst:RemoveTag("withme") 33 inst.components.locomotor:Stop() 34 inst:SetBrain(nil) 35 inst.components.follower:SetLeader(nil) 36 end 37end } 38local function OnDeploy (inst, pt) 39 local girl = SpawnPrefab("stinger") 40 girl.Transform:SetPosition(pt.x, pt.y, pt.z) 41 girl.AnimState:SetBank("wilson") 42 local girlnames = {"wendy","willow","wathgrithr"} 43 girl.buildname = girlnames[math.random(#girlnames)] 44 girl.AnimState:SetBuild(girl.buildname) 45 girl.AnimState:PlayAnimation("idle") 46 girl.AnimState:Show("ARM_normal") 47 girl.AnimState:Hide("ARM_carry") 48 girl.Transform:SetFourFaced() 49 girl.entity:AddSoundEmitter() 50 local shadow = girl.entity:AddDynamicShadow() 51 shadow:SetSize( 1.3, .6 ) 52 MakeCharacterPhysics(girl, 75, .5) 53 local minimap = girl.entity:AddMiniMapEntity() 54 minimap:SetIcon( "wendy.png" ) 55 girl:RemoveComponent("stackable") 56 girl:RemoveComponent("inventoryitem") 57 girl:RemoveComponent("deployable") 58 girl:AddComponent("named") 59 girl.components.named:SetName("My Baby") 60 girl:AddComponent("knownlocations") 61 girl:AddComponent("follower") 62 girl.components.follower:SetLeader(GetPlayer()) 63 girl:AddComponent("inventory") 64 girl.components.container.canbeopened = true 65 girl:AddComponent("locomotor") 66 girl.components.locomotor.walkspeed = 8 67 girl.components.locomotor.runspeed = 12 68 girl:SetStateGraph("SGshadowwaxwell") 69 local brain = require "brains/chesterbrain" 70 girl:SetBrain(brain) 71 girl:AddComponent("combat") 72 girl:AddComponent("health") 73 girl.components.health:SetMaxHealth(2000) 74 girl:ListenForEvent("death", function() 75 girl.components.container:DropEverything() 76 end ) 77 girl:AddComponent("talker") 78 girl:DoPeriodicTask(60, function() 79 local words = {"I love you","You are my love","I like you","I want stay with you","I miss you","you are my darling","I am your sweetheart","You have to love me","Don't go","Are you hungry"} 80 local word = words[math.random(#words)] 81 girl.components.talker:Say(word, 4, false) 82 girl.components.health:DoDelta(2000) 83 end) 84 girl:DoPeriodicTask(400, function() 85 local names = {"waffles","turkeydinner","baconeggs"} 86 local name = names[math.random(#names)] 87 local foods = SpawnPrefab(name) 88 girl.components.container:GiveItem(foods) 89 girl.components.talker:Say("Come to eat", 4, false) 90 end) 91 girl:AddComponent("machine") 92 girl.components.machine.turnonfn = function(girl) 93 girl.components.machine.ison = true 94 girl:AddTag("neat") 95 local hats = {"hat_flower","hat_earmuffs","hat_feather","hat_slurper","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter","hat_beefalo","hat_rain","hat_catcoon"} 96 girl.hat = hats[math.random(#hats)] 97 local armors = {"armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter","armor_sanity","armor_slurper","torso_rain"} 98 girl.armor = armors[math.random(#armors)] 99 girl.sg:GoToState("hit") 100 girl.AnimState:OverrideSymbol("swap_hat", girl.hat, "swap_hat") 101 girl.AnimState:OverrideSymbol("swap_body", girl.armor, "swap_body") 102 girl.AnimState:Show("HAT") 103 girl.AnimState:Show("HAT_HAIR") 104 girl.AnimState:Hide("HAIR_NOHAT") 105 girl.AnimState:Hide("HAIR") 106 local words = {"I like it","I don't loke it"} 107 local word = words[math.random(#words)] 108 girl.components.talker:Say(word, 4, false) 109 end 110 girl.components.machine.turnofffn = function(girl) 111 girl.components.machine.ison = false 112 girl:RemoveTag("neat") 113 girl.sg:GoToState("stunned") 114 girl.AnimState:Hide("HAT") 115 girl.AnimState:Hide("HAT_HAIR") 116 girl.AnimState:Show("HAIR_NOHAT") 117 girl.AnimState:Show("HAIR") 118 girl.AnimState:ClearOverrideSymbol("swap_body") 119 girl.SoundEmitter:PlaySound("dontstarve/characters/wendy/hurt") 120 girl.components.talker:Say("Don't, Don't, Don't", 4, false) 121 end 122 girl:AddComponent("sanityaura") 123 girl.components.sanityaura.aura = TUNING.SANITYAURA_HUGE 124 girl:ListenForEvent("attacked", function(girl, data) 125 girl.sg:GoToState("stunned") 126 girl.SoundEmitter:PlaySound("dontstarve/characters/wendy/hurt") 127 girl.components.talker:Say("Don't, Don't, Don't", 4, false) 128 end ) 129 girl:AddTag("fridge") 130 girl:AddTag("withme") 131 girl:AddTag("companion") 132 girl:AddTag("girls") 133 inst.components.stackable:Get():Remove() 134end 135 inst:AddComponent("deployable") 136 inst.components.deployable.ondeploy = OnDeploy 137 inst:AddComponent("container") 138 inst.components.container.widgetbuttoninfo = widgetbuttoninfo 139 inst.components.container:SetNumSlots(#slotpos) 140 inst.components.container.widgetslotpos = slotpos 141 inst.components.container.widgetpos = Vector3(0,150,0) 142 inst.components.container.side_align_tip = 160 143 inst.components.container.canbeopened = false 144local function onsave(inst, data) 145 if inst:HasTag("girls") then 146 data.girls = true 147 end 148 if inst:HasTag("withme") then 149 data.withme = true 150 end 151 if inst:HasTag("neat") then 152 data.neat = true 153 end 154 data.buildname = inst.buildname 155 data.hat = inst.hat 156 data.armor = inst.armor 157end 158local function onload(inst, data) 159 if data and data.girls then 160 inst.AnimState:SetBank("wilson") 161 local girlnames = {"wendy","willow","wathgrithr"} 162 inst.buildname = girlnames[math.random(#girlnames)] 163 inst.AnimState:SetBuild(inst.buildname) 164 inst.AnimState:PlayAnimation("idle") 165 inst.AnimState:Show("ARM_normal") 166 inst.AnimState:Hide("ARM_carry") 167 inst.Transform:SetFourFaced() 168 inst.entity:AddSoundEmitter() 169 local shadow = inst.entity:AddDynamicShadow() 170 shadow:SetSize( 1.3, .6 ) 171 MakeCharacterPhysics(inst, 75, .5) 172 local minimap = inst.entity:AddMiniMapEntity() 173 minimap:SetIcon( "wendy.png" ) 174 inst:RemoveComponent("stackable") 175 inst:RemoveComponent("inventoryitem") 176 inst:RemoveComponent("deployable") 177 inst:AddComponent("named") 178 inst.components.named:SetName("My Baby") 179 inst:AddComponent("knownlocations") 180 inst:AddComponent("follower") 181 inst:AddComponent("inventory") 182 inst.components.container.canbeopened = true 183 inst:AddComponent("locomotor") 184 inst.components.locomotor.walkspeed = 8 185 inst.components.locomotor.runspeed = 12 186 inst:SetStateGraph("SGshadowwaxwell") 187 inst:AddComponent("combat") 188 inst:AddComponent("health") 189 inst.components.health:SetMaxHealth(2000) 190 inst:ListenForEvent("death", function() 191 inst.components.container:DropEverything() 192 end ) 193 inst:AddComponent("talker") 194 inst:DoPeriodicTask(60, function() 195 local words = {"I love you","You are my love","I like you","I want stay with you","I miss you","you are my darling","I am your sweetheart","You have to love me","Don't go","Are you hungry"} 196 local word = words[math.random(#words)] 197 inst.components.talker:Say(word, 4, false) 198 inst.components.health:DoDelta(2000) 199 end) 200 inst:DoPeriodicTask(400, function() 201 local names = {"waffles","turkeydinner","baconeggs"} 202 local name = names[math.random(#names)] 203 local foods = SpawnPrefab(name) 204 inst.components.container:GiveItem(foods) 205 inst.components.talker:Say("Come to eat", 4, false) 206 end) 207 inst:AddComponent("machine") 208 inst.components.machine.turnonfn = function(inst) 209 inst.components.machine.ison = true 210 inst:AddTag("neat") 211 local hats = {"hat_flower","hat_earmuffs","hat_feather","hat_slurper","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter","hat_beefalo","hat_rain","hat_catcoon"} 212 inst.hat = hats[math.random(#hats)] 213 local armors = {"armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter","armor_sanity","armor_slurper","torso_rain"} 214 inst.armor = armors[math.random(#armors)] 215 inst.sg:GoToState("hit") 216 inst.AnimState:OverrideSymbol("swap_hat", inst.hat, "swap_hat") 217 inst.AnimState:OverrideSymbol("swap_body", inst.armor, "swap_body") 218 inst.AnimState:Show("HAT") 219 inst.AnimState:Show("HAT_HAIR") 220 inst.AnimState:Hide("HAIR_NOHAT") 221 inst.AnimState:Hide("HAIR") 222 local words = {"I like it","I don't loke it"} 223 local word = words[math.random(#words)] 224 inst.components.talker:Say(word, 4, false) 225 end 226 inst.components.machine.turnofffn = function(inst) 227 inst.components.machine.ison = false 228 inst:RemoveTag("neat") 229 inst.sg:GoToState("stunned") 230 inst.AnimState:Hide("HAT") 231 inst.AnimState:Hide("HAT_HAIR") 232 inst.AnimState:Show("HAIR_NOHAT") 233 inst.AnimState:Show("HAIR") 234 inst.AnimState:ClearOverrideSymbol("swap_body") 235 inst.SoundEmitter:PlaySound("dontstarve/characters/wendy/hurt") 236 inst.components.talker:Say("Don't, Don't, Don't", 4, false) 237 end 238 inst:AddComponent("sanityaura") 239 inst.components.sanityaura.aura = TUNING.SANITYAURA_HUGE 240 inst:ListenForEvent("attacked", function(inst, data) 241 inst.sg:GoToState("stunned") 242 inst.SoundEmitter:PlaySound("dontstarve/characters/wendy/hurt") 243 inst.components.talker:Say("Don't, Don't, Don't", 4, false) 244 end ) 245 inst:AddTag("fridge") 246 inst:AddTag("companion") 247 inst:AddTag("girls") 248 end 249 if data and data.withme then 250 inst:AddTag("withme") 251 local brain = require "brains/chesterbrain" 252 inst:SetBrain(brain) 253 inst:RestartBrain() 254 inst.components.follower:SetLeader(GetPlayer()) 255 end 256 if data and data.neat then 257 inst.components.machine.ison = true 258 inst:AddTag("neat") 259 inst.AnimState:Show("HAT") 260 inst.AnimState:Show("HAT_HAIR") 261 inst.AnimState:Hide("HAIR_NOHAT") 262 inst.AnimState:Hide("HAIR") 263 if data and data.hat then 264 inst.hat = data.hat 265 inst.AnimState:OverrideSymbol("swap_hat", inst.hat, "swap_hat") 266 end 267 if data and data.armor then 268 inst.armor = data.armor 269 inst.AnimState:OverrideSymbol("swap_body", inst.armor, "swap_body") 270 end 271 end 272 if data and data.buildname then 273 inst.buildname = data.buildname 274 inst.AnimState:SetBuild(inst.buildname) 275 end 276end 277 inst.OnSave = onsave 278 inst.OnLoad = onload 279 280 即可用蜂刺种人工女友,随机为温蒂、薇洛、瓦丝格雷斯三人之一。鼠标左键点女友,可打开她的背包格(18格),让她帮你背东西,她的背包带有冷藏功能。点格子右上方的“Do”按钮,可让女友停留在原地,再次点“Do”按钮可继续跟随,如果你殴打她,她不再跟随你,也可通过点“Do”按钮让她继续跟随。鼠标右键点女友,可为她随机更换衣帽,再次点击可脱下衣帽,搭配好的衣帽会一直保留在她身上,不受存读档影响。每天女友会为你做一份料理,在她的背包格中拿取。女友会不时对你说话,与她紧紧依偎可以补脑(不再孤独了)。女友没有战斗能力,如果遇到敌人,要保护好她哦,你也可以选择逃跑,她会努力跟上你的,如果她遇难了,背包里的物品将掉在地上。不想要女友了,杀掉即可(按Ctrl + 鼠标左键攻击)。不要与“用蜂刺种杀人蜂窝”一同修改

2025/04/23 · Bny