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

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

2025/04/23 · Bny

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

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

2025/04/23 · Bny

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

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一九二.毒龙兵团(装备暗影剑召唤坎普斯士兵) 1.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/nightsword.lua文件,将inst.components.equippable.dapperness = TUNING.CRAZINESS_MED替换为以下内容: local function cancreatelight(staff, caster, target, pos) local ground = GetWorld() if ground and pos then local tile = ground.Map:GetTileAtPoint(pos.x, pos.y, pos.z) return tile ~= GROUND.IMPASSIBLE and tile < GROUND.UNDERGROUND end return false end local function createlight(staff, target, pos) local light = SpawnPrefab("krampus") light.Transform:SetPosition(pos.x, pos.y, pos.z) local caster = staff.components.inventoryitem.owner end inst:AddComponent("spellcaster") inst.components.spellcaster:SetSpellFn(createlight) inst.components.spellcaster:SetSpellTestFn(cancreatelight) inst.components.spellcaster.canuseonpoint = true inst.components.spellcaster.canusefrominventory = false 2.用MT管理器打开游戏目录/assets/scripts/prefabs/krampus.lua文件,将下列内容: local function OnAttacked(inst, data) inst.components.combat:SetTarget(data.attacker) --inst.components.combat:ShareTarget(data.attacker, SEE_DIST, function(dude) return dude:HasTag("hound") and not dude.components.health:IsDead() end, 5) end 替换为: local function Retarget(inst) local newtarget = FindEntity(inst, 20, function(guy) return guy.components.combat and inst.components.combat:CanTarget(guy) and (guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy) end) return newtarget end local function OnAttacked(inst, data) local attacker = data.attacker if attacker and attacker:HasTag("player") then inst.components.health:SetVal(0) else inst.components.combat:SetTarget(attacker) end end 3.将local brain = require "brains/krampusbrain"替换为local brain = require "brains/abigailbrain" 4.将下列内容: inst:AddComponent("sleeper") inst:AddComponent("health") inst.components.health:SetMaxHealth(TUNING.KRAMPUS_HEALTH) inst:AddComponent("combat") inst.components.combat.hiteffectsymbol = "krampus_torso" inst.components.combat:SetDefaultDamage(TUNING.KRAMPUS_DAMAGE) inst.components.combat:SetAttackPeriod(TUNING.KRAMPUS_ATTACK_PERIOD) 替换为: inst:AddComponent("health") inst.components.health:SetMaxHealth(TUNING.KRAMPUS_HEALTH*10) inst:AddComponent("follower") inst:AddComponent("combat") inst.components.combat.hiteffectsymbol = "krampus_torso" inst.components.combat:SetDefaultDamage(TUNING.KRAMPUS_DAMAGE*10) inst.components.combat:SetAttackPeriod(TUNING.KRAMPUS_ATTACK_PERIOD*.1) inst.components.combat:SetRetargetFunction(3, Retarget) inst.AnimState:Hide("SACK") inst.AnimState:Show("ARM") 即可装备暗影剑时,在空地上按鼠标右键召唤坎普斯士兵。坎普斯经过了深度改造,不会偷东西,只会为主角浴血奋战。不想要坎普斯跟随时,杀死它即可,它虽然强悍,但主角对它一击毙命

2025/04/23 · Bny

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

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一九三.我的小伙伴(用火炬召唤其他主角一起工作战斗) 1.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/torch.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function cancreatelight(staff, caster, target, pos) local ground = GetWorld() if ground and pos then local tile = ground.Map:GetTileAtPoint(pos.x, pos.y, pos.z) return tile ~= GROUND.IMPASSIBLE and tile < GROUND.UNDERGROUND end return false end local function createlight(staff, target, pos) local light = SpawnPrefab("shadowwaxwell") light.Transform:SetPosition(pos.x, pos.y, pos.z) local caster = staff.components.inventoryitem.owner light.components.follower:SetLeader(caster) end inst:AddComponent("spellcaster") inst.components.spellcaster:SetSpellFn(createlight) inst.components.spellcaster:SetSpellTestFn(cancreatelight) inst.components.spellcaster.canuseonpoint = true inst.components.spellcaster.canusefrominventory = false 2.用MT管理器打开游戏目录/assets/scripts/prefabs/shadowwaxwell.lua文件,将下列内容: anim:SetBuild("waxwell_shadow_mod") anim:PlayAnimation("idle") anim:Hide("ARM_carry") anim:Hide("hat") anim:Hide("hat_hair") inst:AddTag("scarytoprey") inst:AddTag("NOCLICK") inst:AddComponent("colourtweener") inst.components.colourtweener:StartTween({0,0,0,.5}, 0) inst:AddComponent("locomotor") inst.components.locomotor:SetSlowMultiplier( 0.6 ) inst.components.locomotor.pathcaps = { ignorecreep = true } inst.components.locomotor.runspeed = TUNING.SHADOWWAXWELL_SPEED inst:AddComponent("combat") inst.components.combat.hiteffectsymbol = "torso" -- inst.components.combat:SetRetargetFunction(1, Retarget) inst.components.combat:SetKeepTargetFunction(KeepTarget) inst.components.combat:SetAttackPeriod(TUNING.SHADOWWAXWELL_ATTACK_PERIOD) inst.components.combat:SetRange(2, 3) inst.components.combat:SetDefaultDamage(TUNING.SHADOWWAXWELL_DAMAGE) inst:AddComponent("health") inst.components.health:SetMaxHealth(TUNING.SHADOWWAXWELL_LIFE) inst.components.health.nofadeout = true inst:ListenForEvent("death", ondeath) inst:AddComponent("inventory") inst.components.inventory.dropondeath = false inst:AddComponent("sanityaura") inst.components.sanityaura.penalty = TUNING.SHADOWWAXWELL_SANITY_PENALTY 替换为: local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"} inst.animname = names[math.random(#names)] anim:SetBuild(inst.animname) anim:PlayAnimation("idle") anim:Hide("ARM_carry") anim:Hide("hat") anim:Hide("hat_hair") inst:AddComponent("locomotor") inst.components.locomotor.pathcaps = { ignorecreep = true } inst.components.locomotor.runspeed = TUNING.SHADOWWAXWELL_SPEED*2 inst:AddComponent("combat") inst.components.combat.hiteffectsymbol = "torso" inst.components.combat:SetKeepTargetFunction(KeepTarget) inst.components.combat:SetAttackPeriod(TUNING.SHADOWWAXWELL_ATTACK_PERIOD*.1) inst.components.combat:SetRange(2, 3) inst.components.combat:SetDefaultDamage(TUNING.SHADOWWAXWELL_DAMAGE*10) inst:AddComponent("health") inst.components.health:SetMaxHealth(TUNING.SHADOWWAXWELL_LIFE*10) inst.components.health.nofadeout = true inst:AddComponent("inventory") inst.components.inventory.dropondeath = false 即可装备火炬在空地上点鼠标右键,随机召唤其他主角,一起砍树、开矿、战斗。不想要伙伴时,对其按Ctrl + 鼠标左键杀掉即可,不杀掉几天后其也会自然死去,想要就再召唤吧。不要与“火炬召唤亡灵”一同修改,使用麦斯威尔作主角时不要修改本条

