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

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

YN200-养育孩子(主角逝去则孩子接班,一代一代生存下去)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二00.养育孩子(主角逝去则孩子接班,一代一代生存下去) 3 4 1.用MT管理器打开游戏目录/assets/scripts/prefabs/minotaurhorn.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function getson (inst) 7 TheFrontEnd:Fade(false,1) 8 GetPlayer():DoTaskInTime(1.5, function() 9 TheFrontEnd:Fade(true,1) 10 local pt = GetPlayer():GetPosition() 11 local son = SpawnPrefab("resurrectionstatue") 12 son.Transform:SetPosition(pt.x, pt.y, pt.z) 13 son.AnimState:SetBank("wilson") 14 if GetPlayer().prefab == "wilson" then son.AnimState:SetBuild("wilson") end 15 if GetPlayer().prefab == "wendy" then son.AnimState:SetBuild("wendy") end 16 if GetPlayer().prefab == "wes" then son.AnimState:SetBuild("wes") end 17 if GetPlayer().prefab == "wickerbottom" then son.AnimState:SetBuild("wickerbottom") end 18 if GetPlayer().prefab == "willow" then son.AnimState:SetBuild("willow") end 19 if GetPlayer().prefab == "wolfgang" then son.AnimState:SetBuild("wolfgang_skinny") end 20 if GetPlayer().prefab == "wx78" then son.AnimState:SetBuild("wx78") end 21 if GetPlayer().prefab == "woodie" then son.AnimState:SetBuild("woodie") end 22 if GetPlayer().prefab == "waxwell" then son.AnimState:SetBuild("waxwell") end 23 if GetPlayer().prefab == "wathgrithr" then son.AnimState:SetBuild("wathgrithr") end 24 if GetPlayer().prefab == "webber" then son.AnimState:SetBuild("webber") end 25 local hats = {"hat_beefalo","hat_feather","hat_flower","hat_top","hat_walrus","hat_winter"} 26 local hat = hats[math.random(#hats)] 27 son.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat") 28 local armors = {"armor_sanity","armor_slurper","armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter"} 29 local armor = armors[math.random(#armors)] 30 son.AnimState:OverrideSymbol("swap_body", armor, "swap_body") 31 son.AnimState:Show("HAT") 32 son.AnimState:Show("HAT_HAIR") 33 son.AnimState:Hide("HAIR_NOHAT") 34 son.AnimState:Hide("HAIR") 35 son.AnimState:Hide("ARM_carry") 36 son.AnimState:Show("ARM_normal") 37 son.AnimState:PlayAnimation("idle") 38 son.AnimState:Hide("snow") 39 son.Transform:SetFourFaced() 40 son.Transform:SetScale(0.8,0.8,0.8) 41 son:AddComponent("combat") 42 son.components.combat.hiteffectsymbol = "torso" 43 son.components.combat:SetRetargetFunction(3, function(son) 44 if not son.components.health:IsDead() then 45 return FindEntity(son, 20, function(guy) 46 if guy.components.health and not guy.components.health:IsDead() then 47 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy 48 end 49 end) 50 end 51 end ) 52 son.components.combat:SetKeepTargetFunction(function(son, target) return target and target:IsValid() end ) 53 son.components.combat:SetAttackPeriod(1) 54 son.components.combat:SetRange(2, 3) 55 son.components.combat:SetDefaultDamage(10) 56 son:AddComponent("health") 57 son.components.health:SetMaxHealth(1000) 58 son.components.health.nofadeout = true 59 son:AddComponent("inventory") 60 son.components.inventory.dropondeath = false 61 son:AddComponent("locomotor") 62 son.components.locomotor.pathcaps = { ignorecreep = true } 63 son.components.locomotor.runspeed = 12 64 local brain = require"brains/shadowwaxwellbrain" 65 son:SetBrain(brain) 66 son:SetStateGraph("SGshadowwaxwell") 67 son:RemoveComponent("lootdropper") 68 son:RemoveComponent("workable") 69 son:RemoveComponent("burnable") 70 son:RemoveComponent("propagator") 71 MakeCharacterPhysics(son, 75, .5) 72 son:RemoveTag("structure") 73 son:AddComponent("follower") 74 son.components.follower.leader = GetPlayer() 75 son:AddComponent("trader") 76 son.components.trader:SetAcceptTest(function(son, item) 77 if GetPlayer().components.inventory:Has("goldnugget", 5) then 78 if item.prefab == "goldnugget" and son.components.health and not son.components.health:IsDead() then 79 return son.components.health:GetPercent() < .99 80 end 81 end 82 return false 83 end ) 84 son.components.trader.onaccept = function(son, giver, item) 85 GetPlayer().components.inventory:ConsumeByName("goldnugget", 4) 86 son.components.health:DoDelta(1000) 87 end 88 son:AddComponent("machine") 89 son.components.machine.turnonfn = function() son.components.locomotor:Stop() son.brain:Stop() end 90 son.components.machine.turnofffn = function() son.brain:Start() end 91 son:ListenForEvent("death", function() 92 GetPlayer().components.sanity:DoDelta(-100) 93 SpawnPrefab("trinket_1").Transform:SetPosition(son.Transform:GetWorldPosition()) 94 end ) 95 son:AddTag("companion") 96 son:AddTag("sons") 97 inst:Remove() 98 end ) 99end 100local function OnDeploy (inst, pt) 101 if GetPlayer().components.inventory:Has("goldnugget", 100) then 102 GetPlayer().components.inventory:ConsumeByName("goldnugget", 100) 103 local egg1 = SpawnPrefab("minotaurhorn") 104 egg1.AnimState:SetBuild("tallbird_egg") 105 egg1.AnimState:SetBank("egg") 106 egg1.AnimState:PlayAnimation("egg") 107 egg1.Transform:SetPosition(pt.x+2+3, pt.y, pt.z+2-3) 108 egg1.AnimState:SetMultColour(0/255,255/255,0/255,1) 109 egg1.Transform:SetScale(1.5,1.5,1.5) 110 egg1:AddComponent("health") 111 egg1.components.health:SetMaxHealth(1) 112 egg1:AddComponent("combat") 113 egg1:RemoveComponent("edible") 114 egg1.components.inventoryitem.canbepickedup = false 115 local egg2 = SpawnPrefab("minotaurhorn") 116 egg2.AnimState:SetBuild("tallbird_egg") 117 egg2.AnimState:SetBank("egg") 118 egg2.AnimState:PlayAnimation("egg") 119 egg2.Transform:SetPosition(pt.x+2-3, pt.y, pt.z+2+3) 120 egg2.AnimState:SetMultColour(0/255,255/255,0/255,1) 121 egg2.Transform:SetScale(1.5,1.5,1.5) 122 egg2:AddComponent("health") 123 egg2.components.health:SetMaxHealth(1) 124 egg2:AddComponent("combat") 125 egg2:RemoveComponent("edible") 126 egg2.components.inventoryitem.canbepickedup = false 127 egg1:ListenForEvent("death", function() egg1.AnimState:PlayAnimation("crack") egg2:Remove() 128 if math.random()<.5 then 129 local pt = GetPlayer():GetPosition() 130 GetSeasonManager():DoLightningStrike(pt) 131 inst:DoTaskInTime(1, function() getson(inst) end ) 132 else 133 SpawnPrefab("collapse_small").Transform:SetPosition(egg1.Transform:GetWorldPosition()) 134 GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") 135 end 136 end ) 137 egg2:ListenForEvent("death", function() egg2.AnimState:PlayAnimation("crack") egg1:Remove() 138 if math.random()<.5 then 139 local pt = GetPlayer():GetPosition() 140 GetSeasonManager():DoLightningStrike(pt) 141 inst:DoTaskInTime(2, function() getson(inst) end ) 142 else 143 SpawnPrefab("collapse_small").Transform:SetPosition(egg2.Transform:GetWorldPosition()) 144 GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") 145 end 146 end ) 147 end 148end 149 inst:AddComponent("deployable") 150 inst.components.deployable.ondeploy = OnDeploy 151 152 153 2.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/resurrectionstatue.lua文件,将下列内容: 154 155 inst.OnSave = onsave 156 inst.OnLoad = onload 157 158 替换为: 159 160local items = { AXE = "swap_axe", PICK = "swap_pickaxe", SWORD = "swap_spear" } 161local function EquipItem(inst, item) 162 if item then 163 inst.AnimState:OverrideSymbol("swap_object", item, item) 164 inst.AnimState:Show("ARM_carry") 165 inst.AnimState:Hide("ARM_normal") 166 end 167end 168 inst.items = items 169 inst.equipfn = EquipItem 170 EquipItem(inst) 171local function onsave2(inst, data) 172 if inst:HasTag("sons") then 173 data.sons = true 174 end 175end 176local function onload2(inst, data) 177 if data and data.sons then 178 inst.AnimState:SetBank("wilson") 179 if GetPlayer().prefab == "wilson" then inst.AnimState:SetBuild("wilson") end 180 if GetPlayer().prefab == "wendy" then inst.AnimState:SetBuild("wendy") end 181 if GetPlayer().prefab == "wes" then inst.AnimState:SetBuild("wes") end 182 if GetPlayer().prefab == "wickerbottom" then inst.AnimState:SetBuild("wickerbottom") end 183 if GetPlayer().prefab == "willow" then inst.AnimState:SetBuild("willow") end 184 if GetPlayer().prefab == "wolfgang" then inst.AnimState:SetBuild("wolfgang_skinny") end 185 if GetPlayer().prefab == "wx78" then inst.AnimState:SetBuild("wx78") end 186 if GetPlayer().prefab == "woodie" then inst.AnimState:SetBuild("woodie") end 187 if GetPlayer().prefab == "waxwell" then inst.AnimState:SetBuild("waxwell") end 188 if GetPlayer().prefab == "wathgrithr" then inst.AnimState:SetBuild("wathgrithr") end 189 if GetPlayer().prefab == "webber" then inst.AnimState:SetBuild("webber") end 190 local hats = {"hat_beefalo","hat_feather","hat_flower","hat_top","hat_walrus","hat_winter"} 191 local hat = hats[math.random(#hats)] 192 inst.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat") 193 local armors = {"armor_sanity","armor_slurper","armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter"} 194 local armor = armors[math.random(#armors)] 195 inst.AnimState:OverrideSymbol("swap_body", armor, "swap_body") 196 inst.AnimState:Show("HAT") 197 inst.AnimState:Show("HAT_HAIR") 198 inst.AnimState:Hide("HAIR_NOHAT") 199 inst.AnimState:Hide("HAIR") 200 inst.AnimState:Hide("ARM_carry") 201 inst.AnimState:Show("ARM_normal") 202 inst.AnimState:PlayAnimation("idle") 203 inst.AnimState:Hide("snow") 204 inst.Transform:SetFourFaced() 205 inst.Transform:SetScale(0.8,0.8,0.8) 206 inst:AddComponent("combat") 207 inst.components.combat.hiteffectsymbol = "torso" 208 inst.components.combat:SetRetargetFunction(3, function(inst) 209 if not inst.components.health:IsDead() then 210 return FindEntity(inst, 20, function(guy) 211 if guy.components.health and not guy.components.health:IsDead() then 212 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy 213 end 214 end) 215 end 216 end ) 217 inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) 218 inst.components.combat:SetAttackPeriod(1) 219 inst.components.combat:SetRange(2, 3) 220 inst.components.combat:SetDefaultDamage(10) 221 inst:AddComponent("health") 222 inst.components.health:SetMaxHealth(1000) 223 inst.components.health.nofadeout = true 224 inst:AddComponent("inventory") 225 inst.components.inventory.dropondeath = false 226 inst:AddComponent("locomotor") 227 inst.components.locomotor.pathcaps = { ignorecreep = true } 228 inst.components.locomotor.runspeed = 12 229 local brain = require"brains/shadowwaxwellbrain" 230 inst:SetBrain(brain) 231 inst:SetStateGraph("SGshadowwaxwell") 232 inst:RemoveComponent("lootdropper") 233 inst:RemoveComponent("workable") 234 inst:RemoveComponent("burnable") 235 inst:RemoveComponent("propagator") 236 MakeCharacterPhysics(inst, 75, .5) 237 inst:RemoveTag("structure") 238 inst:AddComponent("follower") 239 inst.components.follower.leader = GetPlayer() 240 inst:AddComponent("trader") 241 inst.components.trader:SetAcceptTest(function(inst, item) 242 if GetPlayer().components.inventory:Has("goldnugget", 5) then 243 if item.prefab == "goldnugget" and inst.components.health and not inst.components.health:IsDead() then 244 return inst.components.health:GetPercent() < .99 245 end 246 end 247 return false 248 end ) 249 inst.components.trader.onaccept = function(inst, giver, item) 250 GetPlayer().components.inventory:ConsumeByName("goldnugget", 4) 251 inst.components.health:DoDelta(1000) 252 end 253 inst:AddComponent("machine") 254 inst.components.machine.turnonfn = function() inst.components.locomotor:Stop() inst.brain:Stop() end 255 inst.components.machine.turnofffn = function() inst.brain:Start() end 256 inst:ListenForEvent("death", function() 257 GetPlayer().components.sanity:DoDelta(-100) 258 SpawnPrefab("trinket_1").Transform:SetPosition(inst.Transform:GetWorldPosition()) 259 end ) 260 inst:AddTag("companion") 261 inst:AddTag("sons") 262 end 263end 264 inst.OnSave = onsave2 265 inst.OnLoad = onload2 266 267 即可在你攒够100个黄金时,将远古守护者角种在地上,向上天求子,会赐予你2个蛋(身上黄金数不足时,只收走远古守护者角,不给蛋),选一个打破,如果中了(屏幕黑一下),就会获得孩子,如果没中(生一团烟),就只能下次再试了。使用不同主角,将获得不同的孩子,可以带着他打仗、砍树、开矿。如果你死了,他将长大成人,继承你的事业,一代一代在饥荒世界里生存下去。如果他不幸夭折了,对你而言无疑是晴天霹雳(减100点脑),他将为你留下一件小小的遗物,让你永远不要忘记他。当遇到危险时,可以对他点鼠标右键,让他停留在原地,等危险排除了,再对他按右键,即可继续跟随。可以通过给零花钱为他补血(拿着黄金对他点鼠标左键),一次5个黄金,身上黄金数不足或孩子满血时拒收。注意未成年人是不会跟着你下地洞的,把他安顿好后再去刷怪吧

2025/04/23 · Bny

YN201-私家军(用火药种私家军,可装备盔甲、帽子,需要支付工资)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二0一.私家军(用火药种私家军,可装备盔甲、帽子,需要支付工资) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/gunpowder.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function itemtest(inst, item, slot) 7 if item.prefab == "armorgrass" or item.prefab == "armorwood" or item.prefab == "armormarble" or item.prefab == "armor_sanity" or item.prefab == "armorruins" or item.prefab == "footballhat" or item.prefab == "ruinshat" or item.prefab == "beefalohat" or item.prefab == "featherhat" or item.prefab == "goldnugget" then 8 return true 9 end 10 return false 11end 12local slotpos = { Vector3(0,32+4,0), Vector3(0,-(32+4),0), Vector3(0,-(64+32+8+4),0)} 13local widgetbuttoninfo = { 14 text = "Go", 15 position = Vector3(0, -165, 0), 16 fn = function(inst) 17 if inst:HasTag("mercenary") then 18 if inst.components.container:Has("goldnugget", 20) then inst:AddTag("cango") end 19 inst.components.container:Close(GetPlayer()) 20 GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") 21 inst.AnimState:Hide("HAT") 22 inst.AnimState:Hide("HAT_HAIR") 23 inst.AnimState:Show("HAIR_NOHAT") 24 inst.AnimState:Show("HAIR") 25 inst.AnimState:ClearOverrideSymbol("swap_body") 26 for k,v in pairs(inst.components.container.slots) do 27 if v.prefab == "footballhat" or v.prefab == "ruinshat" or v.prefab == "beefalohat" or v.prefab == "featherhat" then 28 inst.AnimState:Show("HAT") 29 inst.AnimState:Show("HAT_HAIR") 30 inst.AnimState:Hide("HAIR_NOHAT") 31 inst.AnimState:Hide("HAIR") 32 end 33 if v and v.prefab == "armorgrass" then 34 inst.AnimState:OverrideSymbol("swap_body", "armor_grass", "swap_body") 35 inst:ListenForEvent("attacked", function(inst, data) 36 inst.components.health:DoDelta(15) 37 end ) 38 end 39 if v and v.prefab == "armorwood" then 40 inst.AnimState:OverrideSymbol("swap_body", "armor_wood", "swap_body") 41 inst:ListenForEvent("attacked", function(inst, data) 42 inst.components.health:DoDelta(20) 43 end ) 44 end 45 if v and v.prefab == "armormarble" then 46 inst.AnimState:OverrideSymbol("swap_body", "armor_marble", "swap_body") 47 inst:ListenForEvent("attacked", function(inst, data) 48 inst.components.health:DoDelta(25) 49 end ) 50 end 51 if v and v.prefab == "armor_sanity" then 52 inst.AnimState:OverrideSymbol("swap_body", "armor_sanity", "swap_body") 53 inst:ListenForEvent("attacked", function(inst, data) 54 inst.components.health:DoDelta(30) 55 end ) 56 end 57 if v and v.prefab == "armorruins" then 58 inst.AnimState:OverrideSymbol("swap_body", "armor_ruins", "swap_body") 59 inst:ListenForEvent("attacked", function(inst, data) 60 inst.components.health:DoDelta(35) 61 end ) 62 end 63 if v and v.prefab == "footballhat" then 64 inst.AnimState:OverrideSymbol("swap_hat", "hat_football", "swap_hat") 65 end 66 if v and v.prefab == "ruinshat" then 67 inst.AnimState:OverrideSymbol("swap_hat", "hat_ruins", "swap_hat") 68 end 69 if v and v.prefab == "beefalohat" then 70 inst.AnimState:OverrideSymbol("swap_hat", "hat_beefalo", "swap_hat") 71 end 72 if v and v.prefab == "featherhat" then 73 inst.AnimState:OverrideSymbol("swap_hat", "hat_feather", "swap_hat") 74 end 75 end 76 end 77 end } 78 inst:AddComponent("container") 79 inst.components.container.widgetbuttoninfo = widgetbuttoninfo 80 inst.components.container:SetNumSlots(#slotpos) 81 inst.components.container.widgetslotpos = slotpos 82 inst.components.container.widgetpos = Vector3(0,180,0) 83 inst.components.container.side_align_tip = 160 84 inst.components.container.canbeopened = false 85 inst.components.container.itemtestfn = itemtest 86 inst.components.container.onopenfn = function(inst) inst:RemoveTag("cango") end 87local items = { SWORD = "swap_spear" } 88local function EquipItem(inst, item) 89 if item then 90 inst.AnimState:OverrideSymbol("swap_object", item, item) 91 inst.AnimState:Show("ARM_carry") 92 inst.AnimState:Hide("ARM_normal") 93 end 94end 95 inst.items = items 96 inst.equipfn = EquipItem 97 EquipItem(inst) 98local function OnDeploy (inst, pt) 99 if GetPlayer().components.inventory:Has("goldnugget", 100) then 100 GetPlayer().components.inventory:ConsumeByName("goldnugget", 100) 101 local mercenary = SpawnPrefab("gunpowder") 102 mercenary.Transform:SetPosition(pt.x, pt.y, pt.z) 103 mercenary.AnimState:SetBank("wilson") 104 mercenary.AnimState:SetBuild("wilson") 105 mercenary.AnimState:PlayAnimation("idle") 106 mercenary.AnimState:OverrideSymbol("swap_object", "swap_spear", "swap_spear") 107 mercenary.AnimState:Show("ARM_carry") 108 mercenary.AnimState:Hide("ARM_normal") 109 mercenary.Transform:SetFourFaced() 110 local shadow = mercenary.entity:AddDynamicShadow() 111 shadow:SetSize( 1.3, .6 ) 112 MakeCharacterPhysics(mercenary, 75, .5) 113 local minimap = mercenary.entity:AddMiniMapEntity() 114 minimap:SetIcon( "researchlab.png" ) 115 mercenary:AddTag("mercenary") 116 mercenary:AddComponent("locomotor") 117 mercenary.components.locomotor.walkspeed = 8 118 mercenary.components.locomotor.runspeed = 15 119 mercenary:SetStateGraph("SGshadowwaxwell") 120 mercenary:RemoveComponent("stackable") 121 mercenary:RemoveComponent("explosive") 122 mercenary:RemoveComponent("inventoryitem") 123 mercenary:RemoveComponent("burnable") 124 mercenary:RemoveComponent("propagator") 125 mercenary:RemoveComponent("deployable") 126 mercenary:RemoveComponent("bait") 127 mercenary:RemoveTag("molebait") 128 mercenary:AddComponent("follower") 129 mercenary:AddComponent("inventory") 130 mercenary.components.container.canbeopened = true 131 mercenary:AddComponent("combat") 132 mercenary.components.combat.hiteffectsymbol = "torso" 133 mercenary.components.combat:SetDefaultDamage(50) 134 mercenary.components.combat:SetRange(2, 3) 135 mercenary.components.combat:SetAttackPeriod(0.5) 136 mercenary.components.combat:SetRetargetFunction(2, function(mercenary) 137 if not mercenary.components.health:IsDead() then 138 return FindEntity(mercenary, 25, function(guy) 139 if guy.components.health and not guy.components.health:IsDead() then 140 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") 141 end 142 end) 143 end 144 end ) 145 mercenary.components.combat:SetKeepTargetFunction(function(mercenary, target) return target and target:IsValid() end ) 146 mercenary:AddComponent("health") 147 mercenary.components.health:SetMaxHealth(1500) 148 mercenary.components.health.nofadeout = true 149 mercenary:DoPeriodicTask(1, function(mercenary) 150 if mercenary:HasTag("cango") then 151 if not mercenary.components.container:Has("goldnugget", 20) then 152 mercenary.AnimState:SetBloomEffectHandle("") 153 mercenary.components.locomotor:Stop() 154 mercenary:SetBrain(nil) 155 mercenary.components.follower:SetLeader(nil) 156 else 157 mercenary.AnimState:SetBloomEffectHandle("shaders/anim.ksh") 158 local brain = require "brains/abigailbrain" 159 mercenary:SetBrain(brain) 160 mercenary:RestartBrain() 161 mercenary.components.follower:SetLeader(GetPlayer()) 162 end 163 else 164 mercenary.AnimState:SetBloomEffectHandle("") 165 mercenary.components.locomotor:Stop() 166 mercenary:SetBrain(nil) 167 mercenary.components.follower:SetLeader(nil) 168 end 169 end ) 170 mercenary:DoPeriodicTask(480, function(mercenary) 171 if mercenary.components.container:Has("goldnugget", 20) then 172 mercenary.components.container:ConsumeByName("goldnugget", 20) 173 mercenary.components.health:DoDelta(500) 174 end 175 end ) 176 mercenary:AddComponent( "playerprox" ) 177 mercenary.components.playerprox:SetDist(3,5) 178 mercenary.components.playerprox:SetOnPlayerNear(function(mercenary) 179 mercenary.components.locomotor.walkspeed = 1 180 mercenary.components.locomotor.runspeed = 2 181 end ) 182 mercenary.components.playerprox:SetOnPlayerFar(function(mercenary) 183 mercenary.components.locomotor.walkspeed = 8 184 mercenary.components.locomotor.runspeed = 15 185 end ) 186 end 187 inst.components.stackable:Get():Remove() 188end 189 inst:AddComponent("deployable") 190 inst.components.deployable.ondeploy = OnDeploy 191local function onsave(inst, data) 192 if inst:HasTag("mercenary") then 193 data.mercenary = true 194 end 195 if inst:HasTag("cango") then 196 data.cango = true 197 end 198end 199local function onload(inst, data) 200 if data and data.mercenary then 201 inst.AnimState:SetBank("wilson") 202 inst.AnimState:SetBuild("wilson") 203 inst.AnimState:PlayAnimation("idle") 204 inst.AnimState:OverrideSymbol("swap_object", "swap_spear", "swap_spear") 205 inst.AnimState:Show("ARM_carry") 206 inst.AnimState:Hide("ARM_normal") 207 inst.Transform:SetFourFaced() 208 local shadow = inst.entity:AddDynamicShadow() 209 shadow:SetSize( 1.3, .6 ) 210 MakeCharacterPhysics(inst, 75, .5) 211 local minimap = inst.entity:AddMiniMapEntity() 212 minimap:SetIcon( "researchlab.png" ) 213 inst:AddTag("mercenary") 214 inst:AddComponent("locomotor") 215 inst.components.locomotor.walkspeed = 8 216 inst.components.locomotor.runspeed = 15 217 inst:SetStateGraph("SGshadowwaxwell") 218 inst:RemoveComponent("stackable") 219 inst:RemoveComponent("explosive") 220 inst:RemoveComponent("inventoryitem") 221 inst:RemoveComponent("burnable") 222 inst:RemoveComponent("propagator") 223 inst:RemoveComponent("deployable") 224 inst:RemoveComponent("bait") 225 inst:RemoveTag("molebait") 226 inst:AddComponent("follower") 227 inst:AddComponent("inventory") 228 inst.components.container.canbeopened = true 229 inst:AddComponent("combat") 230 inst.components.combat.hiteffectsymbol = "torso" 231 inst.components.combat:SetDefaultDamage(50) 232 inst.components.combat:SetRange(2, 3) 233 inst.components.combat:SetAttackPeriod(0.5) 234 inst.components.combat:SetRetargetFunction(2, function(inst) 235 if not inst.components.health:IsDead() then 236 return FindEntity(inst, 25, function(guy) 237 if guy.components.health and not guy.components.health:IsDead() then 238 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") 239 end 240 end) 241 end 242 end ) 243 inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) 244 inst:AddComponent("health") 245 inst.components.health:SetMaxHealth(1500) 246 inst.components.health.nofadeout = true 247 inst:DoPeriodicTask(1, function(inst) 248 if inst:HasTag("cango") then 249 if not inst.components.container:Has("goldnugget", 20) then 250 inst.AnimState:SetBloomEffectHandle("") 251 inst.components.locomotor:Stop() 252 inst:SetBrain(nil) 253 inst.components.follower:SetLeader(nil) 254 else 255 inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") 256 local brain = require "brains/abigailbrain" 257 inst:SetBrain(brain) 258 inst:RestartBrain() 259 inst.components.follower:SetLeader(GetPlayer()) 260 end 261 else 262 inst.AnimState:SetBloomEffectHandle("") 263 inst.components.locomotor:Stop() 264 inst:SetBrain(nil) 265 inst.components.follower:SetLeader(nil) 266 end 267 end ) 268 inst:DoPeriodicTask(480, function(inst) 269 if inst.components.container:Has("goldnugget", 20) then 270 inst.components.container:ConsumeByName("goldnugget", 20) 271 inst.components.health:DoDelta(500) 272 end 273 end ) 274 inst:AddComponent( "playerprox" ) 275 inst.components.playerprox:SetDist(3,5) 276 inst.components.playerprox:SetOnPlayerNear(function(inst) 277 inst.components.locomotor.walkspeed = 1 278 inst.components.locomotor.runspeed = 2 279 end ) 280 inst.components.playerprox:SetOnPlayerFar(function(inst) 281 inst.components.locomotor.walkspeed = 8 282 inst.components.locomotor.runspeed = 15 283 end ) 284 inst.AnimState:Hide("HAT") 285 inst.AnimState:Hide("HAT_HAIR") 286 inst.AnimState:Show("HAIR_NOHAT") 287 inst.AnimState:Show("HAIR") 288 inst.AnimState:ClearOverrideSymbol("swap_body") 289 for k,v in pairs(inst.components.container.slots) do 290 if v.prefab == "footballhat" or v.prefab == "ruinshat" or v.prefab == "beefalohat" or v.prefab == "featherhat" then 291 inst.AnimState:Show("HAT") 292 inst.AnimState:Show("HAT_HAIR") 293 inst.AnimState:Hide("HAIR_NOHAT") 294 inst.AnimState:Hide("HAIR") 295 end 296 if v and v.prefab == "armorgrass" then 297 inst.AnimState:OverrideSymbol("swap_body", "armor_grass", "swap_body") 298 inst:ListenForEvent("attacked", function(inst, data) 299 inst.components.health:DoDelta(15) 300 end ) 301 end 302 if v and v.prefab == "armorwood" then 303 inst.AnimState:OverrideSymbol("swap_body", "armor_wood", "swap_body") 304 inst:ListenForEvent("attacked", function(inst, data) 305 inst.components.health:DoDelta(20) 306 end ) 307 end 308 if v and v.prefab == "armormarble" then 309 inst.AnimState:OverrideSymbol("swap_body", "armor_marble", "swap_body") 310 inst:ListenForEvent("attacked", function(inst, data) 311 inst.components.health:DoDelta(25) 312 end ) 313 end 314 if v and v.prefab == "armor_sanity" then 315 inst.AnimState:OverrideSymbol("swap_body", "armor_sanity", "swap_body") 316 inst:ListenForEvent("attacked", function(inst, data) 317 inst.components.health:DoDelta(30) 318 end ) 319 end 320 if v and v.prefab == "armorruins" then 321 inst.AnimState:OverrideSymbol("swap_body", "armor_ruins", "swap_body") 322 inst:ListenForEvent("attacked", function(inst, data) 323 inst.components.health:DoDelta(35) 324 end ) 325 end 326 if v and v.prefab == "footballhat" then 327 inst.AnimState:OverrideSymbol("swap_hat", "hat_football", "swap_hat") 328 end 329 if v and v.prefab == "ruinshat" then 330 inst.AnimState:OverrideSymbol("swap_hat", "hat_ruins", "swap_hat") 331 end 332 if v and v.prefab == "beefalohat" then 333 inst.AnimState:OverrideSymbol("swap_hat", "hat_beefalo", "swap_hat") 334 end 335 if v and v.prefab == "featherhat" then 336 inst.AnimState:OverrideSymbol("swap_hat", "hat_feather", "swap_hat") 337 end 338 end 339 end 340 if data and data.cango then 341 inst:AddTag("cango") 342 end 343end 344 inst.OnSave = onsave 345 inst.OnLoad = onload 346 347 即可在身上有100个黄金时,用火药种私家军,将花费100个黄金,身上黄金数不足时不会种出来。鼠标左键点击他可打开格子,放入至少20个黄金后,点Go按钮,会跟随你打仗。追上他用鼠标左键再次点击,可让他停在原地,想让他继续跟随,就再点Go按钮即可。私家军士兵每天的工资是20个黄金,自动从他身上的黄金中扣除(并同时回补三分之一的血),如果他身上的黄金数不足20个时,将罢工,请及时续费。如果私家军的格子中有盔甲、帽子,点Go按钮会自动装备。装备盔甲可提高私家军的防御力,按防御力由低到高排序为草盔甲、木盔甲、大理石盔甲、夜魔盔甲、远古盔甲。装备帽子只起到装饰作用,可装备的帽子有猪皮帽、远古帽、牛毛帽、羽毛帽。不要在他的格子里放2个盔甲或2个帽子,他只会选择1个装备。私家军在小地图上显示为科学机器的图标,可以方便地找到他们的位置。火药在科学选项(画着原子)下,用1个烂鸡蛋、1个木炭、1个硝石制造

2025/04/23 · Bny