YN160-神之矛(矛攻击时召唤闪电雷击敌人)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一六0.神之矛(矛攻击时召唤闪电雷击敌人) 用MT管理器打开游戏目录/assets/scripts/prefabs/spear.lua文件, 1.在local function onequip(inst, owner)的下一行插入以下内容: if owner.components.playerlightningtarget then owner:AddTag("nolightning") owner:RemoveComponent("playerlightningtarget") end 2.在local function onunequip(inst, owner)的下一行插入以下内容: if owner:HasTag("nolightning") then owner:RemoveTag("nolightning") owner:AddComponent("playerlightningtarget") end 3.将inst:AddComponent("weapon")替换为以下内容: local function onattack(inst, attacker, target) inst:StartThread(function() for k = 1, 5 do local pos = target:GetPosition() GetSeasonManager():DoLightningStrike(pos) target.components.health:DoDelta(-100) Sleep(0.3) end end) end inst:AddComponent("weapon") inst.components.weapon:SetRange(20, 25) inst.components.weapon:SetOnAttack(onattack) inst.components.weapon:SetProjectile("bishop_charge") 即可让矛在攻击时召唤5道闪电,连续雷击敌人,会烧着附近的敌人。因为神之矛太过凶猛,请远离自己的基地使用,也千万不要在带同伴时使用

2025/04/23 · Bny

YN161-钓金龟(用鱼竿将敌人变成黄金雕像)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一六一.钓金龟(用鱼竿将敌人变成黄金雕像) 用MT管理器打开游戏目录/assets/scripts/prefabs/fishingrod.lua文件,将下列内容: inst:AddComponent("weapon") inst.components.weapon:SetDamage(TUNING.FISHINGROD_DAMAGE) inst.components.weapon.attackwear = 4 替换为: local function onattack(inst, attacker, target) SpawnPrefab("ruins_statue_mage").Transform:SetPosition(target.Transform:GetWorldPosition()) SpawnPrefab("collapse_small").Transform:SetPosition(target.Transform:GetWorldPosition()) target:Remove() end inst:AddComponent("weapon") inst.components.weapon:SetDamage(0) inst.components.weapon:SetRange(12, 15) inst.components.weapon:SetOnAttack(onattack) inst.components.weapon:SetProjectile("bishop_charge") 即可用鱼竿远距离攻击敌人时,把敌人变成黄金雕像,用锤子砸碎雕像可得宝石和铥矿石。鱼竿在生存选项(画着绳套)下,用2个树杈、2个蛛丝制造

2025/04/23 · Bny

YN162-萌时代(扔蜂蜜将怪物变回童年)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一六二.萌时代(扔蜂蜜将怪物变回童年) 用MT管理器打开游戏目录/assets/scripts/prefabs/honey.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function onhit(inst, attacker, target) inst:Remove() SpawnPrefab("collapse_small").Transform:SetPosition(target.Transform:GetWorldPosition()) target.Transform:SetScale(0.7, 0.7, 0.7) if target.components.health then target.components.health.currenthealth = 1 target.components.health.maxhealth = 1 end if target.components.combat then target.components.combat:SetDefaultDamage(0) target.components.combat.target = nil end if target.components.locomotor then target.components.locomotor.runspeed = 1 target.components.locomotor.walkspeed = 1 end end local function onthrown(inst, data) inst.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround ) end inst:AddComponent("weapon") inst.components.weapon:SetDamage(0) inst.components.weapon:SetRange(20, 25) inst:AddComponent("equippable") inst.components.equippable.equipstack = true inst:AddComponent("projectile") inst.components.projectile:SetSpeed(60) inst.components.projectile:SetOnHitFn(onhit) inst:ListenForEvent("onthrown", onthrown) 即可扔蜂蜜将怪物变成无害的童年怪物,怪物体型变小、生命值为1、没有攻击力、行走缓慢。因为蜂蜜可装备,如果主角也想吃蜂蜜,请拿起蜂蜜对主角按鼠标右键

2025/04/23 · Bny

