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

YN202-天使蝴蝶(用雨衣种天使蝴蝶,为你照亮,电击来犯之敌,可收入物品栏)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二0二.天使蝴蝶(用雨衣种天使蝴蝶,为你照亮,电击来犯之敌,可收入物品栏) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/raincoat.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function OnDeploy (inst, pt) 7 local scalewing = SpawnPrefab("raincoat") 8 scalewing.Transform:SetPosition(pt.x, pt.y, pt.z) 9 scalewing.AnimState:SetBank("butterfly") 10 scalewing.AnimState:SetBuild("butterfly_basic") 11 scalewing.AnimState:PlayAnimation("idle") 12 scalewing.AnimState:SetRayTestOnBB(true); 13 scalewing.Transform:SetTwoFaced() 14 scalewing.Transform:SetScale(1.5, 1.5, 1.5) 15 scalewing.AnimState:SetMultColour(255/255,0/255,115/255,0.8) 16 scalewing.AnimState:SetBloomEffectHandle("shaders/anim.ksh") 17 scalewing.entity:AddSoundEmitter() 18 local shadow = scalewing.entity:AddDynamicShadow() 19 shadow:SetSize(.8, .5) 20 RemovePhysicsColliders(scalewing) 21 scalewing.entity:AddLight() 22 scalewing.Light:SetFalloff(1) 23 scalewing.Light:SetIntensity(.8) 24 scalewing.Light:SetRadius(12) 25 scalewing.Light:SetColour(180/255, 195/255, 50/255) 26 scalewing.Light:Enable(true) 27 scalewing:RemoveComponent("inventoryitem") 28 scalewing:RemoveComponent("equippable") 29 scalewing:RemoveComponent("waterproofer") 30 scalewing:RemoveComponent("fueled") 31 scalewing:RemoveComponent("insulator") 32 scalewing:RemoveComponent("deployable") 33 scalewing:AddComponent("inventoryitem") 34 scalewing.components.inventoryitem:ChangeImageName("butterfly") 35 scalewing:AddComponent("named") 36 scalewing.components.named:SetName("Butterfly") 37 scalewing:AddComponent("follower") 38 scalewing.components.follower:SetLeader(GetPlayer()) 39 scalewing:AddComponent("locomotor") 40 scalewing.components.locomotor.walkspeed = 8 41 scalewing:SetStateGraph("SGbutterfly") 42 local brain = require "brains/abigailbrain" 43 scalewing:SetBrain(brain) 44 scalewing:AddComponent("health") 45 scalewing.components.health:SetMaxHealth(10) 46 scalewing.components.health:SetInvincible(true) 47 scalewing:AddComponent("combat") 48 scalewing.components.combat:SetDefaultDamage(0) 49 scalewing.components.combat:SetRange(2) 50 scalewing.components.combat:SetAttackPeriod(0.5) 51 scalewing.components.combat:SetRetargetFunction(1, function(scalewing) 52 if not scalewing.components.health:IsDead() then 53 return FindEntity(GetPlayer(), 20, function(guy) 54 if guy.components.health and not guy.components.health:IsDead() then 55 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy.components.combat.target == scalewing or scalewing.components.combat.target == guy or guy:HasTag("monster") 56 end 57 end) 58 end 59 end ) 60 scalewing.components.combat:SetKeepTargetFunction(function(scalewing, target) return target and target:IsValid() end ) 61 scalewing:AddTag("duty") 62 scalewing.task = scalewing:DoPeriodicTask(0.5, function(scalewing) 63 local target = FindEntity(scalewing, 3, function(guy) 64 if guy.components.health and not guy.components.health:IsDead() then 65 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy.components.combat.target == scalewing or scalewing.components.combat.target == guy or guy:HasTag("monster") 66 end 67 end ) 68 if target then 69 if target.components.combat then target.components.combat:SetTarget(scalewing) end 70 if target.components.locomotor then target.components.locomotor:Stop() end 71 SpawnPrefab("lightning_rod_fx").Transform:SetPosition(target.Transform:GetWorldPosition()) 72 scalewing.SoundEmitter:PlaySound("dontstarve/common/lightningrod") 73 target.components.health:DoDelta(-100) 74 end 75 end ) 76 scalewing.components.inventoryitem:SetOnDroppedFn(function(scalewing) 77 scalewing:AddTag("duty") 78 scalewing.Light:Enable(true) 79 scalewing.task = scalewing:DoPeriodicTask(0.5, function(scalewing) 80 local target = FindEntity(scalewing, 3, function(guy) 81 if guy.components.health and not guy.components.health:IsDead() then 82 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy.components.combat.target == scalewing or scalewing.components.combat.target == guy or guy:HasTag("monster") 83 end 84 end ) 85 if target then 86 if target.components.combat then target.components.combat:SetTarget(scalewing) end 87 if target.components.locomotor then target.components.locomotor:Stop() end 88 SpawnPrefab("lightning_rod_fx").Transform:SetPosition(target.Transform:GetWorldPosition()) 89 scalewing.SoundEmitter:PlaySound("dontstarve/common/lightningrod") 90 target.components.health:DoDelta(-100) 91 end 92 end ) 93 end ) 94 scalewing.components.inventoryitem:SetOnPickupFn(function(scalewing) 95 scalewing:RemoveTag("duty") 96 scalewing.Light:Enable(false) 97 if scalewing.task then scalewing.task:Cancel() scalewing.task = nil end 98 end ) 99 scalewing.components.inventoryitem:SetOnPutInInventoryFn(function(scalewing) 100 scalewing:RemoveTag("duty") 101 scalewing.Light:Enable(false) 102 if scalewing.task then scalewing.task:Cancel() scalewing.task = nil end 103 end ) 104 scalewing:AddTag("scalewings") 105 inst:Remove() 106end 107 inst:AddComponent("deployable") 108 inst.components.deployable.ondeploy = OnDeploy 109local function onsave(inst, data) 110 if inst:HasTag("scalewings") then 111 data.scalewings = true 112 end 113 if inst:HasTag("duty") then 114 data.duty = true 115 end 116end 117local function onload(inst, data) 118 if data and data.scalewings then 119 inst.AnimState:SetBank("butterfly") 120 inst.AnimState:SetBuild("butterfly_basic") 121 inst.AnimState:PlayAnimation("idle") 122 inst.AnimState:SetRayTestOnBB(true); 123 inst.Transform:SetTwoFaced() 124 inst.Transform:SetScale(1.5, 1.5, 1.5) 125 inst.AnimState:SetMultColour(255/255,0/255,115/255,0.8) 126 inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") 127 inst.entity:AddSoundEmitter() 128 local shadow = inst.entity:AddDynamicShadow() 129 shadow:SetSize(.8, .5) 130 RemovePhysicsColliders(inst) 131 inst.entity:AddLight() 132 inst.Light:SetFalloff(1) 133 inst.Light:SetIntensity(.8) 134 inst.Light:SetRadius(12) 135 inst.Light:SetColour(180/255, 195/255, 50/255) 136 inst.Light:Enable(true) 137 inst:RemoveComponent("inventoryitem") 138 inst:RemoveComponent("equippable") 139 inst:RemoveComponent("waterproofer") 140 inst:RemoveComponent("fueled") 141 inst:RemoveComponent("insulator") 142 inst:RemoveComponent("deployable") 143 inst:AddComponent("inventoryitem") 144 inst.components.inventoryitem:ChangeImageName("butterfly") 145 inst:AddComponent("named") 146 inst.components.named:SetName("Butterfly") 147 inst:AddComponent("follower") 148 inst.components.follower:SetLeader(GetPlayer()) 149 inst:AddComponent("locomotor") 150 inst.components.locomotor.walkspeed = 8 151 inst:SetStateGraph("SGbutterfly") 152 local brain = require "brains/abigailbrain" 153 inst:SetBrain(brain) 154 inst:AddComponent("health") 155 inst.components.health:SetMaxHealth(10) 156 inst.components.health:SetInvincible(true) 157 inst:AddComponent("combat") 158 inst.components.combat:SetDefaultDamage(0) 159 inst.components.combat:SetRange(2) 160 inst.components.combat:SetAttackPeriod(0.5) 161 inst.components.combat:SetRetargetFunction(1, function(inst) 162 if not inst.components.health:IsDead() then 163 return FindEntity(GetPlayer(), 20, function(guy) 164 if guy.components.health and not guy.components.health:IsDead() then 165 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy.components.combat.target == inst or inst.components.combat.target == guy or guy:HasTag("monster") 166 end 167 end) 168 end 169 end ) 170 inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) 171 inst.components.inventoryitem:SetOnDroppedFn(function(inst) 172 inst:AddTag("duty") 173 inst.Light:Enable(true) 174 inst.task = inst:DoPeriodicTask(0.5, function(inst) 175 local target = FindEntity(inst, 3, function(guy) 176 if guy.components.health and not guy.components.health:IsDead() then 177 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy.components.combat.target == inst or inst.components.combat.target == guy or guy:HasTag("monster") 178 end 179 end ) 180 if target then 181 if target.components.combat then target.components.combat:SetTarget(inst) end 182 if target.components.locomotor then target.components.locomotor:Stop() end 183 SpawnPrefab("lightning_rod_fx").Transform:SetPosition(target.Transform:GetWorldPosition()) 184 inst.SoundEmitter:PlaySound("dontstarve/common/lightningrod") 185 target.components.health:DoDelta(-100) 186 end 187 end ) 188 end ) 189 inst.components.inventoryitem:SetOnPickupFn(function(inst) 190 inst:RemoveTag("duty") 191 inst.Light:Enable(false) 192 if inst.task then inst.task:Cancel() inst.task = nil end 193 end ) 194 inst.components.inventoryitem:SetOnPutInInventoryFn(function(inst) 195 inst:RemoveTag("duty") 196 inst.Light:Enable(false) 197 if inst.task then inst.task:Cancel() inst.task = nil end 198 end ) 199 inst:AddTag("scalewings") 200 end 201 if data and data.duty then 202 inst:AddTag("duty") 203 inst.task = inst:DoPeriodicTask(0.5, function(inst) 204 local target = FindEntity(inst, 3, function(guy) 205 if guy.components.health and not guy.components.health:IsDead() then 206 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy.components.combat.target == inst or inst.components.combat.target == guy or guy:HasTag("monster") 207 end 208 end ) 209 if target then 210 if target.components.combat then target.components.combat:SetTarget(inst) end 211 if target.components.locomotor then target.components.locomotor:Stop() end 212 SpawnPrefab("lightning_rod_fx").Transform:SetPosition(target.Transform:GetWorldPosition()) 213 inst.SoundEmitter:PlaySound("dontstarve/common/lightningrod") 214 target.components.health:DoDelta(-100) 215 end 216 end ) 217 end 218end 219 inst.OnSave = onsave 220 inst.OnLoad = onload 221 222 即可用雨衣种天使蝴蝶,会跟随你,为你照亮。任何企图攻击你的敌人,都会遭到天使蝴蝶的电击,杀伤其生命值,并阻止其靠近你。鼠标左键点击天使蝴蝶,可收入物品栏,显示为蝴蝶图标。不想要天使蝴蝶了,在物品栏中对其按鼠标右键即可。雨衣在穿戴选项(画着礼帽)下,用2个触手皮、2个绳子、2个硬骨头制造

