游民星空 > 攻略秘籍 > 攻略 > 正文

饥荒 全人物解锁及主角自动回血等实用修改教程

2015-01-21 11:28:46 来源:互联网 作者:易宁 我要投稿

第214页:饥饿的儿童

展开

二一四.饥饿的儿童(不时有孤儿向你乞讨,施舍黄金后离开,否则跟随你直到午夜冻饿而死)

  1.用记事本打开游戏目录\data\DLC0001\scripts\prefabs\forest.lua文件,在inst:AddComponent("clock")的下一行插入以下内容:

  local function createbeggar(inst)

  for k = 1,math.random(3,7) do

  local pt = GetPlayer():GetPosition()

  local beggar = SpawnPrefab("foliage")

  beggar.Transform:SetPosition(pt.x+(math.random(50)-math.random(50)), 0, pt.z+(math.random(50)-math.random(50)))

  beggar.AnimState:SetBank("wilson")

  local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}

  local buildname = names[math.random(#names)]

  beggar.AnimState:SetBuild(buildname)

  beggar.Transform:SetScale(0.8, 0.8, 0.8)

  beggar.AnimState:OverrideSymbol("swap_body", "armor_grass", "swap_body")

  beggar.AnimState:Hide("ARM_carry")

  beggar.AnimState:Show("ARM_normal")

  beggar.AnimState:PlayAnimation("idle")

  local sound = beggar.entity:AddSoundEmitter()

  local shadow = beggar.entity:AddDynamicShadow()

  shadow:SetSize( 1.3, .6 )

  beggar.Transform:SetFourFaced()

  local brain = require "brains/chesterbrain"

  beggar:SetBrain(brain)

  beggar:AddComponent("knownlocations")

  beggar:AddComponent("locomotor")

  beggar.components.locomotor.walkspeed = 5

  beggar.components.locomotor.runspeed = 15

  beggar:SetStateGraph("SGshadowwaxwell")

  MakeCharacterPhysics(beggar, 50, .5)

  beggar:RemoveComponent("stackable")

  beggar:RemoveComponent("tradable")

  beggar:RemoveComponent("fuel")

  beggar:RemoveComponent("inventoryitem")

  beggar:RemoveComponent("edible")

  beggar:RemoveComponent("perishable")

  beggar:RemoveComponent("burnable")

  beggar:RemoveComponent("propagator")

  beggar:RemoveTag("cattoy")

  beggar:AddComponent("follower")

  beggar.components.follower:SetLeader(GetPlayer())

  beggar:AddComponent("health")

  beggar.components.health:SetMaxHealth(500)

  beggar.components.health:SetInvincible(true)

  beggar.components.health.nofadeout = true

  beggar:AddComponent("combat")

  beggar:DoPeriodicTask(math.random(10,60), function(beggar)

  beggar.SoundEmitter:PlaySound("dontstarve/characters/willow/hurt")

  beggar.AnimState:PlayAnimation("hungry")

  end )

  beggar:AddComponent("trader")

  beggar.components.trader:SetAcceptTest(function(beggar, item)

  if GetPlayer().components.inventory:Has("goldnugget", 10) then

  if item.prefab == "goldnugget" then

  return true

  end

  end

  return false

  end )

  beggar.components.trader.onaccept = function(beggar, giver, item)

  GetPlayer().components.inventory:ConsumeByName("goldnugget", 9)

  GetPlayer().components.sanity:DoDelta(5)

  beggar.components.locomotor:Stop()

  beggar:SetBrain(nil)

  beggar.components.follower:SetLeader(nil)

  beggar.AnimState:PlayAnimation("idle_onemanband1_loop",true)

  beggar:DoTaskInTime(5, function() beggar:Remove() end )

  end

  beggar:ListenForEvent( "nighttime", function()

  beggar.components.locomotor:Stop()

  beggar:SetBrain(nil)

  beggar.components.follower:SetLeader(nil)

  beggar.AnimState:PlayAnimation("idle_shiver_pre")

  beggar.AnimState:PushAnimation("idle_shiver_loop")

  beggar.AnimState:PushAnimation("idle_shiver_pst", false)

  beggar:RemoveComponent("trader")

  beggar:DoTaskInTime(math.random(1,6), function()

  beggar.components.health:SetInvincible(false)

  beggar.components.health:Kill()

  end )

  end, GetWorld())

  beggar:ListenForEvent("death", function()

  GetPlayer():DoTaskInTime(2, function()

  GetPlayer().components.sanity:DoDelta(-10)

  end )

  end )

  beggar:AddTag("beggars")

  end

  end

  inst:ListenForEvent( "daytime", function() if math.random()<.3 then createbeggar(inst) end end , GetWorld())

  2.用记事本打开游戏目录\data\DLC0001\scripts\prefabs\foliage.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:

  local function onsave(inst, data)

  if inst:HasTag("beggars") then

  data.beggars = true

  end

  end

  local function onload(inst, data)

  if data and data.beggars then

  inst.AnimState:SetBank("wilson")

  local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}

  local buildname = names[math.random(#names)]

  inst.AnimState:SetBuild(buildname)

  inst.Transform:SetScale(0.8, 0.8, 0.8)

  inst.AnimState:OverrideSymbol("swap_body", "armor_grass", "swap_body")

  inst.AnimState:Hide("ARM_carry")

  inst.AnimState:Show("ARM_normal")

  inst.AnimState:PlayAnimation("idle")

  local sound = inst.entity:AddSoundEmitter()

  local shadow = inst.entity:AddDynamicShadow()

  shadow:SetSize( 1.3, .6 )

  inst.Transform:SetFourFaced()

  local brain = require "brains/chesterbrain"

  inst:SetBrain(brain)

  inst:AddComponent("knownlocations")

  inst:AddComponent("locomotor")

  inst.components.locomotor.walkspeed = 5

  inst.components.locomotor.runspeed = 15

  inst:SetStateGraph("SGshadowwaxwell")

  MakeCharacterPhysics(inst, 50, .5)

  inst:RemoveComponent("stackable")

  inst:RemoveComponent("tradable")

  inst:RemoveComponent("fuel")

  inst:RemoveComponent("inventoryitem")

  inst:RemoveComponent("edible")

  inst:RemoveComponent("perishable")

  inst:RemoveComponent("burnable")

  inst:RemoveComponent("propagator")

  inst:RemoveTag("cattoy")

  inst:AddComponent("follower")

  inst.components.follower:SetLeader(GetPlayer())

  inst:AddComponent("health")

  inst.components.health:SetMaxHealth(500)

  inst.components.health:SetInvincible(true)

  inst.components.health.nofadeout = true

  inst:AddComponent("combat")

  inst:DoPeriodicTask(math.random(10,60), function(inst)

  inst.SoundEmitter:PlaySound("dontstarve/characters/willow/hurt")

  inst.AnimState:PlayAnimation("hungry")

  end )

  inst:AddComponent("trader")

  inst.components.trader:SetAcceptTest(function(inst, item)

  if GetPlayer().components.inventory:Has("goldnugget", 10) 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", 9)

  GetPlayer().components.sanity:DoDelta(5)

  inst.components.locomotor:Stop()

  inst:SetBrain(nil)

  inst.components.follower:SetLeader(nil)

  inst.AnimState:PlayAnimation("idle_onemanband1_loop",true)

  inst:DoTaskInTime(5, function() inst:Remove() end )

  end

  inst:ListenForEvent( "nighttime", function()

  inst.components.locomotor:Stop()

  inst:SetBrain(nil)

  inst.components.follower:SetLeader(nil)

  inst.AnimState:PlayAnimation("idle_shiver_pre")

  inst.AnimState:PushAnimation("idle_shiver_loop")

  inst.AnimState:PushAnimation("idle_shiver_pst", false)

  inst:RemoveComponent("trader")

  inst:DoTaskInTime(math.random(1,6), function()

  inst.components.health:SetInvincible(false)

  inst.components.health:Kill()

  end )

  end, GetWorld())

  inst:ListenForEvent("death", function()

  GetPlayer():DoTaskInTime(2, function()

  GetPlayer().components.sanity:DoDelta(-10)

  end )

  end )

  inst:AddTag("beggars")

  end

  end

  inst.OnSave = onsave

  inst.OnLoad = onload

  即可开启一个独特的游戏模式,在饥荒世界这苦寒之地,有许多失去亲人的儿童正在忍饥挨饿,已经站稳脚跟的你,有责任帮助他们。不时会有孤儿向你乞讨,只要10个黄金(拿着黄金对儿童点鼠标左键),就能给予他们几天的温饱(儿童将离开),你也会获得心灵的宁静(补5点脑)。如果你不愿付出,他们也不会给你添任何麻烦,只是默默地跟随,期盼着一点点施舍。当黑夜来临时,他们将在你眼前冻饿而死,苍天为之动容(你将降10点脑),痛惜一个幼小生命的逝去。何去何从,由你自己决定。不要与“荒野之狼”一同修改

更多相关内容请关注:饥荒专区

责任编辑:Shy夏夏

上一页 211 212 213 214 215 216 217 218 219 220 221 下一页
友情提示:支持键盘左右键“← →”翻页

本文是否解决了您的问题

文章内容导航
游民星空APP
随手浏览游戏攻略
code
攻略合集
单机游戏下载
休闲娱乐
综合热点资讯
游民星空联运游戏