YN163-犬牙手雷(扔犬牙炸倒一大片)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一六三.犬牙手雷(扔犬牙炸倒一大片) 用MT管理器打开游戏目录/assets/scripts/prefabs/houndstooth.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function onhit(inst, attacker, target) SpawnPrefab("collapse_small").Transform:SetPosition(target.Transform:GetWorldPosition()) SpawnPrefab("explode_small").Transform:SetPosition(target.Transform:GetWorldPosition()) local pos = Vector3(target.Transform:GetWorldPosition()) GetClock():DoLightningLighting() GetPlayer().components.playercontroller:ShakeCamera(target, "FULL", 0.7, 0.02, .5, 40) inst.components.combat:DoAreaAttack(target, 8) inst:Remove() end local function onthrown(inst, data) inst.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround ) end inst:AddComponent("weapon") inst.components.weapon:SetDamage(3000) inst.components.weapon:SetRange(15, 18) inst:AddComponent("combat") inst.components.combat:SetDefaultDamage(3000) inst.components.combat.playerdamagepercent = 0 inst:AddComponent("equippable") inst.components.equippable.equipstack = true inst:AddComponent("projectile") inst.components.projectile:SetSpeed(60) inst.components.projectile:SetOnHitFn(onhit) inst:ListenForEvent("onthrown", onthrown) 即可在装备犬牙时,对一群敌人扔出(远距离对敌人按鼠标左键)炸倒一大片。犬牙手雷不会伤到主角

2025/04/23 · Bny

YN164-高爆地雷(指南针放在地上作地雷)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一六四.高爆地雷(指南针放在地上作地雷) 用MT管理器打开游戏目录/assets/scripts/prefabs/compass.lua文件,在inst:AddComponent("inventoryitem")的下一行插入以下内容 inst.components.inventoryitem:SetOnDroppedFn(function() inst:RemoveTag("startkill") if inst.task then inst.task:Cancel() inst.task = nil end end ) inst.components.inventoryitem:SetOnPickupFn(function() inst:RemoveTag("startkill") if inst.task then inst.task:Cancel() inst.task = nil end end ) inst.components.inventoryitem:SetOnPutInInventoryFn(function() inst:RemoveTag("startkill") if inst.task then inst.task:Cancel() inst.task = nil end end ) local function OnDeploy (inst, pt) inst:AddTag("startkill") inst.Physics:Teleport(pt:Get()) inst.task = inst:DoPeriodicTask(0.1, function(inst) local target = FindEntity(inst, 2, function(guy) return guy.components.combat and guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") and not guy:HasTag("smallbird") and not guy:HasTag("chester") end ) if target then GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition()) SpawnPrefab("explode_small").Transform:SetPosition(inst.Transform:GetWorldPosition()) local pos = Vector3(inst.Transform:GetWorldPosition()) GetClock():DoLightningLighting() GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.7, 0.02, .5, 40) target.components.health:DoDelta(-3000) inst:Remove() end end ) end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy inst.components.deployable.min_spacing = 2 inst:AddComponent("stackable") inst.components.stackable.maxsize = 999 local function onsave(inst, data) if inst:HasTag("startkill") then data.startkill = true end end local function onload(inst, data) if data and data.startkill then inst:AddTag("startkill") inst.task = inst:DoPeriodicTask(0.1, function(inst) local target = FindEntity(inst, 2, function(guy) return guy.components.combat and guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") and not guy:HasTag("smallbird") and not guy:HasTag("chester") end ) if target then GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition()) SpawnPrefab("explode_small").Transform:SetPosition(inst.Transform:GetWorldPosition()) local pos = Vector3(inst.Transform:GetWorldPosition()) GetClock():DoLightningLighting() GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.7, 0.02, .5, 40) target.components.health:DoDelta(-3000) inst:Remove() end end ) end end inst.OnSave = onsave inst.OnLoad = onload 即可拿起指南针用鼠标右键部署在空地上,敌人踩上后会爆炸,主角、自养高鸟、狗箱不会触发。指南针在生存选项(画着绳套)下,用1个黄金、1张纸制造

2025/04/23 · Bny

