模组文件免费下载和使用,谨防上当受骗。

YN186-智能围墙(按键盘F11键造一圈大理石围墙,点围墙可开门,5秒自动关门,夜晚启动照明)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一八六.智能围墙(按键盘F11键造一圈大理石围墙,点围墙可开门,5秒自动关门,夜晚启动照明) 1.用MT管理器打开游戏目录/assets/scripts/prefabs/marblepillar.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function GetStatus(inst, viewer) local pt = inst:GetPosition() inst:Remove() inst:DoTaskInTime(5, function() SpawnPrefab("marblepillar").Transform:SetPosition(pt.x, pt.y, pt.z) inst.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup") end) end local function LightsOn(inst) inst.Light:Enable(true) end local function LightsOff(inst) inst.Light:Enable(false) end local light = inst.entity:AddLight() light:SetFalloff(1) light:SetIntensity(.8) light:SetRadius(10) light:Enable(false) light:SetColour(180/255, 195/255, 50/255) inst.components.inspectable.getstatus = GetStatus inst:ListenForEvent( "daytime", function() LightsOff(inst) end, GetWorld()) inst:ListenForEvent( "dusktime", function() LightsOn(inst) end, GetWorld()) 2.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playercontroller")的下一行插入以下内容: TheInput:AddKeyUpHandler(KEY_F11, function() local player = GetPlayer() local pt = Vector3(player.Transform:GetWorldPosition()) for k = 1, 75 do local theta = 1 * 2 * PI local radius = 18 local result_offset = FindValidPositionByFan(theta, radius, 75, function(offset) local x,y,z = (pt + offset):Get() local ents = TheSim:FindEntities(x,y,z , 1) return not next(ents) end) if result_offset then local tentacle = SpawnPrefab("marblepillar") tentacle.Transform:SetPosition((pt + result_offset):Get()) GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40) end inst.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup") end end) TheInput:AddKeyUpHandler(KEY_F12, function() local player = GetPlayer() local range = 30 local pos = Vector3(player.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, range) for k,v in pairs(ents) do if v.prefab == "marblepillar" then v:Remove() end end inst.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup") end) 即可在开阔的空地上按键盘F11键,建造一圈大理石围墙,按F12键可消去。对围墙按鼠标左键可开门,5秒后自动关门,夜晚自动启动照明系统,用作自宅围墙或圈养动物都适宜。注意不要拿着镐点围墙,除非你想获得大理石

2025/04/23 · Bny

YN187-高压电避难所(按小键盘加号键筑一圈带高压电的玄武岩墙,按减号键消失)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一八七.高压电避难所(按小键盘加号键筑一圈带高压电的玄武岩墙,按减号键消失) 1.用MT管理器打开游戏目录/assets/scripts/prefabs/basalt.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function OnExplode(inst, target) if target and not target:HasTag("smallbird") and not target:HasTag("chester") then SpawnPrefab("lightning_rod_fx").Transform:SetPosition(inst.Transform:GetWorldPosition()) SpawnPrefab("lightning_rod_fx").Transform:SetPosition(target.Transform:GetWorldPosition()) inst.SoundEmitter:PlaySound("dontstarve/common/lightningrod") target.components.health:DoDelta(-3000) end inst:DoTaskInTime(.1, function() inst.components.mine:Reset() end ) end inst:AddComponent("mine") inst.components.mine:SetRadius(4) inst.components.mine:SetAlignment("player") inst.components.mine:SetOnExplodeFn(OnExplode) inst.components.mine:Reset() 2.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("catcher")的下一行插入以下内容: TheInput:AddKeyUpHandler(KEY_KP_PLUS, function() local player = GetPlayer() local pt = Vector3(player.Transform:GetWorldPosition()) for k = 1, 50 do local theta = 1 * 2 * PI local radius = 8 local result_offset = FindValidPositionByFan(theta, radius, 50, function(offset) local x,y,z = (pt + offset):Get() local ents = TheSim:FindEntities(x,y,z , 1) return not next(ents) end) if result_offset then local tentacle = SpawnPrefab("basalt_pillar") tentacle.Transform:SetPosition((pt + result_offset):Get()) GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40) local fx = SpawnPrefab("lightning_rod_fx") local pos = pt + result_offset fx.Transform:SetPosition(pos.x, pos.y, pos.z) end inst.SoundEmitter:PlaySound("dontstarve/common/lightningrod") end end) TheInput:AddKeyUpHandler(KEY_KP_MINUS, function() local player = GetPlayer() local range = 15 local pos = Vector3(player.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, range) for k,v in pairs(ents) do if v.prefab == "basalt_pillar" then SpawnPrefab("lightning_rod_fx").Transform:SetPosition(v.Transform:GetWorldPosition()) v:Remove() end end inst.SoundEmitter:PlaySound("dontstarve/common/lightningrod") end) 即可按小键盘加号键,在主角周围筑起一圈带高压电的玄武岩墙,怪物靠近会被电死,按小键盘减号键自动消失。注意不要离怪物太近时按加号键,会把怪物也圈进来或使墙有缺口。如果使用橙色魔杖或“瑞士手杖”(见本修改技巧),就可以自由出入各个避难所,把家具、农田放在里面,再也不怕狗和巨鹿了

