YN170-反物质制造机(绿魔杖左键点敌人,生成敌人反物质分身自相残杀)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一七0.反物质制造机(绿魔杖左键点敌人,生成敌人反物质分身自相残杀) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/staff.lua文件,在local inst = commonfn("green")的下一行插入以下内容: local function onattack_green(inst, owner, target) if target.prefab == "bee" or target.prefab == "killerbee" or target.prefab == "flies" or target.prefab == "mosquito" or target.prefab == "frog" or target.prefab == "beefalo" or target.prefab == "lightninggoat" or target.prefab == "pigman" or target.prefab == "pigguard" or target.prefab == "bunnyman" or target.prefab == "merm" or target.prefab == "spider_hider" or target.prefab == "spider_spitter" or target.prefab == "spider" or target.prefab == "spider_warrior" or target.prefab == "spiderqueen" or target.prefab == "spider_dropper" or target.prefab == "hound" or target.prefab == "firehound" or target.prefab == "icehound" or target.prefab == "leif" or target.prefab == "leif_sparse" or target.prefab == "walrus" or target.prefab == "little_walrus" or target.prefab == "smallbird" or target.prefab == "teenbird" or target.prefab == "tallbird" or target.prefab == "koalefant_summer" or target.prefab == "koalefant_winter" or target.prefab == "penguin" or target.prefab == "slurtle" or target.prefab == "snurtle" or target.prefab == "bat" or target.prefab == "rocky" or target.prefab == "monkey" or target.prefab == "buzzard" or target.prefab == "catcoon" or target.prefab == "knight" or target.prefab == "bishop" or target.prefab == "rook" or target.prefab == "crawlinghorror" or target.prefab == "terrorbeak" or target.prefab == "deerclops" or target.prefab == "minotaur" or target.prefab == "worm" or target.prefab == "abigail" or target.prefab == "ghost" or target.prefab == "krampus" or target.prefab == "moose" or target.prefab == "dragonfly" or target.prefab == "warg" or target.prefab == "bearger" then local copy = SpawnPrefab(target.prefab) copy.Transform:SetPosition(target.Transform:GetWorldPosition()) copy.AnimState:SetMultColour(0/255,0/255,0/255,0.5) if copy:HasTag("monster") then copy:RemoveTag("monster") end copy.task = copy:DoPeriodicTask(1, function() copy.components.combat.target = target end) target:ListenForEvent("death", function() if not copy.components.health:IsDead() then copy:Remove() end end ) copy:DoTaskInTime(60, function() if not copy.components.health:IsDead() then copy:Remove() end end ) else local copy = SpawnPrefab("leif") copy.Transform:SetPosition(target.Transform:GetWorldPosition()) copy.AnimState:SetMultColour(0/255,0/255,0/255,0.5) copy.Transform:SetScale(0.5, 0.5, 0.5) copy:RemoveTag("monster") copy.components.combat:SetAttackPeriod(1) copy.task = copy:DoPeriodicTask(1, function() copy.components.combat.target = target end) target:ListenForEvent("death", function() if not copy.components.health:IsDead() then copy:Remove() end end ) copy:DoTaskInTime(60, function() if not copy.components.health:IsDead() then copy:Remove() end end ) end end inst:AddComponent("weapon") inst.components.weapon:SetDamage(0) inst.components.weapon:SetRange(30, 35) inst.components.weapon:SetOnAttack(onattack_green) inst.components.weapon:SetProjectile("bishop_charge") 即可装备绿魔杖时,按鼠标左键点敌人,生成敌人的反物质分身,与敌人自相残杀。敌人有多强大,其反物质分身就有多强大,主角只须观战即可。反物质分身最多存在60秒,当敌人死去时,反物质分身也将消失。中立的小动物、修改技巧创生的生物,将生成反物质树精

2025/04/23 · Bny