2025/04/23 · Bny

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

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一九四.宠物双子星(用齿轮种宠物狗,用海象牙种宠物海狸) 1.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/gears.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function OnDeploy (inst, pt) local dog = SpawnPrefab("teenbird") dog.Transform:SetPosition(pt.x, pt.y, pt.z) dog.AnimState:SetBank("hound") dog.AnimState:SetBuild("hound_ice") dog:SetStateGraph("SGhound") dog.components.follower:SetLeader(GetPlayer()) dog.Transform:SetScale(0.6, 0.6, 0.6) dog:AddTag("dogs") dog.components.health:SetMaxHealth(10000) dog.components.locomotor.runspeed = 20 dog:RemoveComponent("growable") inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy 2.用MT管理器打开游戏目录/assets/scripts/prefabs/walrus_tusk.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function OnDeploy (inst, pt) local beaver = SpawnPrefab("teenbird") beaver.Transform:SetPosition(pt.x, pt.y, pt.z) beaver.AnimState:SetBank("werebeaver") beaver.AnimState:SetBuild("werebeaver_build") beaver:SetStateGraph("SGwerebeaver") beaver.components.follower:SetLeader(GetPlayer()) beaver.Transform:SetScale(0.6, 0.6, 0.6) beaver:AddTag("beavers") beaver.components.eater:SetVegetarian() beaver.components.health:SetMaxHealth(10000) beaver.components.locomotor.runspeed = 20 beaver:RemoveComponent("growable") inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy 3.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/smallbird.lua文件,在Asset("ANIM", "anim/smallbird_basic.zip"),的下一行插入以下内容: Asset("ANIM", "anim/werebeaver_build.zip"), Asset("ANIM", "anim/werebeaver_basic.zip"), 4.在inst:AddTag("teenbird")的下一行插入以下内容: local function onsave(inst, data) if inst:HasTag("dogs") then data.dogs = true end if inst:HasTag("beavers") then data.beavers = true end end local function onload(inst, data) if data.dogs then inst.AnimState:SetBank("hound") inst.AnimState:SetBuild("hound_ice") inst:SetStateGraph("SGhound") inst.components.follower:SetLeader(GetPlayer()) inst.Transform:SetScale(0.6, 0.6, 0.6) inst.components.health:SetMaxHealth(10000) inst.components.locomotor.runspeed = 20 inst:RemoveComponent("growable") inst:AddTag("dogs") end if data.beavers then inst.AnimState:SetBank("werebeaver") inst.AnimState:SetBuild("werebeaver_build") inst:SetStateGraph("SGwerebeaver") inst.components.follower:SetLeader(GetPlayer()) inst.Transform:SetScale(0.6, 0.6, 0.6) inst.components.health:SetMaxHealth(10000) inst.components.eater:SetVegetarian() inst.components.locomotor.runspeed = 20 inst:RemoveComponent("growable") inst:AddTag("beavers") end end inst.OnSave = onsave inst.OnLoad = onload 即可用齿轮种宠物狗,用海象牙种宠物海狸,它们可以陪伴你,帮你打怪,是活力十足的小淘气。宠物需要喂食,不然会咬你(轻轻的),宠物狗喜欢吃肉,宠物海狸喜欢吃蔬菜,通过喂食可以为它们补血。最好在家的角落里扔一些食物,让它们随饿随吃