2025/04/23 · Bny

YN203-宠物熊(用黄色护身符种宠物熊,是战场好帮手,左键点击可停在原地,喂大肉可补血)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二0三.宠物熊(用黄色护身符种宠物熊,是战场好帮手,左键点击可停在原地,喂大肉可补血) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/amulet.lua文件,在inst.AnimState:PlayAnimation("yellowamulet")的下一行插入以下内容: 5 6local function SetStandState(inst, state) 7 inst.StandState = string.lower(state) 8end 9local function OnDeploy (inst, pt) 10 local mybear = SpawnPrefab("yellowamulet") 11 mybear.Transform:SetPosition(pt.x, pt.y, pt.z) 12 mybear.AnimState:SetBank("bearger") 13 mybear.AnimState:SetBuild("bearger_build") 14 mybear.AnimState:PlayAnimation("idle_loop", true) 15 mybear.Transform:SetScale(0.5, 0.5, 0.5) 16 mybear.Transform:SetFourFaced() 17 local sound = mybear.entity:AddSoundEmitter() 18 local shadow = mybear.entity:AddDynamicShadow() 19 shadow:SetSize(3, 1.8) 20 MakeCharacterPhysics(mybear, 500, 1) 21 mybear:RemoveComponent("equippable") 22 mybear:RemoveComponent("inventoryitem") 23 mybear:RemoveComponent("fueled") 24 mybear:RemoveComponent("deployable") 25 SetStandState(mybear, "QUAD") 26 mybear.CanGroundPound = false 27 mybear.SetStandState = SetStandState 28 mybear.IsStandState = function(mybear, state) 29 return mybear.StandState == string.lower(state) 30 end 31 mybear.WorkEntities = function(mybear) 32 mybear.SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") 33 GetPlayer().components.playercontroller:ShakeCamera(mybear, "FULL", 0.5, 0.05, 2, 40) 34 end 35 mybear:AddComponent("groundpounder") 36 mybear.components.groundpounder.destroyer = true 37 mybear.components.groundpounder.damageRings = 3 38 mybear.components.groundpounder.destructionRings = 4 39 mybear.components.groundpounder.numRings = 5 40 mybear:AddComponent("named") 41 mybear.components.named:SetName("My Bear") 42 mybear:AddComponent("inventory") 43 mybear:AddComponent("knownlocations") 44 mybear:AddComponent("timer") 45 mybear:AddComponent("eater") 46 mybear.components.eater.foodprefs = {"MEAT"} 47 mybear:AddComponent("follower") 48 mybear.components.follower:SetLeader(GetPlayer()) 49 mybear:AddComponent("lootdropper") 50 mybear.components.lootdropper:SetLoot({"meat", "meat", "meat", "meat", "bearger_fur"}) 51 mybear:AddComponent("health") 52 mybear.components.health:SetMaxHealth(10000) 53 mybear:AddComponent("combat") 54 mybear.components.combat:SetDefaultDamage(300) 55 mybear.components.combat:SetAttackPeriod(0.5) 56 mybear.components.combat.hiteffectsymbol = "bearger_body" 57 mybear.components.combat:SetAreaDamage(4, 1) 58 mybear.components.combat.playerdamagepercent = 0 59 mybear.components.combat:SetRange(2, 4) 60 mybear.components.combat:SetHurtSound("dontstarve_DLC001/creatures/bearger/hurt") 61 mybear.components.combat:SetRetargetFunction(1, function(mybear) 62 if not mybear.components.health:IsDead() then 63 return FindEntity(mybear, 25, function(guy) 64 if guy.components.combat then 65 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") 66 end 67 end ) 68 end 69 end ) 70 mybear.components.combat:SetKeepTargetFunction(function(mybear, target) return target and target:IsValid() end ) 71 mybear:ListenForEvent("attacked", function(mybear, data) 72 if data.attacker ~= GetPlayer() then 73 mybear.components.combat:SetTarget(data.attacker) 74 else 75 mybear.components.combat:SetTarget(nil) 76 end 77 end ) 78 mybear:AddComponent("locomotor") 79 mybear.components.locomotor.walkspeed = 15 80 mybear.components.locomotor.runspeed = 20 81 mybear.components.locomotor:SetShouldRun(true) 82 mybear:SetStateGraph("SGbearger") 83 local brain = require "brains/abigailbrain" 84 mybear:SetBrain(brain) 85 mybear:AddComponent("trader") 86 mybear.components.trader:SetAcceptTest(function(mybear, item) 87 if item.prefab == "meat" then 88 return mybear.components.health:GetPercent() < 1 89 end 90 return false 91 end ) 92 mybear.components.trader.onaccept = function(mybear, giver, item) 93 if item.prefab == "meat" then 94 mybear.components.health:DoDelta(2000) 95 end 96 end 97 mybear.components.inspectable.getstatus = function(mybear) 98 if not mybear:HasTag("stophere") then 99 mybear:AddTag("stophere") 100 mybear.components.locomotor:Stop() 101 mybear:SetBrain(nil) 102 mybear.components.follower:SetLeader(nil) 103 mybear.AnimState:PlayAnimation("sleep_loop",true) 104 else 105 mybear:RemoveTag("stophere") 106 local brain = require "brains/abigailbrain" 107 mybear:SetBrain(brain) 108 mybear:RestartBrain() 109 mybear.components.follower:SetLeader(GetPlayer()) 110 end 111 end 112 mybear:AddTag("companion") 113 mybear:AddTag("mybears") 114 inst:Remove() 115end 116 inst:AddComponent("deployable") 117 inst.components.deployable.ondeploy = OnDeploy 118local function onsave(inst, data) 119 if inst:HasTag("mybears") then 120 data.mybears = true 121 end 122 if inst:HasTag("stophere") then 123 data.stophere = true 124 end 125end 126local function onload(inst, data) 127 if data and data.mybears then 128 inst.AnimState:SetBank("bearger") 129 inst.AnimState:SetBuild("bearger_build") 130 inst.AnimState:PlayAnimation("idle_loop", true) 131 inst.Transform:SetScale(0.5, 0.5, 0.5) 132 inst.Transform:SetFourFaced() 133 local sound = inst.entity:AddSoundEmitter() 134 local shadow = inst.entity:AddDynamicShadow() 135 shadow:SetSize(3, 1.8) 136 MakeCharacterPhysics(inst, 500, 1) 137 inst:RemoveComponent("equippable") 138 inst:RemoveComponent("inventoryitem") 139 inst:RemoveComponent("fueled") 140 inst:RemoveComponent("deployable") 141 SetStandState(inst, "QUAD") 142 inst.CanGroundPound = false 143 inst.SetStandState = SetStandState 144 inst.IsStandState = function(inst, state) 145 return inst.StandState == string.lower(state) 146 end 147 inst.WorkEntities = function(inst) 148 inst.SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") 149 GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.5, 0.05, 2, 40) 150 end 151 inst:AddComponent("groundpounder") 152 inst.components.groundpounder.destroyer = true 153 inst.components.groundpounder.damageRings = 3 154 inst.components.groundpounder.destructionRings = 4 155 inst.components.groundpounder.numRings = 5 156 inst:AddComponent("named") 157 inst.components.named:SetName("My Bear") 158 inst:AddComponent("inventory") 159 inst:AddComponent("knownlocations") 160 inst:AddComponent("timer") 161 inst:AddComponent("eater") 162 inst.components.eater.foodprefs = {"MEAT"} 163 inst:AddComponent("follower") 164 inst.components.follower:SetLeader(GetPlayer()) 165 inst:AddComponent("lootdropper") 166 inst.components.lootdropper:SetLoot({"meat", "meat", "meat", "meat", "bearger_fur"}) 167 inst:AddComponent("health") 168 inst.components.health:SetMaxHealth(10000) 169 inst:AddComponent("combat") 170 inst.components.combat:SetDefaultDamage(300) 171 inst.components.combat:SetAttackPeriod(0.5) 172 inst.components.combat.hiteffectsymbol = "bearger_body" 173 inst.components.combat:SetAreaDamage(4, 1) 174 inst.components.combat.playerdamagepercent = 0 175 inst.components.combat:SetRange(2, 4) 176 inst.components.combat:SetHurtSound("dontstarve_DLC001/creatures/bearger/hurt") 177 inst.components.combat:SetRetargetFunction(1, function(inst) 178 if not inst.components.health:IsDead() then 179 return FindEntity(inst, 25, function(guy) 180 if guy.components.combat then 181 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") 182 end 183 end ) 184 end 185 end ) 186 inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) 187 inst:ListenForEvent("attacked", function(inst, data) 188 if data.attacker ~= GetPlayer() then 189 inst.components.combat:SetTarget(data.attacker) 190 else 191 inst.components.combat:SetTarget(nil) 192 end 193 end ) 194 inst:AddComponent("locomotor") 195 inst.components.locomotor.walkspeed = 15 196 inst.components.locomotor.runspeed = 20 197 inst.components.locomotor:SetShouldRun(true) 198 inst:SetStateGraph("SGbearger") 199 local brain = require "brains/abigailbrain" 200 inst:SetBrain(brain) 201 inst:AddComponent("trader") 202 inst.components.trader:SetAcceptTest(function(inst, item) 203 if item.prefab == "meat" then 204 return inst.components.health:GetPercent() < 1 205 end 206 return false 207 end ) 208 inst.components.trader.onaccept = function(inst, giver, item) 209 if item.prefab == "meat" then 210 inst.components.health:DoDelta(2000) 211 end 212 end 213 inst.components.inspectable.getstatus = function(inst) 214 if not inst:HasTag("stophere") then 215 inst:AddTag("stophere") 216 inst.components.locomotor:Stop() 217 inst:SetBrain(nil) 218 inst.components.follower:SetLeader(nil) 219 inst.AnimState:PlayAnimation("sleep_loop",true) 220 else 221 inst:RemoveTag("stophere") 222 local brain = require "brains/abigailbrain" 223 inst:SetBrain(brain) 224 inst:RestartBrain() 225 inst.components.follower:SetLeader(GetPlayer()) 226 end 227 end 228 inst:AddTag("companion") 229 inst:AddTag("mybears") 230 end 231 if data and data.stophere then 232 inst:AddTag("stophere") 233 inst.components.locomotor:Stop() 234 inst:SetBrain(nil) 235 inst.components.follower:SetLeader(nil) 236 inst.AnimState:PlayAnimation("sleep_loop",true) 237 end 238end 239 inst.OnSave = onsave 240 inst.OnLoad = onload 241 242 即可用黄色护身符种宠物熊,它身强力壮,是战斗时的好帮手。鼠标左键点熊,可让它停在原地,再次点击可继续跟随。给宠物熊大肉(拿着大肉对其点鼠标左键),可为它补血,最多5块可补满。不想要宠物熊了,杀死即可(按Ctrl + 鼠标左键攻击),它不会还手。宠物熊行走时会撞碎阻挡的建筑、植物,所以不要让它离你的基地太近。黄色护身符在远古选项(画着远古祭坛)下,用2个铥矿石、3个噩梦燃料、1个黄色宝石制造