YN171-收妖镜(装备铥矿奖章对敌人按右键,将其收入镜中)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一七一.收妖镜(装备铥矿奖章对敌人按右键,将其收入镜中) 用MT管理器打开游戏目录/assets/scripts/prefabs/nightmare_timepiece.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function onequip(inst, owner) owner.components.inventory:SetOverflow(inst) inst.components.container:Open(owner) end local function onunequip(inst, owner) owner.components.inventory:SetOverflow(nil) inst.components.container:Close(owner) end local function itemtest(inst, item, slot) if item:HasTag("catched") then return true end return false end local slotpos = {} for y = 0, 9 do table.insert(slotpos, Vector3(-162, -y*75 + 170 ,0)) end local function cancatchmonster(inst, caster, target) if target then return target.components.locomotor and target.components.health and not target.components.health:IsDead() and not target:HasTag("smallbird") and not target:HasTag("chester") end return true end local function catchmonster(staff, target, pos) if not inst.components.container:IsFull() then if target.components.stackable then target:RemoveComponent("stackable") end if target.components.inventoryitem then target:RemoveComponent("inventoryitem") end target:AddComponent("inventoryitem") target.components.inventoryitem.nobounce = true target.components.inventoryitem.canbepickedup = true target.components.inventoryitem:ChangeImageName("beard_monster") target.components.health.canmurder = true target:AddTag("catched") target.components.inventoryitem:SetOnDroppedFn(function(target) target:RemoveComponent("inventoryitem") target:RemoveTag("catched") if target.brain then target.brain:Start() end if target.sg then target.sg:Start() end end ) target.components.inventoryitem:SetOnPutInInventoryFn(function(target) if target.sg then target.sg:GoToState("idle") end if target.SoundEmitter then target.SoundEmitter:KillAllSounds() end end ) inst.components.container:GiveItem(target) end end inst:AddComponent("spellcaster") inst.components.spellcaster:SetSpellFn(catchmonster) inst.components.spellcaster:SetSpellTestFn(cancatchmonster) inst.components.spellcaster.canuseontargets = true inst.components.spellcaster.canusefrominventory = false inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.HANDS inst.components.equippable:SetOnEquip( onequip ) inst.components.equippable:SetOnUnequip( onunequip ) inst:AddComponent("container") inst.components.container:SetNumSlots(#slotpos) inst.components.container.widgetslotpos = slotpos inst.components.container.widgetpos = Vector3(18,50,0) inst.components.container.side_widget = true inst.components.container.itemtestfn = itemtest inst.components.container.acceptsstacks = false 即可在装备铥矿奖章时,对敌人按鼠标右键,将敌人收入镜中(画面右边的格子中,显示为烧焦的兔子),如果想杀死它,就对格子中的敌人按鼠标右键,会获得战利品;如果想释放它,就拿出敌人放在地上。“收妖镜”的格子全满后,无法再收新的敌人,可以将敌人放在物品栏或其他背包后再收妖。在存档退出前,请处置(杀掉或释放)全部收来的敌人,否则读档后,敌人将全部被放出。铥矿奖章在远古选项(画着远古祭坛)下,用2个铥矿石、2个噩梦燃料制造,制造时需要靠近远古祭坛

2025/04/23 · Bny

YN172-溜溜球(用陷阱种溜溜球,连续打击多个目标,打完自动回到手中)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一七二.溜溜球(用陷阱种溜溜球,连续打击多个目标,打完自动回到手中) 用MT管理器打开游戏目录/assets/scripts/prefabs/trap.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 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}, } local function OnDeploy (inst, pt) local ball = SpawnPrefab("trap") ball.Transform:SetPosition(pt.x, pt.y, pt.z) ball.AnimState:SetBank("bulb") ball.AnimState:SetBuild("bulb") ball.AnimState:PlayAnimation("idle") ball.AnimState:SetBloomEffectHandle("shaders/anim.ksh") ball:ClearStateGraph() RemovePhysicsColliders(ball) ball.components.inventoryitem:ChangeImageName("lightbulb") ball.colour_idx = math.random(#colours) ball.AnimState:SetMultColour(colours[ball.colour_idx][1],colours[ball.colour_idx][2],colours[ball.colour_idx][3],1) ball:RemoveComponent("finiteuses") ball:RemoveComponent("trap") ball:RemoveComponent("deployable") ball:RemoveTag("trap") ball:AddComponent("weapon") ball.components.weapon:SetDamage(30) ball.components.weapon:SetRange(20, 25) ball:AddComponent("equippable") ball.components.equippable.equipslot = EQUIPSLOTS.HANDS ball.components.equippable:SetOnEquip(function(ball) ball.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") end ) ball:AddComponent("projectile") ball.components.projectile:SetSpeed(25) ball.components.projectile:SetOnHitFn(function(ball, owner, target) GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") local target0 = FindEntity(owner, 25, function(guy) if guy.components.combat and guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") then return guy.components.combat.target == owner or owner.components.combat.target == guy or guy:HasTag("monster") end end ) if target0 then ball.components.projectile:Throw(owner, target0) else owner.components.inventory:Equip(ball) end end ) ball.components.projectile:SetOnMissFn(function(ball, owner) owner.components.inventory:Equip(ball) end ) ball:ListenForEvent("onthrown", function(ball) local pt = ball:GetPosition() ball.Transform:SetPosition(pt.x, 2, pt.z) ball.SoundEmitter:PlaySound("dontstarve/wilson/boomerang_throw") end ) ball:AddComponent("workable") ball.components.workable:SetWorkAction(ACTIONS.HAMMER) ball.components.workable:SetWorkLeft(3) ball.components.workable:SetOnFinishCallback(function(ball) SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(ball.Transform:GetWorldPosition()) ball:Remove() end ) ball:AddTag("projectile") ball:AddTag("balls") inst:Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("balls") then data.balls = true end data.colour_idx = inst.colour_idx end local function onload(inst, data) if data and data.balls then inst.AnimState:SetBank("bulb") inst.AnimState:SetBuild("bulb") inst.AnimState:PlayAnimation("idle") inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:ClearStateGraph() RemovePhysicsColliders(inst) inst.components.inventoryitem:ChangeImageName("lightbulb") inst:RemoveComponent("finiteuses") inst:RemoveComponent("trap") inst:RemoveComponent("deployable") inst:RemoveTag("trap") inst:AddComponent("weapon") inst.components.weapon:SetDamage(30) inst.components.weapon:SetRange(20, 25) inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.HANDS inst.components.equippable:SetOnEquip(function(inst) inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") end ) inst:AddComponent("projectile") inst.components.projectile:SetSpeed(25) inst.components.projectile:SetOnHitFn(function(inst, owner, target) GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") local target0 = FindEntity(owner, 25, function(guy) if guy.components.combat and guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") then return guy.components.combat.target == owner or owner.components.combat.target == guy or guy:HasTag("monster") end end ) if target0 then inst.components.projectile:Throw(owner, target0) else owner.components.inventory:Equip(inst) end end ) inst.components.projectile:SetOnMissFn(function(inst, owner) owner.components.inventory:Equip(inst) end ) inst:ListenForEvent("onthrown", function(inst) local pt = inst:GetPosition() inst.Transform:SetPosition(pt.x, 2, pt.z) inst.SoundEmitter:PlaySound("dontstarve/wilson/boomerang_throw") end ) inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.HAMMER) inst.components.workable:SetWorkLeft(3) inst.components.workable:SetOnFinishCallback(function(inst) SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(inst.Transform:GetWorldPosition()) inst:Remove() end ) inst:AddTag("projectile") inst:AddTag("balls") end if data and data.colour_idx then inst.colour_idx = math.min(#colours, data.colour_idx) inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1) end end inst.OnSave = onsave inst.OnLoad = onload 即可用陷阱种溜溜球(颜色随机),装备后对敌人按鼠标左键,可以扔出并连续打击附近所有敌人,消灭敌人后自动回到手中,完美代替回旋镖。不想要溜溜球时,用锤子砸掉即可。陷阱在生存选项(画着绳套)下,用2个树枝、6个草制造

2025/04/23 · Bny

YN173-千斤锤(用火腿短棍攻击时,天降巨石将敌人拍扁)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一七三.千斤锤(用火腿短棍攻击时,天降巨石将敌人拍扁) 用MT管理器打开游戏目录/assets/scripts/prefabs/hambat.lua文件,将inst:AddComponent("weapon")替换为以下内容: local function onattack(inst, owner, target) local pt = target:GetPosition() local boulder = SpawnPrefab("thulecite") RemovePhysicsColliders(boulder) boulder.AnimState:SetBloomEffectHandle("shaders/anim.ksh") boulder.Transform:SetScale(3,3,3) boulder:RemoveComponent("inventoryitem") boulder.Transform:SetPosition(pt.x, 10, pt.z) boulder.falling = boulder:DoPeriodicTask(.01, function() boulder.Physics:SetMotorVelOverride(0,-55,0) end) boulder:DoTaskInTime(0.1, function() if boulder.falling then boulder.falling:Cancel() boulder.falling = nil end GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") GetPlayer().components.playercontroller:ShakeCamera(boulder, "FULL", 0.5, 0.05, 2, 40) SpawnPrefab("collapse_big").Transform:SetPosition(boulder.Transform:GetWorldPosition()) target:AddTag("NOCLICK") MakeInventoryPhysics(target) target.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround ) target.AnimState:SetLayer( LAYER_BACKGROUND ) target.AnimState:SetSortOrder( 1 ) target.AnimState:SetPercent("hit", math.random()) if target.brain then target:SetBrain(nil) end if target.components.locomotor then target.components.locomotor:Stop() end if target.components.combat then target.components.combat:SetTarget(nil) end if target.components.health then target.components.health:SetInvincible(false) end target:DoTaskInTime(5, function() target.components.health:Kill() end ) local pos = Vector3(boulder.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,0,pos.z, 5) for k,v in pairs(ents) do if v.components.workable and v.components.workable.workleft > 0 and not v.components.inventoryitem then v.components.workable:Destroy(boulder) end end boulder:DoTaskInTime(0.5, function() GetPlayer().SoundEmitter:PlaySound("dontstarve/common/stone_drop") SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(boulder.Transform:GetWorldPosition()) boulder:Remove() end ) end ) end inst:AddComponent("weapon") inst.components.weapon:SetRange(20, 25) inst.components.weapon:SetOnAttack(onattack) 即可在用火腿短棍攻击时,天降巨石将敌人拍扁,并震毁附近的建筑、石头、植物,敌人将在5秒后死亡。火腿短棍在战斗选项(画着两把剑)下,用1个猪皮、2个树枝、2个大肉制造

2025/04/23 · Bny

YN174-霸王枪(瓦丝格雷斯矛升级为霸王枪,鼠标左键远距离突刺并撤回,右键挑飞敌人,敌人会喷血)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一七四.霸王枪(瓦丝格雷斯矛升级为霸王枪,鼠标左键远距离突刺并撤回,右键挑飞敌人,敌人会喷血) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/spear_wathgrithr.lua文件, 1.在local function onequip(inst, owner)的下一行插入以下内容: inst.fire = SpawnPrefab( "campfirefire" ) local follower = inst.fire.entity:AddFollower() follower:FollowSymbol( owner.GUID, "swap_object", 20, -88, 1 ) inst.fire.AnimState:SetMultColour(255/255,0/255,0/255,1) inst.fire.Transform:SetScale(0.8, 0.8, 0.8) inst.fire:RemoveComponent("heater") inst.fire.persists = false 2.在local function onunequip(inst, owner)的下一行插入以下内容: inst.fire:Remove() inst.fire = nil 3.将下列内容: inst:AddComponent("weapon") inst.components.weapon:SetDamage(TUNING.WATHGRITHR_SPEAR_DAMAGE) ------- inst:AddComponent("finiteuses") inst.components.finiteuses:SetMaxUses(TUNING.WATHGRITHR_SPEAR_USES) inst.components.finiteuses:SetUses(TUNING.WATHGRITHR_SPEAR_USES) inst.components.finiteuses:SetOnFinished( onfinished ) 替换为: local function canattack(inst, target) if TheInput:IsMouseDown(MOUSEBUTTON_RIGHT) then GetPlayer().AnimState:PlayAnimation("atk") SpawnPrefab("groundpoundring_fx").Transform:SetPosition(GetPlayer().Transform:GetWorldPosition()) SpawnPrefab("explode_small").Transform:SetPosition(target.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") local pt01 = GetPlayer():GetPosition() local pt02 = target:GetPosition() target.Transform:SetPosition((pt02.x-pt01.x)*0.5+pt02.x, 0, (pt02.z-pt01.z)*0.5+pt02.z) local blood = SpawnPrefab("splash") blood.Transform:SetPosition(target.Transform:GetWorldPosition()) blood.AnimState:SetMultColour(255/255,0/255,0/255,1) blood.Transform:SetScale(2, 2, 2) if target.components.locomotor then target.components.locomotor:Stop() end if target.components.combat then target.components.combat:SetTarget(GetPlayer()) end if target.components.health then target.components.health:DoDelta(-100) if target.components.health:GetPercent() < 0.3 then target.AnimState:SetMultColour(255/255,0/255,0/255,1) end end end return true end local function onattack(inst, attacker, target) local pt1 = attacker:GetPosition() local pt2 = target:GetPosition() GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") attacker:DoTaskInTime(0.01, function() attacker.Transform:SetPosition(pt2.x, pt2.y, pt2.z) SpawnPrefab("explode_small").Transform:SetPosition(target.Transform:GetWorldPosition()) SpawnPrefab("groundpoundring_fx").Transform:SetPosition(target.Transform:GetWorldPosition()) if target.components.locomotor then target.components.locomotor:Stop() end attacker:StartThread(function() for k = 1, 3 do local blood = SpawnPrefab("splash") blood.Transform:SetPosition(pt2.x, 1.5, pt2.z) blood.AnimState:SetMultColour(255/255,0/255,0/255,1) blood.Transform:SetScale(2, 2, 2) Sleep(.1) end end ) if target.components.health and target.components.health:GetPercent() < 0.3 then target.AnimState:SetMultColour(255/255,0/255,0/255,1) end end ) attacker:DoTaskInTime(0.3, function() attacker.Transform:SetPosition(pt1.x, pt1.y, pt1.z) end ) end inst:AddComponent("weapon") inst.components.weapon:SetDamage(300) inst.components.weapon:SetRange(15, 20) inst.components.weapon:SetOnAttack(onattack) inst.components.weapon:SetCanAttack(canattack) 即可让瓦丝格雷斯矛升级为霸王枪,装备霸王枪,鼠标左键点敌人(按住可连续攻击),会远距离突刺敌人,刺中后迅速撤回原位,不给敌人还击的机会。鼠标右键点敌人,可将敌人挑飞,按住右键扫过一群敌人,可防止被围攻。使用霸王枪时,敌人会喷血,场面极其惨烈,如果你是儿童,请捂住眼睛使用。瓦丝格雷斯矛可修改“全人物可制造瓦丝格雷斯矛、瓦丝格雷斯帽”获得

2025/04/23 · Bny

YN175-霸王斧(用蜻蜓鳞片种霸王斧,攻击敌人时震开并伤害周围敌人,可吸敌人的血)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一七五.霸王斧(用蜻蜓鳞片种霸王斧,攻击敌人时震开并伤害周围敌人,可吸敌人的血) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/dragon_scales.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function OnDeploy (inst, pt) local bigaxe = SpawnPrefab("dragon_scales") bigaxe.Transform:SetPosition(pt.x, pt.y, pt.z) bigaxe.AnimState:SetBank("Lucy_axe") bigaxe.AnimState:SetBuild("Lucy_axe") bigaxe.AnimState:PlayAnimation("idle") bigaxe.components.inventoryitem:ChangeImageName("lucy") bigaxe:AddComponent("named") bigaxe.components.named:SetName("Poleaxe") bigaxe:RemoveComponent("stackable") bigaxe:RemoveComponent("deployable") bigaxe:AddComponent("equippable") bigaxe.components.equippable.equipslot = EQUIPSLOTS.HANDS bigaxe.components.equippable:SetOnEquip(function(bigaxe, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_lucy_axe", "swap_lucy_axe") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") bigaxe.fire = SpawnPrefab( "campfirefire" ) local follower = bigaxe.fire.entity:AddFollower() follower:FollowSymbol( owner.GUID, "swap_object", -2, -135, 1 ) bigaxe.fire.AnimState:SetMultColour(255/255,0/255,0/255,1) bigaxe.fire:RemoveComponent("heater") bigaxe.fire.persists = false end ) bigaxe.components.equippable:SetOnUnequip(function(bigaxe, owner) owner.AnimState:Hide("ARM_carry") owner.AnimState:Show("ARM_normal") bigaxe.fire:Remove() bigaxe.fire = nil end ) bigaxe:AddComponent("weapon") bigaxe.components.weapon:SetDamage(500) bigaxe.components.weapon:SetOnAttack(function(bigaxe, attacker, target) GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") SpawnPrefab("groundpoundring_fx").Transform:SetPosition(attacker.Transform:GetWorldPosition()) GetPlayer().components.playercontroller:ShakeCamera(attacker, "FULL", 0.5, 0.05, 2, 40) if target.components.locomotor then target.components.locomotor:Stop() end if target.components.health:GetPercent() < 0.3 then target.AnimState:SetMultColour(255/255,0/255,0/255,1) end attacker.components.health:DoDelta(150) attacker:StartThread(function() for k = 1, 3 do local blood = SpawnPrefab("splash") blood.Transform:SetPosition(target.Transform:GetWorldPosition()) blood.AnimState:SetMultColour(255/255,0/255,0/255,1) blood.Transform:SetScale(2, 2, 2) Sleep(.1) end end ) target:AddTag("nomove") target:DoTaskInTime(0.4, function() target:RemoveTag("nomove") end ) local pos = Vector3(attacker.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 8) 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("nomove") then if v.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == v or v:HasTag("monster") then SpawnPrefab("explode_small").Transform:SetPosition(v.Transform:GetWorldPosition()) v.components.health:DoDelta(-300) local pt01 = attacker:GetPosition() local pt02 = v:GetPosition() v.Transform:SetPosition((pt02.x-pt01.x)*1.5+pt02.x, 0, (pt02.z-pt01.z)*1.5+pt02.z) if v.components.locomotor then v.components.locomotor:Stop() end if v.components.health:GetPercent() < 0.3 then v.AnimState:SetMultColour(255/255,0/255,0/255,1) end end end end end ) bigaxe:AddComponent("tool") bigaxe.components.tool:SetAction(ACTIONS.CHOP, 15) bigaxe:AddTag("bigaxes") inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("bigaxes") then data.bigaxes = true end end local function onload(inst, data) if data and data.bigaxes then inst.AnimState:SetBank("Lucy_axe") inst.AnimState:SetBuild("Lucy_axe") inst.AnimState:PlayAnimation("idle") inst.components.inventoryitem:ChangeImageName("lucy") inst:AddComponent("named") inst.components.named:SetName("Poleaxe") inst:RemoveComponent("stackable") inst:RemoveComponent("deployable") inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.HANDS inst.components.equippable:SetOnEquip(function(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_lucy_axe", "swap_lucy_axe") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") inst.fire = SpawnPrefab( "campfirefire" ) local follower = inst.fire.entity:AddFollower() follower:FollowSymbol( owner.GUID, "swap_object", -2, -135, 1 ) inst.fire.AnimState:SetMultColour(255/255,0/255,0/255,1) inst.fire:RemoveComponent("heater") inst.fire.persists = false end ) inst.components.equippable:SetOnUnequip(function(inst, owner) owner.AnimState:Hide("ARM_carry") owner.AnimState:Show("ARM_normal") inst.fire:Remove() inst.fire = nil end ) inst:AddComponent("weapon") inst.components.weapon:SetDamage(500) inst.components.weapon:SetOnAttack(function(inst, attacker, target) GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") SpawnPrefab("groundpoundring_fx").Transform:SetPosition(attacker.Transform:GetWorldPosition()) GetPlayer().components.playercontroller:ShakeCamera(attacker, "FULL", 0.5, 0.05, 2, 40) if target.components.locomotor then target.components.locomotor:Stop() end if target.components.health:GetPercent() < 0.3 then target.AnimState:SetMultColour(255/255,0/255,0/255,1) end attacker.components.health:DoDelta(150) attacker:StartThread(function() for k = 1, 3 do local blood = SpawnPrefab("splash") blood.Transform:SetPosition(target.Transform:GetWorldPosition()) blood.AnimState:SetMultColour(255/255,0/255,0/255,1) blood.Transform:SetScale(2, 2, 2) Sleep(.1) end end ) target:AddTag("nomove") target:DoTaskInTime(0.4, function() target:RemoveTag("nomove") end ) local pos = Vector3(attacker.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 8) 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("nomove") then if v.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == v or v:HasTag("monster") then SpawnPrefab("explode_small").Transform:SetPosition(v.Transform:GetWorldPosition()) v.components.health:DoDelta(-300) local pt01 = attacker:GetPosition() local pt02 = v:GetPosition() v.Transform:SetPosition((pt02.x-pt01.x)*1.5+pt02.x, 0, (pt02.z-pt01.z)*1.5+pt02.z) if v.components.locomotor then v.components.locomotor:Stop() end if v.components.health:GetPercent() < 0.3 then v.AnimState:SetMultColour(255/255,0/255,0/255,1) end end end end end ) inst:AddComponent("tool") inst.components.tool:SetAction(ACTIONS.CHOP, 15) inst:AddTag("bigaxes") end end inst.OnSave = onsave inst.OnLoad = onload 即可用蜻蜓鳞片种霸王斧,装备霸王斧攻击时,自动会吸取敌人的血,补充主角生命值,同时震开并伤害周围的敌人(区域攻击),减少你被围殴的机会。霸王斧用来砍树也极其锋利,一斧便可砍倒一棵。蜻蜓鳞片靠打蜻蜓获得,也可在“巨型超市”花9-11个黄金购得