2025/04/23 · Bny

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

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一九五.口袋猴子(用蜂蜜绷带种猴子,帮你活捉兔子、鸟、鼹鼠等小动物) 用MT管理器打开游戏目录/assets/scripts/prefabs/bandage.lua文件,在inst:AddComponent("inventoryitem")的下一行插入以下内容: local function OnDeploy (inst, pt) local helper = SpawnPrefab("bandage") helper.Transform:SetPosition(pt.x, pt.y, pt.z) helper.AnimState:SetBank("kiki") helper.AnimState:SetBuild("kiki_basic") helper.AnimState:PlayAnimation("idle_loop", true) helper.Transform:SetFourFaced() helper.Transform:SetScale(0.8, 0.8, 0.8) helper:RemoveComponent("stackable") helper:RemoveComponent("healer") local sound = helper.entity:AddSoundEmitter() helper.soundtype = "" local brain = require "brains/abigailbrain" helper:SetBrain(brain) helper:AddComponent("locomotor") helper.components.locomotor:SetTriggersCreep(false) helper.components.locomotor.pathcaps = { ignorecreep = false } helper.components.locomotor.walkspeed = 12 helper:SetStateGraph("SGmonkey") helper:AddComponent("follower") GetPlayer().components.leader:AddFollower(helper) helper:AddComponent("combat") helper.components.combat.hiteffectsymbol = "torso" helper.components.combat:SetRetargetFunction(1, function(helper) if not helper.components.health:IsDead() then return FindEntity(helper, 20, function(guy) if guy.components.health and not guy.components.health:IsDead() then 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" end end) end end ) helper.components.combat:SetKeepTargetFunction(function(helper, target) return target and target:IsValid() end ) helper.components.combat:SetAttackPeriod(1) helper.components.combat:SetRange(1, 2) helper.components.combat:SetDefaultDamage(1) helper.components.combat.onhitotherfn = function(helper, other, damage) if other.prefab == "crow" then local prey = SpawnPrefab("crow") GetPlayer().components.inventory:GiveItem(prey) end if other.prefab == "robin" then local prey = SpawnPrefab("robin") GetPlayer().components.inventory:GiveItem(prey) end if other.prefab == "robin_winter" then local prey = SpawnPrefab("robin_winter") GetPlayer().components.inventory:GiveItem(prey) end if other.prefab == "bee" then local prey = SpawnPrefab("bee") GetPlayer().components.inventory:GiveItem(prey) end if other.prefab == "killerbee" then local prey = SpawnPrefab("killerbee") GetPlayer().components.inventory:GiveItem(prey) end if other.prefab == "rabbit" then local prey = SpawnPrefab("rabbit") GetPlayer().components.inventory:GiveItem(prey) end if other.prefab == "butterfly" then local prey = SpawnPrefab("butterfly") GetPlayer().components.inventory:GiveItem(prey) end if other.prefab == "mole" then local prey = SpawnPrefab("mole") GetPlayer().components.inventory:GiveItem(prey) end other:Remove() end helper:AddComponent("health") helper.components.health:SetMaxHealth(1000) helper.components.health:SetInvincible(true) helper.components.health.nofadeout = true helper.components.inventoryitem:ChangeImageName("cave_banana") helper:AddComponent( "playerprox" ) helper.components.playerprox:SetDist(3,5) helper.components.playerprox:SetOnPlayerNear(function(helper) helper.components.locomotor.walkspeed = 5 end ) helper.components.playerprox:SetOnPlayerFar(function(helper) helper.components.locomotor.walkspeed = 12 end ) helper:AddTag("helpers") inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("helpers") then data.helpers = true end end local function onload(inst, data) if data and data.helpers then inst.AnimState:SetBank("kiki") inst.AnimState:SetBuild("kiki_basic") inst.AnimState:PlayAnimation("idle_loop", true) inst.Transform:SetFourFaced() inst.Transform:SetScale(0.8, 0.8, 0.8) inst:RemoveComponent("stackable") inst:RemoveComponent("healer") local sound = inst.entity:AddSoundEmitter() inst.soundtype = "" local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst:AddComponent("locomotor") inst.components.locomotor:SetTriggersCreep(false) inst.components.locomotor.pathcaps = { ignorecreep = false } inst.components.locomotor.walkspeed = 12 inst:SetStateGraph("SGmonkey") inst:AddComponent("follower") GetPlayer().components.leader:AddFollower(inst) inst:AddComponent("combat") inst.components.combat.hiteffectsymbol = "torso" inst.components.combat:SetRetargetFunction(1, function(inst) if not inst.components.health:IsDead() then return FindEntity(inst, 20, function(guy) if guy.components.health and not guy.components.health:IsDead() then 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" end end) end end ) inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) inst.components.combat:SetAttackPeriod(1) inst.components.combat:SetRange(1, 2) inst.components.combat:SetDefaultDamage(1) inst.components.combat.onhitotherfn = function(inst, other, damage) if other.prefab == "crow" then local prey = SpawnPrefab("crow") GetPlayer().components.inventory:GiveItem(prey) end if other.prefab == "robin" then local prey = SpawnPrefab("robin") GetPlayer().components.inventory:GiveItem(prey) end if other.prefab == "robin_winter" then local prey = SpawnPrefab("robin_winter") GetPlayer().components.inventory:GiveItem(prey) end if other.prefab == "bee" then local prey = SpawnPrefab("bee") GetPlayer().components.inventory:GiveItem(prey) end if other.prefab == "killerbee" then local prey = SpawnPrefab("killerbee") GetPlayer().components.inventory:GiveItem(prey) end if other.prefab == "rabbit" then local prey = SpawnPrefab("rabbit") GetPlayer().components.inventory:GiveItem(prey) end if other.prefab == "butterfly" then local prey = SpawnPrefab("butterfly") GetPlayer().components.inventory:GiveItem(prey) end if other.prefab == "mole" then local prey = SpawnPrefab("mole") GetPlayer().components.inventory:GiveItem(prey) end other:Remove() end inst:AddComponent("health") inst.components.health:SetMaxHealth(1000) inst.components.health:SetInvincible(true) inst.components.health.nofadeout = true inst.components.inventoryitem:ChangeImageName("cave_banana") inst:AddComponent( "playerprox" ) inst.components.playerprox:SetDist(3,5) inst.components.playerprox:SetOnPlayerNear(function(inst) inst.components.locomotor.walkspeed = 5 end ) inst.components.playerprox:SetOnPlayerFar(function(inst) inst.components.locomotor.walkspeed = 12 end ) inst:AddTag("helpers") end end inst.OnSave = onsave inst.OnLoad = onload 即可用蜂蜜绷带种猴子,鼠标左键点猴子,可将其放入物品栏(显示为香蕉的图标)。在附近有兔子、鸟、蜜蜂、杀人蜂、蝴蝶、鼹鼠等小动物时,可将猴子放在地上,会为你捕捉小动物,如果同时修改了“网上宠宠店”,就可以将捉到的小动物卖掉换黄金。如果不想要猴子了,在物品栏中对其按鼠标右键即可。蜂蜜绷带在生存选项(画着绳套)下,用1张纸、2个蜂蜜制造

