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

YN216-鬼影重重(夜晚墓地有大量亡魂游荡,购买亡魂之心让主角变身亡魂)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二一六.鬼影重重(夜晚墓地有大量亡魂游荡,购买亡魂之心让主角变身亡魂) 1.用MT管理器打开游戏目录/assets/scripts/prefabs/gravestone.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function createghostnpc(inst) for k = 1,math.random(3,7) do local pt = inst:GetPosition() local ghostnpc = SpawnPrefab("deadlyfeast") ghostnpc.Transform:SetPosition(pt.x+(math.random(20)-math.random(20)), 0, pt.z+(math.random(20)-math.random(20))) ghostnpc.entity:AddSoundEmitter() ghostnpc.AnimState:SetBank("ghost") ghostnpc.AnimState:SetBuild("ghost_build") ghostnpc.AnimState:PlayAnimation("idle", true) ghostnpc.Transform:SetFourFaced() MakeGhostPhysics(ghostnpc, 1, .5) local minimap = ghostnpc.entity:AddMiniMapEntity() minimap:SetIcon("whitespider_den.png") ghostnpc.AnimState:SetBloomEffectHandle("shaders/anim.ksh") local light = ghostnpc.entity:AddLight() light:SetIntensity(.6) light:SetRadius(.5) light:SetFalloff(.6) light:Enable(true) light:SetColour(180/255, 195/255, 225/255) local brain = require "brains/leifbrain" ghostnpc:SetBrain(brain) ghostnpc:AddComponent("locomotor") ghostnpc.components.locomotor.walkspeed = 5 ghostnpc.components.locomotor.runspeed = 5 ghostnpc:SetStateGraph("SGghost") ghostnpc:AddTag("ghostnpcs") ghostnpc:RemoveComponent("edible") ghostnpc:RemoveComponent("inventoryitem") ghostnpc:RemoveTag("meat") ghostnpc:AddComponent("sanityaura") ghostnpc.components.sanityaura.aura = -TUNING.SANITYAURA_SMALL ghostnpc:AddComponent("health") ghostnpc.components.health:SetMaxHealth(500) ghostnpc:AddComponent("trader") ghostnpc.components.trader:SetAcceptTest(function(ghostnpc, item) if GetPlayer().components.inventory:Has("goldnugget", 30) then if item.prefab == "goldnugget" then return true end end return false end ) ghostnpc.components.trader.onaccept = function(ghostnpc, giver, item) GetPlayer().components.inventory:ConsumeByName("goldnugget", 29) local ghostheart = SpawnPrefab("deadlyfeast") ghostheart.AnimState:SetBank("egg") ghostheart.AnimState:SetBuild("tallbird_egg") ghostheart.AnimState:PlayAnimation("cooked") ghostheart.components.inventoryitem:ChangeImageName("tallbirdegg_cooked") ghostheart:RemoveComponent("edible") ghostheart:RemoveTag("meat") ghostheart:AddComponent("equippable") ghostheart.components.equippable:SetOnEquip( function(ghostheart, owner) if owner == GetPlayer() and not GetPlayer():HasTag("poisoning") and not GetPlayer():HasTag("fever") then owner.components.locomotor:Stop() owner.components.playercontroller:Enable(false) owner:DoTaskInTime(0.3, function() SpawnPrefab("collapse_big").Transform:SetPosition(owner.Transform:GetWorldPosition()) owner.AnimState:SetBank("ghost") owner.AnimState:SetBuild("ghost_build") owner:SetStateGraph("SGghost") owner.AnimState:PlayAnimation("idle", true) owner.Transform:SetScale(1.2,1.2,1.2) local shadow = owner.entity:AddDynamicShadow() shadow:SetSize( 0, 0 ) owner.AnimState:SetBloomEffectHandle("shaders/anim.ksh") local light = owner.entity:AddLight() light:SetIntensity(.6) light:SetRadius(20) light:SetFalloff(.6) light:Enable(true) light:SetColour(180/255, 195/255, 225/255) owner.components.locomotor.walkspeed = 20 owner.components.locomotor.runspeed = 20 owner.components.health:DoDelta(owner.components.health.maxhealth) owner.components.health:SetInvincible(true) owner.components.hunger:DoDelta(owner.components.hunger.max) owner.components.hunger:Pause() owner.components.sanity:DoDelta(owner.components.sanity.max) owner.components.sanity.ignore = true owner.components.combat:SetDefaultDamage(1000) owner:AddComponent("aura") owner.components.aura.radius = 3 owner.components.aura.tickperiod = 0.5 owner.components.aura.ignoreallies = true owner.components.aura.auratestfn = function(ghostnpc, target) if target.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == target then return true end return false end owner.components.temperature:SetTemp(20) owner.components.playercontroller:Enable(true) end ) end end ) ghostheart.components.equippable:SetOnUnequip( function(ghostheart, owner) SpawnPrefab("collapse_big").Transform:SetPosition(owner.Transform:GetWorldPosition()) owner.components.locomotor:Stop() owner.components.playercontroller:Enable(false) owner:DoTaskInTime(0.3, function() owner.AnimState:SetBank("wilson") if GetPlayer().prefab == "wilson" then owner.AnimState:SetBuild("wilson") end if GetPlayer().prefab == "wendy" then owner.AnimState:SetBuild("wendy") end if GetPlayer().prefab == "wes" then owner.AnimState:SetBuild("wes") end if GetPlayer().prefab == "wickerbottom" then owner.AnimState:SetBuild("wickerbottom") end if GetPlayer().prefab == "willow" then owner.AnimState:SetBuild("willow") end if GetPlayer().prefab == "wolfgang" then owner.AnimState:SetBuild("wolfgang") end if GetPlayer().prefab == "wx78" then owner.AnimState:SetBuild("wx78") end if GetPlayer().prefab == "woodie" then owner.AnimState:SetBuild("woodie") end if GetPlayer().prefab == "waxwell" then owner.AnimState:SetBuild("waxwell") end if GetPlayer().prefab == "wathgrithr" then owner.AnimState:SetBuild("wathgrithr") end if GetPlayer().prefab == "webber" then owner.AnimState:SetBuild("webber") end owner:SetStateGraph("SGwilson") owner.AnimState:PlayAnimation("idle") owner.Transform:SetScale(1,1,1) local shadow = owner.entity:AddDynamicShadow() shadow:SetSize( 1.3, .6 ) owner.AnimState:SetBloomEffectHandle("") owner.Light:Enable(false) owner.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED owner.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED owner.components.health:SetInvincible(false) owner.components.hunger:Resume() owner.components.sanity.ignore = false owner.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE) owner.components.combat.hiteffectsymbol = "torso" owner:RemoveComponent("aura") owner.components.temperature:SetTemp(nil) owner.components.playercontroller:Enable(true) ghostheart:Remove() end ) end ) ghostheart.components.equippable.equipslot = EQUIPSLOTS.HANDS ghostheart:AddTag("ghostheart") GetPlayer().components.inventory:GiveItem(ghostheart) end ghostnpc:AddComponent("combat") ghostnpc.components.combat:SetDefaultDamage(3) ghostnpc.components.combat:SetAttackPeriod(1) ghostnpc.components.combat:SetRetargetFunction(2, function(ghostnpc) if not ghostnpc.components.health:IsDead() then return FindEntity(ghostnpc, 25, function(guy) if guy:HasTag("monster") then return guy end if guy:HasTag("player") and guy.components.inventory and not guy.components.inventory:FindItem(function(item) return item.prefab == "nightmarefuel" end ) then return guy end end ) end end ) ghostnpc:ListenForEvent("attacked", function(ghostnpc, data) ghostnpc.components.combat:SetTarget(data.attacker) ghostnpc.components.combat:ShareTarget(data.attacker, 35, function(dude) return dude:HasTag("ghostnpcs") and not dude.components.health:IsDead() end, 5) end ) ghostnpc:AddComponent("aura") ghostnpc.components.aura.radius = 2 ghostnpc.components.aura.tickperiod = 1 ghostnpc.components.aura.ignoreallies = true ghostnpc.components.aura.auratestfn = function(ghostnpc, target) if target:HasTag("ghostnpcs") then return false end if target.components.combat.target == ghostnpc or ghostnpc.components.combat.target == target then return true end end ghostnpc:ListenForEvent("death", function() local gems = {"purplegem","bluegem","redgem","orangegem","yellowgem","greengem","thulecite","goldnugget"} local gem = gems[math.random(#gems)] SpawnPrefab(gem).Transform:SetPosition(ghostnpc.Transform:GetWorldPosition()) end ) ghostnpc:ListenForEvent( "daytime", function() ghostnpc:Remove() end , GetWorld()) end end inst:ListenForEvent( "dusktime", function() createghostnpc(inst) end , GetWorld()) 2.用MT管理器打开游戏目录/assets/scripts/prefabs/deadlyfeast.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function onsave(inst, data) if inst:HasTag("ghostnpcs") then data.ghostnpcs = true end if inst:HasTag("ghostheart") then data.ghostheart = true end end local function onload(inst, data) if data and data.ghostnpcs then inst.entity:AddSoundEmitter() inst.AnimState:SetBank("ghost") inst.AnimState:SetBuild("ghost_build") inst.AnimState:PlayAnimation("idle", true) inst.Transform:SetFourFaced() MakeGhostPhysics(inst, 1, .5) local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon("whitespider_den.png") inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") local light = inst.entity:AddLight() light:SetIntensity(.6) light:SetRadius(.5) light:SetFalloff(.6) light:Enable(true) light:SetColour(180/255, 195/255, 225/255) local brain = require "brains/leifbrain" inst:SetBrain(brain) inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 5 inst.components.locomotor.runspeed = 5 inst:SetStateGraph("SGghost") inst:AddTag("ghostnpcs") inst:RemoveComponent("edible") inst:RemoveComponent("inventoryitem") inst:RemoveTag("meat") inst:AddComponent("sanityaura") inst.components.sanityaura.aura = -TUNING.SANITYAURA_SMALL inst:AddComponent("health") inst.components.health:SetMaxHealth(500) inst:AddComponent("trader") inst.components.trader:SetAcceptTest(function(inst, item) if GetPlayer().components.inventory:Has("goldnugget", 30) then if item.prefab == "goldnugget" then return true end end return false end ) inst.components.trader.onaccept = function(inst, giver, item) GetPlayer().components.inventory:ConsumeByName("goldnugget", 29) local ghostheart = SpawnPrefab("deadlyfeast") ghostheart.AnimState:SetBank("egg") ghostheart.AnimState:SetBuild("tallbird_egg") ghostheart.AnimState:PlayAnimation("cooked") ghostheart.components.inventoryitem:ChangeImageName("tallbirdegg_cooked") ghostheart:RemoveComponent("edible") ghostheart:RemoveTag("meat") ghostheart:AddComponent("equippable") ghostheart.components.equippable:SetOnEquip( function(ghostheart, owner) if owner == GetPlayer() and not GetPlayer():HasTag("poisoning") and not GetPlayer():HasTag("fever") then owner.components.locomotor:Stop() owner.components.playercontroller:Enable(false) owner:DoTaskInTime(0.3, function() SpawnPrefab("collapse_big").Transform:SetPosition(owner.Transform:GetWorldPosition()) owner.AnimState:SetBank("ghost") owner.AnimState:SetBuild("ghost_build") owner:SetStateGraph("SGghost") owner.AnimState:PlayAnimation("idle", true) owner.Transform:SetScale(1.2,1.2,1.2) local shadow = owner.entity:AddDynamicShadow() shadow:SetSize( 0, 0 ) owner.AnimState:SetBloomEffectHandle("shaders/anim.ksh") local light = owner.entity:AddLight() light:SetIntensity(.6) light:SetRadius(20) light:SetFalloff(.6) light:Enable(true) light:SetColour(180/255, 195/255, 225/255) owner.components.locomotor.walkspeed = 20 owner.components.locomotor.runspeed = 20 owner.components.health:DoDelta(owner.components.health.maxhealth) owner.components.health:SetInvincible(true) owner.components.hunger:DoDelta(owner.components.hunger.max) owner.components.hunger:Pause() owner.components.sanity:DoDelta(owner.components.sanity.max) owner.components.sanity.ignore = true owner.components.combat:SetDefaultDamage(1000) owner:AddComponent("aura") owner.components.aura.radius = 3 owner.components.aura.tickperiod = 0.5 owner.components.aura.ignoreallies = true owner.components.aura.auratestfn = function(inst, target) if target.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == target then return true end return false end owner.components.temperature:SetTemp(20) owner.components.playercontroller:Enable(true) end ) end end ) ghostheart.components.equippable:SetOnUnequip( function(ghostheart, owner) SpawnPrefab("collapse_big").Transform:SetPosition(owner.Transform:GetWorldPosition()) owner.components.locomotor:Stop() owner.components.playercontroller:Enable(false) owner:DoTaskInTime(0.3, function() owner.AnimState:SetBank("wilson") if GetPlayer().prefab == "wilson" then owner.AnimState:SetBuild("wilson") end if GetPlayer().prefab == "wendy" then owner.AnimState:SetBuild("wendy") end if GetPlayer().prefab == "wes" then owner.AnimState:SetBuild("wes") end if GetPlayer().prefab == "wickerbottom" then owner.AnimState:SetBuild("wickerbottom") end if GetPlayer().prefab == "willow" then owner.AnimState:SetBuild("willow") end if GetPlayer().prefab == "wolfgang" then owner.AnimState:SetBuild("wolfgang") end if GetPlayer().prefab == "wx78" then owner.AnimState:SetBuild("wx78") end if GetPlayer().prefab == "woodie" then owner.AnimState:SetBuild("woodie") end if GetPlayer().prefab == "waxwell" then owner.AnimState:SetBuild("waxwell") end if GetPlayer().prefab == "wathgrithr" then owner.AnimState:SetBuild("wathgrithr") end if GetPlayer().prefab == "webber" then owner.AnimState:SetBuild("webber") end owner:SetStateGraph("SGwilson") owner.AnimState:PlayAnimation("idle") owner.Transform:SetScale(1,1,1) local shadow = owner.entity:AddDynamicShadow() shadow:SetSize( 1.3, .6 ) owner.AnimState:SetBloomEffectHandle("") owner.Light:Enable(false) owner.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED owner.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED owner.components.health:SetInvincible(false) owner.components.hunger:Resume() owner.components.sanity.ignore = false owner.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE) owner.components.combat.hiteffectsymbol = "torso" owner:RemoveComponent("aura") owner.components.temperature:SetTemp(nil) owner.components.playercontroller:Enable(true) ghostheart:Remove() end ) end ) ghostheart.components.equippable.equipslot = EQUIPSLOTS.HANDS ghostheart:AddTag("ghostheart") GetPlayer().components.inventory:GiveItem(ghostheart) end inst:AddComponent("combat") inst.components.combat:SetDefaultDamage(3) inst.components.combat:SetAttackPeriod(1) inst.components.combat:SetRetargetFunction(2, function(inst) if not inst.components.health:IsDead() then return FindEntity(inst, 25, function(guy) if guy:HasTag("monster") then return guy end if guy:HasTag("player") and guy.components.inventory and not guy.components.inventory:FindItem(function(item) return item.prefab == "nightmarefuel" end ) then return guy end end ) end end ) inst:ListenForEvent("attacked", function(inst, data) inst.components.combat:SetTarget(data.attacker) inst.components.combat:ShareTarget(data.attacker, 35, function(dude) return dude:HasTag("ghostnpcs") and not dude.components.health:IsDead() end, 5) end ) inst:AddComponent("aura") inst.components.aura.radius = 2 inst.components.aura.tickperiod = 1 inst.components.aura.ignoreallies = true inst.components.aura.auratestfn = function(inst, target) if target:HasTag("ghostnpcs") then return false end if target.components.combat.target == inst or inst.components.combat.target == target then return true end end inst:ListenForEvent("death", function() local gems = {"purplegem","bluegem","redgem","orangegem","yellowgem","greengem","thulecite","goldnugget"} local gem = gems[math.random(#gems)] SpawnPrefab(gem).Transform:SetPosition(inst.Transform:GetWorldPosition()) end ) inst:ListenForEvent( "daytime", function() inst:Remove() end , GetWorld()) end if data and data.ghostheart then inst.AnimState:SetBank("egg") inst.AnimState:SetBuild("tallbird_egg") inst.AnimState:PlayAnimation("cooked") inst.components.inventoryitem:ChangeImageName("tallbirdegg_cooked") inst:RemoveComponent("edible") inst:RemoveTag("meat") inst:AddComponent("equippable") inst.components.equippable:SetOnEquip( function(inst, owner) if owner == GetPlayer() and not GetPlayer():HasTag("poisoning") and not GetPlayer():HasTag("fever") then owner.components.locomotor:Stop() owner.components.playercontroller:Enable(false) owner:DoTaskInTime(0.3, function() SpawnPrefab("collapse_big").Transform:SetPosition(owner.Transform:GetWorldPosition()) owner.AnimState:SetBank("ghost") owner.AnimState:SetBuild("ghost_build") owner:SetStateGraph("SGghost") owner.AnimState:PlayAnimation("idle", true) owner.Transform:SetScale(1.2,1.2,1.2) local shadow = owner.entity:AddDynamicShadow() shadow:SetSize( 0, 0 ) owner.AnimState:SetBloomEffectHandle("shaders/anim.ksh") local light = owner.entity:AddLight() light:SetIntensity(.6) light:SetRadius(20) light:SetFalloff(.6) light:Enable(true) light:SetColour(180/255, 195/255, 225/255) owner.components.locomotor.walkspeed = 20 owner.components.locomotor.runspeed = 20 owner.components.health:DoDelta(owner.components.health.maxhealth) owner.components.health:SetInvincible(true) owner.components.hunger:DoDelta(owner.components.hunger.max) owner.components.hunger:Pause() owner.components.sanity:DoDelta(owner.components.sanity.max) owner.components.sanity.ignore = true owner.components.combat:SetDefaultDamage(1000) owner:AddComponent("aura") owner.components.aura.radius = 3 owner.components.aura.tickperiod = 0.5 owner.components.aura.ignoreallies = true owner.components.aura.auratestfn = function(ghostnpc, target) if target.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == target then return true end return false end owner.components.temperature:SetTemp(20) owner.components.playercontroller:Enable(true) end ) end end ) inst.components.equippable:SetOnUnequip( function(inst, owner) SpawnPrefab("collapse_big").Transform:SetPosition(owner.Transform:GetWorldPosition()) owner.components.locomotor:Stop() owner.components.playercontroller:Enable(false) owner:DoTaskInTime(0.3, function() owner.AnimState:SetBank("wilson") if GetPlayer().prefab == "wilson" then owner.AnimState:SetBuild("wilson") end if GetPlayer().prefab == "wendy" then owner.AnimState:SetBuild("wendy") end if GetPlayer().prefab == "wes" then owner.AnimState:SetBuild("wes") end if GetPlayer().prefab == "wickerbottom" then owner.AnimState:SetBuild("wickerbottom") end if GetPlayer().prefab == "willow" then owner.AnimState:SetBuild("willow") end if GetPlayer().prefab == "wolfgang" then owner.AnimState:SetBuild("wolfgang") end if GetPlayer().prefab == "wx78" then owner.AnimState:SetBuild("wx78") end if GetPlayer().prefab == "woodie" then owner.AnimState:SetBuild("woodie") end if GetPlayer().prefab == "waxwell" then owner.AnimState:SetBuild("waxwell") end if GetPlayer().prefab == "wathgrithr" then owner.AnimState:SetBuild("wathgrithr") end if GetPlayer().prefab == "webber" then owner.AnimState:SetBuild("webber") end owner:SetStateGraph("SGwilson") owner.AnimState:PlayAnimation("idle") owner.Transform:SetScale(1,1,1) local shadow = owner.entity:AddDynamicShadow() shadow:SetSize( 1.3, .6 ) owner.AnimState:SetBloomEffectHandle("") owner.Light:Enable(false) owner.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED owner.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED owner.components.health:SetInvincible(false) owner.components.hunger:Resume() owner.components.sanity.ignore = false owner.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE) owner.components.combat.hiteffectsymbol = "torso" owner:RemoveComponent("aura") owner.components.temperature:SetTemp(nil) owner.components.playercontroller:Enable(true) inst:Remove() end ) end ) inst.components.equippable.equipslot = EQUIPSLOTS.HANDS inst:AddTag("ghostheart") end end inst.OnSave = onsave inst.OnLoad = onload 即可在夜晚时,墓地有大量亡魂游荡,会主动攻击你,且靠近它们会降脑,消灭亡魂可获得宝石、铥矿石、黄金。亡魂在小地图上显示为白蜘蛛的图标。如果身上携带了噩梦燃料,亡魂就不会主动攻击你,给亡魂30个黄金(拿着黄金对亡魂点鼠标左键),可购买亡魂之心,装备它即可变身亡魂,生命、饥饿、脑全部锁死,按Ctrl + 鼠标左键攻击,且任何攻击你的敌人都会被自动烫死。卸载亡魂之心即可变回人,同时亡魂之心消失,想再变身就多买一些吧。如果修改了“小病小灾”,在主角感冒和食物中毒时,装备亡魂之心也不会变身

2025/04/23 · Bny

YN217-角斗场(用铥矿石种角斗场,参与生死角斗赚奖金,也可观看比赛)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二一七.角斗场(用铥矿石种角斗场,参与生死角斗赚奖金,也可观看比赛) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/thulecite.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local names = {"swap_goldenaxe","swap_spear","swap_spike","swap_batbat","swap_ruins_bat"} local weapon = names[math.random(#names)] local items = { SWORD = weapon } local function EquipItem(inst, item) if item then inst.AnimState:OverrideSymbol("swap_object", item, item) inst.AnimState:Show("ARM_carry") inst.AnimState:Hide("ARM_normal") end end inst.items = items inst.equipfn = EquipItem EquipItem(inst) local function fightgame(inst) local pt = inst:GetPosition() local gamehost = SpawnPrefab("thulecite") gamehost.Transform:SetPosition(pt.x, pt.y, pt.z) gamehost.AnimState:SetBank("wilson") gamehost.AnimState:SetBuild("wolfgang") gamehost.AnimState:OverrideSymbol("swap_hat", "hat_top", "swap_hat") gamehost.AnimState:Show("HAT") gamehost.AnimState:Show("HAT_HAIR") gamehost.AnimState:Hide("HAIR_NOHAT") gamehost.AnimState:Hide("HAIR") gamehost.AnimState:Hide("ARM_carry") gamehost.AnimState:Show("ARM_normal") gamehost.Transform:SetFourFaced() gamehost.AnimState:PlayAnimation("idle") gamehost:RemoveComponent("repairer") gamehost:RemoveComponent("edible") gamehost:RemoveComponent("tradable") gamehost:RemoveComponent("inventoryitem") gamehost:RemoveComponent("stackable") gamehost:RemoveComponent("deployable") gamehost:RemoveComponent("bait") gamehost:RemoveTag("molebait") gamehost:AddTag("gamehost") gamehost:AddComponent("workable") gamehost.components.workable:SetWorkAction(ACTIONS.HAMMER) gamehost.components.workable:SetWorkLeft(3) gamehost.components.workable:SetOnFinishCallback(function(gamehost) local pos = Vector3(gamehost.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 50) for k,v in pairs(ents) do if v:HasTag("candel") then SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") v:Remove() end end gamehost:Remove() end ) local fountain = SpawnPrefab("thulecite") fountain.Transform:SetPosition(pt.x-11, 0, pt.z-11) fountain.AnimState:SetBank("staff_purple_base") fountain.AnimState:SetBuild("staff_purple_base") fountain.AnimState:PlayAnimation("idle_full_loop") fountain.Transform:SetScale(1.5, 1.5, 1.5) fountain.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround ) fountain.AnimState:SetLayer( LAYER_BACKGROUND ) fountain.AnimState:SetSortOrder( 1 ) fountain.Transform:SetRotation( 45 ) fountain:AddTag("NOCLICK") fountain:RemoveComponent("repairer") fountain:RemoveComponent("edible") fountain:RemoveComponent("tradable") fountain:RemoveComponent("inventoryitem") fountain:RemoveComponent("stackable") fountain:RemoveComponent("deployable") fountain:RemoveComponent("bait") fountain:RemoveTag("molebait") local light = fountain.entity:AddLight() light:SetFalloff(1) light:SetIntensity(.8) light:SetRadius(18) light:SetColour(180/255, 195/255, 50/255) light:Enable(true) fountain:AddTag("candel") local pt0 = Vector3(fountain.Transform:GetWorldPosition()) for k = 1, 60 do local result_offset = FindValidPositionByFan(1 * 2 * PI, 12, 60, function(offset) local x,y,z = (pt0 + offset):Get() local ents = TheSim:FindEntities(x,y,z , 1) return not next(ents) end) if result_offset then local fence = SpawnPrefab("thulecite") fence.AnimState:SetBank("marble_pillar") fence.AnimState:SetBuild("marble_pillar") fence.AnimState:PlayAnimation("full") MakeObstaclePhysics(fence, 1) fence:RemoveComponent("repairer") fence:RemoveComponent("edible") fence:RemoveComponent("tradable") fence:RemoveComponent("inventoryitem") fence:RemoveComponent("stackable") fence:RemoveComponent("deployable") fence:RemoveComponent("bait") fence:RemoveTag("molebait") fence:AddTag("candel") fence.Transform:SetPosition((pt0 + result_offset):Get()) end end gamehost:AddComponent("trader") gamehost.components.trader:SetAcceptTest(function(gamehost, item) if not gamehost:HasTag("startgame") then if GetPlayer().components.inventory:Has("goldnugget", 100) then if item.prefab == "goldnugget" then return true end end end return false end ) gamehost.components.trader.onaccept = function(gamehost, giver, item) GetPlayer().components.inventory:ConsumeByName("goldnugget", 99) GetPlayer().components.locomotor:Stop() GetPlayer().Transform:SetPosition(pt.x-11+5, 0, pt.z-11-5) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/horn_beefalo") gamehost:AddTag("startgame") local warrior0 = SpawnPrefab("thulecite") warrior0.Transform:SetPosition(pt.x-11-5, 0, pt.z-11+5) warrior0.AnimState:SetBank("wilson") local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"} local buildname = names[math.random(#names)] warrior0.AnimState:SetBuild(buildname) local hats = {"hat_beefalo","hat_feather","hat_football","hat_ruins","hat_slurper","hat_slurtle","hat_spider"} local hat = hats[math.random(#hats)] warrior0.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat") local armors = {"armor_grass","armor_marble","armor_ruins","armor_sanity","armor_slurper","armor_wood"} local armor = armors[math.random(#armors)] warrior0.AnimState:OverrideSymbol("swap_body", armor, "swap_body") warrior0.AnimState:Show("HAT") warrior0.AnimState:Show("HAT_HAIR") warrior0.AnimState:Hide("HAIR_NOHAT") warrior0.AnimState:Hide("HAIR") warrior0.AnimState:Hide("ARM_carry") warrior0.AnimState:Show("ARM_normal") warrior0.AnimState:PlayAnimation("idle") warrior0.Transform:SetFourFaced() local sound = warrior0.entity:AddSoundEmitter() local shadow = warrior0.entity:AddDynamicShadow() shadow:SetSize( 1.3, .6 ) local brain = require "brains/frogbrain" warrior0:SetBrain(brain) warrior0:AddComponent("locomotor") warrior0.components.locomotor.walkspeed = 5 warrior0.components.locomotor.runspeed = 10 warrior0:SetStateGraph("SGshadowwaxwell") MakeCharacterPhysics(warrior0, 75, .5) warrior0:RemoveComponent("repairer") warrior0:RemoveComponent("edible") warrior0:RemoveComponent("tradable") warrior0:RemoveComponent("inventoryitem") warrior0:RemoveComponent("stackable") warrior0:RemoveComponent("deployable") warrior0:RemoveComponent("bait") warrior0:RemoveTag("molebait") warrior0:AddComponent("inventory") warrior0:AddComponent("knownlocations") warrior0:AddComponent("health") warrior0.components.health:SetMaxHealth(math.random(2500,5000)) warrior0:AddComponent("combat") warrior0.components.combat:SetDefaultDamage(math.random(25,50)) warrior0.components.combat:SetAttackPeriod(2) warrior0.components.combat:SetRetargetFunction(1, function(warrior0) if not warrior0.components.health:IsDead() then return FindEntity(warrior0, 30, function(guy) return guy:HasTag("player") end ) end end ) warrior0:DoPeriodicTask(1, function(warrior0) if not warrior0:HasTag("noplay") then if warrior0.components.health.currenthealth <= 100 then warrior0:AddTag("noplay") warrior0.components.combat:SetTarget(nil) warrior0.components.combat:SetRetargetFunction(100, nil ) end if GetPlayer().components.health.currenthealth <= 51 then warrior0.components.locomotor:Stop() warrior0:SetBrain(nil) warrior0:AddTag("noplay") warrior0.components.combat:SetTarget(nil) warrior0.components.combat:SetRetargetFunction(100, nil ) warrior0.components.health:SetInvincible(true) warrior0.AnimState:PlayAnimation("idle_onemanband1_loop",true) GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold") gamehost:DoTaskInTime(3, function() warrior0:Remove() GetPlayer().components.locomotor:Stop() GetPlayer().Transform:SetPosition(pt.x-1, 0, pt.z+1) if gamehost.task then gamehost.task:Cancel() gamehost.task = nil end gamehost:RemoveTag("startgame") end ) end end end ) warrior0:ListenForEvent("death", function() GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold") gamehost:DoTaskInTime(3, function() GetPlayer().components.locomotor:Stop() GetPlayer().Transform:SetPosition(pt.x-1, 0, pt.z+1) for k = 1, 200 do local goldnugget = SpawnPrefab("goldnugget") GetPlayer().components.inventory:GiveItem(goldnugget) end if gamehost.task then gamehost.task:Cancel() gamehost.task = nil end gamehost:RemoveTag("startgame") end ) end ) warrior0:AddTag("candel") gamehost.task = gamehost:DoPeriodicTask(1, function(gamehost) local target = FindEntity(fountain, 13, function(guy) return guy:HasTag("player") end ) if not target then GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold") warrior0:Remove() if gamehost.task then gamehost.task:Cancel() gamehost.task = nil end gamehost:RemoveTag("startgame") end end ) end gamehost.components.inspectable.getstatus = function(gamehost) if not gamehost:HasTag("startgame") then if GetPlayer().components.inventory:Has("goldnugget", 20) then GetPlayer().components.inventory:ConsumeByName("goldnugget", 20) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/horn_beefalo") gamehost:AddTag("startgame") local warrior1 = SpawnPrefab("thulecite") warrior1.Transform:SetPosition(pt.x-11+5, 0, pt.z-11-5) warrior1.AnimState:SetBank("wilson") local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"} local buildname = names[math.random(#names)] warrior1.AnimState:SetBuild(buildname) local hats = {"hat_beefalo","hat_feather","hat_football","hat_ruins","hat_slurper","hat_slurtle","hat_spider"} local hat = hats[math.random(#hats)] warrior1.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat") local armors = {"armor_grass","armor_marble","armor_ruins","armor_sanity","armor_slurper","armor_wood"} local armor = armors[math.random(#armors)] warrior1.AnimState:OverrideSymbol("swap_body", armor, "swap_body") warrior1.AnimState:Show("HAT") warrior1.AnimState:Show("HAT_HAIR") warrior1.AnimState:Hide("HAIR_NOHAT") warrior1.AnimState:Hide("HAIR") warrior1.AnimState:Hide("ARM_carry") warrior1.AnimState:Show("ARM_normal") warrior1.AnimState:PlayAnimation("idle") warrior1.Transform:SetFourFaced() local sound = warrior1.entity:AddSoundEmitter() local shadow = warrior1.entity:AddDynamicShadow() shadow:SetSize( 1.3, .6 ) local brain = require "brains/frogbrain" warrior1:SetBrain(brain) warrior1:AddComponent("locomotor") warrior1.components.locomotor.walkspeed = 5 warrior1.components.locomotor.runspeed = 10 warrior1:SetStateGraph("SGshadowwaxwell") MakeCharacterPhysics(warrior1, 75, .5) warrior1:RemoveComponent("repairer") warrior1:RemoveComponent("edible") warrior1:RemoveComponent("tradable") warrior1:RemoveComponent("inventoryitem") warrior1:RemoveComponent("stackable") warrior1:RemoveComponent("deployable") warrior1:RemoveComponent("bait") warrior1:RemoveTag("molebait") warrior1:AddComponent("inventory") warrior1:AddComponent("knownlocations") warrior1:AddComponent("health") warrior1.components.health:SetMaxHealth(math.random(200,500)) warrior1:AddComponent("combat") warrior1.components.combat:SetDefaultDamage(math.random(25,100)) warrior1.components.combat:SetAttackPeriod(3) warrior1.components.combat:SetRetargetFunction(1, function(warrior1) if not warrior1.components.health:IsDead() then return FindEntity(warrior1, 30, function(guy) return guy:HasTag("warrior2") end ) end end ) warrior1:AddTag("warrior1") warrior1:AddTag("candel") local warrior2 = SpawnPrefab("thulecite") warrior2.Transform:SetPosition(pt.x-11-5, 0, pt.z-11+5) warrior2.AnimState:SetBank("wilson") local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"} local buildname = names[math.random(#names)] warrior2.AnimState:SetBuild(buildname) local hats = {"hat_beefalo","hat_feather","hat_football","hat_ruins","hat_slurper","hat_slurtle","hat_spider"} local hat = hats[math.random(#hats)] warrior2.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat") local armors = {"armor_grass","armor_marble","armor_ruins","armor_sanity","armor_slurper","armor_wood"} local armor = armors[math.random(#armors)] warrior2.AnimState:OverrideSymbol("swap_body", armor, "swap_body") warrior2.AnimState:Show("HAT") warrior2.AnimState:Show("HAT_HAIR") warrior2.AnimState:Hide("HAIR_NOHAT") warrior2.AnimState:Hide("HAIR") warrior2.AnimState:Hide("ARM_carry") warrior2.AnimState:Show("ARM_normal") warrior2.AnimState:PlayAnimation("idle") warrior2.Transform:SetFourFaced() local sound = warrior2.entity:AddSoundEmitter() local shadow = warrior2.entity:AddDynamicShadow() shadow:SetSize( 1.3, .6 ) local brain = require "brains/frogbrain" warrior2:SetBrain(brain) warrior2:AddComponent("locomotor") warrior2.components.locomotor.walkspeed = 5 warrior2.components.locomotor.runspeed = 10 warrior2:SetStateGraph("SGshadowwaxwell") MakeCharacterPhysics(warrior2, 75, .5) warrior2:RemoveComponent("repairer") warrior2:RemoveComponent("edible") warrior2:RemoveComponent("tradable") warrior2:RemoveComponent("inventoryitem") warrior2:RemoveComponent("stackable") warrior2:RemoveComponent("deployable") warrior2:RemoveComponent("bait") warrior2:RemoveTag("molebait") warrior2:AddComponent("inventory") warrior2:AddComponent("knownlocations") warrior2:AddComponent("health") warrior2.components.health:SetMaxHealth(math.random(200,500)) warrior2:AddComponent("combat") warrior2.components.combat:SetDefaultDamage(math.random(25,100)) warrior2.components.combat:SetAttackPeriod(3) warrior2.components.combat:SetRetargetFunction(1, function(warrior2) if not warrior2.components.health:IsDead() then return FindEntity(warrior2, 30, function(guy) return guy:HasTag("warrior1") end ) end end ) warrior2:AddTag("warrior2") warrior2:AddTag("candel") warrior1:DoPeriodicTask(1, function(warrior1) if not warrior1:HasTag("noplay") and not warrior2:HasTag("noplay") then if warrior1.components.health.currenthealth <= 100 then warrior1:AddTag("noplay") warrior1.components.combat:SetTarget(nil) warrior1.components.combat:SetRetargetFunction(100, nil ) end end end ) warrior2:DoPeriodicTask(1, function(warrior2) if not warrior2:HasTag("noplay") and not warrior1:HasTag("noplay") then if warrior2.components.health.currenthealth <= 100 then warrior2:AddTag("noplay") warrior2.components.combat:SetTarget(nil) warrior2.components.combat:SetRetargetFunction(100, nil ) end end end ) warrior1:ListenForEvent("death", function() GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold") warrior2.components.locomotor:Stop() warrior2:SetBrain(nil) warrior2.AnimState:PlayAnimation("idle_onemanband1_loop",true) gamehost:DoTaskInTime(3, function() warrior2:Remove() gamehost:RemoveTag("startgame") end ) end ) warrior2:ListenForEvent("death", function() GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold") warrior1.components.locomotor:Stop() warrior1:SetBrain(nil) warrior1.AnimState:PlayAnimation("idle_onemanband1_loop",true) gamehost:DoTaskInTime(3, function() warrior1:Remove() gamehost:RemoveTag("startgame") end ) end ) end end end end local function OnDeploy (inst, pt) fightgame(inst) inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("candel") then data.candel = true end if inst:HasTag("gamehost") then data.gamehost = true end end local function onload(inst, data) if data and data.candel then inst:Remove() end if data and data.gamehost then fightgame(inst) inst:Remove() end end inst.OnSave = onsave inst.OnLoad = onload 即可在开阔的空地上,用铥矿石种角斗场,(拿着1个铥矿石对地面点鼠标右键,如果拿着多个铥矿石,则不会种出来)。当身上有20个黄金时,鼠标左键点老板,可以观看一场角斗。如果想参加角斗,就给老板100个黄金(拿着黄金对老板点鼠标左键),你将进入角斗场与其他角斗士对战。如果击败对手,将获得本金加奖金共200个黄金;如果你的血量小于50,则判定你失败,对手会饶你不死,但本金将不会退回;如果你逃出围墙,同样判定你失败。每次与你对战的对手都不同,如果上一次失败,不代表下次不会胜利哦,作个职业的角斗士吧

2025/04/23 · Bny

YN218-潘多拉魔盒(用硬骨头种潘多拉魔盒,每60秒有一批怪物来袭,展开塔防吧)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二一八.潘多拉魔盒(用硬骨头种潘多拉魔盒,每60秒有一批怪物来袭,展开塔防吧) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/boneshard.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function makemagicbox(inst) local pt = inst:GetPosition() local magicbox = SpawnPrefab("boneshard") magicbox.Transform:SetPosition(pt.x, pt.y, pt.z) magicbox.AnimState:SetBank("pandoras_chest") magicbox.AnimState:SetBuild("pandoras_chest") magicbox.AnimState:PlayAnimation("closed") magicbox.AnimState:SetMultColour(255/255,0/255,0/255,1) magicbox.Transform:SetScale(0.8, 0.8, 0.8) magicbox.AnimState:SetBloomEffectHandle("shaders/anim.ksh") local minimap = magicbox.entity:AddMiniMapEntity() minimap:SetIcon( "pandoras_chest.png" ) magicbox:RemoveComponent("inventoryitem") magicbox:RemoveComponent("stackable") magicbox:RemoveComponent("deployable") magicbox:AddTag("magicbox") magicbox:AddComponent("workable") magicbox.components.workable:SetWorkAction(ACTIONS.HAMMER) magicbox.components.workable:SetWorkLeft(3) magicbox.components.workable:SetOnFinishCallback(function(magicbox) local pos = Vector3(magicbox.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000) for k,v in pairs(ents) do if v:HasTag("bogey") then SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition()) v:Remove() end end SpawnPrefab("collapse_big").Transform:SetPosition(magicbox.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") magicbox:Remove() end ) magicbox.components.inspectable.getstatus = function(magicbox) if not magicbox:HasTag("makebogey") then magicbox:AddTag("makebogey") magicbox.AnimState:PlayAnimation("open") magicbox:DoTaskInTime(0.5, function(magicbox) SpawnPrefab("collapse_small").Transform:SetPosition(magicbox.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/horn_beefalo") GetPlayer().components.playercontroller:ShakeCamera(magicbox, "FULL", 2.5, 0.03, 2, 30) local pos = Vector3(magicbox.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000) for k,v in pairs(ents) do if v:HasTag("bogey") then SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition()) v:Remove() end end local names = {"spiderqueen","hound","firehound","icehound","killerbee","walrus","leif","leif_sparse","koalefant_summer","koalefant_winter","deerclops","merm","knight","bishop","bat"} magicbox.name = names[math.random(#names)] for k = 1,math.random(10,30) do local pt0 = magicbox:GetPosition() local ground = GetWorld() local x = pt0.x+(math.random(50)-math.random(50)) local z = pt0.z+(math.random(50)-math.random(50)) local tile = ground.Map:GetTileAtPoint(x,0, z) if tile ~= GROUND.IMPASSABLE and tile ~= GROUND.INVALID then local bogey = SpawnPrefab(magicbox.name) bogey.Transform:SetPosition(x,0,z) bogey:AddTag("bogey") bogey.components.combat:SetRetargetFunction(1, function(bogey) if not bogey.components.health:IsDead() then return FindEntity(bogey, 100, function(guy) if guy.components.health and not guy.components.health:IsDead() then return guy:HasTag("player") end end ) end end ) bogey.components.combat:SetKeepTargetFunction(function(bogey, target) return target and target:IsValid() end ) bogey:ListenForEvent("attacked", function(bogey, data) bogey.components.combat:SetTarget(GetPlayer()) end ) end end end ) magicbox.task = magicbox:DoPeriodicTask(60, function(magicbox) SpawnPrefab("collapse_small").Transform:SetPosition(magicbox.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/horn_beefalo") GetPlayer().components.playercontroller:ShakeCamera(magicbox, "FULL", 2.5, 0.03, 2, 30) local pos = Vector3(magicbox.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000) for k,v in pairs(ents) do if v:HasTag("bogey") then SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition()) v:Remove() end end local names = {"spiderqueen","hound","firehound","icehound","killerbee","walrus","leif","leif_sparse","koalefant_summer","koalefant_winter","deerclops","merm","knight","bishop","bat"} magicbox.name = names[math.random(#names)] for k = 1,math.random(10,30) do local pt0 = magicbox:GetPosition() local ground = GetWorld() local x = pt0.x+(math.random(50)-math.random(50)) local z = pt0.z+(math.random(50)-math.random(50)) local tile = ground.Map:GetTileAtPoint(x,0, z) if tile ~= GROUND.IMPASSABLE and tile ~= GROUND.INVALID then local bogey = SpawnPrefab(magicbox.name) bogey.Transform:SetPosition(x,0,z) bogey:AddTag("bogey") bogey.components.combat:SetRetargetFunction(1, function(bogey) if not bogey.components.health:IsDead() then return FindEntity(bogey, 100, function(guy) if guy.components.health and not guy.components.health:IsDead() then return guy:HasTag("player") end end ) end end ) bogey.components.combat:SetKeepTargetFunction(function(bogey, target) return target and target:IsValid() end ) bogey:ListenForEvent("attacked", function(bogey, data) bogey.components.combat:SetTarget(GetPlayer()) end ) end end end ) else magicbox:RemoveTag("makebogey") magicbox.AnimState:PlayAnimation("close") GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold") if magicbox.task then magicbox.task:Cancel() magicbox.task = nil end local pos = Vector3(magicbox.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000) for k,v in pairs(ents) do if v:HasTag("bogey") then SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition()) v:Remove() end end end end end local function OnDeploy (inst, pt) makemagicbox(inst) inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("magicbox") then data.magicbox = true end end local function onload(inst, data) if data and data.magicbox then makemagicbox(inst) inst:Remove() end end inst.OnSave = onsave inst.OnLoad = onload 即可用硬骨头种潘多拉魔盒,(拿着1个硬骨头对地面点鼠标右键,如果拿着多个,则不会种出来)。鼠标左键点魔盒,可打开盒子,每60秒将吹响一次号角,预示着新一批怪物来袭,且源源不绝,充分满足你求死不得的需要。鼠标左键再次点击魔盒,可让怪物回到盒中。建议围绕魔盒修建防御设施(如牙齿陷阱、眼睛炮塔等),否则你挺不过几个60秒的。潘多拉魔盒在小地图上显示为远古箱子图标,不想要潘多拉魔盒了,用锤子砸掉即可。硬骨头靠砸碎地图上的骨架获得

2025/04/23 · Bny

YN219-铁血蛮族(蛮族霸占虫洞,打死可得肉类、装备,带瓦丝格雷斯帽不被攻击,用大肉收买蛮族做手下)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二一九.铁血蛮族(蛮族霸占虫洞,打死可得肉类、装备,带瓦丝格雷斯帽不被攻击,用大肉收买蛮族做手下) 1.用MT管理器打开游戏目录/assets/scripts/prefabs/wormhole.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function createsavage(inst) for k = 1,math.random(10,15) do local pt = inst:GetPosition() local savage = SpawnPrefab("hammer") savage.Transform:SetPosition(pt.x+(math.random(30)-math.random(30)), 0, pt.z+(math.random(30)-math.random(30))) savage.AnimState:SetBank("wilson") savage.AnimState:SetBuild("wolfgang") savage.AnimState:OverrideSymbol("swap_hat", "hat_wathgrithr", "swap_hat") savage.AnimState:OverrideSymbol("swap_body", "torso_rain", "swap_body") savage.AnimState:OverrideSymbol("swap_object", "swap_spear_wathgrithr", "swap_spear_wathgrithr") savage.AnimState:Show("HAT") savage.AnimState:Show("HAT_HAIR") savage.AnimState:Hide("HAIR_NOHAT") savage.AnimState:Hide("HAIR") savage.AnimState:Hide("ARM_normal") savage.AnimState:Show("ARM_carry") savage.AnimState:PlayAnimation("idle") savage.Transform:SetScale(1.2, 1.2, 1.2) local sound = savage.entity:AddSoundEmitter() local shadow = savage.entity:AddDynamicShadow() shadow:SetSize( 1.3, .6 ) savage.Transform:SetFourFaced() MakeCharacterPhysics(savage, 100, .5) local minimap = savage.entity:AddMiniMapEntity() minimap:SetIcon( "wolfgang.png" ) savage:AddComponent("locomotor") savage.components.locomotor.walkspeed = 4 savage.components.locomotor.runspeed = 8 savage:SetStateGraph("SGshadowwaxwell") local brain = require "brains/leifbrain" savage:SetBrain(brain) savage:RemoveComponent("weapon") savage:RemoveComponent("tool") savage:RemoveComponent("finiteuses") savage:RemoveComponent("inventoryitem") savage:RemoveComponent("equippable") savage:RemoveTag("hammer") savage:AddComponent("inventory") savage:AddComponent("health") savage.components.health:SetMaxHealth(2000) savage:ListenForEvent("death", function() local pt1 = savage:GetPosition() for k = 1,math.random(5,10) do local meatnames = {"meat","smallmeat","drumstick"} local meatname = meatnames[math.random(#meatnames)] local meat = SpawnPrefab(meatname) meat.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3))) end if math.random() < 0.01 then local lootnames = {"spear_wathgrithr","wathgrithrhat"} local lootname = lootnames[math.random(#lootnames)] local loot = SpawnPrefab(lootname) loot.Transform:SetPosition(pt1.x, 0, pt1.z) end end ) savage:AddComponent("combat") savage.components.combat:SetDefaultDamage(30) savage.components.combat:SetAttackPeriod(1.5) savage.components.combat:SetRetargetFunction(3, function(savage) if not savage.components.health:IsDead() then return FindEntity(savage, 20, function(guy) return savage.components.combat:CanTarget(guy) and not guy:HasTag("savages") and not guy:HasTag("goodsavages") end ) end end ) savage.components.combat:SetKeepTargetFunction(function(savage, target) return target and target:IsValid() end ) savage:ListenForEvent("attacked", function(savage, data) savage.components.combat:SetTarget(data.attacker) savage.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("savages") and not dude:HasTag("mysavage") and not dude.components.health:IsDead() end, 5) end ) savage.Physics:SetCollisionCallback(function(savage, other) if other and other.components.workable and other.components.workable.workleft > 0 then other.components.workable:Destroy(savage) end end) savage:ListenForEvent( "nighttime", function() savage:Remove() end , GetWorld()) savage:AddComponent("trader") savage.components.trader:SetAcceptTest(function(savage, item) if GetPlayer():HasTag("goodsavages") then if GetPlayer().components.inventory:Has("meat", 10) then if item.prefab == "meat" then return true end end end return false end ) savage.components.trader.onaccept = function(savage, giver, item) GetPlayer().components.inventory:ConsumeByName("meat", 9) savage:AddTag("mysavage") savage.AnimState:SetBloomEffectHandle("shaders/anim.ksh") savage:AddComponent("follower") savage.components.follower:SetLeader(GetPlayer()) local brain = require "brains/abigailbrain" savage:SetBrain(brain) savage:RestartBrain() savage.components.combat:SetAttackPeriod(1) savage.components.combat:SetRetargetFunction(1, function(savage) if not savage.components.health:IsDead() then return FindEntity(GetPlayer(), 20, function(guy) if guy.components.combat and guy.components.health and not guy.components.health:IsDead() then return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") end end ) end end ) savage:RemoveAllEventCallbacks() savage:RemoveComponent("trader") savage:ListenForEvent( "daytime", function() savage.components.health:DoDelta(2000) end , GetWorld()) savage:ListenForEvent("attacked", function(savage, data) savage.components.combat:SetTarget(data.attacker) end ) savage.Physics:SetCollisionCallback( nil ) savage.components.inspectable.getstatus = function(savage) if not savage:HasTag("stophere") then savage:AddTag("stophere") savage.components.locomotor:Stop() savage:SetBrain(nil) savage.components.follower:SetLeader(nil) savage.AnimState:SetBloomEffectHandle("") else savage:RemoveTag("stophere") local brain = require "brains/abigailbrain" savage:SetBrain(brain) savage:RestartBrain() savage.components.follower:SetLeader(GetPlayer()) savage.AnimState:SetBloomEffectHandle("shaders/anim.ksh") end end end savage:AddTag("savages") end end inst:ListenForEvent( "daytime", function() createsavage(inst) end , GetWorld()) 2.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/hammer.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local items = { SWORD = "swap_spear_wathgrithr" } local function EquipItem(inst, item) if item then inst.AnimState:OverrideSymbol("swap_object", item, item) inst.AnimState:Show("ARM_carry") inst.AnimState:Hide("ARM_normal") end end inst.items = items inst.equipfn = EquipItem EquipItem(inst) local function onsave(inst, data) if inst:HasTag("savages") then data.savages = true end if inst:HasTag("mysavage") then data.mysavage = true end if inst:HasTag("stophere") then data.stophere = true end end local function onload(inst, data) if data and data.savages then inst.AnimState:SetBank("wilson") inst.AnimState:SetBuild("wolfgang") inst.AnimState:OverrideSymbol("swap_hat", "hat_wathgrithr", "swap_hat") inst.AnimState:OverrideSymbol("swap_body", "torso_rain", "swap_body") inst.AnimState:OverrideSymbol("swap_object", "swap_spear_wathgrithr", "swap_spear_wathgrithr") inst.AnimState:Show("HAT") inst.AnimState:Show("HAT_HAIR") inst.AnimState:Hide("HAIR_NOHAT") inst.AnimState:Hide("HAIR") inst.AnimState:Hide("ARM_normal") inst.AnimState:Show("ARM_carry") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(1.2, 1.2, 1.2) local sound = inst.entity:AddSoundEmitter() local shadow = inst.entity:AddDynamicShadow() shadow:SetSize( 1.3, .6 ) inst.Transform:SetFourFaced() MakeCharacterPhysics(inst, 100, .5) local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon( "wolfgang.png" ) inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 4 inst.components.locomotor.runspeed = 8 inst:SetStateGraph("SGshadowwaxwell") local brain = require "brains/leifbrain" inst:SetBrain(brain) inst:RemoveComponent("weapon") inst:RemoveComponent("tool") inst:RemoveComponent("finiteuses") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("equippable") inst:RemoveTag("hammer") inst:AddComponent("inventory") inst:AddComponent("health") inst.components.health:SetMaxHealth(2000) inst:ListenForEvent("death", function() local pt1 = inst:GetPosition() for k = 1,math.random(5,10) do local meatnames = {"meat","smallmeat","drumstick"} local meatname = meatnames[math.random(#meatnames)] local meat = SpawnPrefab(meatname) meat.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3))) end if math.random() < 0.01 then local lootnames = {"spear_wathgrithr","wathgrithrhat"} local lootname = lootnames[math.random(#lootnames)] local loot = SpawnPrefab(lootname) loot.Transform:SetPosition(pt1.x, 0, pt1.z) end end ) inst:AddComponent("combat") inst.components.combat:SetDefaultDamage(30) inst.components.combat:SetAttackPeriod(1.5) inst.components.combat:SetRetargetFunction(3, function(inst) if not inst.components.health:IsDead() then return FindEntity(inst, 20, function(guy) return inst.components.combat:CanTarget(guy) and not guy:HasTag("savages") and not guy:HasTag("goodsavages") end ) end end ) inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) inst:ListenForEvent("attacked", function(inst, data) inst.components.combat:SetTarget(data.attacker) inst.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("savages") and not dude:HasTag("mysavage") and not dude.components.health:IsDead() end, 5) end ) inst.Physics:SetCollisionCallback(function(inst, other) if other and other.components.workable and other.components.workable.workleft > 0 then other.components.workable:Destroy(inst) end end) inst:ListenForEvent( "nighttime", function() inst:Remove() end , GetWorld()) inst:AddComponent("trader") inst.components.trader:SetAcceptTest(function(inst, item) if GetPlayer():HasTag("goodsavages") then if GetPlayer().components.inventory:Has("meat", 10) then if item.prefab == "meat" then return true end end end return false end ) inst.components.trader.onaccept = function(inst, giver, item) GetPlayer().components.inventory:ConsumeByName("meat", 9) inst:AddTag("mysavage") inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:AddComponent("follower") inst.components.follower:SetLeader(GetPlayer()) local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.combat:SetAttackPeriod(1) inst.components.combat:SetRetargetFunction(1, function(inst) if not inst.components.health:IsDead() then return FindEntity(GetPlayer(), 20, function(guy) if guy.components.combat and guy.components.health and not guy.components.health:IsDead() then return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") end end ) end end ) inst:RemoveAllEventCallbacks() inst:RemoveComponent("trader") inst:ListenForEvent( "daytime", function() inst.components.health:DoDelta(2000) end , GetWorld()) inst:ListenForEvent("attacked", function(inst, data) inst.components.combat:SetTarget(data.attacker) end ) inst.Physics:SetCollisionCallback( nil ) inst.components.inspectable.getstatus = function(inst) if not inst:HasTag("stophere") then inst:AddTag("stophere") inst.components.locomotor:Stop() inst:SetBrain(nil) inst.components.follower:SetLeader(nil) inst.AnimState:SetBloomEffectHandle("") else inst:RemoveTag("stophere") local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(GetPlayer()) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") end end end inst:AddTag("savages") end if data and data.mysavage then inst:AddTag("mysavage") inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:AddComponent("follower") inst.components.follower:SetLeader(GetPlayer()) local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.combat:SetAttackPeriod(1) inst.components.combat:SetRetargetFunction(1, function(inst) if not inst.components.health:IsDead() then return FindEntity(GetPlayer(), 20, function(guy) if guy.components.combat and guy.components.health and not guy.components.health:IsDead() then return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") end end ) end end ) inst:RemoveAllEventCallbacks() inst:RemoveComponent("trader") inst:ListenForEvent( "daytime", function() inst.components.health:DoDelta(2000) end , GetWorld()) inst:ListenForEvent("attacked", function(inst, data) inst.components.combat:SetTarget(data.attacker) end ) inst.Physics:SetCollisionCallback( nil ) inst.components.inspectable.getstatus = function(inst) if not inst:HasTag("stophere") then inst:AddTag("stophere") inst.components.locomotor:Stop() inst:SetBrain(nil) inst.components.follower:SetLeader(nil) inst.AnimState:SetBloomEffectHandle("") else inst:RemoveTag("stophere") local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(GetPlayer()) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") end end end if data and data.stophere then inst:AddTag("stophere") inst.components.locomotor:Stop() inst:SetBrain(nil) inst.components.follower:SetLeader(nil) inst.AnimState:SetBloomEffectHandle("") end end inst.OnSave = onsave inst.OnLoad = onload 3.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/hats.lua文件,在inst.components.armor:InitCondition(TUNING.ARMOR_WATHGRITHRHAT, TUNING.ARMOR_WATHGRITHRHAT_ABSORPTION)的下一行插入以下内容: inst.components.equippable:SetOnEquip(function(inst, owner) onequip(inst, owner) if owner == GetPlayer() then owner:AddTag("goodsavages") end end ) inst.components.equippable:SetOnUnequip(function(inst, owner) onunequip(inst, owner) owner:RemoveTag("goodsavages") end ) 即可有蛮族霸占虫洞附近的区域,白天和傍晚活动,黑夜消失。他们会攻击一切生物,拆毁建筑,通过小地图可查询蛮族所在位置,显示为沃尔夫冈图标。与蛮族对战时,他们会围攻你,打死蛮族可获得他们携带的肉类,还有一定概率获得瓦丝格雷斯帽和瓦丝格雷斯矛。装备瓦丝格雷斯帽,将被蛮族视为同类,从而免受攻击,并可以用10个大肉收买蛮族作手下(拿着大肉对蛮族点鼠标左键)。蛮族手下不会破坏建筑,无论受多重的伤,每天清晨都会恢复健康,鼠标左键点击(不要拿武器)蛮族手下可让其停留在原地,再次点击可继续跟随。从此开启与铁血蛮族共处的时代,作他们望而生畏的敌人,或带领他们征霸天下吧

2025/04/23 · Bny

YN220-象之树(用紫色护身符种象之树,白天周围有巨象群活动,狩猎它们吧)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二二0.象之树(用紫色护身符种象之树,白天周围有巨象群活动,狩猎它们吧) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/amulet.lua文件,在inst.AnimState:PlayAnimation("purpleamulet")的下一行插入以下内容: local function makebananatree(inst) local pt = inst:GetPosition() local bananatree = SpawnPrefab("purpleamulet") bananatree.Transform:SetPosition(pt.x, pt.y, pt.z) bananatree.AnimState:SetBank("cave_banana_tree") bananatree.AnimState:SetBuild("cave_banana_tree") bananatree.AnimState:PlayAnimation("idle_loop",true) bananatree.Transform:SetScale(1.5, 1.5, 1.5) bananatree:AddComponent("named") bananatree.components.named:SetName("Banana Tree") bananatree:RemoveComponent("equippable") bananatree:RemoveComponent("inventoryitem") bananatree:RemoveComponent("fueled") bananatree:RemoveComponent("deployable") bananatree:AddComponent("workable") bananatree.components.workable:SetWorkAction(ACTIONS.CHOP) bananatree.components.workable:SetWorkLeft(10) bananatree.components.workable:SetOnFinishCallback(function() SpawnPrefab("collapse_big").Transform:SetPosition(bananatree.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") bananatree:Remove() end ) bananatree:ListenForEvent( "daytime", function() local pos = Vector3(bananatree.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 5) for k,v in pairs(ents) do if v.components.inventoryitem and not v.components.inventoryitem:IsHeld() then if v.prefab == "cave_banana" then v:Remove() end end end bananatree:DoTaskInTime(0.3, function(bananatree) bananatree:StartThread(function() for k = 1,math.random(4,8) do local pt1 = bananatree:GetPosition() local banana = SpawnPrefab("cave_banana") banana.Transform:SetPosition(pt1.x+(math.random(5)-math.random(5)), 5, pt1.z+(math.random(5)-math.random(5))) Sleep(0.3) end end ) end ) for k = 1,math.random(5,10) do local elephant = SpawnPrefab("purpleamulet") elephant.Transform:SetPosition(pt.x+(math.random(30)-math.random(30)), 0, pt.z+(math.random(30)-math.random(30))) elephant.AnimState:SetBank("koalefant") elephant.AnimState:SetBuild("koalefant_winter_build") elephant.AnimState:PlayAnimation("idle_loop", true) local sound = elephant.entity:AddSoundEmitter() local shadow = elephant.entity:AddDynamicShadow() shadow:SetSize( 4.5, 2 ) elephant.Transform:SetFourFaced() MakeCharacterPhysics(elephant, 500, 1.5) elephant:AddComponent("named") elephant.components.named:SetName("Elephant") elephant.Transform:SetScale(1.5, 1.5, 1.5) local minimap = elephant.entity:AddMiniMapEntity() minimap:SetIcon( "cave_banana_tree.png" ) elephant:RemoveComponent("equippable") elephant:RemoveComponent("inventoryitem") elephant:RemoveComponent("fueled") elephant:RemoveComponent("deployable") elephant:AddComponent("knownlocations") elephant:AddComponent("health") elephant.components.health:SetMaxHealth(1000) elephant:AddComponent("combat") elephant.components.combat.hiteffectsymbol = "beefalo_body" elephant.components.combat:SetDefaultDamage(30) elephant.components.combat:SetAttackPeriod(2) elephant.components.combat:SetRetargetFunction(3, function(elephant) if not elephant.components.health:IsDead() then return FindEntity(elephant, 25, function(guy) return guy:HasTag("monster") end ) end end ) elephant.components.combat:SetKeepTargetFunction(function(elephant, target) return target and target:IsValid() end ) elephant:ListenForEvent("attacked", function(elephant, data) elephant.components.combat:SetTarget(data.attacker) elephant.components.combat:ShareTarget(data.attacker, 10, function(dude) return dude:HasTag("elephants") and not dude.components.health:IsDead() end, 1) end ) elephant:AddComponent("lootdropper") elephant.components.lootdropper:SetLoot({"meat","meat","meat","meat","meat","meat","meat","meat","meat","meat","trunk_winter"}) elephant:AddComponent("locomotor") elephant.components.locomotor.walkspeed = 2 elephant.components.locomotor.runspeed = 4 elephant:SetStateGraph("SGkoalefant") local brain = require "brains/frogbrain" elephant:SetBrain(brain) elephant:ListenForEvent( "nighttime", function() elephant:Remove() end , GetWorld()) elephant:DoPeriodicTask(math.random(30, 60), function(elephant) if not elephant.components.combat.target then local sgnames = {"bellow","graze","alert","shake"} local sgname = sgnames[math.random(#sgnames)] elephant.sg:GoToState(sgname) end end ) elephant:DoPeriodicTask(math.random(120, 240), function(inst) SpawnPrefab("poop").Transform:SetPosition(elephant.Transform:GetWorldPosition()) end ) if math.random() < 0.5 then elephant:AddTag("redelephants") elephant.AnimState:SetBuild("koalefant_summer_build") elephant.components.lootdropper:SetLoot({"meat","meat","meat","meat","meat","meat","meat","meat","meat","meat","trunk_summer"}) end elephant:AddTag("elephants") end end , GetWorld()) bananatree:AddTag("bananatree") end local function OnDeploy (inst, pt) makebananatree(inst) inst:Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("bananatree") then data.bananatree = true end if inst:HasTag("elephants") then data.elephants = true end if inst:HasTag("redelephants") then data.redelephants = true end end local function onload(inst, data) if data and data.bananatree then makebananatree(inst) inst:Remove() end if data and data.elephants then inst.AnimState:SetBank("koalefant") inst.AnimState:SetBuild("koalefant_winter_build") inst.AnimState:PlayAnimation("idle_loop", true) local sound = inst.entity:AddSoundEmitter() local shadow = inst.entity:AddDynamicShadow() shadow:SetSize( 4.5, 2 ) inst.Transform:SetFourFaced() MakeCharacterPhysics(inst, 500, 1.5) inst:AddComponent("named") inst.components.named:SetName("Elephant") inst.Transform:SetScale(1.5, 1.5, 1.5) local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon( "cave_banana_tree.png" ) inst:RemoveComponent("equippable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("fueled") inst:RemoveComponent("deployable") inst:AddComponent("knownlocations") inst:AddComponent("health") inst.components.health:SetMaxHealth(1000) inst:AddComponent("combat") inst.components.combat.hiteffectsymbol = "beefalo_body" inst.components.combat:SetDefaultDamage(30) inst.components.combat:SetAttackPeriod(2) inst.components.combat:SetRetargetFunction(3, function(inst) if not inst.components.health:IsDead() then return FindEntity(inst, 25, function(guy) return guy:HasTag("monster") end ) end end ) inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) inst:ListenForEvent("attacked", function(inst, data) inst.components.combat:SetTarget(data.attacker) inst.components.combat:ShareTarget(data.attacker, 10, function(dude) return dude:HasTag("elephants") and not dude.components.health:IsDead() end, 1) end ) inst:AddComponent("lootdropper") inst.components.lootdropper:SetLoot({"meat","meat","meat","meat","meat","meat","meat","meat","meat","meat","trunk_winter"}) inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 2 inst.components.locomotor.runspeed = 4 inst:SetStateGraph("SGkoalefant") local brain = require "brains/frogbrain" inst:SetBrain(brain) inst:ListenForEvent( "nighttime", function() inst:Remove() end , GetWorld()) inst:DoPeriodicTask(math.random(30, 60), function(inst) if not inst.components.combat.target then local sgnames = {"bellow","graze","alert","shake"} local sgname = sgnames[math.random(#sgnames)] inst.sg:GoToState(sgname) end end ) inst:DoPeriodicTask(math.random(120, 240), function(inst) SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition()) end ) inst:AddTag("elephants") end if data and data.redelephants then inst:AddTag("redelephants") inst.AnimState:SetBuild("koalefant_summer_build") inst.components.lootdropper:SetLoot({"meat","meat","meat","meat","meat","meat","meat","meat","meat","meat","trunk_summer"}) end end inst.OnSave = onsave inst.OnLoad = onload 即可用紫色护身符种象之树,白天会掉落香蕉,并有巨象群在周围活动,夜晚离开。巨象不会主动攻击你,想狩猎它们时,尽量选择落单的巨象,否则其他巨象会一起反击。巨象在小地图上显示为香蕉图标,它们是天然的肉库,杀死一只可获得10块大肉及象鼻,并且会不断产便便,缺少肥料的话,可以在象之树附近拾取。不想要象之树了,砍掉即可,象群会在黑夜离去。紫色护身符在魔法选项(画着红骷髅)下,用6个黄金、4个噩梦燃料、2个紫宝石制造

2025/04/23 · Bny

YN221-变身传奇(主角吃疯肉变身其他主角)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二二一.变身传奇(主角吃疯肉变身其他主角) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/meats.lua文件,在inst.components.edible.sanityvalue = -TUNING.SANITY_MED的下一句插入以下内容: local function item_oneaten(inst, eater) local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"} inst.animname = names[math.random(#names)] if eater:HasTag("player") then eater.AnimState:SetBuild(inst.animname) SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition()) end end inst.components.edible:SetOnEatenFn(item_oneaten) 即可无须开新档,靠吃疯肉就让主角随机变成其他主角的形象,变身后小地图显示不变,原主角技能也不变,该长胡子的还是会长胡子哦。想恢复原主角形象,存档退出后再读档即可。变身不会变成麦斯威尔和伍迪。不要与“荒野之狼”一同修改

2025/04/23 · Bny

YN222-我是巨鹿(按键盘HOME键主角变身巨鹿,按END键还原)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二二二.我是巨鹿(按键盘HOME键主角变身巨鹿,按END键还原) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playercontroller")的下一行插入以下内容: TheInput:AddKeyUpHandler(KEY_HOME, function() if inst.components.inventory:Has("goldnugget", 30) then inst.components.inventory:ConsumeByName("goldnugget", 30) inst.components.locomotor:Stop() inst.components.playercontroller:Enable(false) inst.AnimState:PlayAnimation("idle_shiver_pre") inst.AnimState:PushAnimation("idle_shiver_loop") inst.AnimState:PushAnimation("idle_shiver_pst", false) inst:DoTaskInTime(1, function() inst.AnimState:SetBank("deerclops") inst.AnimState:SetBuild("deerclops_build") inst:SetStateGraph("SGdeerclops") inst.AnimState:PlayAnimation("idle_loop", true) inst.Transform:SetScale(1.5,1.5,1.5) shadow:SetSize( 6, 3.5 ) local pos = GetPlayer():GetPosition() GetSeasonManager():DoLightningStrike(pos) inst.components.health:SetInvincible(true) inst.components.hunger:Pause() inst.components.combat:SetDefaultDamage(500) inst.components.combat.hiteffectsymbol = "deerclops_body" inst.components.combat.onhitotherfn = function() inst.SoundEmitter:PlaySound("dontstarve/creatures/deerclops/attack") inst.components.playercontroller:ShakeCamera(inst, "FULL", 0.5, 0.05, 2, 40) end inst.components.combat.playerdamagepercent = 0 inst.components.combat:SetAreaDamage(10, 1) inst.components.temperature:SetTemp(20) inst.components.playercontroller:Enable(true) end ) end end ) TheInput:AddKeyUpHandler(KEY_END, function() inst.components.locomotor:Stop() inst.components.playercontroller:Enable(false) inst.AnimState:PlayAnimation("taunt") inst:DoTaskInTime(1, function() inst.AnimState:SetBank("wilson") inst.AnimState:SetBuild(name) inst:SetStateGraph("SGwilson") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(1,1,1) shadow:SetSize( 1.3, .6 ) local pos = GetPlayer():GetPosition() GetSeasonManager():DoLightningStrike(pos) inst.components.health:SetInvincible(false) inst.components.hunger:Resume() inst.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE) inst.components.combat.hiteffectsymbol = "torso" inst.components.combat.onhitotherfn = nil inst.components.combat:SetAreaDamage(0, 0) inst.components.temperature:SetTemp(nil) inst.components.playercontroller:Enable(true) end ) end ) 即可在你深陷绝境之时,对电脑屏幕大喊“我是巨鹿”,并同时按下键盘HOME键,主角将变身无敌巨鹿(锁血、锁饥饿、不怕冷),对敌人展开恐怖的报复吧(按Ctrl + 鼠标左键攻击)。每次变身将消耗30个黄金,身上黄金数不足时不会变身。想要变回主角时,按键盘END键即可。注意,由于巨鹿变身时会招来闪电,并且本身具备大面积杀伤的能力,所以请远离基地变身,且尽量不要带同伴。修改过“神奇跳跃”的话,不要在变身巨鹿时跳跃

2025/04/23 · Bny

YN223-我是神龙(按键盘L键主角变身神龙,能吐火,再按L键变回人)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二二三.我是神龙(按键盘L键主角变身神龙,能吐火,再按L键变回人) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playercontroller")的下一行插入以下内容: TheInput:AddKeyUpHandler(KEY_L, function() if not inst:HasTag("dragon") then if inst.components.inventory:Has("goldnugget", 30) then inst.components.inventory:ConsumeByName("goldnugget", 30) inst.components.locomotor:Stop() inst.components.playercontroller:Enable(false) inst.AnimState:PlayAnimation("idle_shiver_pre") inst.AnimState:PushAnimation("idle_shiver_loop") inst.AnimState:PushAnimation("idle_shiver_pst", false) inst:DoTaskInTime(1, function() inst:AddTag("dragon") inst.AnimState:SetBank("krampus") inst.AnimState:SetBuild("krampus_build") inst:SetStateGraph("SGkrampus") inst.AnimState:PlayAnimation("idle", true) inst.AnimState:Hide("SACK") inst.AnimState:Show("ARM") inst.Transform:SetScale(1.8,1.8,1.8) shadow:SetSize( 6, 3.5 ) local light = inst.entity:AddLight() light:SetIntensity(.8) light:SetRadius(20) light:SetFalloff(.6) light:Enable(true) light:SetColour(255/255, 0/255, 0/255) inst.components.locomotor.walkspeed = 10 inst.components.locomotor.runspeed = 15 local pos = GetPlayer():GetPosition() GetSeasonManager():DoLightningStrike(pos) inst.components.health:SetInvincible(true) inst.components.hunger:Pause() inst.components.combat:SetDefaultDamage(500) inst.components.combat.hiteffectsymbol = "krampus_torso" local pearl = SpawnPrefab("dragonfruit") pearl.entity:AddSoundEmitter() RemovePhysicsColliders(pearl) pearl:AddTag("projectile") pearl:AddTag("pearl") pearl:RemoveComponent("edible") pearl:RemoveComponent("stackable") pearl:RemoveComponent("tradable") pearl:RemoveComponent("perishable") pearl:RemoveComponent("cookable") pearl:RemoveComponent("bait") pearl:RemoveComponent("plantable") pearl:RemoveComponent("burnable") pearl:RemoveComponent("propagator") pearl:AddComponent("burnable") pearl.components.burnable:SetFXLevel(3) pearl.components.burnable:AddBurnFX("character_fire", Vector3(0,0,0) ) pearl:AddComponent("weapon") pearl.components.weapon:SetDamage(500) pearl.components.weapon:SetRange(20, 25) pearl:AddComponent("equippable") pearl.components.equippable.equipslot = EQUIPSLOTS.HANDS pearl.components.equippable:SetOnEquip(function(pearl) pearl.components.burnable:Extinguish() end ) pearl:AddComponent("projectile") pearl.components.projectile:SetSpeed(50) pearl.components.projectile:SetOnHitFn(function(pearl, owner, target) inst.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") SpawnPrefab("collapse_small").Transform:SetPosition(target.Transform:GetWorldPosition()) SpawnPrefab("explode_small").Transform:SetPosition(target.Transform:GetWorldPosition()) inst.components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .5, 40) if target.components.burnable then target.components.burnable:Ignite() end owner.components.inventory:Equip(pearl) end ) pearl.components.projectile:SetOnMissFn(function(pearl, owner) owner.components.inventory:Equip(pearl) end ) pearl:ListenForEvent("onthrown", function(pearl) local pt = pearl:GetPosition() pearl.Transform:SetPosition(pt.x, 2, pt.z) pearl.SoundEmitter:PlaySound("dontstarve/common/blackpowder_explo") pearl.components.burnable:Ignite(true) end ) inst.components.inventory:Equip(pearl) inst.components.temperature:SetTemp(20) inst.components.playercontroller:Enable(true) end ) end else inst.components.locomotor:Stop() inst.components.playercontroller:Enable(false) inst.AnimState:PlayAnimation("taunt") inst:DoTaskInTime(1, function() inst:RemoveTag("dragon") inst.AnimState:SetBank("wilson") inst.AnimState:SetBuild(name) inst:SetStateGraph("SGwilson") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(1,1,1) shadow:SetSize( 1.3, .6 ) inst.Light:Enable(false) inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED local pos = GetPlayer():GetPosition() GetSeasonManager():DoLightningStrike(pos) inst.components.health:SetInvincible(false) inst.components.hunger:Resume() inst.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE) inst.components.combat.hiteffectsymbol = "torso" local pos0 = Vector3(inst.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos0.x,pos0.y,pos0.z, 3000) for k,v in pairs(ents) do if v:HasTag("pearl") then v:Remove() end end inst.components.temperature:SetTemp(nil) inst.components.playercontroller:Enable(true) end ) end end ) 即可在身上有30个黄金时,按键盘L键,主角随即变身神龙,将消耗30个黄金,身上黄金数不足时不会变身。变身神龙后,自动装备龙果,对敌人按鼠标左键,可发射龙果火球,如果卸载龙果,则改为近身格斗(按Ctrl + 鼠标左键攻击,或按住F键反击),防止点燃附近植物。神龙可夜视,不会饥饿,且锁血,对地上的物品点鼠标左键可捡起。想要变回主角时,再次按键盘L键即可,龙果将消失

2025/04/23 · Bny

YN224-我是龙卷风(按键盘U键主角变身龙卷风,掠过之处尽毁,敌人靠近会被冻伤,再按U键变回人)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二二四.我是龙卷风(按键盘U键主角变身龙卷风,掠过之处尽毁,敌人靠近会被冻伤,再按U键变回人) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playercontroller")的下一行插入以下内容: TheInput:AddKeyUpHandler(KEY_U, function() if not inst:HasTag("windman") then inst.components.locomotor:Stop() inst.components.playercontroller:Enable(false) inst.AnimState:PlayAnimation("idle_shiver_pre") inst.AnimState:PushAnimation("idle_shiver_loop") inst.AnimState:PushAnimation("idle_shiver_pst", false) GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") inst:DoTaskInTime(0.3, function() inst:AddTag("windman") inst.AnimState:SetBank("tornado") inst.AnimState:SetBuild("tornado") inst:SetStateGraph("SGtornado") inst.AnimState:PlayAnimation("tornado_pre") inst.AnimState:PushAnimation("tornado_loop") inst.Transform:SetScale(1.8,1.8,1.8) local light = inst.entity:AddLight() light:SetIntensity(.8) light:SetRadius(10) light:SetFalloff(.6) light:Enable(true) light:SetColour(255/255,255/255,255/255) inst.components.locomotor.walkspeed = 20 inst.components.locomotor.runspeed = 30 inst.components.health:SetInvincible(true) inst.components.hunger:Pause() inst.components.temperature:SetTemp(20) inst.Physics:SetCollisionCallback(function(inst, other) if other and other.components.health and other.components.combat then if other.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == other or other:HasTag("monster") then other.components.health:DoDelta(-100) if other.components.freezable then other.components.freezable:AddColdness(10) other.components.freezable:SpawnShatterFX() end end end if other and other.components.workable and other.components.workable.workleft > 0 then GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") other.components.workable:Destroy(inst) end end ) inst.components.playercontroller:Enable(true) end ) else inst.components.locomotor:Stop() inst.components.playercontroller:Enable(false) GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") inst.AnimState:PlayAnimation("tornado_pst") inst:DoTaskInTime(0.3, function() inst:RemoveTag("windman") inst.AnimState:SetBank("wilson") inst.AnimState:SetBuild(name) inst:SetStateGraph("SGwilson") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(1,1,1) inst.Light:Enable(false) inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED inst.components.health:SetInvincible(false) inst.components.hunger:Resume() inst.components.temperature:SetTemp(nil) inst.Physics:SetCollisionCallback( nil ) inst.components.playercontroller:Enable(true) end ) end end ) 即可按键盘U键,主角变身龙卷风,掠过之处一切建筑、植物尽毁,敌人靠近将被冻伤。龙卷风可夜视,不会饥饿,且锁血,去席卷大陆吧。再次按键盘U键可变回人

2025/04/23 · Bny

YN225-荒野之狼(吃蜗牛龟粘液变成狼,打败别的狼成为领袖)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二二五.荒野之狼(吃蜗牛龟粘液变成狼,打败别的狼成为领袖) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/slurtleslime.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function item_oneaten(inst, eater) if eater:HasTag("player") then local pos = GetPlayer():GetPosition() GetSeasonManager():DoLightningStrike(pos) eater.components.locomotor:Stop() eater.components.playercontroller:Enable(false) eater:DoTaskInTime(1, function() eater.AnimState:SetBank("hound") eater.AnimState:SetBuild("hound_red") eater.AnimState:PlayAnimation("idle") eater:SetStateGraph("SGhound") eater:RemoveTag("scarytoprey") eater:AddTag("monster") local light = eater.entity:AddLight() light:SetFalloff(1) light:SetIntensity(.8) light:SetRadius(20) light:Enable(true) light:SetColour(0/255, 255/255, 0/255) eater:ListenForEvent("attacked", function(eater) local pt = eater:GetPosition() eater.Transform:SetPosition(pt.x+(math.random(5)-math.random(5)), 0, pt.z+(math.random(5)-math.random(5))) end ) eater.components.locomotor.runspeed = 25 eater.components.sanity:DoDelta(eater.components.sanity.max) eater.components.sanity.ignore = true eater.components.health:StartRegen(100, 10) eater.components.combat:SetDefaultDamage(500) eater.components.combat:SetAttackPeriod(0.1) eater.components.eater:SetCarnivore() eater.components.temperature:SetTemp(20) eater.components.playercontroller:Enable(true) GetPlayer().HUD.controls.crafttabs:Hide() GetPlayer().HUD.controls.inv:Hide() GetPlayer().HUD.controls.mapcontrols.minimapBtn:Hide() local head = GetPlayer().components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD) GetPlayer().components.inventory:DropItem(head) local hands = GetPlayer().components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) GetPlayer().components.inventory:DropItem(hands) local body = GetPlayer().components.inventory:GetEquippedItem(EQUIPSLOTS.BODY) GetPlayer().components.inventory:DropItem(body) eater.components.playeractionpicker.leftclickoverride = function(eater, target_ent, pos) if eater.components.combat:CanTarget(target_ent) then return eater.components.playeractionpicker:SortActionList({ACTIONS.ATTACK}, target_ent, nil) end if target_ent and target_ent.components.edible and eater.components.eater:CanEat(target_ent) then return eater.components.playeractionpicker:SortActionList({ACTIONS.EAT}, target_ent, nil) end end eater:DoPeriodicTask(3, function(eater) if math.random() < 0.05 then if eater.components.hunger:GetPercent() > 0.995 then local pt1 = eater:GetPosition() local wolf = SpawnPrefab("slurtleslime") wolf.Transform:SetPosition(pt1.x+(math.random(10)-math.random(10)), 0, pt1.z+(math.random(10)-math.random(10))) wolf.AnimState:SetBank("hound") wolf.AnimState:SetBuild("hound") wolf.AnimState:PlayAnimation("idle") wolf.Transform:SetFourFaced() local sound = wolf.entity:AddSoundEmitter() local shadow = wolf.entity:AddDynamicShadow() shadow:SetSize( 2.5, 1.5 ) MakeCharacterPhysics(wolf, 10, .5) wolf:AddComponent("locomotor") wolf.components.locomotor.runspeed = 25 wolf:SetStateGraph("SGhound") local brain = require "brains/frogbrain" wolf:SetBrain(brain) wolf:RemoveComponent("stackable") wolf:RemoveComponent("fuel") wolf:RemoveComponent("inventoryitem") wolf:RemoveComponent("explosive") wolf:RemoveComponent("burnable") wolf:RemoveComponent("propagator") wolf:RemoveComponent("edible") wolf:AddComponent("follower") wolf:AddComponent("knownlocations") wolf:AddComponent("lootdropper") wolf.components.lootdropper:SetLoot({"meat", "meat"}) wolf:AddComponent("health") wolf.components.health:SetMaxHealth(2000) wolf.components.health:StartRegen(100, 10) wolf:AddComponent("combat") wolf.components.combat:SetDefaultDamage(20) wolf.components.combat:SetAttackPeriod(0.1) wolf.components.combat:SetTarget(eater) wolf.AnimState:SetMultColour(255/255,0/255,0/255,1) wolf.components.combat:SetRetargetFunction(1, function(wolf) if not wolf.components.health:IsDead() then return FindEntity(wolf, 300, function(guy) return guy:HasTag("player") end ) end end ) wolf.components.combat:SetKeepTargetFunction(function(wolf, target) return target and target:IsValid() end ) wolf.task = wolf:DoPeriodicTask(1, function(customer) if wolf.components.health.currenthealth < 1000 then wolf.components.combat:SetTarget(nil) wolf:RemoveTag("goodbye") local brain = require "brains/abigailbrain" wolf:SetBrain(brain) wolf:RestartBrain() wolf.components.follower:SetLeader(GetPlayer()) wolf.AnimState:SetMultColour(255/255,255/255,255/255,1) wolf.components.combat:SetRetargetFunction(2, function(wolf) if not wolf.components.health:IsDead() then return FindEntity(wolf, 20, function(guy) if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("wolfs") then return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy end end ) end end ) wolf.components.combat:SetKeepTargetFunction(function(wolf, target) return target and target:IsValid() end ) if wolf.task then wolf.task:Cancel() wolf.task = nil end end end ) wolf:AddTag("monster") wolf:AddTag("wolfs") wolf:AddTag("goodbye") end end end ) end ) end end inst:AddComponent("edible") inst.components.edible:SetOnEatenFn(item_oneaten) inst.components.edible.hungervalue = 1 inst.components.edible.foodtype = "VEGGIE" local function onsave(inst, data) if inst:HasTag("wolfs") then data.wolfs = true end if inst:HasTag("goodbye") then data.goodbye = true end end local function onload(inst, data) if data and data.goodbye then inst:Remove() end if data and data.wolfs then inst.AnimState:SetBank("hound") inst.AnimState:SetBuild("hound") inst.AnimState:PlayAnimation("idle") inst.Transform:SetFourFaced() local sound = inst.entity:AddSoundEmitter() local shadow = inst.entity:AddDynamicShadow() shadow:SetSize( 2.5, 1.5 ) MakeCharacterPhysics(inst, 10, .5) inst:AddComponent("locomotor") inst.components.locomotor.runspeed = 25 inst:SetStateGraph("SGhound") inst:RemoveComponent("stackable") inst:RemoveComponent("fuel") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("explosive") inst:RemoveComponent("burnable") inst:RemoveComponent("propagator") inst:RemoveComponent("edible") inst:AddComponent("follower") inst:AddComponent("knownlocations") inst:AddComponent("lootdropper") inst.components.lootdropper:SetLoot({"meat", "meat"}) inst:AddComponent("health") inst.components.health:SetMaxHealth(2000) inst.components.health:StartRegen(100, 10) inst:AddComponent("combat") inst.components.combat:SetDefaultDamage(20) inst.components.combat:SetAttackPeriod(0.1) local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst.components.follower:SetLeader(GetPlayer()) inst.components.combat:SetRetargetFunction(2, function(inst) if not inst.components.health:IsDead() then return FindEntity(inst, 20, function(guy) if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("wolfs") then return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy end end ) end end ) inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) inst:AddTag("monster") inst:AddTag("wolfs") end end inst.OnSave = onsave inst.OnLoad = onload 即可吃蜗牛龟粘液让主角变成狼,体验野生动物的生活。可喜的是,你将拥有强大的生命力(自动回血),超快的跑动速度和恐怖的咬合能力,黑夜也不会影响你看清前方,甚至由于没有了人的味道,一些小动物将无法躲避你。可悲的是,你必须告别之前所有的伙伴,连“新移民”都会主动攻击你,离开人类的生活,流浪在荒郊野外。战斗中,由于你的体重变轻,被打时会被甩出去,因此要学会扬长避短,发挥速度和攻击力的优势,跑过去咬上一口就躲,千万不要与敌人原地肉搏。当你进食到最饱时,有一定概率出现别的狼(全身红色)挑战你,打败它(它身上不再呈红色),则将成为你的小弟,用锋利的牙齿发展起你的狼群吧。如果实在受不了荒野的生活了,存档退出再读档,即可变回人,但狼小弟将继续跟随你。使用大力士、伍迪作主角时,不适用此项,不要与“变身传奇”、“饥饿的儿童”一同修改。蜗牛龟粘液可打蜗牛龟和蜗牛窝获得

2025/04/23 · Bny