2025/04/23 · Bny

YN176-霸王盔(用猪皮种霸王盔,吸收99%伤害,挨打时弹开并反伤敌人,可照明、防雨、防冻、防暑、补脑、奔跑加速)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一七六.霸王盔(用猪皮种霸王盔,吸收99%伤害,挨打时弹开并反伤敌人,可照明、防雨、防冻、防暑、补脑、奔跑加速) 用MT管理器打开游戏目录/assets/scripts/prefabs/pigskin.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function OnDeploy (inst, pt) local helmet = SpawnPrefab("pigskin") helmet.Transform:SetPosition(pt.x, pt.y, pt.z) helmet.AnimState:SetBank("wathgrithrhat") helmet.AnimState:SetBuild("hat_wathgrithr") helmet.AnimState:PlayAnimation("anim") helmet.components.inventoryitem:ChangeImageName("wathgrithrhat") helmet:RemoveComponent("stackable") helmet:RemoveComponent("tradable") helmet:RemoveComponent("edible") helmet:RemoveComponent("burnable") helmet:RemoveComponent("propagator") helmet:RemoveComponent("deployable") helmet:AddComponent("equippable") helmet.components.equippable.equipslot = EQUIPSLOTS.HEAD helmet.components.equippable.walkspeedmult = 2.5 helmet.components.equippable.dapperness = TUNING.DAPPERNESS_HUGE*32 helmet.components.equippable:SetOnEquip(function(helmet, owner) owner.AnimState:OverrideSymbol("swap_hat", "hat_wathgrithr", "swap_hat") owner.AnimState:Show("HAT") owner.AnimState:Show("HAT_HAIR") owner.AnimState:Hide("HAIR_NOHAT") owner.AnimState:Hide("HAIR") if owner == GetPlayer() then owner.AnimState:Hide("HEAD") owner.AnimState:Show("HEAD_HAIR") owner.components.temperature:SetTemp(20) owner:PushEvent("stopfreezing") owner:PushEvent("stopoverheating") owner.components.moisture:SetMoistureLevel(0) helmet.fire = SpawnPrefab( "campfirefire" ) local follower = helmet.fire.entity:AddFollower() follower:FollowSymbol( owner.GUID, "swap_hat", -6, -196, 0 ) helmet.fire.AnimState:SetMultColour(255/255,0/255,0/255,1) helmet.fire.Transform:SetScale(1.3, 1.3, 1.3) helmet.fire:RemoveComponent("heater") helmet.fire.persists = false helmet.helmetfn = function(attacked, data) if data and data.attacker and data.attacker.components.health then SpawnPrefab("groundpoundring_fx").Transform:SetPosition(owner.Transform:GetWorldPosition()) data.attacker.components.health:DoDelta(-300) local pt01 = owner:GetPosition() local pt02 = data.attacker:GetPosition() data.attacker.Transform:SetPosition((pt02.x-pt01.x)*1.5+pt02.x, 0, (pt02.z-pt01.z)*1.5+pt02.z) if data.attacker.components.locomotor then data.attacker.components.locomotor:Stop() end if data.attacker.components.health:GetPercent() < 0.3 then data.attacker.AnimState:SetMultColour(255/255,0/255,0/255,1) end end end helmet:ListenForEvent("attacked", helmet.helmetfn, owner) owner:AddTag("goodsavages") end end ) helmet.components.equippable:SetOnUnequip(function(helmet, owner) owner.AnimState:Hide("HAT") owner.AnimState:Hide("HAT_HAIR") owner.AnimState:Show("HAIR_NOHAT") owner.AnimState:Show("HAIR") if owner == GetPlayer() then owner.AnimState:Show("HEAD") owner.AnimState:Hide("HEAD_HAIR") owner.components.temperature:SetTemp(nil) helmet.fire:Remove() helmet.fire = nil helmet:RemoveEventCallback("attacked", helmet.helmetfn, owner) owner:RemoveTag("goodsavages") end end ) helmet:AddComponent("armor") helmet.components.armor:InitCondition(20000, 0.99) helmet:AddComponent("waterproofer") helmet.components.waterproofer:SetEffectiveness(1) helmet:AddTag("helmets") inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("helmets") then data.helmets = true end end local function onload(inst, data) if data and data.helmets then inst.AnimState:SetBank("wathgrithrhat") inst.AnimState:SetBuild("hat_wathgrithr") inst.AnimState:PlayAnimation("anim") inst.components.inventoryitem:ChangeImageName("wathgrithrhat") inst:RemoveComponent("stackable") inst:RemoveComponent("tradable") inst:RemoveComponent("edible") inst:RemoveComponent("burnable") inst:RemoveComponent("propagator") inst:RemoveComponent("deployable") inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.HEAD inst.components.equippable.walkspeedmult = 2.5 inst.components.equippable.dapperness = TUNING.DAPPERNESS_HUGE*32 inst.components.equippable:SetOnEquip(function(inst, owner) owner.AnimState:OverrideSymbol("swap_hat", "hat_wathgrithr", "swap_hat") owner.AnimState:Show("HAT") owner.AnimState:Show("HAT_HAIR") owner.AnimState:Hide("HAIR_NOHAT") owner.AnimState:Hide("HAIR") if owner == GetPlayer() then owner.AnimState:Hide("HEAD") owner.AnimState:Show("HEAD_HAIR") owner.components.temperature:SetTemp(20) owner:PushEvent("stopfreezing") owner:PushEvent("stopoverheating") owner.components.moisture:SetMoistureLevel(0) inst.fire = SpawnPrefab( "campfirefire" ) local follower = inst.fire.entity:AddFollower() follower:FollowSymbol( owner.GUID, "swap_hat", -6, -196, 0 ) inst.fire.AnimState:SetMultColour(255/255,0/255,0/255,1) inst.fire.Transform:SetScale(1.3, 1.3, 1.3) inst.fire:RemoveComponent("heater") inst.fire.persists = false inst.helmetfn = function(attacked, data) if data and data.attacker and data.attacker.components.health then SpawnPrefab("groundpoundring_fx").Transform:SetPosition(owner.Transform:GetWorldPosition()) data.attacker.components.health:DoDelta(-300) local pt01 = owner:GetPosition() local pt02 = data.attacker:GetPosition() data.attacker.Transform:SetPosition((pt02.x-pt01.x)*1.5+pt02.x, 0, (pt02.z-pt01.z)*1.5+pt02.z) if data.attacker.components.locomotor then data.attacker.components.locomotor:Stop() end if data.attacker.components.health:GetPercent() < 0.3 then data.attacker.AnimState:SetMultColour(255/255,0/255,0/255,1) end end end inst:ListenForEvent("attacked", inst.helmetfn, owner) owner:AddTag("goodsavages") end end ) inst.components.equippable:SetOnUnequip(function(inst, owner) owner.AnimState:Hide("HAT") owner.AnimState:Hide("HAT_HAIR") owner.AnimState:Show("HAIR_NOHAT") owner.AnimState:Show("HAIR") if owner == GetPlayer() then owner.AnimState:Show("HEAD") owner.AnimState:Hide("HEAD_HAIR") owner.components.temperature:SetTemp(nil) inst.fire:Remove() inst.fire = nil inst:RemoveEventCallback("attacked", inst.helmetfn, owner) owner:RemoveTag("goodsavages") end end ) inst:AddComponent("armor") inst.components.armor:InitCondition(20000, 0.99) inst:AddComponent("waterproofer") inst.components.waterproofer:SetEffectiveness(1) inst:AddTag("helmets") end end inst.OnSave = onsave inst.OnLoad = onload 即可用猪皮种霸王盔,吸收99%伤害,敌人攻击你时会被弹开,并遭到反伤,让你流的每一滴血,都收到百倍利息。霸王盔可照明、防雨、防冻、防暑、补脑,并使奔跑加速,与“霸王枪”并称饥荒世界两大神器,助你在乱世中百战百胜。佩戴霸王盔时,“铁血蛮族”不敢主动攻击你。不要与“用猪皮种猪火炬”一同修改