YN165-死神之光(拿提灯时右键点空地,满屏敌人通杀)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一六五.死神之光(拿提灯时右键点空地,满屏敌人通杀) 用MT管理器打开游戏目录/assets/scripts/prefabs/mininglantern.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function cancreatelight(staff, caster, target, pos) local fuelpercent = inst.components.fueled:GetPercent() if fuelpercent > 0.5 then return true else return false end end local function createlight(staff, target, pos) local SHAKE_DIST = 40 local player = GetClosestInstWithTag("player", inst, SHAKE_DIST) if player then player.components.playercontroller:ShakeCamera(inst, "VERTICAL", 1, 0.03, 2, SHAKE_DIST) end inst:DoTaskInTime(0, function() inst.components.combat:DoAreaAttack(inst, 30) end) GetClock():DoLightningLighting() inst.components.fueled.currentfuel = 50 end inst:AddComponent("spellcaster") inst.components.spellcaster:SetSpellFn(createlight) inst.components.spellcaster:SetSpellTestFn(cancreatelight) inst.components.spellcaster.canuseonpoint = true inst.components.spellcaster.canusefrominventory = false inst:AddComponent("combat") inst.components.combat:SetDefaultDamage(3000) inst.components.combat.playerdamagepercent = 0 即可拿提灯时右键点空地,满屏敌人通杀。注意提灯燃料超过50%时,才能释放死神之光,释放后提灯燃料接近耗尽,想再释放需要向提灯中填充荧光果(拿荧光果对装备格中的提灯按右键),大约3颗即可

2025/04/23 · Bny

YN166-魔之双臂(狼牙棒左键抓来敌人并致死、右键抓地移动主角)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一六六.魔之双臂(狼牙棒左键抓来敌人并致死、右键抓地移动主角) 用MT管理器打开游戏目录/assets/scripts/prefabs/tentaclespike.lua文件,将下列内容: inst:AddComponent("weapon") inst.components.weapon:SetDamage(TUNING.SPIKE_DAMAGE) ------- inst:AddComponent("finiteuses") inst.components.finiteuses:SetMaxUses(TUNING.SPIKE_USES) inst.components.finiteuses:SetUses(TUNING.SPIKE_USES) inst.components.finiteuses:SetOnFinished( onfinished ) 替换为: local function onattack(inst, owner, target) local pt = owner:GetPosition() if target.components.health then target.Transform:SetPosition(pt.x+1, pt.y, pt.z) end inst:DoTaskInTime(0.1, function() target.components.health:DoDelta(-3000) end) end inst:AddComponent("weapon") inst.components.weapon:SetDamage(0) inst.components.weapon:SetRange(20, 25) inst.components.weapon:SetOnAttack(onattack) inst.components.weapon:SetProjectile("bishop_charge") inst:AddComponent("blinkstaff") 即可在装备狼牙棒时,对敌人点左键将其抓过来并致死;对空地点右键,抓地移动主角,使狼牙棒既可杀伤敌人,又可有效闪避。用来抓鸟、兔、火鸡、大象等会逃跑的动物也很实用哦。狼牙棒靠打沼泽里的触手获得

2025/04/23 · Bny

YN167-致命的毒箭(中吹箭的敌人不知不觉流血至死)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一六七.致命的毒箭(中吹箭的敌人不知不觉流血至死) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/blowdart.lua文件,在inst.components.weapon:SetDamage(TUNING.PIPE_DART_DAMAGE)的下一行插入以下内容: local function pipeonhit(inst, attacker, target) target.components.health:StartRegen(-100, 1) target.components.combat.target = nil target.AnimState:SetMultColour(255/255,0/255,0/255,1) attacker.components.inventory:Equip(inst) end inst.components.weapon:SetRange(20, 25) inst.components.projectile:SetOnHitFn(pipeonhit) 即可让中吹箭的敌人变成红色,每秒减100点血直至死亡,被射中的敌人不会反击主角。吹箭为无限使用,吹出后自动回到手中

2025/04/23 · Bny