2025/04/23 · Bny

YN204-宠物蜻蜓(用蜻蜓盔甲种宠物蜻蜓,攻击力超强,鼠标右键点击可帮你捡地上的物品)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二0四.宠物蜻蜓(用蜻蜓盔甲种宠物蜻蜓,攻击力超强,鼠标右键点击可帮你捡地上的物品) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/armor_dragonfly.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function OnDeploy (inst, pt) 7 local myfly = SpawnPrefab("armordragonfly") 8 myfly.Transform:SetPosition(pt.x, pt.y, pt.z) 9 myfly.AnimState:SetBank("dragonfly") 10 myfly.AnimState:SetBuild("dragonfly_build") 11 myfly.AnimState:PlayAnimation("idle", true) 12 myfly.Transform:SetScale(0.5, 0.5, 0.5) 13 myfly.Transform:SetFourFaced() 14 local sound = myfly.entity:AddSoundEmitter() 15 local shadow = myfly.entity:AddDynamicShadow() 16 shadow:SetSize(3, 1.8) 17 MakeCharacterPhysics(myfly, 50, 0.7) 18 local light = myfly.entity:AddLight() 19 myfly.Light:Enable(false) 20 myfly.Light:SetRadius(2) 21 myfly.Light:SetFalloff(0.5) 22 myfly.Light:SetIntensity(.75) 23 myfly.Light:SetColour(235/255,121/255,12/255) 24 myfly:RemoveComponent("inventoryitem") 25 myfly:RemoveComponent("armor") 26 myfly:RemoveComponent("equippable") 27 myfly:RemoveComponent("deployable") 28 MakeLargePropagator(myfly) 29 myfly.components.propagator.decayrate = 0 30 myfly:AddComponent("groundpounder") 31 myfly.components.groundpounder.numRings = 2 32 myfly.components.groundpounder.burner = true 33 myfly.components.groundpounder.groundpoundfx = "firesplash_fx" 34 myfly.components.groundpounder.groundpounddamagemult = .5 35 myfly.components.groundpounder.groundpoundringfx = "firering_fx" 36 myfly:AddComponent("named") 37 myfly.components.named:SetName("My Dragonfly") 38 myfly:AddComponent("inventory") 39 myfly:AddComponent("knownlocations") 40 myfly:AddComponent("follower") 41 myfly.components.follower:SetLeader(GetPlayer()) 42 myfly:AddComponent("lootdropper") 43 myfly.components.lootdropper:SetLoot({"meat", "meat", "meat", "meat", "dragon_scales"}) 44 myfly:AddComponent("health") 45 myfly.components.health:SetMaxHealth(5000) 46 myfly:AddComponent("combat") 47 myfly.components.combat:SetDefaultDamage(300) 48 myfly.components.combat:SetAttackPeriod(0.5) 49 myfly.components.combat.hiteffectsymbol = "dragonfly_body" 50 myfly.components.combat:SetAreaDamage(6, 0.8) 51 myfly.components.combat.playerdamagepercent = 0 52 myfly.components.combat:SetRange(4) 53 myfly.components.combat.battlecryenabled = false 54 myfly.components.combat:SetHurtSound("dontstarve_DLC001/creatures/dragonfly/hurt") 55 myfly.components.combat:SetRetargetFunction(1, function(myfly) 56 if not myfly.components.health:IsDead() then 57 return FindEntity(myfly, 25, function(guy) 58 if guy.components.combat then 59 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") 60 end 61 end ) 62 end 63 end ) 64 myfly.components.combat:SetKeepTargetFunction(function(myfly, target) return target and target:IsValid() end ) 65 myfly:ListenForEvent("attacked", function(myfly, data) 66 if data.attacker ~= GetPlayer() then 67 if not data.attacker:HasTag("myflys") then 68 myfly.components.combat:SetTarget(data.attacker) 69 end 70 else 71 myfly.components.health:Kill() 72 end 73 end ) 74 myfly:AddComponent("locomotor") 75 myfly.components.locomotor.walkspeed = 25 76 myfly:SetStateGraph("SGdragonfly") 77 local brain = require "brains/abigailbrain" 78 myfly:SetBrain(brain) 79 myfly:DoPeriodicTask(5, function() 80 if myfly.components.combat and not myfly.components.combat.target then 81 if myfly.fire_build then 82 myfly.sg:GoToState("flameoff") 83 end 84 if myfly.components.health and myfly.components.health:GetPercent() < 1 then 85 myfly.components.health:DoDelta(200) 86 end 87 end 88 end ) 89 myfly:AddComponent("machine") 90 myfly.components.machine.turnonfn = function() 91 myfly:AddTag("inhaling") 92 myfly.AnimState:SetBloomEffectHandle("shaders/anim.ksh") 93 myfly.task = myfly:DoPeriodicTask(.5, function(myfly) 94 local pos = Vector3(myfly.Transform:GetWorldPosition()) 95 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 15) 96 for k,v in pairs(ents) do 97 local pt1 = v:GetPosition() 98 if v.components.inventoryitem and v.components.inventoryitem.canbepickedup and v.components.inventoryitem.cangoincontainer 99 and not v.components.inventoryitem:IsHeld() and not v:HasTag("trap") and not v:HasTag("light") and not v:HasTag("blowdart") 100 and not v:HasTag("projectile") then 101 if not GetPlayer().components.inventory:IsFull() then 102 SpawnPrefab("small_puff").Transform:SetPosition(pt1.x, pt1.y, pt1.z) 103 GetPlayer().components.inventory:GiveItem(v) 104 GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") 105 end 106 end 107 end 108 end ) 109 end 110 myfly.components.machine.turnofffn = function() 111 myfly:RemoveTag("inhaling") 112 myfly.AnimState:SetBloomEffectHandle( "" ) 113 if myfly.task then myfly.task:Cancel() myfly.task = nil end 114 end 115 myfly.components.inspectable.getstatus = function(myfly) 116 if not myfly:HasTag("stophere") then 117 myfly:AddTag("stophere") 118 myfly.components.locomotor:Stop() 119 myfly:SetBrain(nil) 120 myfly.components.follower:SetLeader(nil) 121 myfly.sg:GoToState("flameoff") 122 else 123 myfly:RemoveTag("stophere") 124 local brain = require "brains/abigailbrain" 125 myfly:SetBrain(brain) 126 myfly:RestartBrain() 127 myfly.components.follower:SetLeader(GetPlayer()) 128 end 129 end 130 myfly:ListenForEvent("death", function() 131 myfly.components.machine:TurnOff() 132 end ) 133 myfly:AddTag("companion") 134 myfly:AddTag("myflys") 135 inst:Remove() 136end 137 inst:AddComponent("deployable") 138 inst.components.deployable.ondeploy = OnDeploy 139local function onsave(inst, data) 140 if inst:HasTag("myflys") then 141 data.myflys = true 142 end 143 if inst:HasTag("stophere") then 144 data.stophere = true 145 end 146 if inst:HasTag("inhaling") then 147 data.inhaling = true 148 end 149end 150local function onload(inst, data) 151 if data and data.myflys then 152 inst.AnimState:SetBank("dragonfly") 153 inst.AnimState:SetBuild("dragonfly_build") 154 inst.AnimState:PlayAnimation("idle", true) 155 inst.Transform:SetScale(0.5, 0.5, 0.5) 156 inst.Transform:SetFourFaced() 157 local sound = inst.entity:AddSoundEmitter() 158 local shadow = inst.entity:AddDynamicShadow() 159 shadow:SetSize(3, 1.8) 160 MakeCharacterPhysics(inst, 50, 0.7) 161 local light = inst.entity:AddLight() 162 inst.Light:Enable(false) 163 inst.Light:SetRadius(2) 164 inst.Light:SetFalloff(0.5) 165 inst.Light:SetIntensity(.75) 166 inst.Light:SetColour(235/255,121/255,12/255) 167 inst:RemoveComponent("inventoryitem") 168 inst:RemoveComponent("armor") 169 inst:RemoveComponent("equippable") 170 inst:RemoveComponent("deployable") 171 MakeLargePropagator(inst) 172 inst.components.propagator.decayrate = 0 173 inst:AddComponent("groundpounder") 174 inst.components.groundpounder.numRings = 2 175 inst.components.groundpounder.burner = true 176 inst.components.groundpounder.groundpoundfx = "firesplash_fx" 177 inst.components.groundpounder.groundpounddamagemult = .5 178 inst.components.groundpounder.groundpoundringfx = "firering_fx" 179 inst:AddComponent("named") 180 inst.components.named:SetName("My Dragonfly") 181 inst:AddComponent("inventory") 182 inst:AddComponent("knownlocations") 183 inst:AddComponent("follower") 184 inst.components.follower:SetLeader(GetPlayer()) 185 inst:AddComponent("lootdropper") 186 inst.components.lootdropper:SetLoot({"meat", "meat", "meat", "meat", "dragon_scales"}) 187 inst:AddComponent("health") 188 inst.components.health:SetMaxHealth(5000) 189 inst:AddComponent("combat") 190 inst.components.combat:SetDefaultDamage(300) 191 inst.components.combat:SetAttackPeriod(0.5) 192 inst.components.combat.hiteffectsymbol = "dragonfly_body" 193 inst.components.combat:SetAreaDamage(6, 0.8) 194 inst.components.combat.playerdamagepercent = 0 195 inst.components.combat:SetRange(4) 196 inst.components.combat.battlecryenabled = false 197 inst.components.combat:SetHurtSound("dontstarve_DLC001/creatures/dragonfly/hurt") 198 inst.components.combat:SetRetargetFunction(1, function(inst) 199 if not inst.components.health:IsDead() then 200 return FindEntity(inst, 25, function(guy) 201 if guy.components.combat then 202 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") 203 end 204 end ) 205 end 206 end ) 207 inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) 208 inst:ListenForEvent("attacked", function(inst, data) 209 if data.attacker ~= GetPlayer() then 210 if not data.attacker:HasTag("myflys") then 211 inst.components.combat:SetTarget(data.attacker) 212 end 213 else 214 inst.components.health:Kill() 215 end 216 end ) 217 inst:AddComponent("locomotor") 218 inst.components.locomotor.walkspeed = 25 219 inst:SetStateGraph("SGdragonfly") 220 local brain = require "brains/abigailbrain" 221 inst:SetBrain(brain) 222 inst:DoPeriodicTask(5, function() 223 if inst.components.combat and not inst.components.combat.target then 224 if inst.fire_build then 225 inst.sg:GoToState("flameoff") 226 end 227 if inst.components.health and inst.components.health:GetPercent() < 1 then 228 inst.components.health:DoDelta(200) 229 end 230 end 231 end ) 232 inst:AddComponent("machine") 233 inst.components.machine.turnonfn = function() 234 inst:AddTag("inhaling") 235 inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") 236 inst.task = inst:DoPeriodicTask(.5, function(inst) 237 local pos = Vector3(inst.Transform:GetWorldPosition()) 238 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 15) 239 for k,v in pairs(ents) do 240 local pt1 = v:GetPosition() 241 if v.components.inventoryitem and v.components.inventoryitem.canbepickedup and v.components.inventoryitem.cangoincontainer 242 and not v.components.inventoryitem:IsHeld() and not v:HasTag("trap") and not v:HasTag("light") and not v:HasTag("blowdart") 243 and not v:HasTag("projectile") then 244 if not GetPlayer().components.inventory:IsFull() then 245 SpawnPrefab("small_puff").Transform:SetPosition(pt1.x, pt1.y, pt1.z) 246 GetPlayer().components.inventory:GiveItem(v) 247 GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") 248 end 249 end 250 end 251 end ) 252 end 253 inst.components.machine.turnofffn = function() 254 inst:RemoveTag("inhaling") 255 inst.AnimState:SetBloomEffectHandle( "" ) 256 if inst.task then inst.task:Cancel() inst.task = nil end 257 end 258 inst.components.inspectable.getstatus = function(inst) 259 if not inst:HasTag("stophere") then 260 inst:AddTag("stophere") 261 inst.components.locomotor:Stop() 262 inst:SetBrain(nil) 263 inst.components.follower:SetLeader(nil) 264 inst.sg:GoToState("flameoff") 265 else 266 inst:RemoveTag("stophere") 267 local brain = require "brains/abigailbrain" 268 inst:SetBrain(brain) 269 inst:RestartBrain() 270 inst.components.follower:SetLeader(GetPlayer()) 271 end 272 end 273 inst:ListenForEvent("death", function() 274 inst.components.machine:TurnOff() 275 end ) 276 inst:AddTag("companion") 277 inst:AddTag("myflys") 278 end 279 if data and data.stophere then 280 inst:AddTag("stophere") 281 inst.components.locomotor:Stop() 282 inst:SetBrain(nil) 283 inst.components.follower:SetLeader(nil) 284 inst.sg:GoToState("flameoff") 285 end 286 if data and data.inhaling then 287 inst.components.machine.ison = true 288 inst.components.machine:TurnOn() 289 end 290end 291 inst.OnSave = onsave 292 inst.OnLoad = onload 293 294 即可用蜻蜓盔甲种宠物蜻蜓,攻击力超强,并自动补血,是战斗时的好帮手。鼠标左键点蜻蜓,可让它停在原地,再次点击可继续跟随。鼠标右键点蜻蜓,可让它帮你捡地上的东西(快速吸取至主角物品栏),再次点击可停止捡东西。不想要宠物蜻蜓了,杀死即可(按Ctrl + 鼠标左键攻击),打一下即死。宠物蜻蜓攻击时会引发火灾,所以带它战斗时不要离基地太近,也不要同时带1个以上的宠物蜻蜓去战斗,否则容易互殴。蜻蜓盔甲在战斗选项(画着两把剑)下,用1个蜻蜓鳞片、1个木盔甲、3个猪皮制造

2025/04/23 · Bny

YN205-统御战狼(按键盘X键召唤战狼,誓死护卫你,给5块疯肉升级为金刚战狼)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二0五.统御战狼(按键盘X键召唤战狼,誓死护卫你,给5块疯肉升级为金刚战狼) 3 4 1.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playercontroller")的下一行插入以下内容: 5 6TheInput:AddKeyUpHandler(KEY_X, function() 7 if inst.components.inventory:Has("goldnugget", 20) then 8 inst.components.inventory:ConsumeByName("goldnugget", 20) 9 inst.AnimState:PlayAnimation("give") 10 inst.SoundEmitter:PlaySound("dontstarve/common/horn_beefalo") 11 local mywolf = SpawnPrefab("greenamulet") 12 local pt = GetPlayer():GetPosition() 13 mywolf.Transform:SetPosition(pt.x+(math.random(3)-math.random(3)), 0, pt.z+(math.random(3)-math.random(3))) 14 mywolf.AnimState:SetBank("warg") 15 mywolf.AnimState:SetBuild("warg_build") 16 mywolf.AnimState:PlayAnimation("idle") 17 mywolf.Transform:SetScale(0.6, 0.6, 0.6) 18 mywolf.Transform:SetFourFaced() 19 local sound = mywolf.entity:AddSoundEmitter() 20 local shadow = mywolf.entity:AddDynamicShadow() 21 shadow:SetSize(1.2, 0.7) 22 MakeCharacterPhysics(mywolf, 100, 1) 23 mywolf:RemoveComponent("equippable") 24 mywolf:RemoveComponent("inventoryitem") 25 mywolf:RemoveComponent("finiteuses") 26 mywolf:RemoveComponent("deployable") 27 mywolf:AddComponent("named") 28 mywolf.components.named:SetName("Wolf") 29 mywolf:AddComponent("follower") 30 mywolf.components.follower:SetLeader(GetPlayer()) 31 mywolf:AddComponent("lootdropper") 32 mywolf.components.lootdropper:SetLoot({"monstermeat", "houndstooth"}) 33 mywolf:AddComponent("health") 34 mywolf.components.health:SetMaxHealth(1000) 35 mywolf.components.health:StartRegen(50, 10) 36 mywolf:AddComponent("combat") 37 mywolf.components.combat:SetDefaultDamage(50) 38 mywolf.components.combat:SetAttackPeriod(0.5) 39 mywolf.components.combat:SetRange(3) 40 mywolf.components.combat:SetRetargetFunction(1, function(mywolf) 41 if not mywolf.components.health:IsDead() then 42 return FindEntity(mywolf, 25, function(guy) 43 if guy.components.combat then 44 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") 45 end 46 end ) 47 end 48 end ) 49 mywolf.components.combat:SetKeepTargetFunction(function(mywolf, target) return target and target:IsValid() end ) 50 mywolf:ListenForEvent("attacked", function(mywolf, data) 51 if data.attacker ~= GetPlayer() then 52 mywolf.components.combat:SetTarget(data.attacker) 53 mywolf.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("mywolfs") and not dude.components.health:IsDead() end, 10) 54 else 55 mywolf.components.health:Kill() 56 end 57 end ) 58 mywolf:AddComponent("locomotor") 59 mywolf.components.locomotor.runspeed = 18 60 mywolf.components.locomotor:SetShouldRun(true) 61 mywolf:SetStateGraph("SGwarg") 62 local brain = require "brains/abigailbrain" 63 mywolf:SetBrain(brain) 64 mywolf:AddComponent("trader") 65 mywolf.components.trader:SetAcceptTest(function(mywolf, item) 66 if GetPlayer().components.inventory:Has("monstermeat", 5) then 67 if item.prefab == "monstermeat" then 68 if not mywolf:HasTag("superwolf") then 69 return true 70 end 71 end 72 end 73 return false 74 end ) 75 mywolf.components.trader.onaccept = function(mywolf, giver, item) 76 if item.prefab == "monstermeat" then 77 giver.components.inventory:ConsumeByName("monstermeat", 4) 78 mywolf:AddTag("superwolf") 79 mywolf.components.named:SetName("Super Wolf") 80 mywolf.AnimState:SetBloomEffectHandle("shaders/anim.ksh") 81 mywolf.Transform:SetScale(0.7, 0.7, 0.7) 82 mywolf.components.health:SetMaxHealth(2000) 83 mywolf.components.health:DoDelta(2000) 84 mywolf.components.combat:SetDefaultDamage(100) 85 mywolf.components.locomotor.runspeed = 25 86 end 87 end 88 mywolf.components.inspectable.getstatus = function(mywolf) 89 if not mywolf:HasTag("stophere") then 90 mywolf:AddTag("stophere") 91 mywolf.components.locomotor:Stop() 92 mywolf:SetBrain(nil) 93 mywolf.components.follower:SetLeader(nil) 94 else 95 mywolf:RemoveTag("stophere") 96 local brain = require "brains/abigailbrain" 97 mywolf:SetBrain(brain) 98 mywolf:RestartBrain() 99 mywolf.components.follower:SetLeader(GetPlayer()) 100 end 101 end 102 mywolf:AddTag("companion") 103 mywolf:AddTag("mywolfs") 104 end 105end ) 106 107 108 2.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/amulet.lua文件,在inst.AnimState:PlayAnimation("greenamulet")的下一行插入以下内容: 109 110local function onsave(inst, data) 111 if inst:HasTag("mywolfs") then 112 data.mywolfs = true 113 end 114 if inst:HasTag("superwolf") then 115 data.superwolf = true 116 end 117 if inst:HasTag("stophere") then 118 data.stophere = true 119 end 120end 121local function onload(inst, data) 122 if data and data.mywolfs then 123 inst.AnimState:SetBank("warg") 124 inst.AnimState:SetBuild("warg_build") 125 inst.AnimState:PlayAnimation("idle") 126 inst.Transform:SetScale(0.6, 0.6, 0.6) 127 inst.Transform:SetFourFaced() 128 local sound = inst.entity:AddSoundEmitter() 129 local shadow = inst.entity:AddDynamicShadow() 130 shadow:SetSize(1.2, 0.7) 131 MakeCharacterPhysics(inst, 100, 1) 132 inst:RemoveComponent("equippable") 133 inst:RemoveComponent("inventoryitem") 134 inst:RemoveComponent("finiteuses") 135 inst:RemoveComponent("deployable") 136 inst:AddComponent("named") 137 inst.components.named:SetName("Wolf") 138 inst:AddComponent("follower") 139 inst.components.follower:SetLeader(GetPlayer()) 140 inst:AddComponent("lootdropper") 141 inst.components.lootdropper:SetLoot({"monstermeat", "houndstooth"}) 142 inst:AddComponent("health") 143 inst.components.health:SetMaxHealth(1000) 144 inst.components.health:StartRegen(50, 10) 145 inst:AddComponent("combat") 146 inst.components.combat:SetDefaultDamage(50) 147 inst.components.combat:SetAttackPeriod(0.5) 148 inst.components.combat:SetRange(3) 149 inst.components.combat:SetRetargetFunction(1, function(inst) 150 if not inst.components.health:IsDead() then 151 return FindEntity(inst, 25, function(guy) 152 if guy.components.combat then 153 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") 154 end 155 end ) 156 end 157 end ) 158 inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) 159 inst:ListenForEvent("attacked", function(inst, data) 160 if data.attacker ~= GetPlayer() then 161 inst.components.combat:SetTarget(data.attacker) 162 inst.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("mywolfs") and not dude.components.health:IsDead() end, 10) 163 else 164 inst.components.health:Kill() 165 end 166 end ) 167 inst:AddComponent("locomotor") 168 inst.components.locomotor.runspeed = 18 169 inst.components.locomotor:SetShouldRun(true) 170 inst:SetStateGraph("SGwarg") 171 local brain = require "brains/abigailbrain" 172 inst:SetBrain(brain) 173 inst:AddComponent("trader") 174 inst.components.trader:SetAcceptTest(function(inst, item) 175 if GetPlayer().components.inventory:Has("monstermeat", 5) then 176 if item.prefab == "monstermeat" then 177 if not inst:HasTag("superwolf") then 178 return true 179 end 180 end 181 end 182 return false 183 end ) 184 inst.components.trader.onaccept = function(inst, giver, item) 185 if item.prefab == "monstermeat" then 186 giver.components.inventory:ConsumeByName("monstermeat", 4) 187 inst:AddTag("superwolf") 188 inst.components.named:SetName("Super Wolf") 189 inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") 190 inst.Transform:SetScale(0.7, 0.7, 0.7) 191 inst.components.health:SetMaxHealth(2000) 192 inst.components.health:DoDelta(2000) 193 inst.components.combat:SetDefaultDamage(100) 194 inst.components.locomotor.runspeed = 25 195 end 196 end 197 inst.components.inspectable.getstatus = function(inst) 198 if not inst:HasTag("stophere") then 199 inst:AddTag("stophere") 200 inst.components.locomotor:Stop() 201 inst:SetBrain(nil) 202 inst.components.follower:SetLeader(nil) 203 else 204 inst:RemoveTag("stophere") 205 local brain = require "brains/abigailbrain" 206 inst:SetBrain(brain) 207 inst:RestartBrain() 208 inst.components.follower:SetLeader(GetPlayer()) 209 end 210 end 211 inst:AddTag("companion") 212 inst:AddTag("mywolfs") 213 end 214 if data and data.superwolf then 215 inst:AddTag("superwolf") 216 inst.components.named:SetName("Super Wolf") 217 inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") 218 inst.Transform:SetScale(0.7, 0.7, 0.7) 219 inst.components.health:SetMaxHealth(2000) 220 inst.components.health:DoDelta(2000) 221 inst.components.combat:SetDefaultDamage(100) 222 inst.components.locomotor.runspeed = 25 223 end 224 if data and data.stophere then 225 inst:AddTag("stophere") 226 inst.components.locomotor:Stop() 227 inst:SetBrain(nil) 228 inst.components.follower:SetLeader(nil) 229 end 230end 231 inst.OnSave = onsave 232 inst.OnLoad = onload 233 234 即可按键盘X键召唤战狼,每只花费20个黄金,身上黄金数不足时无法召唤。战狼极其忠诚,会誓死护卫你,鼠标左键点击可停在原地,再次点击则继续跟随。如果想赐战狼死,用任何武器打击一下即可(按Ctrl + 鼠标左键攻击),它不会还击。战狼生命力顽强,会自动回血。当一只战狼遭到攻击时,其他战狼会围攻敌人。给战狼5块疯肉(拿着疯肉对战狼点鼠标左键),可将其升级为金刚战狼,生命值、攻击力、速度会大幅提升。统御你的战狼部队,横扫大陆吧

2025/04/23 · Bny

YN206-糖豆敢死队(按键盘T键召唤糖豆敢死队,对敌发动自杀式爆炸,鼠标左键点击可退钱)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二0六.糖豆敢死队(按键盘T键召唤糖豆敢死队,对敌发动自杀式爆炸,鼠标左键点击可退钱) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playercontroller")的下一行插入以下内容: 5 6TheInput:AddKeyUpHandler(KEY_T, function() 7 if inst.components.inventory:Has("goldnugget", 2) then 8 inst.components.inventory:ConsumeByName("goldnugget", 2) 9 inst.AnimState:PlayAnimation("give") 10 inst.SoundEmitter:PlaySound("dontstarve/HUD/research_available") 11 local bean = SpawnPrefab("goatmilk") 12 local pt = GetPlayer():GetPosition() 13 bean.Transform:SetPosition(pt.x+(math.random(3)-math.random(3)), 0, pt.z+(math.random(3)-math.random(3))) 14 SpawnPrefab("collapse_small").Transform:SetPosition(bean.Transform:GetWorldPosition()) 15 bean.AnimState:SetBank("treedrake") 16 bean.AnimState:SetBuild("treedrake_build") 17 bean.AnimState:PlayAnimation("enter") 18 bean.AnimState:SetBloomEffectHandle("shaders/anim.ksh") 19 bean.Transform:SetScale(1.2, 1.2, 1.2) 20 bean.Transform:SetFourFaced() 21 local sound = bean.entity:AddSoundEmitter() 22 local shadow = bean.entity:AddDynamicShadow() 23 shadow:SetSize(1.25, .75) 24 MakeCharacterPhysics(bean, 1, .25) 25 local colours= { {198/255,43/255,43/255}, {79/255,153/255,68/255}, {35/255,105/255,235/255}, {233/255,208/255,69/255}, {109/255,50/255,163/255}, {222/255,126/255,39/255} } 26 bean.colour_idx = math.random(#colours) 27 bean.AnimState:SetMultColour(colours[bean.colour_idx][1],colours[bean.colour_idx][2],colours[bean.colour_idx][3],1) 28 bean:RemoveComponent("edible") 29 bean:RemoveComponent("perishable") 30 bean:RemoveComponent("stackable") 31 bean:RemoveComponent("inventoryitem") 32 bean:RemoveTag("catfood") 33 bean.persists = false 34 bean:AddComponent("named") 35 bean.components.named:SetName("Jelly Bean") 36 bean:AddComponent("follower") 37 bean.components.follower:SetLeader(GetPlayer()) 38 bean:AddComponent("health") 39 bean.components.health:SetMaxHealth(10) 40 bean.components.health:SetInvincible(true) 41 bean:AddComponent("combat") 42 bean.components.combat:SetDefaultDamage(1) 43 bean.components.combat:SetAttackPeriod(2) 44 bean.components.combat:SetRange(0.5) 45 bean.components.combat:SetRetargetFunction(1, function(bean) 46 if not bean.components.health:IsDead() then 47 return FindEntity(bean, 25, function(guy) 48 if guy.components.combat then 49 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") 50 end 51 end ) 52 end 53 end ) 54 bean.components.combat:SetKeepTargetFunction(function(bean, target) return target and target:IsValid() end ) 55 bean:AddComponent("locomotor") 56 bean.components.locomotor.walkspeed = 15 57 bean:SetStateGraph("SGbirchnutdrake") 58 local brain = require "brains/abigailbrain" 59 bean:SetBrain(brain) 60 bean:DoPeriodicTask(0.25, function() 61 local pos = Vector3(bean.Transform:GetWorldPosition()) 62 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 2) 63 for k,v in pairs(ents) do 64 if v and v.components.combat and v.components.health and not v.components.health:IsDead() then 65 if v.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == v or v.components.combat.target == bean or bean.components.combat.target == v or v:HasTag("monster") then 66 GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") 67 SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition()) 68 SpawnPrefab("explode_small").Transform:SetPosition(v.Transform:GetWorldPosition()) 69 GetClock():DoLightningLighting() 70 GetPlayer().components.playercontroller:ShakeCamera(v, "FULL", 0.7, 0.02, .5, 40) 71 v.components.health:Kill() 72 bean:Remove() 73 end 74 end 75 end 76 end ) 77 bean.components.inspectable.getstatus = function(bean) 78 inst.SoundEmitter:PlaySound("dontstarve/HUD/research_available") 79 SpawnPrefab("collapse_small").Transform:SetPosition(bean.Transform:GetWorldPosition()) 80 for k = 1, 2 do 81 local goldnugget = SpawnPrefab("goldnugget") 82 inst.components.inventory:GiveItem(goldnugget) 83 end 84 bean:Remove() 85 end 86 bean:AddTag("companion") 87 bean:AddTag("beans") 88 end 89end ) 90 91 即可按键盘T键召唤糖豆敢死队,花费2个黄金,身上黄金数不足时无法召唤。糖豆敢死队员将冲向你的敌人,对其发动自杀式爆炸,并杀伤周边敌人。鼠标点击多余的糖豆敢死队员,可清退它们,换回2个黄金(放入主角物品栏)。存档退出后再读档,糖豆敢死队将离开,在之前将它们都清退掉吧

