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

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

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

第358页:百变存钱罐

展开

三零八.百变存钱罐(用鱼竿种百变存钱罐,每天获得3个黄金的零花钱,可变外型、防雷击、照明、补脑)

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

  local function itemtest(inst, item, slot)

  if item.prefab == "goldnugget" then

  return true

  end

  return false

  end

  local slotpos = { Vector3(0,-75,0)}

  local widgetbuttoninfo = {

  text = "Change",

  position = Vector3(0, -15, 0),

  fn = function(inst)

  GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")

  inst:RemoveTag("doll_1") inst:RemoveTag("doll_2") inst:RemoveTag("doll_3") inst:RemoveTag("doll_4") inst:RemoveTag("doll_5") inst:RemoveTag("doll_6") inst:RemoveTag("doll_7") inst:RemoveTag("doll_8") inst:RemoveTag("doll_9") inst:RemoveTag("doll_10")

  if math.random()<.08 then

  inst:AddTag("doll_1")

  inst.AnimState:SetBank("bearger")

  inst.AnimState:SetBuild("bearger_build")

  inst.AnimState:PlayAnimation("idle_loop")

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

  elseif math.random()<.16 then

  inst:AddTag("doll_2")

  inst.AnimState:SetBank("lightning_goat")

  inst.AnimState:SetBuild("lightning_goat_build")

  inst.AnimState:PlayAnimation("idle_loop")

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

  elseif math.random()<.24 then

  inst:AddTag("doll_3")

  inst.AnimState:SetBank("leif")

  inst.AnimState:SetBuild("leif_build")

  inst.AnimState:PlayAnimation("idle_loop")

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

  elseif math.random()<.32 then

  inst:AddTag("doll_4")

  inst.AnimState:SetBank("beefalo")

  inst.AnimState:SetBuild("beefalo_build")

  inst.AnimState:PlayAnimation("idle_loop")

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

  elseif math.random()<.4 then

  inst:AddTag("doll_5")

  inst.AnimState:SetBank("rook")

  inst.AnimState:SetBuild("rook_build")

  inst.AnimState:PlayAnimation("idle")

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

  elseif math.random()<.48 then

  inst:AddTag("doll_6")

  inst.AnimState:SetBank("deerclops")

  inst.AnimState:SetBuild("deerclops_build")

  inst.AnimState:PlayAnimation("idle_loop")

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

  elseif math.random()<.56 then

  inst:AddTag("doll_7")

  inst.AnimState:SetBank("rook")

  inst.AnimState:SetBuild("rook_rhino")

  inst.AnimState:PlayAnimation("idle")

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

  elseif math.random()<.64 then

  inst:AddTag("doll_8")

  inst.AnimState:SetBank("Pig_King")

  inst.AnimState:SetBuild("Pig_King")

  inst.AnimState:PlayAnimation("idle")

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

  elseif math.random()<.72 then

  inst:AddTag("doll_9")

  inst.AnimState:SetBank("goosemoose")

  inst.AnimState:SetBuild("goosemoose_build")

  inst.AnimState:PlayAnimation("idle")

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

  elseif math.random()<.95 then

  inst:AddTag("doll_10")

  inst.AnimState:SetBank("dragonfly")

  inst.AnimState:SetBuild("dragonfly_build")

  inst.AnimState:PlayAnimation("idle")

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

  else

  inst.AnimState:SetBank("trinkets")

  inst.AnimState:SetBuild("trinkets")

  inst.AnimState:PlayAnimation(tostring(4))

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

  end

  end }

  local function OnDeploy (inst, pt)

  local doll = SpawnPrefab("fishingrod")

  doll.Transform:SetPosition(pt.x, pt.y, pt.z)

  doll.AnimState:SetBank("trinkets")

  doll.AnimState:SetBuild("trinkets")

  doll.AnimState:PlayAnimation(tostring(4))

  doll.Transform:SetFourFaced()

  doll.Transform:SetScale(1.5,1.5,1.5)

  local light = doll.entity:AddLight()

  light:SetFalloff(0.5)

  light:SetIntensity(.8)

  light:SetRadius(3.0)

  light:SetColour(180/255, 195/255, 50/255)

  light:Enable(true)

  MakeObstaclePhysics(doll, 0.5)

  doll:RemoveComponent("fishingrod")

  doll:RemoveComponent("finiteuses")

  doll:RemoveComponent("inventoryitem")

  doll:RemoveComponent("equippable")

  if doll.components.weapon then doll:RemoveComponent("weapon") end

  doll:RemoveComponent("deployable")

  doll.components.container.canbeopened = true

  doll:AddComponent("named")

  doll.components.named:SetName("Piggy bank")

  doll:AddComponent("sanityaura")

  doll.components.sanityaura.aura = TUNING.SANITYAURA_MED

  doll:AddTag("lightningrod")

  doll:ListenForEvent("lightningstrike", function()

  doll.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )

  doll:DoTaskInTime(60, function()

  doll.AnimState:SetBloomEffectHandle("")

  end )

  end )

  doll:AddComponent("workable")

  doll.components.workable:SetWorkAction(ACTIONS.HAMMER)

  doll.components.workable:SetWorkLeft(3)

  doll.components.workable:SetOnFinishCallback(function(doll)

  doll.Light:Enable(false)

  doll.components.container:DropEverything()

  SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(doll.Transform:GetWorldPosition())

  GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")

  doll:Remove()

  end )

  doll:ListenForEvent( "daytime", function()

  for k = 1, 3 do

  local goldnugget = SpawnPrefab("goldnugget")

  doll.components.container:GiveItem(goldnugget)

  end

  end, GetWorld())

  doll:AddTag("scarytoprey")

  doll:AddTag("dolls")

  inst:Remove()

  end

  inst:AddComponent("deployable")

  inst.components.deployable.ondeploy = OnDeploy

  local function onsave(inst, data)

  if inst:HasTag("dolls") then

  data.dolls = true

  end

  if inst:HasTag("doll_1") then

  data.doll_1 = true

  end

  if inst:HasTag("doll_2") then

  data.doll_2 = true

  end

  if inst:HasTag("doll_3") then

  data.doll_3 = true

  end

  if inst:HasTag("doll_4") then

  data.doll_4 = true

  end

  if inst:HasTag("doll_5") then

  data.doll_5 = true

  end

  if inst:HasTag("doll_6") then

  data.doll_6 = true

  end

  if inst:HasTag("doll_7") then

  data.doll_7 = true

  end

  if inst:HasTag("doll_8") then

  data.doll_8 = true

  end

  if inst:HasTag("doll_9") then

  data.doll_9 = true

  end

  if inst:HasTag("doll_10") then

  data.doll_10 = true

  end

  end

  local function onload(inst, data)

  if data and data.dolls then

  inst.AnimState:SetBank("trinkets")

  inst.AnimState:SetBuild("trinkets")

  inst.AnimState:PlayAnimation(tostring(4))

  inst.Transform:SetFourFaced()

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

  local light = inst.entity:AddLight()

  light:SetFalloff(0.5)

  light:SetIntensity(.8)

  light:SetRadius(3.0)

  light:SetColour(180/255, 195/255, 50/255)

  light:Enable(true)

  MakeObstaclePhysics(inst, 0.5)

  inst:RemoveComponent("fishingrod")

  inst:RemoveComponent("finiteuses")

  inst:RemoveComponent("inventoryitem")

  inst:RemoveComponent("equippable")

  if inst.components.weapon then inst:RemoveComponent("weapon") end

  inst:RemoveComponent("deployable")

  inst.components.container.canbeopened = true

  inst:AddComponent("named")

  inst.components.named:SetName("Piggy bank")

  inst:AddComponent("sanityaura")

  inst.components.sanityaura.aura = TUNING.SANITYAURA_MED

  inst:AddTag("lightningrod")

  inst:ListenForEvent("lightningstrike", function()

  inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )

  inst:DoTaskInTime(60, function()

  inst.AnimState:SetBloomEffectHandle("")

  end )

  end )

  inst:AddComponent("workable")

  inst.components.workable:SetWorkAction(ACTIONS.HAMMER)

  inst.components.workable:SetWorkLeft(3)

  inst.components.workable:SetOnFinishCallback(function(inst)

  inst.Light:Enable(false)

  inst.components.container:DropEverything()

  SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(inst.Transform:GetWorldPosition())

  GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")

  inst:Remove()

  end )

  inst:ListenForEvent( "daytime", function()

  for k = 1, 3 do

  local goldnugget = SpawnPrefab("goldnugget")

  inst.components.container:GiveItem(goldnugget)

  end

  end, GetWorld())

  inst:AddTag("scarytoprey")

  inst:AddTag("dolls")

  end

  if data and data.doll_1 then

  inst:AddTag("doll_1")

  inst.AnimState:SetBank("bearger")

  inst.AnimState:SetBuild("bearger_build")

  inst.AnimState:PlayAnimation("idle_loop")

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

  end

  if data and data.doll_2 then

  inst:AddTag("doll_2")

  inst.AnimState:SetBank("lightning_goat")

  inst.AnimState:SetBuild("lightning_goat_build")

  inst.AnimState:PlayAnimation("idle_loop")

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

  end

  if data and data.doll_3 then

  inst:AddTag("doll_3")

  inst.AnimState:SetBank("leif")

  inst.AnimState:SetBuild("leif_build")

  inst.AnimState:PlayAnimation("idle_loop")

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

  end

  if data and data.doll_4 then

  inst:AddTag("doll_4")

  inst.AnimState:SetBank("beefalo")

  inst.AnimState:SetBuild("beefalo_build")

  inst.AnimState:PlayAnimation("idle_loop")

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

  end

  if data and data.doll_5 then

  inst:AddTag("doll_5")

  inst.AnimState:SetBank("rook")

  inst.AnimState:SetBuild("rook_build")

  inst.AnimState:PlayAnimation("idle")

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

  end

  if data and data.doll_6 then

  inst:AddTag("doll_6")

  inst.AnimState:SetBank("deerclops")

  inst.AnimState:SetBuild("deerclops_build")

  inst.AnimState:PlayAnimation("idle_loop")

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

  end

  if data and data.doll_7 then

  inst:AddTag("doll_7")

  inst.AnimState:SetBank("rook")

  inst.AnimState:SetBuild("rook_rhino")

  inst.AnimState:PlayAnimation("idle")

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

  end

  if data and data.doll_8 then

  inst:AddTag("doll_8")

  inst.AnimState:SetBank("Pig_King")

  inst.AnimState:SetBuild("Pig_King")

  inst.AnimState:PlayAnimation("idle")

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

  end

  if data and data.doll_9 then

  inst:AddTag("doll_9")

  inst.AnimState:SetBank("goosemoose")

  inst.AnimState:SetBuild("goosemoose_build")

  inst.AnimState:PlayAnimation("idle")

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

  end

  if data and data.doll_10 then

  inst:AddTag("doll_10")

  inst.AnimState:SetBank("dragonfly")

  inst.AnimState:SetBuild("dragonfly_build")

  inst.AnimState:PlayAnimation("idle")

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

  end

  end

  inst.OnSave = onsave

  inst.OnLoad = onload

  inst:AddComponent("container")

  inst.components.container:SetNumSlots(#slotpos)

  inst.components.container.widgetslotpos = slotpos

  inst.components.container.widgetpos = Vector3(0,150,0)

  inst.components.container.side_align_tip = 160

  inst.components.container.itemtestfn = itemtest

  inst.components.container.widgetbuttoninfo = widgetbuttoninfo

  inst.components.container.canbeopened = false

  即可用鱼竿种百变存钱罐,鼠标左键点存钱罐可打开格子,每天将获得3个黄金的零花钱,在格子中拿取。点格子上方的“Change”按钮,可使存钱罐改换为巨鹿、猪王、熊等造型。百变存钱罐放在家中,可防雷击、照明,靠近会补脑,并且可以吓阻火鸡、兔子等小动物,让它们不敢偷吃你扔在地上的食物。不想要百变存钱罐了,用锤子砸掉即可,里面的黄金会掉在地上。鱼竿在生存选项(画着绳套)下,用2个树枝、2个蛛丝制造

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

责任编辑:Shy夏夏

上一页 351 352 353 354 355 356 357 358 359 360 361 下一页
友情提示:支持键盘左右键“← →”翻页

本文是否解决了您的问题

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