第200页:养育孩子
展开二百.养育孩子(主角逝去则孩子接班,一代一代生存下去)
1.用记事本打开游戏目录\data\scripts\prefabs\minotaurhorn.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
local function getson (inst)
TheFrontEnd:Fade(false,1)
GetPlayer():DoTaskInTime(1.5, function()
TheFrontEnd:Fade(true,1)
local pt = GetPlayer():GetPosition()
local son = SpawnPrefab("resurrectionstatue")
son.Transform:SetPosition(pt.x, pt.y, pt.z)
son.AnimState:SetBank("wilson")
if GetPlayer().prefab == "wilson" then son.AnimState:SetBuild("wilson") end
if GetPlayer().prefab == "wendy" then son.AnimState:SetBuild("wendy") end
if GetPlayer().prefab == "wes" then son.AnimState:SetBuild("wes") end
if GetPlayer().prefab == "wickerbottom" then son.AnimState:SetBuild("wickerbottom") end
if GetPlayer().prefab == "willow" then son.AnimState:SetBuild("willow") end
if GetPlayer().prefab == "wolfgang" then son.AnimState:SetBuild("wolfgang_skinny") end
if GetPlayer().prefab == "wx78" then son.AnimState:SetBuild("wx78") end
if GetPlayer().prefab == "woodie" then son.AnimState:SetBuild("woodie") end
if GetPlayer().prefab == "waxwell" then son.AnimState:SetBuild("waxwell") end
if GetPlayer().prefab == "wathgrithr" then son.AnimState:SetBuild("wathgrithr") end
if GetPlayer().prefab == "webber" then son.AnimState:SetBuild("webber") end
local hats = {"hat_beefalo","hat_feather","hat_flower","hat_top","hat_walrus","hat_winter"}
local hat = hats[math.random(#hats)]
son.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
local armors = {"armor_sanity","armor_slurper","armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter"}
local armor = armors[math.random(#armors)]
son.AnimState:OverrideSymbol("swap_body", armor, "swap_body")
son.AnimState:Show("HAT")
son.AnimState:Show("HAT_HAIR")
son.AnimState:Hide("HAIR_NOHAT")
son.AnimState:Hide("HAIR")
son.AnimState:Hide("ARM_carry")
son.AnimState:Show("ARM_normal")
son.AnimState:PlayAnimation("idle")
son.AnimState:Hide("snow")
son.Transform:SetFourFaced()
son.Transform:SetScale(0.8,0.8,0.8)
son:AddComponent("combat")
son.components.combat.hiteffectsymbol = "torso"
son.components.combat:SetRetargetFunction(3, function(son)
if not son.components.health:IsDead() then
return FindEntity(son, 20, function(guy)
if guy.components.health and not guy.components.health:IsDead() then
return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy
end
end)
end
end )
son.components.combat:SetKeepTargetFunction(function(son, target) return target and target:IsValid() end )
son.components.combat:SetAttackPeriod(1)
son.components.combat:SetRange(2, 3)
son.components.combat:SetDefaultDamage(10)
son:AddComponent("health")
son.components.health:SetMaxHealth(1000)
son.components.health.nofadeout = true
son:AddComponent("inventory")
son.components.inventory.dropondeath = false
son:AddComponent("locomotor")
son.components.locomotor.pathcaps = { ignorecreep = true }
son.components.locomotor.runspeed = 12
local brain = require"brains/shadowwaxwellbrain"
son:SetBrain(brain)
son:SetStateGraph("SGshadowwaxwell")
son:RemoveComponent("lootdropper")
son:RemoveComponent("workable")
son:RemoveComponent("burnable")
son:RemoveComponent("propagator")
MakeCharacterPhysics(son, 75, .5)
son:RemoveTag("structure")
son:AddComponent("follower")
son.components.follower.leader = GetPlayer()
son:AddComponent("trader")
son.components.trader:SetAcceptTest(function(son, item)
if GetPlayer().components.inventory:Has("goldnugget", 5) then
if item.prefab == "goldnugget" and son.components.health and not son.components.health:IsDead() then
return son.components.health:GetPercent() < .99
end
end
return false
end )
son.components.trader.onaccept = function(son, giver, item)
GetPlayer().components.inventory:ConsumeByName("goldnugget", 4)
son.components.health:DoDelta(1000)
end
son:AddComponent("machine")
son.components.machine.turnonfn = function() son.components.locomotor:Stop() son.brain:Stop() end
son.components.machine.turnofffn = function() son.brain:Start() end
son:ListenForEvent("death", function()
GetPlayer().components.sanity:DoDelta(-100)
SpawnPrefab("trinket_1").Transform:SetPosition(son.Transform:GetWorldPosition())
end )
son:AddTag("companion")
son:AddTag("sons")
inst:Remove()
end )
end
local function OnDeploy (inst, pt)
if GetPlayer().components.inventory:Has("goldnugget", 100) then
GetPlayer().components.inventory:ConsumeByName("goldnugget", 100)
local egg1 = SpawnPrefab("minotaurhorn")
egg1.AnimState:SetBuild("tallbird_egg")
egg1.AnimState:SetBank("egg")
egg1.AnimState:PlayAnimation("egg")
egg1.Transform:SetPosition(pt.x+2+3, pt.y, pt.z+2-3)
egg1.AnimState:SetMultColour(0/255,255/255,0/255,1)
egg1.Transform:SetScale(1.5,1.5,1.5)
egg1:AddComponent("health")
egg1.components.health:SetMaxHealth(1)
egg1:AddComponent("combat")
egg1:RemoveComponent("edible")
egg1.components.inventoryitem.canbepickedup = false
local egg2 = SpawnPrefab("minotaurhorn")
egg2.AnimState:SetBuild("tallbird_egg")
egg2.AnimState:SetBank("egg")
egg2.AnimState:PlayAnimation("egg")
egg2.Transform:SetPosition(pt.x+2-3, pt.y, pt.z+2+3)
egg2.AnimState:SetMultColour(0/255,255/255,0/255,1)
egg2.Transform:SetScale(1.5,1.5,1.5)
egg2:AddComponent("health")
egg2.components.health:SetMaxHealth(1)
egg2:AddComponent("combat")
egg2:RemoveComponent("edible")
egg2.components.inventoryitem.canbepickedup = false
egg1:ListenForEvent("death", function() egg1.AnimState:PlayAnimation("crack") egg2:Remove()
if math.random()<.5 then
local pt = GetPlayer():GetPosition()
GetSeasonManager():DoLightningStrike(pt)
inst:DoTaskInTime(1, function() getson(inst) end )
else
SpawnPrefab("collapse_small").Transform:SetPosition(egg1.Transform:GetWorldPosition())
GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
end
end )
egg2:ListenForEvent("death", function() egg2.AnimState:PlayAnimation("crack") egg1:Remove()
if math.random()<.5 then
local pt = GetPlayer():GetPosition()
GetSeasonManager():DoLightningStrike(pt)
inst:DoTaskInTime(2, function() getson(inst) end )
else
SpawnPrefab("collapse_small").Transform:SetPosition(egg2.Transform:GetWorldPosition())
GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
end
end )
end
end
inst:AddComponent("deployable")
inst.components.deployable.ondeploy = OnDeploy
2.用记事本打开游戏目录\data\DLC0001\scripts\prefabs\resurrectionstatue.lua文件,将下列内容:
inst.OnSave = onsave
inst.OnLoad = onload
替换为:
local items = { AXE = "swap_axe", PICK = "swap_pickaxe", SWORD = "swap_spear" }
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 onsave2(inst, data)
if inst:HasTag("sons") then
data.sons = true
end
end
local function onload2(inst, data)
if data and data.sons then
inst.AnimState:SetBank("wilson")
if GetPlayer().prefab == "wilson" then inst.AnimState:SetBuild("wilson") end
if GetPlayer().prefab == "wendy" then inst.AnimState:SetBuild("wendy") end
if GetPlayer().prefab == "wes" then inst.AnimState:SetBuild("wes") end
if GetPlayer().prefab == "wickerbottom" then inst.AnimState:SetBuild("wickerbottom") end
if GetPlayer().prefab == "willow" then inst.AnimState:SetBuild("willow") end
if GetPlayer().prefab == "wolfgang" then inst.AnimState:SetBuild("wolfgang_skinny") end
if GetPlayer().prefab == "wx78" then inst.AnimState:SetBuild("wx78") end
if GetPlayer().prefab == "woodie" then inst.AnimState:SetBuild("woodie") end
if GetPlayer().prefab == "waxwell" then inst.AnimState:SetBuild("waxwell") end
if GetPlayer().prefab == "wathgrithr" then inst.AnimState:SetBuild("wathgrithr") end
if GetPlayer().prefab == "webber" then inst.AnimState:SetBuild("webber") end
local hats = {"hat_beefalo","hat_feather","hat_flower","hat_top","hat_walrus","hat_winter"}
local hat = hats[math.random(#hats)]
inst.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
local armors = {"armor_sanity","armor_slurper","armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter"}
local armor = armors[math.random(#armors)]
inst.AnimState:OverrideSymbol("swap_body", armor, "swap_body")
inst.AnimState:Show("HAT")
inst.AnimState:Show("HAT_HAIR")
inst.AnimState:Hide("HAIR_NOHAT")
inst.AnimState:Hide("HAIR")
inst.AnimState:Hide("ARM_carry")
inst.AnimState:Show("ARM_normal")
inst.AnimState:PlayAnimation("idle")
inst.AnimState:Hide("snow")
inst.Transform:SetFourFaced()
inst.Transform:SetScale(0.8,0.8,0.8)
inst:AddComponent("combat")
inst.components.combat.hiteffectsymbol = "torso"
inst.components.combat:SetRetargetFunction(3, function(inst)
if not inst.components.health:IsDead() then
return FindEntity(inst, 20, function(guy)
if guy.components.health and not guy.components.health:IsDead() then
return guy.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.components.combat:SetAttackPeriod(1)
inst.components.combat:SetRange(2, 3)
inst.components.combat:SetDefaultDamage(10)
inst:AddComponent("health")
inst.components.health:SetMaxHealth(1000)
inst.components.health.nofadeout = true
inst:AddComponent("inventory")
inst.components.inventory.dropondeath = false
inst:AddComponent("locomotor")
inst.components.locomotor.pathcaps = { ignorecreep = true }
inst.components.locomotor.runspeed = 12
local brain = require"brains/shadowwaxwellbrain"
inst:SetBrain(brain)
inst:SetStateGraph("SGshadowwaxwell")
inst:RemoveComponent("lootdropper")
inst:RemoveComponent("workable")
inst:RemoveComponent("burnable")
inst:RemoveComponent("propagator")
MakeCharacterPhysics(inst, 75, .5)
inst:RemoveTag("structure")
inst:AddComponent("follower")
inst.components.follower.leader = GetPlayer()
inst:AddComponent("trader")
inst.components.trader:SetAcceptTest(function(inst, item)
if GetPlayer().components.inventory:Has("goldnugget", 5) then
if item.prefab == "goldnugget" and inst.components.health and not inst.components.health:IsDead() then
return inst.components.health:GetPercent() < .99
end
end
return false
end )
inst.components.trader.onaccept = function(inst, giver, item)
GetPlayer().components.inventory:ConsumeByName("goldnugget", 4)
inst.components.health:DoDelta(1000)
end
inst:AddComponent("machine")
inst.components.machine.turnonfn = function() inst.components.locomotor:Stop() inst.brain:Stop() end
inst.components.machine.turnofffn = function() inst.brain:Start() end
inst:ListenForEvent("death", function()
GetPlayer().components.sanity:DoDelta(-100)
SpawnPrefab("trinket_1").Transform:SetPosition(inst.Transform:GetWorldPosition())
end )
inst:AddTag("companion")
inst:AddTag("sons")
end
end
inst.OnSave = onsave2
inst.OnLoad = onload2
即可在你攒够100个黄金时,将远古守护者角种在地上,向上天求子,会赐予你2个蛋(身上黄金数不足时,只收走远古守护者角,不给蛋),选一个打破,如果中了(屏幕黑一下),就会获得孩子,如果没中(生一团烟),就只能下次再试了。使用不同主角,将获得不同的孩子,可以带着他打仗、砍树、开矿。如果你死了,他将长大成人,继承你的事业,一代一代在饥荒世界里生存下去。如果他不幸夭折了,对你而言无疑是晴天霹雳(减100点脑),他将为你留下一件小小的遗物,让你永远不要忘记他。当遇到危险时,可以对他点鼠标右键,让他停留在原地,等危险排除了,再对他按右键,即可继续跟随。可以通过给零花钱为他补血(拿着黄金对他点鼠标左键),一次5个黄金,身上黄金数不足或孩子满血时拒收。注意未成年人是不会跟着你下地洞的,把他安顿好后再去刷怪吧
更多相关内容请关注:饥荒专区
责任编辑:Shy夏夏