2025/04/23 · Bny

YN177-活捉手杖(装备龙卷风魔杖,鼠标左键点鸟、鼹鼠等小动物,可远程活捉)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一七七.活捉手杖(装备龙卷风魔杖,鼠标左键点鸟、鼹鼠等小动物,可远程活捉) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/staff_tornado.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function canattack(inst, target) if target.prefab == "bee" or target.prefab == "killerbee" or target.prefab == "crow" or target.prefab == "robin" or target.prefab == "robin_winter" or target.prefab == "butterfly" or target.prefab == "mole" or target.prefab == "mosquito" or target.prefab == "rabbit" then return true end return false end local function onattack(inst, attacker, target) if target.prefab == "bee" then local prey = SpawnPrefab("bee") GetPlayer().components.inventory:GiveItem(prey) end if target.prefab == "killerbee" then local prey = SpawnPrefab("killerbee") GetPlayer().components.inventory:GiveItem(prey) end if target.prefab == "crow" then local prey = SpawnPrefab("crow") GetPlayer().components.inventory:GiveItem(prey) end if target.prefab == "robin" then local prey = SpawnPrefab("robin") GetPlayer().components.inventory:GiveItem(prey) end if target.prefab == "robin_winter" then local prey = SpawnPrefab("robin_winter") GetPlayer().components.inventory:GiveItem(prey) end if target.prefab == "butterfly" then local prey = SpawnPrefab("butterfly") GetPlayer().components.inventory:GiveItem(prey) end if target.prefab == "mole" then local prey = SpawnPrefab("mole") GetPlayer().components.inventory:GiveItem(prey) end if target.prefab == "mosquito" then local prey = SpawnPrefab("mosquito") GetPlayer().components.inventory:GiveItem(prey) end if target.prefab == "rabbit" then local prey = SpawnPrefab("rabbit") GetPlayer().components.inventory:GiveItem(prey) end target:Remove() end inst:AddComponent("weapon") inst.components.weapon:SetDamage(0) inst.components.weapon:SetRange(25, 30) inst.components.weapon:SetOnAttack(onattack) inst.components.weapon:SetCanAttack(canattack) inst.components.weapon:SetProjectile("bishop_charge") 即可将龙卷风魔杖升级为活捉手杖,装备活捉手杖,鼠标左键点小动物,可远距离活捉它们。可活捉的小动物包括蜜蜂、杀人蜂、鸟、蝴蝶、鼹鼠、蚊子、兔子。龙卷风魔杖右键召唤龙卷风的功能保留。龙卷风魔杖在战斗选项下,用10个鹿鸭羽毛、1个闪电羊角、1个齿轮制造