2025/04/23 · Bny

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

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一九六.口袋浣熊(用纸种口袋浣熊,捕猎、战斗好帮手,喂鱼变身超级浣熊) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/papyrus.lua文件,在inst:AddComponent("inventoryitem")的下一行插入以下内容: local function OnDeploy (inst, pt) local coon = SpawnPrefab("papyrus") coon.Transform:SetPosition(pt.x, pt.y, pt.z) coon.AnimState:SetBank("catcoon") coon.AnimState:SetBuild("catcoon_build") coon.AnimState:PlayAnimation("idle_loop") coon.Transform:SetFourFaced() coon.Transform:SetScale(0.8, 0.8, 0.8) coon.entity:AddSoundEmitter() local shadow = coon.entity:AddDynamicShadow() shadow:SetSize(2,0.75) coon:RemoveComponent("stackable") coon:RemoveComponent("fuel") coon:RemoveComponent("tradable") coon:RemoveComponent("burnable") coon:RemoveComponent("propagator") coon:RemoveComponent("deployable") coon:RemoveTag("cattoy") coon.components.inventoryitem:ChangeImageName("catcoonhat") coon:AddComponent("named") coon.components.named:SetName("Catcoon") coon:AddComponent("follower") coon.components.follower:SetLeader(GetPlayer()) coon:AddComponent("locomotor") coon.components.locomotor.walkspeed = 12 coon:SetStateGraph("SGcatcoon") local brain = require "brains/abigailbrain" coon:SetBrain(brain) coon:AddComponent("health") coon.components.health:SetMaxHealth(3000) coon:AddComponent("lootdropper") coon.components.lootdropper:SetLoot({"smallmeat"}) coon:AddComponent("combat") coon.components.combat:SetDefaultDamage(50) coon.components.combat:SetRange(4) coon.components.combat:SetAttackPeriod(0.5) coon.components.combat:SetHurtSound("dontstarve_DLC001/creatures/catcoon/hurt") coon.components.combat.battlecryinterval = 20 coon.components.combat:SetRetargetFunction(1, function(coon) if not coon.components.health:IsDead() then return FindEntity(GetPlayer(), 20, function(guy) if guy.components.health and not guy.components.health:IsDead() then return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") or guy:HasTag("smallcreature") end end) end end ) coon.components.combat:SetKeepTargetFunction(function(coon, target) return target and target:IsValid() end ) coon:ListenForEvent("attacked", function(coon, data) if data.attacker ~= GetPlayer() then coon.components.combat:SetTarget(data.attacker) else coon.components.health:Kill() end end ) coon:AddComponent( "playerprox" ) coon.components.playerprox:SetDist(3,5) coon.components.playerprox:SetOnPlayerNear(function(coon) coon.components.locomotor.walkspeed = 5 end ) coon.components.playerprox:SetOnPlayerFar(function(coon) coon.components.locomotor.walkspeed = 12 end ) coon:AddComponent("trader") coon.components.trader:SetAcceptTest(function(coon, item) if not coon:HasTag("supercoon") then if item.prefab == "fish" then return true end if item.prefab == "smallmeat" then return coon.components.health:GetPercent() < 1 end end return false end ) coon.components.trader.onaccept = function(coon, giver, item) if item.prefab == "fish" then coon:AddTag("supercoon") coon.components.named:SetName("SuperCatcoon") SpawnPrefab("collapse_big").Transform:SetPosition(coon.Transform:GetWorldPosition()) coon.AnimState:SetBloomEffectHandle("shaders/anim.ksh") coon.Transform:SetScale(1.3, 1.3, 1.3) coon.components.inventoryitem.canbepickedup = false coon.components.health:SetInvincible(true) coon.components.combat:SetDefaultDamage(500) coon:DoTaskInTime(60, function(coon) coon:RemoveTag("supercoon") coon.components.named:SetName("Catcoon") SpawnPrefab("collapse_big").Transform:SetPosition(coon.Transform:GetWorldPosition()) coon.AnimState:SetBloomEffectHandle("") coon.Transform:SetScale(0.8, 0.8, 0.8) coon.components.inventoryitem.canbepickedup = true coon.components.health:SetInvincible(false) coon.components.combat:SetDefaultDamage(50) end ) end if item.prefab == "smallmeat" then coon.components.health:DoDelta(1000) end end coon:AddTag("coons") inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("coons") then data.coons = true end end local function onload(inst, data) if data and data.coons then inst.AnimState:SetBank("catcoon") inst.AnimState:SetBuild("catcoon_build") inst.AnimState:PlayAnimation("idle_loop") inst.Transform:SetFourFaced() inst.Transform:SetScale(0.8, 0.8, 0.8) inst.entity:AddSoundEmitter() local shadow = inst.entity:AddDynamicShadow() shadow:SetSize(2,0.75) inst:RemoveComponent("stackable") inst:RemoveComponent("fuel") inst:RemoveComponent("tradable") inst:RemoveComponent("burnable") inst:RemoveComponent("propagator") inst:RemoveComponent("deployable") inst:RemoveTag("cattoy") inst.components.inventoryitem:ChangeImageName("catcoonhat") inst:AddComponent("named") inst.components.named:SetName("Catcoon") inst:AddComponent("follower") inst.components.follower:SetLeader(GetPlayer()) inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 12 inst:SetStateGraph("SGcatcoon") local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst:AddComponent("health") inst.components.health:SetMaxHealth(3000) inst:AddComponent("lootdropper") inst.components.lootdropper:SetLoot({"smallmeat"}) inst:AddComponent("combat") inst.components.combat:SetDefaultDamage(50) inst.components.combat:SetRange(4) inst.components.combat:SetAttackPeriod(0.5) inst.components.combat:SetHurtSound("dontstarve_DLC001/creatures/catcoon/hurt") inst.components.combat.battlecryinterval = 20 inst.components.combat:SetRetargetFunction(1, function(inst) if not inst.components.health:IsDead() then return FindEntity(GetPlayer(), 20, function(guy) if guy.components.health and not guy.components.health:IsDead() then return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") or guy:HasTag("smallcreature") end end) end end ) inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) inst:ListenForEvent("attacked", function(inst, data) if data.attacker ~= GetPlayer() then inst.components.combat:SetTarget(data.attacker) else inst.components.health:Kill() end end ) inst:AddComponent( "playerprox" ) inst.components.playerprox:SetDist(3,5) inst.components.playerprox:SetOnPlayerNear(function(inst) inst.components.locomotor.walkspeed = 5 end ) inst.components.playerprox:SetOnPlayerFar(function(inst) inst.components.locomotor.walkspeed = 12 end ) inst:AddComponent("trader") inst.components.trader:SetAcceptTest(function(inst, item) if not inst:HasTag("supercoon") then if item.prefab == "fish" then return true end if item.prefab == "smallmeat" then return inst.components.health:GetPercent() < 1 end end return false end ) inst.components.trader.onaccept = function(inst, giver, item) if item.prefab == "fish" then inst:AddTag("supercoon") inst.components.named:SetName("SuperCatcoon") SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition()) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst.Transform:SetScale(1.3, 1.3, 1.3) inst.components.inventoryitem.canbepickedup = false inst.components.health:SetInvincible(true) inst.components.combat:SetDefaultDamage(500) inst:DoTaskInTime(60, function(inst) inst:RemoveTag("supercoon") inst.components.named:SetName("Catcoon") SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition()) inst.AnimState:SetBloomEffectHandle("") inst.Transform:SetScale(0.8, 0.8, 0.8) inst.components.inventoryitem.canbepickedup = true inst.components.health:SetInvincible(false) inst.components.combat:SetDefaultDamage(50) end ) end if item.prefab == "smallmeat" then inst.components.health:DoDelta(1000) end end inst:AddTag("coons") end end inst.OnSave = onsave inst.OnLoad = onload 即可用纸种口袋浣熊,帮你捕猎、战斗。鼠标左键点浣熊,可将其放入物品栏(显示为浣熊帽的图标)。喂浣熊小肉,可为其补血(3块可补满),如果喂浣熊鱼,则变身超级浣熊,不会受伤,攻击力提高10倍,60秒后变回来。在超级浣熊状态下,口袋浣熊无法被拿起,也不接受食物。不想要口袋浣熊了,在物品栏中对其按鼠标右键即可。纸在精炼选项(画着白色宝石)下,用4个芦苇制造

