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

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

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

第344页:采矿场

展开

二九四.采矿场(用多功能工具种采矿场,打工赚黄金,买卖宝石)

  用记事本打开游戏目录\data\scripts\prefabs\axe_pickaxe.lua文件,

  1.在Asset("ANIM", "anim/swap_multitool_axe_pickaxe.zip"),的下一行插入以下内容:

  Asset("ANIM", "anim/wolfgang.zip"),

  Asset("ANIM", "anim/wolfgang_skinny.zip"),

  Asset("ANIM", "anim/wolfgang_mighty.zip"),

  Asset("ANIM", "anim/player_wolfgang.zip"),

  Asset("SOUND", "sound/wolfgang.fsb"),

  2.在inst:AddComponent("inspectable")的下一行插入以下内容:

  local function mining(inst)

  local pt = inst:GetPosition()

  local boss = SpawnPrefab("multitool_axe_pickaxe")

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

  boss.AnimState:SetBank("wilson")

  boss.AnimState:SetBuild("wolfgang")

  boss.AnimState:Hide("ARM_carry")

  boss.AnimState:Show("ARM_normal")

  boss.Transform:SetFourFaced()

  boss.AnimState:OverrideSymbol("swap_hat", "hat_miner", "swap_hat")

  boss.AnimState:Show("HAT")

  boss.AnimState:Show("HAT_HAIR")

  boss.AnimState:Hide("HAIR_NOHAT")

  boss.AnimState:Hide("HAIR")

  boss.AnimState:PlayAnimation("idle")

  boss:AddTag("boss")

  boss:RemoveComponent("weapon")

  boss:RemoveComponent("tool")

  boss:RemoveComponent("finiteuses")

  boss:RemoveComponent("inventoryitem")

  boss:RemoveComponent("equippable")

  boss:RemoveComponent("deployable")

  boss:RemoveTag("sharp")

  local light = boss.entity:AddLight()

  light:SetFalloff(1)

  light:SetIntensity(.8)

  light:SetRadius(5)

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

  light:Enable(true)

  boss:AddComponent("trader")

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

  if item.prefab == "goldnugget" then

  return true

  end

  if item.prefab == "purplegem" or item.prefab == "bluegem" or item.prefab == "redgem" or item.prefab == "orangegem" or item.prefab == "yellowgem" or item.prefab == "greengem" then

  return true

  end

  return false

  end )

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

  boss.AnimState:PlayAnimation("give")

  if item.prefab == "goldnugget" then

  SpawnPrefab("pickaxe").Transform:SetPosition(pt.x+0.5, 0, pt.z+0.5)

  end

  if item.prefab == "purplegem" or item.prefab == "bluegem" or item.prefab == "redgem" or item.prefab == "orangegem" or item.prefab == "yellowgem" or item.prefab == "greengem" then

  SpawnPrefab("goldnugget").Transform:SetPosition(pt.x+0.5, 0, pt.z+0.5)

  end

  end

  boss.components.inspectable.getstatus = function(boss)

  boss.AnimState:PlayAnimation("give")

  local rock = SpawnPrefab("multitool_axe_pickaxe")

  rock.Transform:SetPosition(pt.x+1.5, 0, pt.z+1.5)

  rock.AnimState:SetBank("rock")

  rock.AnimState:SetBuild("rock")

  rock.AnimState:PlayAnimation("full")

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

  rock:AddTag("goodbye")

  rock:RemoveComponent("weapon")

  rock:RemoveComponent("tool")

  rock:RemoveComponent("finiteuses")

  rock:RemoveComponent("inventoryitem")

  rock:RemoveComponent("equippable")

  rock:RemoveComponent("deployable")

  rock:RemoveTag("sharp")

  rock:AddComponent("workable")

  rock.components.workable:SetWorkAction(ACTIONS.MINE)

  rock.components.workable:SetWorkLeft(30)

  rock.components.workable:SetOnWorkCallback(function(rock, worker, workleft)

  if rock.components.workable.workleft <= 0 then

  rock.SoundEmitter:PlaySound("dontstarve/wilson/rock_break")

  boss.AnimState:PlayAnimation("give")

  for k = 1, 3 do

  SpawnPrefab("goldnugget").Transform:SetPosition(pt.x+0.5, 0, pt.z-0.5)

  end

  rock:Remove()

  else

  if rock.components.workable.workleft < 10 then

  rock.AnimState:PlayAnimation("low")

  elseif rock.components.workable.workleft < 20 then

  rock.AnimState:PlayAnimation("med")

  else

  rock.AnimState:PlayAnimation("full")

  end

  end

  end)

  end

  local mountain = SpawnPrefab("multitool_axe_pickaxe")

  mountain.Transform:SetPosition(pt.x-2, 0, pt.z-2)

  mountain.AnimState:SetBank("rock2")

  mountain.AnimState:SetBuild("rock2")

  mountain.AnimState:PlayAnimation("full")

  mountain.Transform:SetScale(2, 2, 2)

  mountain:AddTag("goodbye")

  mountain:RemoveComponent("weapon")

  mountain:RemoveComponent("tool")

  mountain:RemoveComponent("finiteuses")

  mountain:RemoveComponent("inventoryitem")

  mountain:RemoveComponent("equippable")

  mountain:RemoveComponent("deployable")

  mountain:RemoveTag("sharp")

  local miner = SpawnPrefab("multitool_axe_pickaxe")

  miner.Transform:SetPosition(pt.x+3-2, 0, pt.z-3-2)

  miner.AnimState:SetBank("wilson")

  miner.AnimState:SetBuild("wes")

  miner.Transform:SetFourFaced()

  miner.AnimState:OverrideSymbol("swap_hat", "hat_miner", "swap_hat")

  miner.AnimState:Show("HAT")

  miner.AnimState:Show("HAT_HAIR")

  miner.AnimState:Hide("HAIR_NOHAT")

  miner.AnimState:Hide("HAIR")

  miner.AnimState:OverrideSymbol("swap_object", "swap_pickaxe", "swap_pickaxe")

  miner.AnimState:Show("ARM_carry")

  miner.AnimState:Hide("ARM_normal")

  miner.AnimState:PlayAnimation("pickaxe_pre")

  miner.AnimState:PlayAnimation("pickaxe_loop", true)

  miner.Transform:SetRotation( 270 )

  miner:AddTag("goodbye")

  miner:RemoveComponent("weapon")

  miner:RemoveComponent("tool")

  miner:RemoveComponent("finiteuses")

  miner:RemoveComponent("inventoryitem")

  miner:RemoveComponent("equippable")

  miner:RemoveComponent("deployable")

  miner:RemoveTag("sharp")

  miner:DoPeriodicTask(30, function()

  miner.AnimState:PlayAnimation("pickaxe_pre")

  miner.AnimState:PlayAnimation("pickaxe_loop", true)

  miner.Transform:SetRotation( 270 )

  end )

  miner:AddComponent("trader")

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

  if item.prefab == "goldnugget" then

  return true

  end

  return false

  end )

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

  miner.AnimState:PlayAnimation("give")

  miner.Transform:SetRotation(GetPlayer().Transform:GetRotation() - 180)

  local names = {"purplegem","bluegem","redgem","orangegem","yellowgem","greengem"}

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

  local gem = SpawnPrefab(name)

  GetPlayer().components.inventory:GiveItem(gem)

  end

  end

  local function OnDeploy (inst, pt)

  mining(inst)

  inst:Remove()

  end

  inst:AddComponent("deployable")

  inst.components.deployable.ondeploy = OnDeploy

  local function onsave(inst, data)

  if inst:HasTag("boss") then

  data.boss = true

  end

  if inst:HasTag("goodbye") then

  data.goodbye = true

  end

  end

  local function onload(inst, data)

  if data and data.boss then

  mining(inst)

  inst:Remove()

  end

  if data and data.goodbye then

  inst:Remove()

  end

  end

  inst.OnSave = onsave

  inst.OnLoad = onload

  MakeLargeBurnable(inst)

  MakeLargePropagator(inst)

  即可用多功能工具种采矿场,鼠标左键点工头(大力士),他会拿出要你加工的石头,用镐将石头凿碎,即可获得3个黄金的工钱(工头会扔在地上)。可以向工头购买镐(拿着黄金对工头点鼠标左键),每把1个黄金。也可以将自己的宝石卖给工头(拿着宝石对工头点鼠标左键),每颗1个黄金。当然也可以私下向矿工(维斯)购买宝石(拿着黄金对矿工点鼠标左键),同样每颗1个黄金(宝石将直接放入主角物品栏),颜色随机。不想要采矿场时,烧掉即可。多功能工具在远古选项(画着远古祭坛)下,用1把黄金斧头、1把黄金镐、2个铥矿石制造,制造时需要靠近远古祭坛

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

责任编辑:Shy夏夏

上一页 341 342 343 344 345 346 347 348 349 350 351 下一页
友情提示:支持键盘左右键“← →”翻页

本文是否解决了您的问题

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