2025/04/23 · Bny

YN178-巨人帽(带猪皮帽变巨人,攻击、防御上升,可撞毁建筑、树、石头)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一七八.巨人帽(带猪皮帽变巨人,攻击、防御上升,可撞毁建筑、树、石头) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/hats.lua文件,将下列内容: local function football() local inst = simple() inst:AddComponent("armor") inst:AddComponent("waterproofer") inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_SMALL) inst.components.armor:InitCondition(TUNING.ARMOR_FOOTBALLHAT, TUNING.ARMOR_FOOTBALLHAT_ABSORPTION) return inst end 替换为: local function football_equip(inst, owner) onequip(inst, owner) if owner == GetPlayer() then owner.Transform:SetScale(3, 3, 3) owner.components.combat:SetDefaultDamage(500) owner.Physics:SetCollisionCallback(function(owner, other) if other and other.components.workable and other.components.workable.workleft > 0 then other.components.workable:Destroy(owner) end end) end end local function football_unequip(inst, owner) onunequip(inst, owner) if owner == GetPlayer() then owner.Transform:SetScale(1, 1, 1) owner.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE) owner.Physics:SetCollisionCallback( nil ) end end local function football() local inst = simple() inst:AddComponent("armor") inst.components.armor:InitCondition(TUNING.ARMOR_FOOTBALLHAT, 0.95) inst:AddComponent("waterproofer") inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_SMALL) inst.components.equippable:SetOnEquip( football_equip ) inst.components.equippable:SetOnUnequip( football_unequip ) return inst end 即可戴猪皮帽变巨人,空手攻击力达到500点(空手按Ctrl + 鼠标左键攻击,或按住F反击),防御敌人95%的伤害(只掉5%的血),可撞毁建筑、树、石头。猪皮帽在战斗选项(画着两把剑)下,用1个绳子、1个猪皮制造,制造时须靠近炼金术引擎

2025/04/23 · Bny

YN179-防弹背包(装备背包吸收99%伤害值)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 一七九.防弹背包(装备背包吸收99%伤害值) 1.普通背包作盔甲:用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/backpack.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: inst:AddComponent("armor") inst.components.armor:InitCondition(TUNING.ARMORMARBLE, 0.99) 2.小猪包作盔甲:用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/piggyback.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: inst:AddComponent("armor") inst.components.armor:InitCondition(TUNING.ARMORMARBLE, 0.99) 3.坎普斯背包作盔甲:用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/krampus_sack.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: inst:AddComponent("armor") inst.components.armor:InitCondition(TUNING.ARMORMARBLE, 0.99) 4.冰包作盔甲:用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/icepack.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: inst:AddComponent("armor") inst.components.armor:InitCondition(TUNING.ARMORMARBLE, 0.99) 5.盔甲永固:用MT管理器打开游戏目录/assets/scripts/components/armor.lua文件,将下列内容: function Armor:SetCondition(amount) self.condition = amount 替换为: function Armor:SetCondition(amount) self.condition = self.maxcondition 即可装备背包就拥有盔甲防护作用,且99%吸收伤害值,还无限使用哦

2025/04/23 · Bny