2025/04/23 · Bny

YN207-斗牛场(用牛角种斗牛场,与公牛搏斗赢奖金,观众会向场内扔额外赏金)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二0七.斗牛场(用牛角种斗牛场,与公牛搏斗赢奖金,观众会向场内扔额外赏金) 3 4 用MT管理器打开游戏目录/assets/scripts/prefabs/horn.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local sounds = 7{ 8 walk = "dontstarve/beefalo/walk", 9 grunt = "dontstarve/beefalo/grunt", 10 yell = "dontstarve/beefalo/yell", 11 swish = "dontstarve/beefalo/tail_swish", 12 curious = "dontstarve/beefalo/curious", 13 angry = "dontstarve/beefalo/angry", 14} 15local function makebullring(inst) 16 local pt = inst:GetPosition() 17 local bullring0 = SpawnPrefab("horn") 18 bullring0.Transform:SetPosition(pt.x, pt.y, pt.z) 19 bullring0.AnimState:SetBank("marble_trees") 20 bullring0.AnimState:SetBuild("marble_trees") 21 bullring0.AnimState:PlayAnimation("full_4") 22 bullring0.Transform:SetScale(1.5, 1.5, 1.5) 23 bullring0:RemoveComponent("instrument") 24 bullring0:RemoveComponent("tool") 25 bullring0:RemoveComponent("finiteuses") 26 bullring0:RemoveComponent("inventoryitem") 27 bullring0:RemoveComponent("deployable") 28 bullring0:RemoveTag("horn") 29 bullring0:AddComponent("named") 30 bullring0.components.named:SetName("Bullring") 31 local light = bullring0.entity:AddLight() 32 light:SetFalloff(1) 33 light:SetIntensity(.8) 34 light:SetRadius(15) 35 light:SetColour(180/255, 195/255, 50/255) 36 light:Enable(true) 37 bullring0:AddComponent("workable") 38 bullring0.components.workable:SetWorkAction(ACTIONS.HAMMER) 39 bullring0.components.workable:SetWorkLeft(3) 40 bullring0.components.workable:SetOnFinishCallback(function() 41 SpawnPrefab("collapse_big").Transform:SetPosition(bullring0.Transform:GetWorldPosition()) 42 GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") 43 local pos = Vector3(bullring0.Transform:GetWorldPosition()) 44 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10) 45 for k,v in pairs(ents) do 46 if v:HasTag("nobullring") then 47 v:Remove() 48 end 49 end 50 bullring0:Remove() 51 end ) 52 bullring0.components.inspectable.getstatus = function(bullring0) 53 GetPlayer().SoundEmitter:PlaySound("dontstarve/common/horn_beefalo") 54 local bullfighting = SpawnPrefab("horn") 55 bullfighting.Transform:SetPosition(pt.x+2, 0, pt.z+2) 56 bullfighting.AnimState:SetBank("beefalo") 57 bullfighting.AnimState:SetBuild("beefalo_build") 58 bullfighting.AnimState:PlayAnimation("idle_loop", true) 59 bullfighting.Transform:SetFourFaced() 60 bullfighting.Transform:SetScale(1.3, 1.3, 1.3) 61 local sound = bullfighting.entity:AddSoundEmitter() 62 bullfighting.sounds = sounds 63 local shadow = bullfighting.entity:AddDynamicShadow() 64 shadow:SetSize( 3, 1.25 ) 65 MakeCharacterPhysics(bullfighting, 200, 1.3) 66 bullfighting:RemoveComponent("instrument") 67 bullfighting:RemoveComponent("tool") 68 bullfighting:RemoveComponent("finiteuses") 69 bullfighting:RemoveComponent("inventoryitem") 70 bullfighting:RemoveComponent("deployable") 71 bullfighting:RemoveTag("horn") 72 bullfighting:AddComponent("named") 73 bullfighting.components.named:SetName("Bullfighting") 74 bullfighting:AddComponent("locomotor") 75 bullfighting.components.locomotor.walkspeed = math.random(4,6) 76 bullfighting.components.locomotor.runspeed = math.random(8,10) 77 bullfighting:SetStateGraph("SGBeefalo") 78 local brain = require "brains/leifbrain" 79 bullfighting:SetBrain(brain) 80 bullfighting:AddComponent("follower") 81 bullfighting:AddComponent("knownlocations") 82 bullfighting:AddComponent("lootdropper") 83 bullfighting.components.lootdropper:SetLoot({"meat","meat","meat","meat","meat","meat","beefalowool","beefalowool","beefalowool","beefalowool"}) 84 bullfighting.components.lootdropper:AddChanceLoot("horn", 0.1) 85 bullfighting:AddComponent("health") 86 bullfighting.components.health:SetMaxHealth(math.random(3000,7000)) 87 bullfighting:AddComponent("combat") 88 bullfighting.components.combat:SetTarget(GetPlayer()) 89 bullfighting.components.combat.hiteffectsymbol = "beefalo_body" 90 bullfighting.components.combat:SetDefaultDamage(math.random(30,70)) 91 bullfighting.components.combat:SetAttackPeriod(math.random(1,3)) 92 bullfighting.components.combat:SetRetargetFunction(1, function(bullfighting) 93 if not bullfighting.components.health:IsDead() then 94 return FindEntity(bullfighting, 200, function(guy) 95 if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("bullfighting") then 96 return guy:HasTag("player") 97 end 98 end ) 99 end 100 end ) 101 bullfighting.components.combat:SetKeepTargetFunction(function(bullfighting, target) return target and target:IsValid() end ) 102 bullfighting:ListenForEvent("death", function() 103 for k = 1, 30 do 104 local goldnugget = SpawnPrefab("goldnugget") 105 GetPlayer().components.inventory:GiveItem(goldnugget) 106 end 107 GetPlayer():StartThread(function() 108 for k = 1, math.random(3,10) do 109 GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") 110 local bounty = SpawnPrefab("goldnugget") 111 bounty.Transform:SetPosition(pt.x, pt.y, pt.z) 112 bounty.components.inventoryitem.canbepickedup = false 113 bounty:AddComponent("complexprojectile") 114 bounty.components.complexprojectile.yOffset = 2.5 115 bounty.components.complexprojectile:Launch(Point(pt.x+(math.random(6,10)-math.random(5)), 0, pt.z+(math.random(6,10)-math.random(5)))) 116 bounty.components.complexprojectile:SetOnHit(function() 117 bounty:RemoveComponent("complexprojectile") 118 bounty.components.inventoryitem.canbepickedup = true 119 end ) 120 Sleep(0.15) 121 end 122 end ) 123 end ) 124 bullfighting:DoTaskInTime(60, function() 125 if not bullfighting.components.health:IsDead() then 126 SpawnPrefab("die_fx").Transform:SetPosition(bullfighting.Transform:GetWorldPosition()) 127 GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") 128 bullfighting:Remove() 129 end 130 end ) 131 bullfighting:AddTag("bullfighting") 132 end 133 bullring0:AddTag("bullring0") 134 local bullring1 = SpawnPrefab("horn") 135 bullring1.Transform:SetPosition(pt.x+2.5, 0, pt.z-2.5) 136 bullring1.AnimState:SetBank("marble_trees") 137 bullring1.AnimState:SetBuild("marble_trees") 138 bullring1.AnimState:PlayAnimation("full_4") 139 bullring1.Transform:SetScale(0.8, 0.8, 0.8) 140 bullring1:RemoveComponent("instrument") 141 bullring1:RemoveComponent("tool") 142 bullring1:RemoveComponent("finiteuses") 143 bullring1:RemoveComponent("inventoryitem") 144 bullring1:RemoveComponent("deployable") 145 bullring1:RemoveTag("horn") 146 bullring1:AddTag("NOCLICK") 147 bullring1:AddTag("nobullring") 148 local bullring2 = SpawnPrefab("horn") 149 bullring2.Transform:SetPosition(pt.x-2.5, 0, pt.z+2.5) 150 bullring2.AnimState:SetBank("marble_trees") 151 bullring2.AnimState:SetBuild("marble_trees") 152 bullring2.AnimState:PlayAnimation("full_4") 153 bullring2.Transform:SetScale(0.8, 0.8, 0.8) 154 bullring2:RemoveComponent("instrument") 155 bullring2:RemoveComponent("tool") 156 bullring2:RemoveComponent("finiteuses") 157 bullring2:RemoveComponent("inventoryitem") 158 bullring2:RemoveComponent("deployable") 159 bullring2:RemoveTag("horn") 160 bullring2:AddTag("NOCLICK") 161 bullring2:AddTag("nobullring") 162 for k = 0,6 do 163 local audience = SpawnPrefab("horn") 164 audience.Transform:SetPosition(pt.x-2+6-k*2, 0, pt.z-2-6+k*2) 165 audience.AnimState:SetBank("wilson") 166 local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"} 167 local buildname = names[math.random(#names)] 168 audience.AnimState:SetBuild(buildname) 169 local hats = {"hat_bee","hat_beefalo","hat_bush","hat_earmuffs","hat_feather","hat_flower","hat_football","hat_miner","hat_ruins","hat_slurper","hat_slurtle","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter","hat_rain","hat_watermelon","hat_ice","hat_catcoon","hat_wathgrithr"} 170 local hat = hats[math.random(#hats)] 171 audience.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat") 172 local armors = {"armor_grass","armor_marble","armor_onemanband","armor_ruins","armor_sanity","armor_slurper","armor_slurtleshell","armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter","armor_wood","torso_rain"} 173 local armor = armors[math.random(#armors)] 174 audience.AnimState:OverrideSymbol("swap_body", armor, "swap_body") 175 audience.AnimState:Show("HAT") 176 audience.AnimState:Show("HAT_HAIR") 177 audience.AnimState:Hide("HAIR_NOHAT") 178 audience.AnimState:Hide("HAIR") 179 audience.AnimState:Hide("ARM_carry") 180 audience.AnimState:Show("ARM_normal") 181 local stories = {"idle","hungry","eat","dart","throw","atk","idle_onemanband1_loop","run_pst","item_hat","give"} 182 local story = stories[math.random(#stories)] 183 audience.AnimState:PlayAnimation(story,true) 184 audience.Transform:SetFourFaced() 185 audience:RemoveComponent("instrument") 186 audience:RemoveComponent("tool") 187 audience:RemoveComponent("finiteuses") 188 audience:RemoveComponent("inventoryitem") 189 audience:RemoveComponent("deployable") 190 audience:RemoveTag("horn") 191 audience:AddTag("NOCLICK") 192 audience:AddTag("nobullring") 193 end 194end 195local function OnDeploy (inst, pt) 196 makebullring(inst) 197 inst:Remove() 198end 199 inst:AddComponent("deployable") 200 inst.components.deployable.ondeploy = OnDeploy 201local function onsave(inst, data) 202 if inst:HasTag("bullring0") then 203 data.bullring0 = true 204 end 205 if inst:HasTag("bullfighting") then 206 data.bullfighting = true 207 end 208 if inst:HasTag("nobullring") then 209 data.nobullring = true 210 end 211end 212local function onload(inst, data) 213 if data and data.bullring0 then 214 makebullring(inst) 215 inst:Remove() 216 end 217 if data and data.bullfighting then 218 inst:Remove() 219 end 220 if data and data.nobullring then 221 inst:Remove() 222 end 223end 224 inst.OnSave = onsave 225 inst.OnLoad = onload 226 227 即可用牛角种斗牛场,鼠标左键点中间的大理石树,会冲出公牛,1分钟内战胜它,可获得30个黄金的奖金(直接放入主角物品栏),和大肉、牛毛等战利品。如未能获胜,1分钟后公牛将消失。每次冲出的公牛,血量、攻击力、攻击节奏、速度都不同,这次打不赢,不代表下次不会胜利哦。场外会有观众为你喝彩,如果你获胜,他们会向场内扔黄金(数量不等),作为你额外的奖励。不想要斗牛场了,用锤子砸掉中间的大理石树即可

2025/04/23 · Bny

YN208-鱼人入侵(每个傍晚都可能遭到众多鱼人的伏击)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二0八.鱼人入侵(每个傍晚都可能遭到众多鱼人的伏击) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/forest.lua文件,在inst:AddComponent("frograin")的下一行插入以下内容: 5 6local function OnNight(inst) 7 local player = GetPlayer() 8 local pt = Vector3(player.Transform:GetWorldPosition()) 9 local nummerms = math.random(15) 10 local ground = GetWorld() 11 if math.random()< .2 then 12 for k = 1, nummerms do 13 local theta = 1 * 2 * PI 14 local radius = 12 15 local result_offset = FindValidPositionByFan(theta, radius, nummerms, function(offset) 16 local x,y,z = (pt + offset):Get() 17 local ents = TheSim:FindEntities(x,y,z , 1) 18 return not next(ents) 19 end) 20 if result_offset and ground.Map:GetTileAtPoint((pt + result_offset):Get()) ~= GROUND.IMPASSABLE then 21 local merm = SpawnPrefab("merm") 22 merm.Transform:SetPosition((pt + result_offset):Get()) 23 merm.components.combat.target = player 24 GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40) 25 local fx = SpawnPrefab("collapse_small") 26 local pos = pt + result_offset 27 fx.Transform:SetPosition(pos.x, pos.y, pos.z) 28 end 29 end 30 end 31end 32 inst:ListenForEvent( "dusktime", function() OnNight( inst ) end, GetWorld()) 33 34 即可让主角在地面时,每天傍晚都有一定概率遭到众多鱼人(数字随机)的伏击。建议鱼人人数少时就和它们拼了,人数多时就跑,它们会暂时占据这个地区,等到白天它们睡着时再各个击破

2025/04/23 · Bny

YN209-宝物猎人(地面每天出宝贝,限时寻宝赢奖金)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二0九.宝物猎人(地面每天出宝贝,限时寻宝赢奖金) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/forest.lua文件,在inst:AddComponent("hunter")的下一行插入以下内容: 5 6local function OnDay(inst) 7 local names = {"trinket_1","trinket_2","trinket_3","trinket_4","trinket_5","trinket_6","trinket_7","trinket_8","trinket_9","trinket_10","trinket_11","trinket_12"} 8 inst.name = names[math.random(#names)] 9 local player = GetPlayer() 10 local pt = Vector3(player.Transform:GetWorldPosition()) 11 local gold = SpawnPrefab(inst.name) 12 gold.Transform:SetPosition(pt.x+(math.random(500)-math.random(500)), 0, pt.z+(math.random(500)-math.random(500))) 13 gold:RemoveComponent("tradable") 14 gold:RemoveComponent("stackable") 15 local minimap = gold.entity:AddMiniMapEntity() 16 minimap:SetIcon( "abigail_flower.png" ) 17 inst:DoTaskInTime(60+math.random(5), function() 18 if not gold.components.inventoryitem:IsHeld() then 19 SpawnPrefab("collapse_small").Transform:SetPosition(gold.Transform:GetWorldPosition()) 20 SpawnPrefab("collapse_small").Transform:SetPosition(player.Transform:GetWorldPosition()) 21 player.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") 22 else 23 for k = 1, 10+math.random(10) do 24 SpawnPrefab("goldnugget").Transform:SetPosition(player.Transform:GetWorldPosition()) 25 player.SoundEmitter:PlaySound("dontstarve/HUD/get_gold") 26 end 27 end 28 gold:Remove() 29 end) 30end 31 inst:ListenForEvent( "daytime", function() OnDay(inst) end, GetWorld()) 32 33 即可在每天天亮时,地面随机出现宝物(12种收藏品之一),小地图上将显示红花的图标,在1分钟内捡到就可获得奖金,错过时间宝物将消失(生起一团烟就说明寻宝失败)。当寻宝计时结束,你也已经捡到宝物的话,将获得10-20个黄金的奖励(出现在脚下)。注意,宝物很有可能出现在海上,如果没有修改过“地图全开”、“主角可渡海”,就只能望洋兴叹了

2025/04/23 · Bny

YN210-无尽的任务(点路牌接任务,讨伐怪物赚赏金)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二一0.无尽的任务(点路牌接任务,讨伐怪物赚赏金) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/homesign.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function GetStatus(inst) 7 if not inst:HasTag("westart") then 8 GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") 9 inst:AddTag("westart") 10 inst.AnimState:SetMultColour(255/255,0/255,0/255,1) 11 local names = {"spiderqueen","deerclops","leif_sparse","minotaur","knight","bishop","rook","firehound"} 12 local name = names[math.random(#names)] 13 local bonuspoints = math.random(6) 14 local pt = inst:GetPosition() 15 local wanted = SpawnPrefab(name) 16 wanted.Transform:SetPosition(pt.x+(math.random(300)-math.random(300)), 0, pt.z+(math.random(300)-math.random(300))) 17 wanted.components.health:SetMaxHealth(1000 * bonuspoints) 18 wanted.components.health:DoDelta(1000 * bonuspoints) 19 wanted.AnimState:SetMultColour(255/255,0/255,0/255,1) 20 wanted.Transform:SetScale(1.5, 1.5, 1.5) 21 local minimap = wanted.entity:AddMiniMapEntity() 22 minimap:SetIcon( "lucy_axe.png" ) 23 wanted:ListenForEvent("death", function() 24 inst:RemoveTag("westart") 25 inst.AnimState:SetMultColour(35/255,105/255,235/255,1) 26 for k = 1, 20*bonuspoints do 27 SpawnPrefab("goldnugget").Transform:SetPosition(GetPlayer().Transform:GetWorldPosition()) 28 GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold") 29 end 30 end ) 31 inst:DoTaskInTime(180, function() 32 if not wanted.components.health:IsDead() then 33 SpawnPrefab("die_fx").Transform:SetPosition(wanted.Transform:GetWorldPosition()) 34 SpawnPrefab("die_fx").Transform:SetPosition(GetPlayer().Transform:GetWorldPosition()) 35 GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") 36 wanted:Remove() 37 inst:RemoveTag("westart") 38 inst.AnimState:SetMultColour(35/255,105/255,235/255,1) 39 end 40 end) 41 end 42end 43 inst.components.inspectable.getstatus = GetStatus 44 inst.AnimState:SetMultColour(35/255,105/255,235/255,1) 45 46 即可点路牌接任务,地图随机位置将出现一个被通缉的怪物,全身红色,小地图上显示为红色斧子图标,血量随机在1000-6000点,不由怪物品种决定(1只狗可能拥有6000的血量)。在3分钟内(游戏中6个小时)找到并杀死它,即讨伐成功,赏金会出现在主角身边,错过时间则任务失败(升起黑烟),被通缉的怪物将人间蒸发。赏金为20-120个黄金,杀死的怪物血量越高,赏金越高。怪物有可能出现在海上,如果没有修改过“地图全开”、“主角可渡海”,就只能望洋兴叹了。这是一个无尽的任务系统,如果同时修改了“巨型超市”,则可以用赏金购买造装备的材料及补血料理,从此开始赏金猎人的生涯吧

2025/04/23 · Bny

YN211-无限进化(给远古祭坛500个黄金,升级主角血量、饥饿、脑最大值各100点)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二一一.无限进化(给远古祭坛500个黄金,升级主角血量、饥饿、脑最大值各100点) 3 4 1.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,将下列内容: 5 6 inst:AddComponent("health") 7 inst.components.health:SetMaxHealth(TUNING.WILSON_HEALTH) 8 inst.components.health.nofadeout = true 9 ------- 10 11 inst:AddComponent("hunger") 12 inst.components.hunger:SetMax(TUNING.WILSON_HUNGER) 13 inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE) 14 inst.components.hunger:SetKillRate(TUNING.WILSON_HEALTH/TUNING.STARVE_KILL_TIME) 15 16 17 inst:AddComponent("sanity") 18 inst.components.sanity:SetMax(TUNING.WILSON_SANITY) 19 inst.components.sanity.onSane = OnSane 20 inst.components.sanity.onInsane = OnInsane 21 22 替换为: 23 24local function newupgrades(inst) 25 inst.components.health.maxhealth = TUNING.WILSON_HEALTH + inst.level_num*100 26 inst.components.hunger.max = TUNING.WILSON_HUNGER + inst.level_num*100 27 inst.components.sanity.max = TUNING.WILSON_SANITY + inst.level_num*100 28end 29 inst.level_num = 0 30 inst:AddComponent("health") 31 inst.components.health:SetMaxHealth(TUNING.WILSON_HEALTH + inst.level_num*100) 32 inst.components.health.nofadeout = true 33 inst:AddComponent("hunger") 34 inst.components.hunger:SetMax(TUNING.WILSON_HUNGER + inst.level_num*100) 35 inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE) 36 inst.components.hunger:SetKillRate(TUNING.WILSON_HEALTH/TUNING.STARVE_KILL_TIME) 37 inst:AddComponent("sanity") 38 inst.components.sanity:SetMax(TUNING.WILSON_SANITY + inst.level_num*100) 39 inst.components.sanity.onSane = OnSane 40 inst.components.sanity.onInsane = OnInsane 41 newupgrades(inst) 42local function onsave(inst, data) 43 data.level_num = inst.level_num 44end 45local function onload(inst, data) 46 inst.level_num = data.level_num or 0 47 inst.components.health.maxhealth = TUNING.WILSON_HEALTH + inst.level_num*100 48 inst.components.hunger.max = TUNING.WILSON_HUNGER + inst.level_num*100 49 inst.components.sanity.max = TUNING.WILSON_SANITY + inst.level_num*100 50 if data.health and data.health.health then inst.components.health.currenthealth = data.health.health end 51 if data.hunger and data.hunger.hunger then inst.components.hunger.current = data.hunger.hunger end 52 if data.sanity and data.sanity.current then inst.components.sanity.current = data.sanity.current end 53end 54 inst.OnSave = onsave 55 inst.OnLoad = onload 56 57 58 2.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/altar_prototyper.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 59 60local function ShouldAcceptItem(inst, item) 61 local player = GetPlayer() 62 if player.components.inventory:Has("goldnugget", 500) then 63 if item.prefab == "goldnugget" then 64 return true 65 end 66 end 67 return false 68end 69local function OnGetItemFromPlayer(inst, giver, item) 70 if item.prefab == "goldnugget" then 71 giver.components.inventory:ConsumeByName("goldnugget", 499) 72 giver.level_num = giver.level_num + 1 73 inst.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup") 74 giver.HUD.controls.status.heart:PulseGreen() 75 giver.HUD.controls.status.stomach:PulseGreen() 76 giver.HUD.controls.status.brain:PulseGreen() 77 giver.HUD.controls.status.brain:ScaleTo(1.3,1,.7) 78 giver.HUD.controls.status.heart:ScaleTo(1.3,1,.7) 79 giver.HUD.controls.status.stomach:ScaleTo(1.3,1,.7) 80 giver.components.health.maxhealth = TUNING.WILSON_HEALTH + giver.level_num*100 81 giver.components.hunger.max = TUNING.WILSON_HUNGER + giver.level_num*100 82 giver.components.sanity.max = TUNING.WILSON_SANITY + giver.level_num*100 83 giver.components.health:DoDelta(giver.components.health.maxhealth) 84 giver.components.hunger:DoDelta(giver.components.hunger.max) 85 giver.components.sanity:DoDelta(giver.components.sanity.max) 86 end 87end 88 inst:AddComponent("trader") 89 inst.components.trader.onaccept = OnGetItemFromPlayer 90 inst.components.trader:SetAcceptTest(ShouldAcceptItem) 91 92 即可给远古祭坛500个黄金(拿着黄金对远古祭坛按鼠标左键),升级主角血量、饥饿、脑最大值各100点,升级无上限,身上黄金不足500时不会升级。如果缺少黄金,可以修改“菜市场”、“肉食店”、“流动商贩”、“杂货收购行”、“收藏品黑市”、“收藏品期货市场”等交易系统赚取黄金(见本修改技巧)。用机器人(wx78)、大力士(沃尔夫冈)作主角时,不要修改此项

2025/04/23 · Bny