2025/04/23 · Bny

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

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一九七.吸地牛(用大理石种吸地牛,地面物品自动吸入肚中,可开矿、砍树) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/inv_marble.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local slotpos = {} for y = 4, 0, -1 do for x = 0, 14 do table.insert(slotpos, Vector3(75*x-75*2+75, 75*y-75*2+75,0)) end end local sounds = { walk = "dontstarve/beefalo/walk", grunt = "dontstarve/beefalo/grunt", yell = "dontstarve/beefalo/yell", swish = "dontstarve/beefalo/tail_swish", curious = "dontstarve/beefalo/curious", angry = "dontstarve/beefalo/angry", } local function OnDeploy (inst, pt) local bull = SpawnPrefab("marble") bull.Transform:SetPosition(pt.x, pt.y, pt.z) bull.AnimState:SetBank("beefalo") bull.AnimState:SetBuild("beefalo_build") bull.AnimState:PlayAnimation("idle_loop", true) bull.Transform:SetFourFaced() bull.Transform:SetScale(0.8, 0.8, 0.8) local sound = bull.entity:AddSoundEmitter() bull.sounds = sounds local shadow = bull.entity:AddDynamicShadow() shadow:SetSize( 3, 1.25 ) MakeCharacterPhysics(bull, 100, 1.5) bull:AddTag("bull") bull:AddTag("companion") bull:AddComponent("locomotor") bull.components.locomotor.walkspeed = 1.5 bull.components.locomotor.runspeed = 15 bull:SetStateGraph("SGBeefalo") bull:AddComponent("follower") bull:AddComponent("knownlocations") bull.components.container.canbeopened = true bull:AddComponent("combat") bull:AddComponent("health") bull.components.health:SetMaxHealth(10000) bull.components.health:SetInvincible(true) bull.components.health.nofadeout = true bull:RemoveComponent("stackable") bull:RemoveComponent("inventoryitem") bull:RemoveComponent("bait") bull:RemoveTag("molebait") bull:AddComponent("workable") bull.components.workable:SetWorkAction(ACTIONS.CHOP) bull.components.workable:SetWorkLeft(3) bull.components.workable:SetOnFinishCallback(function(bull) bull.AnimState:PlayAnimation("death") bull.SoundEmitter:PlaySound("dontstarve/beefalo/yell") bull:DoTaskInTime(1.5, function() bull.components.container:DropEverything() bull:Remove() end) end ) bull:DoPeriodicTask(1, function(bull) if not bull.components.container:Has("cutgrass", 1) then bull.components.locomotor:Stop() bull:SetBrain(nil) bull.components.follower:SetLeader(nil) bull:RemoveTag("letgo") else local brain = require "brains/chesterbrain" bull:SetBrain(brain) bull:RestartBrain() bull.components.follower:SetLeader(GetPlayer()) bull:AddTag("letgo") end end ) bull:DoPeriodicTask(180, function(bull) if bull.components.container:Has("cutgrass", 1) then bull.components.container:ConsumeByName("cutgrass", 1) bull.AnimState:PlayAnimation("graze_loop") end end ) bull:DoPeriodicTask(.1, function(bull) if bull:HasTag("letgo") then local pos = Vector3(bull.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 15) for k,v in pairs(ents) do local pt1 = v:GetPosition() if v.components.inventoryitem and v.components.inventoryitem.canbepickedup and v.components.inventoryitem.cangoincontainer and not v.components.inventoryitem:IsHeld() and not v:HasTag("trap") and not v:HasTag("light") and not v:HasTag("blowdart") and not v:HasTag("projectile") and not v:HasTag("helpers") then if not bull.components.container:IsFull() then SpawnPrefab("small_puff").Transform:SetPosition(pt1.x, pt1.y, pt1.z) bull.components.container:GiveItem(v) bull.SoundEmitter:PlaySound("dontstarve/HUD/research_available") end end end end end ) bull.Physics:SetCollisionCallback(function(bull, other) if other and other.components.workable and other.components.workable.workleft > 0 and not other:HasTag("bull") then SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get()) other.components.workable:Destroy(bull) end end) inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("bull") then data.bull = true end end local function onload(inst, data) if data and data.bull then inst.AnimState:SetBank("beefalo") inst.AnimState:SetBuild("beefalo_build") inst.AnimState:PlayAnimation("idle_loop", true) inst.Transform:SetFourFaced() inst.Transform:SetScale(0.8, 0.8, 0.8) local sound = inst.entity:AddSoundEmitter() inst.sounds = sounds local shadow = inst.entity:AddDynamicShadow() shadow:SetSize( 3, 1.25 ) MakeCharacterPhysics(inst, 100, 1.5) inst:AddTag("bull") inst:AddTag("companion") inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 1.5 inst.components.locomotor.runspeed = 15 inst:SetStateGraph("SGBeefalo") inst:AddComponent("follower") inst:AddComponent("knownlocations") inst.components.container.canbeopened = true inst:AddComponent("combat") inst:AddComponent("health") inst.components.health:SetMaxHealth(10000) inst.components.health:SetInvincible(true) inst.components.health.nofadeout = true inst:RemoveComponent("stackable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("bait") inst:RemoveTag("molebait") inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.CHOP) inst.components.workable:SetWorkLeft(3) inst.components.workable:SetOnFinishCallback(function(inst) inst.AnimState:PlayAnimation("death") inst.SoundEmitter:PlaySound("dontstarve/beefalo/yell") inst:DoTaskInTime(1.5, function() inst.components.container:DropEverything() inst:Remove() end) end ) inst:DoPeriodicTask(1, function(inst) if not inst.components.container:Has("cutgrass", 1) then inst.components.locomotor:Stop() inst:SetBrain(nil) inst.components.follower:SetLeader(nil) inst:RemoveTag("letgo") else local brain = require "brains/chesterbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(GetPlayer()) inst:AddTag("letgo") end end ) inst:DoPeriodicTask(180, function(inst) if inst.components.container:Has("cutgrass", 1) then inst.components.container:ConsumeByName("cutgrass", 1) inst.AnimState:PlayAnimation("graze_loop") end end ) inst:DoPeriodicTask(.1, function(inst) if inst:HasTag("letgo") then local pos = Vector3(inst.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 15) for k,v in pairs(ents) do local pt1 = v:GetPosition() if v.components.inventoryitem and v.components.inventoryitem.canbepickedup and v.components.inventoryitem.cangoincontainer and not v.components.inventoryitem:IsHeld() and not v:HasTag("trap") and not v:HasTag("light") and not v:HasTag("blowdart") and not v:HasTag("projectile") and not v:HasTag("helpers") then if not inst.components.container:IsFull() then SpawnPrefab("small_puff").Transform:SetPosition(pt1.x, pt1.y, pt1.z) inst.components.container:GiveItem(v) inst.SoundEmitter:PlaySound("dontstarve/HUD/research_available") end end end end end ) inst.Physics:SetCollisionCallback(function(inst, other) if other and other.components.workable and other.components.workable.workleft > 0 and not other:HasTag("bull") then SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get()) other.components.workable:Destroy(inst) end end) end end inst.OnSave = onsave inst.OnLoad = onload inst:AddComponent("container") inst.components.container:SetNumSlots(#slotpos) inst.components.container.widgetslotpos = slotpos inst.components.container.widgetpos = Vector3(-300,200,0) inst.components.container.side_align_tip = 160 inst.components.container.canbeopened = false inst:AddTag("fridge") 即可用大理石种吸地牛,鼠标左键点它可开启格子,放入草后会跟随你,吸取沿路所有物品(吸进肚中的格子里,鼠标左键点击可拿取)。拿出草后即停止跟随,在原地等待。吸地牛会消化肚中的草,每天消化2-3根,如果格子中的草被吃完了,就不会跟随你,直到再给它草为止。吸地牛可撞碎石头、撞倒树,并将掉落物品直接吸入肚中,带着它去开矿、砍树吧。不要让吸地牛靠近你的建筑物,它会将其撞毁,除非你想用它拆迁。不想要吸地牛时,用斧子砍它三下即可,肚中物品会掉在地上

2025/04/23 · Bny

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

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一九八.找矿蜗牛(用蜗牛龟盔甲种找矿蜗牛,为你勘探新石矿) 用MT管理器打开游戏目录/assets/scripts/prefabs/armor_snurtleshell.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function OnDeploy (inst, pt) local snail = SpawnPrefab("armorsnurtleshell") snail.Transform:SetPosition(pt.x, pt.y, pt.z) snail.AnimState:SetBank("slurtle") snail.AnimState:SetBuild("slurtle") snail.AnimState:PlayAnimation("idle", true) snail.Transform:SetFourFaced() local sound = snail.entity:AddSoundEmitter() local brain = require "brains/leifbrain" snail:SetBrain(brain) snail:AddComponent("locomotor") snail.components.locomotor.walkspeed = 7 snail:SetStateGraph("SGslurtle") local minimap = snail.entity:AddMiniMapEntity() minimap:SetIcon( "slurtle_den.png" ) snail.components.inventoryitem:ChangeImageName("armorsnurtleshell") snail:RemoveComponent("armor") snail:RemoveComponent("equippable") snail:RemoveComponent("useableitem") snail:RemoveComponent("deployable") snail:RemoveTag("shell") snail:RemoveComponent("inventoryitem") snail:AddComponent("combat") snail:AddComponent("health") snail.components.health:SetMaxHealth(1000) snail.components.health:SetInvincible(true) snail.components.health.nofadeout = true snail.task = snail:DoPeriodicTask(math.random(8,12), function(snail) local pt1 = snail:GetPosition() local rocks = {"rock1","rock2","rock_flintless","rock_ice"} local rock = rocks[math.random(#rocks)] local newrock = SpawnPrefab(rock) newrock.Transform:SetPosition(pt1.x, 0, pt1.z) newrock.Physics:SetActive(false) newrock:DoTaskInTime(3, function(newrock) newrock.Physics:SetActive(true) end ) SpawnPrefab("splash_ocean").Transform:SetPosition(pt1.x, 0, pt1.z) snail.SoundEmitter:PlaySound("dontstarve/wilson/rock_break") GetPlayer().components.playercontroller:ShakeCamera(snail, "FULL", 0.2, 0.02, .25, 40) end ) snail:AddComponent("inventoryitem") snail.components.inventoryitem:SetOnPutInInventoryFn(function(snail) snail:RemoveTag("sports") snail.components.locomotor:Stop() snail:SetBrain(nil) if snail.task then snail.task:Cancel() snail.task = nil end end ) snail.components.inventoryitem:SetOnDroppedFn(function(snail) snail:AddTag("sports") local brain = require "brains/leifbrain" snail:SetBrain(brain) snail:RestartBrain() snail.task = snail:DoPeriodicTask(math.random(8,12), function(snail) local pt1 = snail:GetPosition() local rocks = {"rock1","rock2","rock_flintless","rock_ice"} local rock = rocks[math.random(#rocks)] local newrock = SpawnPrefab(rock) newrock.Transform:SetPosition(pt1.x, 0, pt1.z) newrock.Physics:SetActive(false) newrock:DoTaskInTime(3, function(newrock) newrock.Physics:SetActive(true) end ) SpawnPrefab("splash_ocean").Transform:SetPosition(pt1.x, 0, pt1.z) snail.SoundEmitter:PlaySound("dontstarve/wilson/rock_break") GetPlayer().components.playercontroller:ShakeCamera(snail, "FULL", 0.2, 0.02, .25, 40) end ) end ) snail:AddTag("sports") snail:AddTag("companion") snail:AddTag("snails") inst:Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("snails") then data.snails = true end if inst:HasTag("sports") then data.sports = true end end local function onload(inst, data) if data and data.snails then inst.AnimState:SetBank("slurtle") inst.AnimState:SetBuild("slurtle") inst.AnimState:PlayAnimation("idle", true) inst.Transform:SetFourFaced() local sound = inst.entity:AddSoundEmitter() inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 7 inst:SetStateGraph("SGslurtle") local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon( "slurtle_den.png" ) inst.components.inventoryitem:ChangeImageName("armorsnurtleshell") inst:RemoveComponent("armor") inst:RemoveComponent("equippable") inst:RemoveComponent("useableitem") inst:RemoveComponent("deployable") inst:RemoveTag("shell") inst:RemoveComponent("inventoryitem") inst:AddComponent("combat") inst:AddComponent("health") inst.components.health:SetMaxHealth(1000) inst.components.health:SetInvincible(true) inst.components.health.nofadeout = true inst:AddComponent("inventoryitem") inst.components.inventoryitem:SetOnPutInInventoryFn(function(inst) inst:RemoveTag("sports") inst.components.locomotor:Stop() inst:SetBrain(nil) if inst.task then inst.task:Cancel() inst.task = nil end end ) inst.components.inventoryitem:SetOnDroppedFn(function(inst) inst:AddTag("sports") local brain = require "brains/leifbrain" inst:SetBrain(brain) inst:RestartBrain() inst.task = inst:DoPeriodicTask(math.random(8,12), function(inst) local pt1 = inst:GetPosition() local rocks = {"rock1","rock2","rock_flintless","rock_ice"} local rock = rocks[math.random(#rocks)] local newrock = SpawnPrefab(rock) newrock.Transform:SetPosition(pt1.x, 0, pt1.z) newrock.Physics:SetActive(false) newrock:DoTaskInTime(3, function(newrock) newrock.Physics:SetActive(true) end ) SpawnPrefab("splash_ocean").Transform:SetPosition(pt1.x, 0, pt1.z) inst.SoundEmitter:PlaySound("dontstarve/wilson/rock_break") GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40) end ) end ) inst:AddTag("companion") inst:AddTag("snails") end if data and data.sports then local brain = require "brains/leifbrain" inst:SetBrain(brain) inst:RestartBrain() inst.task = inst:DoPeriodicTask(math.random(8,12), function(inst) local pt1 = inst:GetPosition() local rocks = {"rock1","rock2","rock_flintless","rock_ice"} local rock = rocks[math.random(#rocks)] local newrock = SpawnPrefab(rock) newrock.Transform:SetPosition(pt1.x, 0, pt1.z) newrock.Physics:SetActive(false) newrock:DoTaskInTime(3, function(newrock) newrock.Physics:SetActive(true) end ) SpawnPrefab("splash_ocean").Transform:SetPosition(pt1.x, 0, pt1.z) inst.SoundEmitter:PlaySound("dontstarve/wilson/rock_break") GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40) end ) inst:AddTag("sports") local pt2 = GetPlayer():GetPosition() inst.Transform:SetPosition(pt2.x+1, 0, pt2.z+1) end end inst.OnSave = onsave inst.OnLoad = onload 即可用蜗牛龟盔甲种找矿蜗牛,鼠标左键点蜗牛,可将其放入物品栏(显示为蜗牛龟盔甲的图标)。在空旷的地上放下找矿蜗牛,它会为你勘探出新的石矿,石头从此成为可再生资源。找矿蜗牛只会专注于找矿,不会跟随你,别把它弄丢了,如果真找不到了,存档退出后再读档,它会出现在你身边。不想要找矿蜗牛时,在物品栏中对其按鼠标右键即可。蜗牛龟盔甲可在地下一层打蜗牛龟时获得,如果修改了“巨型超市”,也可以花9-11个黄金购买

2025/04/23 · Bny

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

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一九九.人工女友(用蜂刺种三个女友之一,可背东西、做饭、换衣帽) 用MT管理器打开游戏目录/assets/scripts/prefabs/stinger.lua文件, 1.在Asset("ANIM", "anim/stinger.zip"),的下一行插入以下内容: Asset("ANIM", "anim/wathgrithr.zip"), Asset("SOUND", "sound/wathgrithr.fsb"), 2.在inst:AddComponent("inspectable")的下一行插入以下内容: local slotpos = {} for y = 5, 0, -1 do for x = 0, 2 do table.insert(slotpos, Vector3(75*x-75*2+75, 75*y-75*2+75,0)) end end local widgetbuttoninfo = { text = "Do", position = Vector3(68, 361, 0), fn = function(inst) GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") if not inst:HasTag("withme") then inst:AddTag("withme") local brain = require "brains/chesterbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(GetPlayer()) else inst:RemoveTag("withme") inst.components.locomotor:Stop() inst:SetBrain(nil) inst.components.follower:SetLeader(nil) end end } local function OnDeploy (inst, pt) local girl = SpawnPrefab("stinger") girl.Transform:SetPosition(pt.x, pt.y, pt.z) girl.AnimState:SetBank("wilson") local girlnames = {"wendy","willow","wathgrithr"} girl.buildname = girlnames[math.random(#girlnames)] girl.AnimState:SetBuild(girl.buildname) girl.AnimState:PlayAnimation("idle") girl.AnimState:Show("ARM_normal") girl.AnimState:Hide("ARM_carry") girl.Transform:SetFourFaced() girl.entity:AddSoundEmitter() local shadow = girl.entity:AddDynamicShadow() shadow:SetSize( 1.3, .6 ) MakeCharacterPhysics(girl, 75, .5) local minimap = girl.entity:AddMiniMapEntity() minimap:SetIcon( "wendy.png" ) girl:RemoveComponent("stackable") girl:RemoveComponent("inventoryitem") girl:RemoveComponent("deployable") girl:AddComponent("named") girl.components.named:SetName("My Baby") girl:AddComponent("knownlocations") girl:AddComponent("follower") girl.components.follower:SetLeader(GetPlayer()) girl:AddComponent("inventory") girl.components.container.canbeopened = true girl:AddComponent("locomotor") girl.components.locomotor.walkspeed = 8 girl.components.locomotor.runspeed = 12 girl:SetStateGraph("SGshadowwaxwell") local brain = require "brains/chesterbrain" girl:SetBrain(brain) girl:AddComponent("combat") girl:AddComponent("health") girl.components.health:SetMaxHealth(2000) girl:ListenForEvent("death", function() girl.components.container:DropEverything() end ) girl:AddComponent("talker") girl:DoPeriodicTask(60, function() 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"} local word = words[math.random(#words)] girl.components.talker:Say(word, 4, false) girl.components.health:DoDelta(2000) end) girl:DoPeriodicTask(400, function() local names = {"waffles","turkeydinner","baconeggs"} local name = names[math.random(#names)] local foods = SpawnPrefab(name) girl.components.container:GiveItem(foods) girl.components.talker:Say("Come to eat", 4, false) end) girl:AddComponent("machine") girl.components.machine.turnonfn = function(girl) girl.components.machine.ison = true girl:AddTag("neat") 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"} girl.hat = hats[math.random(#hats)] local armors = {"armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter","armor_sanity","armor_slurper","torso_rain"} girl.armor = armors[math.random(#armors)] girl.sg:GoToState("hit") girl.AnimState:OverrideSymbol("swap_hat", girl.hat, "swap_hat") girl.AnimState:OverrideSymbol("swap_body", girl.armor, "swap_body") girl.AnimState:Show("HAT") girl.AnimState:Show("HAT_HAIR") girl.AnimState:Hide("HAIR_NOHAT") girl.AnimState:Hide("HAIR") local words = {"I like it","I don't loke it"} local word = words[math.random(#words)] girl.components.talker:Say(word, 4, false) end girl.components.machine.turnofffn = function(girl) girl.components.machine.ison = false girl:RemoveTag("neat") girl.sg:GoToState("stunned") girl.AnimState:Hide("HAT") girl.AnimState:Hide("HAT_HAIR") girl.AnimState:Show("HAIR_NOHAT") girl.AnimState:Show("HAIR") girl.AnimState:ClearOverrideSymbol("swap_body") girl.SoundEmitter:PlaySound("dontstarve/characters/wendy/hurt") girl.components.talker:Say("Don't, Don't, Don't", 4, false) end girl:AddComponent("sanityaura") girl.components.sanityaura.aura = TUNING.SANITYAURA_HUGE girl:ListenForEvent("attacked", function(girl, data) girl.sg:GoToState("stunned") girl.SoundEmitter:PlaySound("dontstarve/characters/wendy/hurt") girl.components.talker:Say("Don't, Don't, Don't", 4, false) end ) girl:AddTag("fridge") girl:AddTag("withme") girl:AddTag("companion") girl:AddTag("girls") inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy inst:AddComponent("container") inst.components.container.widgetbuttoninfo = widgetbuttoninfo inst.components.container:SetNumSlots(#slotpos) inst.components.container.widgetslotpos = slotpos inst.components.container.widgetpos = Vector3(0,150,0) inst.components.container.side_align_tip = 160 inst.components.container.canbeopened = false local function onsave(inst, data) if inst:HasTag("girls") then data.girls = true end if inst:HasTag("withme") then data.withme = true end if inst:HasTag("neat") then data.neat = true end data.buildname = inst.buildname data.hat = inst.hat data.armor = inst.armor end local function onload(inst, data) if data and data.girls then inst.AnimState:SetBank("wilson") local girlnames = {"wendy","willow","wathgrithr"} inst.buildname = girlnames[math.random(#girlnames)] inst.AnimState:SetBuild(inst.buildname) inst.AnimState:PlayAnimation("idle") inst.AnimState:Show("ARM_normal") inst.AnimState:Hide("ARM_carry") inst.Transform:SetFourFaced() inst.entity:AddSoundEmitter() local shadow = inst.entity:AddDynamicShadow() shadow:SetSize( 1.3, .6 ) MakeCharacterPhysics(inst, 75, .5) local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon( "wendy.png" ) inst:RemoveComponent("stackable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("deployable") inst:AddComponent("named") inst.components.named:SetName("My Baby") inst:AddComponent("knownlocations") inst:AddComponent("follower") inst:AddComponent("inventory") inst.components.container.canbeopened = true inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 8 inst.components.locomotor.runspeed = 12 inst:SetStateGraph("SGshadowwaxwell") inst:AddComponent("combat") inst:AddComponent("health") inst.components.health:SetMaxHealth(2000) inst:ListenForEvent("death", function() inst.components.container:DropEverything() end ) inst:AddComponent("talker") inst:DoPeriodicTask(60, function() 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"} local word = words[math.random(#words)] inst.components.talker:Say(word, 4, false) inst.components.health:DoDelta(2000) end) inst:DoPeriodicTask(400, function() local names = {"waffles","turkeydinner","baconeggs"} local name = names[math.random(#names)] local foods = SpawnPrefab(name) inst.components.container:GiveItem(foods) inst.components.talker:Say("Come to eat", 4, false) end) inst:AddComponent("machine") inst.components.machine.turnonfn = function(inst) inst.components.machine.ison = true inst:AddTag("neat") 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"} inst.hat = hats[math.random(#hats)] local armors = {"armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter","armor_sanity","armor_slurper","torso_rain"} inst.armor = armors[math.random(#armors)] inst.sg:GoToState("hit") inst.AnimState:OverrideSymbol("swap_hat", inst.hat, "swap_hat") inst.AnimState:OverrideSymbol("swap_body", inst.armor, "swap_body") inst.AnimState:Show("HAT") inst.AnimState:Show("HAT_HAIR") inst.AnimState:Hide("HAIR_NOHAT") inst.AnimState:Hide("HAIR") local words = {"I like it","I don't loke it"} local word = words[math.random(#words)] inst.components.talker:Say(word, 4, false) end inst.components.machine.turnofffn = function(inst) inst.components.machine.ison = false inst:RemoveTag("neat") inst.sg:GoToState("stunned") inst.AnimState:Hide("HAT") inst.AnimState:Hide("HAT_HAIR") inst.AnimState:Show("HAIR_NOHAT") inst.AnimState:Show("HAIR") inst.AnimState:ClearOverrideSymbol("swap_body") inst.SoundEmitter:PlaySound("dontstarve/characters/wendy/hurt") inst.components.talker:Say("Don't, Don't, Don't", 4, false) end inst:AddComponent("sanityaura") inst.components.sanityaura.aura = TUNING.SANITYAURA_HUGE inst:ListenForEvent("attacked", function(inst, data) inst.sg:GoToState("stunned") inst.SoundEmitter:PlaySound("dontstarve/characters/wendy/hurt") inst.components.talker:Say("Don't, Don't, Don't", 4, false) end ) inst:AddTag("fridge") inst:AddTag("companion") inst:AddTag("girls") end if data and data.withme then inst:AddTag("withme") local brain = require "brains/chesterbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(GetPlayer()) end if data and data.neat then inst.components.machine.ison = true inst:AddTag("neat") inst.AnimState:Show("HAT") inst.AnimState:Show("HAT_HAIR") inst.AnimState:Hide("HAIR_NOHAT") inst.AnimState:Hide("HAIR") if data and data.hat then inst.hat = data.hat inst.AnimState:OverrideSymbol("swap_hat", inst.hat, "swap_hat") end if data and data.armor then inst.armor = data.armor inst.AnimState:OverrideSymbol("swap_body", inst.armor, "swap_body") end end if data and data.buildname then inst.buildname = data.buildname inst.AnimState:SetBuild(inst.buildname) end end inst.OnSave = onsave inst.OnLoad = onload 即可用蜂刺种人工女友,随机为温蒂、薇洛、瓦丝格雷斯三人之一。鼠标左键点女友,可打开她的背包格(18格),让她帮你背东西,她的背包带有冷藏功能。点格子右上方的“Do”按钮,可让女友停留在原地,再次点“Do”按钮可继续跟随,如果你殴打她,她不再跟随你,也可通过点“Do”按钮让她继续跟随。鼠标右键点女友,可为她随机更换衣帽,再次点击可脱下衣帽,搭配好的衣帽会一直保留在她身上,不受存读档影响。每天女友会为你做一份料理,在她的背包格中拿取。女友会不时对你说话,与她紧紧依偎可以补脑(不再孤独了)。女友没有战斗能力,如果遇到敌人,要保护好她哦,你也可以选择逃跑,她会努力跟上你的,如果她遇难了,背包里的物品将掉在地上。不想要女友了,杀掉即可(按Ctrl + 鼠标左键攻击)。不要与“用蜂刺种杀人蜂窝”一同修改

2025/04/23 · Bny