2025/04/23 · Bny

YN188-口袋蜂箱(用噩梦燃料种口袋蜂箱,放在地上飞出杀人蜂攻击敌人)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一八八.口袋蜂箱(用噩梦燃料种口袋蜂箱,放在地上飞出杀人蜂攻击敌人) 用MT管理器打开游戏目录/assets/scripts/prefabs/nightmarefuel.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local killersounds = { takeoff = "dontstarve/bee/killerbee_takeoff", attack = "dontstarve/bee/killerbee_attack", buzz = "dontstarve/bee/killerbee_fly_LP", hit = "dontstarve/bee/killerbee_hurt", death = "dontstarve/bee/killerbee_death", } local function OnDeploy (inst, pt) if GetPlayer().components.inventory:Has("goldnugget", 500) then GetPlayer().components.inventory:ConsumeByName("goldnugget", 500) local box = SpawnPrefab("nightmarefuel") box.Transform:SetPosition(pt.x, pt.y, pt.z) box.AnimState:SetBank("bee_box") box.AnimState:SetBuild("bee_box") box.AnimState:PlayAnimation("idle") box.AnimState:SetMultColour(255/255,0/255,0/255,1) box.Transform:SetScale(0.5, 0.5, 0.5) local sound = box.entity:AddSoundEmitter() local minimap = box.entity:AddMiniMapEntity() minimap:SetIcon( "beebox.png" ) box.components.inventoryitem:ChangeImageName("beebox") box:RemoveComponent("stackable") box:RemoveComponent("fuel") box:RemoveComponent("deployable") box:AddComponent("workable") box.components.workable:SetWorkAction(ACTIONS.HAMMER) box.components.workable:SetWorkLeft(3) box.components.workable:SetOnFinishCallback(function(box) SpawnPrefab("collapse_small").Transform:SetPosition(box.Transform:GetWorldPosition()) box.SoundEmitter:PlaySound("dontstarve/common/destroy_wood") box:Remove() end ) box.task = box:DoPeriodicTask(2, function(box) box.AnimState:SetBloomEffectHandle("shaders/anim.ksh") box:DoTaskInTime(1, function() box.AnimState:SetBloomEffectHandle("") end ) local pos = Vector3(box.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 30) for k,v in pairs(ents) do if v.components.health and not v.components.health:IsDead() and not v:HasTag("player") then if v.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == v or v:HasTag("monster") or v.prefab == "beefalo" or v.prefab == "bunnyman" or v.prefab == "pigman" or v.prefab == "pigguard" or v.prefab == "merm" or v.prefab == "monkey" or v.prefab == "tallbird" or v.prefab == "walrus" or v.prefab == "little_walrus" or v.prefab == "wasphive" then local pt1 = box:GetPosition() local killerbee = SpawnPrefab("nightmarefuel") killerbee.Transform:SetPosition(pt1.x, pt1.y, pt1.z) killerbee.AnimState:SetBank("bee") killerbee.AnimState:SetBuild("bee_angry_build") killerbee.AnimState:PlayAnimation("idle") killerbee.AnimState:SetRayTestOnBB(true) killerbee.AnimState:SetMultColour(255/255,255/255,255/255,1) killerbee.entity:AddSoundEmitter() killerbee.entity:AddLightWatcher() killerbee.entity:AddDynamicShadow() killerbee.DynamicShadow:SetSize( .8, .5 ) killerbee.Transform:SetFourFaced() MakeCharacterPhysics(killerbee, 1, .3) killerbee.Physics:SetCollisionGroup(COLLISION.FLYERS) killerbee.Physics:ClearCollisionMask() killerbee.Physics:CollidesWith(COLLISION.WORLD) killerbee.Physics:CollidesWith(COLLISION.FLYERS) killerbee:AddTag("killerbee") killerbee:AddComponent("locomotor") killerbee.components.locomotor:EnableGroundSpeedMultiplier(false) killerbee.components.locomotor:SetTriggersCreep(false) killerbee:SetStateGraph("SGbee") killerbee:AddComponent("health") killerbee.components.health:SetMaxHealth(200) killerbee:AddComponent("combat") killerbee.components.combat:SetTarget(v) killerbee.components.combat:SetDefaultDamage(20) killerbee.components.combat:SetAttackPeriod(0.1) killerbee.components.combat.hiteffectsymbol = "body" killerbee.components.combat:SetRetargetFunction(1, function(killerbee) if not killerbee.components.health:IsDead() then return FindEntity(box, 30, function(guy) if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") then return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") or guy.prefab == "beefalo" or guy.prefab == "bunnyman" or guy.prefab == "pigman" or guy.prefab == "pigguard" or guy.prefab == "merm" or guy.prefab == "monkey" or guy.prefab == "tallbird" or guy.prefab == "walrus" or guy.prefab == "little_walrus" or guy.prefab == "wasphive" end end) end end ) local killerbrain = require("brains/killerbeebrain") killerbee:SetBrain(killerbrain) killerbee.sounds = killersounds killerbee:AddComponent("knownlocations") killerbee:ListenForEvent("attacked", function(killerbee, data) killerbee.components.combat:SetTarget(data.attacker) end ) killerbee:RemoveComponent("stackable") killerbee:RemoveComponent("fuel") killerbee:RemoveComponent("deployable") killerbee:RemoveComponent("inventoryitem") killerbee:DoTaskInTime(30, function() killerbee:Remove() end ) v:ListenForEvent("death", function() killerbee:Remove() end ) end end end end ) box.components.inventoryitem:SetOnPutInInventoryFn(function(box) box:RemoveTag("doings") if box.task then box.task:Cancel() box.task = nil end local pos = Vector3(box.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000) for k,v in pairs(ents) do if v:HasTag("killerbee") then v:Remove() end end end ) box.components.inventoryitem:SetOnDroppedFn(function(box) box:AddTag("doings") box.task = box:DoPeriodicTask(2, function(box) box.AnimState:SetBloomEffectHandle("shaders/anim.ksh") box:DoTaskInTime(1, function() box.AnimState:SetBloomEffectHandle("") end ) local pos = Vector3(box.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 30) for k,v in pairs(ents) do if v.components.health and not v.components.health:IsDead() and not v:HasTag("player") then if v.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == v or v:HasTag("monster") or v.prefab == "beefalo" or v.prefab == "bunnyman" or v.prefab == "pigman" or v.prefab == "pigguard" or v.prefab == "merm" or v.prefab == "monkey" or v.prefab == "tallbird" or v.prefab == "walrus" or v.prefab == "little_walrus" or v.prefab == "wasphive" then local pt1 = box:GetPosition() local killerbee = SpawnPrefab("nightmarefuel") killerbee.Transform:SetPosition(pt1.x, pt1.y, pt1.z) killerbee.AnimState:SetBank("bee") killerbee.AnimState:SetBuild("bee_angry_build") killerbee.AnimState:PlayAnimation("idle") killerbee.AnimState:SetRayTestOnBB(true) killerbee.AnimState:SetMultColour(255/255,255/255,255/255,1) killerbee.entity:AddSoundEmitter() killerbee.entity:AddLightWatcher() killerbee.entity:AddDynamicShadow() killerbee.DynamicShadow:SetSize( .8, .5 ) killerbee.Transform:SetFourFaced() MakeCharacterPhysics(killerbee, 1, .3) killerbee.Physics:SetCollisionGroup(COLLISION.FLYERS) killerbee.Physics:ClearCollisionMask() killerbee.Physics:CollidesWith(COLLISION.WORLD) killerbee.Physics:CollidesWith(COLLISION.FLYERS) killerbee:AddTag("killerbee") killerbee:AddComponent("locomotor") killerbee.components.locomotor:EnableGroundSpeedMultiplier(false) killerbee.components.locomotor:SetTriggersCreep(false) killerbee:SetStateGraph("SGbee") killerbee:AddComponent("health") killerbee.components.health:SetMaxHealth(200) killerbee:AddComponent("combat") killerbee.components.combat:SetTarget(v) killerbee.components.combat:SetDefaultDamage(20) killerbee.components.combat:SetAttackPeriod(0.1) killerbee.components.combat.hiteffectsymbol = "body" killerbee.components.combat:SetRetargetFunction(1, function(killerbee) if not killerbee.components.health:IsDead() then return FindEntity(box, 30, function(guy) if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") then return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") or guy.prefab == "beefalo" or guy.prefab == "bunnyman" or guy.prefab == "pigman" or guy.prefab == "pigguard" or guy.prefab == "merm" or guy.prefab == "monkey" or guy.prefab == "tallbird" or guy.prefab == "walrus" or guy.prefab == "little_walrus" or guy.prefab == "wasphive" end end) end end ) local killerbrain = require("brains/killerbeebrain") killerbee:SetBrain(killerbrain) killerbee.sounds = killersounds killerbee:AddComponent("knownlocations") killerbee:ListenForEvent("attacked", function(killerbee, data) killerbee.components.combat:SetTarget(data.attacker) end ) killerbee:RemoveComponent("stackable") killerbee:RemoveComponent("fuel") killerbee:RemoveComponent("deployable") killerbee:RemoveComponent("inventoryitem") killerbee:DoTaskInTime(30, function() killerbee:Remove() end ) v:ListenForEvent("death", function() killerbee:Remove() end ) end end end end ) end ) box:AddTag("doings") box:AddTag("boxs") end inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("boxs") then data.boxs = true end if inst:HasTag("doings") then data.doings = true end if inst:HasTag("killerbee") then data.killerbee = true end end local function onload(inst, data) if data and data.boxs then inst.AnimState:SetBank("bee_box") inst.AnimState:SetBuild("bee_box") inst.AnimState:PlayAnimation("idle") inst.AnimState:SetMultColour(255/255,0/255,0/255,1) inst.Transform:SetScale(0.5, 0.5, 0.5) local sound = inst.entity:AddSoundEmitter() local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon( "beebox.png" ) inst.components.inventoryitem:ChangeImageName("beebox") inst:RemoveComponent("stackable") inst:RemoveComponent("fuel") inst:RemoveComponent("deployable") inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.HAMMER) inst.components.workable:SetWorkLeft(3) inst.components.workable:SetOnFinishCallback(function(inst) SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition()) inst.SoundEmitter:PlaySound("dontstarve/common/destroy_wood") inst:Remove() end ) inst.components.inventoryitem:SetOnPutInInventoryFn(function(inst) inst:RemoveTag("doings") if inst.task then inst.task:Cancel() inst.task = nil end local pos = Vector3(inst.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000) for k,v in pairs(ents) do if v:HasTag("killerbee") then v:Remove() end end end ) inst.components.inventoryitem:SetOnDroppedFn(function(inst) inst:AddTag("doings") inst.task = inst:DoPeriodicTask(2, function(inst) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:DoTaskInTime(1, function() inst.AnimState:SetBloomEffectHandle("") end ) local pos = Vector3(inst.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 30) for k,v in pairs(ents) do if v.components.health and not v.components.health:IsDead() and not v:HasTag("player") then if v.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == v or v:HasTag("monster") or v.prefab == "beefalo" or v.prefab == "bunnyman" or v.prefab == "pigman" or v.prefab == "pigguard" or v.prefab == "merm" or v.prefab == "monkey" or v.prefab == "tallbird" or v.prefab == "walrus" or v.prefab == "little_walrus" or v.prefab == "wasphive" then local pt1 = inst:GetPosition() local killerbee = SpawnPrefab("nightmarefuel") killerbee.Transform:SetPosition(pt1.x, pt1.y, pt1.z) killerbee.AnimState:SetBank("bee") killerbee.AnimState:SetBuild("bee_angry_build") killerbee.AnimState:PlayAnimation("idle") killerbee.AnimState:SetRayTestOnBB(true) killerbee.AnimState:SetMultColour(255/255,255/255,255/255,1) killerbee.entity:AddSoundEmitter() killerbee.entity:AddLightWatcher() killerbee.entity:AddDynamicShadow() killerbee.DynamicShadow:SetSize( .8, .5 ) killerbee.Transform:SetFourFaced() MakeCharacterPhysics(killerbee, 1, .3) killerbee.Physics:SetCollisionGroup(COLLISION.FLYERS) killerbee.Physics:ClearCollisionMask() killerbee.Physics:CollidesWith(COLLISION.WORLD) killerbee.Physics:CollidesWith(COLLISION.FLYERS) killerbee:AddTag("killerbee") killerbee:AddComponent("locomotor") killerbee.components.locomotor:EnableGroundSpeedMultiplier(false) killerbee.components.locomotor:SetTriggersCreep(false) killerbee:SetStateGraph("SGbee") killerbee:AddComponent("health") killerbee.components.health:SetMaxHealth(200) killerbee:AddComponent("combat") killerbee.components.combat:SetTarget(v) killerbee.components.combat:SetDefaultDamage(20) killerbee.components.combat:SetAttackPeriod(0.1) killerbee.components.combat.hiteffectsymbol = "body" killerbee.components.combat:SetRetargetFunction(1, function(killerbee) if not killerbee.components.health:IsDead() then return FindEntity(inst, 30, function(guy) if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") then return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") or guy.prefab == "beefalo" or guy.prefab == "bunnyman" or guy.prefab == "pigman" or guy.prefab == "pigguard" or guy.prefab == "merm" or guy.prefab == "monkey" or guy.prefab == "tallbird" or guy.prefab == "walrus" or guy.prefab == "little_walrus" or guy.prefab == "wasphive" end end) end end ) local killerbrain = require("brains/killerbeebrain") killerbee:SetBrain(killerbrain) killerbee.sounds = killersounds killerbee:AddComponent("knownlocations") killerbee:ListenForEvent("attacked", function(killerbee, data) killerbee.components.combat:SetTarget(data.attacker) end ) killerbee:RemoveComponent("stackable") killerbee:RemoveComponent("fuel") killerbee:RemoveComponent("deployable") killerbee:RemoveComponent("inventoryitem") killerbee:DoTaskInTime(30, function() killerbee:Remove() end ) v:ListenForEvent("death", function() killerbee:Remove() end ) end end end end ) end ) inst:AddTag("boxs") end if data and data.doings then inst.task = inst:DoPeriodicTask(2, function(inst) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:DoTaskInTime(1, function() inst.AnimState:SetBloomEffectHandle("") end ) local pos = Vector3(inst.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 30) for k,v in pairs(ents) do if v.components.health and not v.components.health:IsDead() and not v:HasTag("player") then if v.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == v or v:HasTag("monster") or v.prefab == "beefalo" or v.prefab == "bunnyman" or v.prefab == "pigman" or v.prefab == "pigguard" or v.prefab == "merm" or v.prefab == "monkey" or v.prefab == "tallbird" or v.prefab == "walrus" or v.prefab == "little_walrus" or v.prefab == "wasphive" then local pt1 = inst:GetPosition() local killerbee = SpawnPrefab("nightmarefuel") killerbee.Transform:SetPosition(pt1.x, pt1.y, pt1.z) killerbee.AnimState:SetBank("bee") killerbee.AnimState:SetBuild("bee_angry_build") killerbee.AnimState:PlayAnimation("idle") killerbee.AnimState:SetRayTestOnBB(true) killerbee.AnimState:SetMultColour(255/255,255/255,255/255,1) killerbee.entity:AddSoundEmitter() killerbee.entity:AddLightWatcher() killerbee.entity:AddDynamicShadow() killerbee.DynamicShadow:SetSize( .8, .5 ) killerbee.Transform:SetFourFaced() MakeCharacterPhysics(killerbee, 1, .3) killerbee.Physics:SetCollisionGroup(COLLISION.FLYERS) killerbee.Physics:ClearCollisionMask() killerbee.Physics:CollidesWith(COLLISION.WORLD) killerbee.Physics:CollidesWith(COLLISION.FLYERS) killerbee:AddTag("killerbee") killerbee:AddComponent("locomotor") killerbee.components.locomotor:EnableGroundSpeedMultiplier(false) killerbee.components.locomotor:SetTriggersCreep(false) killerbee:SetStateGraph("SGbee") killerbee:AddComponent("health") killerbee.components.health:SetMaxHealth(200) killerbee:AddComponent("combat") killerbee.components.combat:SetTarget(v) killerbee.components.combat:SetDefaultDamage(20) killerbee.components.combat:SetAttackPeriod(0.1) killerbee.components.combat.hiteffectsymbol = "body" killerbee.components.combat:SetRetargetFunction(1, function(killerbee) if not killerbee.components.health:IsDead() then return FindEntity(inst, 30, function(guy) if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") then return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") or guy.prefab == "beefalo" or guy.prefab == "bunnyman" or guy.prefab == "pigman" or guy.prefab == "pigguard" or guy.prefab == "merm" or guy.prefab == "monkey" or guy.prefab == "tallbird" or guy.prefab == "walrus" or guy.prefab == "little_walrus" or guy.prefab == "wasphive" end end) end end ) local killerbrain = require("brains/killerbeebrain") killerbee:SetBrain(killerbrain) killerbee.sounds = killersounds killerbee:AddComponent("knownlocations") killerbee:ListenForEvent("attacked", function(killerbee, data) killerbee.components.combat:SetTarget(data.attacker) end ) killerbee:RemoveComponent("stackable") killerbee:RemoveComponent("fuel") killerbee:RemoveComponent("deployable") killerbee:RemoveComponent("inventoryitem") killerbee:DoTaskInTime(30, function() killerbee:Remove() end ) v:ListenForEvent("death", function() killerbee:Remove() end ) end end end end ) inst:AddTag("doings") end if data and data.killerbee then inst:Remove() end end inst.OnSave = onsave inst.OnLoad = onload 即可在攒够500个黄金时,用噩梦燃料种口袋蜂箱,将消费500个黄金,身上黄金数不足时不会种出来。蜂箱放在地上时,如果周围有敌人,会不断飞出杀人蜂攻击敌人,直至敌人死亡为止,且杀人蜂不会攻击主角及同伴(不包括猪人、兔人)。鼠标左键点口袋蜂箱,可将其放入物品栏,显示为蜂箱的图标,所有飞出的杀人蜂将消失。口袋蜂箱类似于导弹防御系统,既可以帮助主角作战,也可以保护基地,无论周围有多少敌人,都会派出足够数量的杀人蜂去攻击,因此只种一个即可,否则对电脑硬件要求较高。可以通过小地图查询口袋蜂箱的位置,显示为蜂箱的图标。不想要口袋蜂箱时,用锤子砸掉即可