YN168-电击枪(用橙色魔杖远程电晕敌人,使其任你宰割)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一六八.电击枪(用橙色魔杖远程电晕敌人,使其任你宰割) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/staff.lua文件,将inst.components.blinkstaff.onblinkfn = onblink替换为以下内容: local function onattack_orange(inst, owner, target) if target.brain then target.brain:Stop() end if target.components.combat then target.components.combat:SetTarget(nil) end if target.components.locomotor then target.components.locomotor:Stop() end target.AnimState:SetMultColour(125/255,125/255,125/255,1) SpawnPrefab("lightning_rod_fx").Transform:SetPosition(target.Transform:GetWorldPosition()) end inst:AddComponent("weapon") inst.components.weapon:SetDamage(10) inst.components.weapon:SetRange(20, 25) inst.components.weapon:SetOnAttack(onattack_orange) inst.components.weapon:SetProjectile("bishop_charge") 即可在装备橙色魔杖时,对敌人按鼠标左键将其电晕,其会失去行动能力,任你处置。对猴子、青蛙等比较讨厌的敌人很适用。橙色魔杖在远古选项(画着远古祭坛)下,用2个噩梦燃料、1个步行手杖、2个橙色宝石制造,制造时需要靠近远古祭坛

2025/04/23 · Bny

YN169-速射步枪(黄色魔杖左键点射、右键连射蜂刺子弹)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一六九.速射步枪(黄色魔杖左键点射、右键连射蜂刺子弹) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/staff.lua文件,将下列内容: local function yellow() local inst = commonfn("yellow") inst.fxcolour = {223/255, 208/255, 69/255} inst.castsound = "dontstarve/common/staffteleport" inst:AddComponent("spellcaster") inst.components.spellcaster:SetSpellFn(createlight) inst.components.spellcaster:SetSpellTestFn(cancreatelight) inst.components.spellcaster.canuseonpoint = true inst.components.spellcaster.canusefrominventory = false inst:AddComponent("reticule") inst.components.reticule.targetfn = function() return Vector3(GetPlayer().entity:LocalToWorldSpace(5,0,0)) end inst.components.reticule.ease = true inst.components.finiteuses:SetMaxUses(TUNING.YELLOWSTAFF_USES) inst.components.finiteuses:SetUses(TUNING.YELLOWSTAFF_USES) inst:AddTag("nopunch") return inst end 替换为: local function yellow() local inst = commonfn("yellow") inst.fxcolour = {223/255, 208/255, 69/255} inst.castsound = "dontstarve/common/staffteleport" local function canattack(inst, target) if GetPlayer().components.inventory:Has("stinger", 1) and TheInput:IsMouseDown(MOUSEBUTTON_RIGHT) then inst.components.weapon:LaunchProjectile(inst, target) end if GetPlayer().components.inventory:Has("stinger", 1) then return true end end local function onattack_yellow(inst, owner, target) owner.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") SpawnPrefab("die_fx").Transform:SetPosition(target.Transform:GetWorldPosition()) TheCamera:Shake("FULL", 0.2, 0.02, .5, 40) owner.components.inventory:ConsumeByName("stinger", 1) end inst:AddComponent("weapon") inst.components.weapon:SetDamage(100) inst.components.weapon:SetRange(25, 30) inst.components.weapon:SetOnAttack(onattack_yellow) inst.components.weapon:SetCanAttack(canattack) inst.components.weapon:SetProjectile("fire_projectile") inst.components.finiteuses:SetMaxUses(TUNING.YELLOWSTAFF_USES*1000) inst.components.finiteuses:SetUses(TUNING.YELLOWSTAFF_USES*1000) return inst end 即可在装备黄色魔杖时,对敌人按鼠标左键点射,按鼠标右键连射,身上没有蜂刺时无法射击(不要光顾着按住右键扫射,时不时关注一下还有多少子弹)。黄色魔杖在远古选项(画着远古祭坛)下,用4个噩梦燃料、2个活木头、2个黄色宝石制造,制造时需要靠近远古祭坛。黄色魔杖原有种小星星功能取消

2025/04/23 · Bny