2025/04/23 · Bny

YN189-避魔圈(按键盘F9键在地上画避魔圈,任何生物靠近都将被弹开,再按F9键取消)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一八九.避魔圈(按键盘F9键在地上画避魔圈,任何生物靠近都将被弹开,再按F9键取消) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playeractionpicker")的下一行插入以下内容: TheInput:AddKeyUpHandler(KEY_F9, function() if not inst:HasTag("havelifebuoy") then inst:AddTag("havelifebuoy") inst.components.locomotor:Stop() inst.AnimState:PlayAnimation("give") inst.components.health:DoDelta(-10) GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.7, 0.02, .5, 40) GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") SpawnPrefab("groundpoundring_fx").Transform:SetPosition(inst.Transform:GetWorldPosition()) SpawnPrefab("tauntfire_fx").Transform:SetPosition(inst.Transform:GetWorldPosition()) inst:DoTaskInTime(0.5, function() local pt = inst:GetPosition() local lifebuoy = SpawnPrefab("firesuppressor_placer") lifebuoy.Transform:SetPosition(pt.x, 0, pt.z) lifebuoy.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround ) lifebuoy.AnimState:SetLayer( LAYER_BACKGROUND ) lifebuoy.AnimState:SetSortOrder( 1 ) lifebuoy.Transform:SetScale(1.1, 1.1, 1.1) lifebuoy.AnimState:SetBloomEffectHandle("shaders/anim.ksh") lifebuoy.AnimState:SetMultColour(255/255,0/255,0/255,1) lifebuoy.persists = false lifebuoy:DoPeriodicTask(0.3, function() local pos = Vector3(lifebuoy.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10) for k,v in pairs(ents) do if v.components.health and v.components.combat and not v.components.health:IsDead() and not v:HasTag("player") and not v:HasTag("wall") then GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") SpawnPrefab("explode_small").Transform:SetPosition(v.Transform:GetWorldPosition()) v.components.health:DoDelta(-200) local pt1 = lifebuoy:GetPosition() local pt2 = v:GetPosition() v.Transform:SetPosition((pt2.x-pt1.x)*1.5+pt2.x, 0, (pt2.z-pt1.z)*1.5+pt2.z) end end end ) lifebuoy:AddTag("NOCLICK") lifebuoy:AddTag("lifebuoy") end ) else inst:RemoveTag("havelifebuoy") inst.components.locomotor:Stop() inst.AnimState:PlayAnimation("give") GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") SpawnPrefab("tauntfire_fx").Transform:SetPosition(inst.Transform:GetWorldPosition()) local pos = Vector3(inst.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000) for k,v in pairs(ents) do if v:HasTag("lifebuoy") then v:Remove() end end end end ) 即可按键盘F9键在地上画避魔圈,主角站在圈中,任何生物靠近都将被弹开,并杀伤其生命值,再次按键盘F9键收掉避魔圈。避魔圈是一种血魔法,每画一次,主角将消耗10点生命,在生命值较低时,请勿施法

2025/04/23 · Bny

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