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

《饥荒》这款生存游戏,很多玩家都想觉得游戏有些难,就想修改一些内容,比如解锁全人物,主角自动回血,主角不会饿之类的,下面小编为大家奉上最全的修改教程,内容简单易懂,希望各位玩家喜欢。目录

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

一七二.溜溜球(用陷阱种溜溜球,连续打击多个目标,打完自动回到手中)

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

  local colours=

  {

  {198/255,43/255,43/255},

  {79/255,153/255,68/255},

  {35/255,105/255,235/255},

  {233/255,208/255,69/255},

  {109/255,50/255,163/255},

  {222/255,126/255,39/255},

  }

  local function OnDeploy (inst, pt)

  local ball = SpawnPrefab("trap")

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

  ball.AnimState:SetBank("bulb")

  ball.AnimState:SetBuild("bulb")

  ball.AnimState:PlayAnimation("idle")

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

  ball:ClearStateGraph()

  RemovePhysicsColliders(ball)

  ball.components.inventoryitem:ChangeImageName("lightbulb")

  ball.colour_idx = math.random(#colours)

  ball.AnimState:SetMultColour(colours[ball.colour_idx][1],colours[ball.colour_idx][2],colours[ball.colour_idx][3],1)

  ball:RemoveComponent("finiteuses")

  ball:RemoveComponent("trap")

  ball:RemoveComponent("deployable")

  ball:RemoveTag("trap")

  ball:AddComponent("weapon")

  ball.components.weapon:SetDamage(30)

  ball.components.weapon:SetRange(20, 25)

  ball:AddComponent("equippable")

  ball.components.equippable.equipslot = EQUIPSLOTS.HANDS

  ball.components.equippable:SetOnEquip(function(ball)

  ball.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")

  end )

  ball:AddComponent("projectile")

  ball.components.projectile:SetSpeed(25)

  ball.components.projectile:SetOnHitFn(function(ball, owner, target)

  GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")

  local target0 = FindEntity(owner, 25, function(guy)

  if guy.components.combat and guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") then

  return guy.components.combat.target == owner or owner.components.combat.target == guy or guy:HasTag("monster")

  end

  end )

  if target0 then

  ball.components.projectile:Throw(owner, target0)

  else

  owner.components.inventory:Equip(ball)

  end

  end )

  ball.components.projectile:SetOnMissFn(function(ball, owner)

  owner.components.inventory:Equip(ball)

  end )

  ball:ListenForEvent("onthrown", function(ball)

  local pt = ball:GetPosition()

  ball.Transform:SetPosition(pt.x, 2, pt.z)

  ball.SoundEmitter:PlaySound("dontstarve/wilson/boomerang_throw")

  end )

  ball:AddComponent("workable")

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

  ball.components.workable:SetWorkLeft(3)

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

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

  ball:Remove()

  end )

  ball:AddTag("projectile")

  ball:AddTag("balls")

  inst:Remove()

  end

  inst:AddComponent("deployable")

  inst.components.deployable.ondeploy = OnDeploy

  local function onsave(inst, data)

  if inst:HasTag("balls") then

  data.balls = true

  end

  data.colour_idx = inst.colour_idx

  end

  local function onload(inst, data)

  if data and data.balls then

  inst.AnimState:SetBank("bulb")

  inst.AnimState:SetBuild("bulb")

  inst.AnimState:PlayAnimation("idle")

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

  inst:ClearStateGraph()

  RemovePhysicsColliders(inst)

  inst.components.inventoryitem:ChangeImageName("lightbulb")

  inst:RemoveComponent("finiteuses")

  inst:RemoveComponent("trap")

  inst:RemoveComponent("deployable")

  inst:RemoveTag("trap")

  inst:AddComponent("weapon")

  inst.components.weapon:SetDamage(30)

  inst.components.weapon:SetRange(20, 25)

  inst:AddComponent("equippable")

  inst.components.equippable.equipslot = EQUIPSLOTS.HANDS

  inst.components.equippable:SetOnEquip(function(inst)

  inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")

  end )

  inst:AddComponent("projectile")

  inst.components.projectile:SetSpeed(25)

  inst.components.projectile:SetOnHitFn(function(inst, owner, target)

  GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")

  local target0 = FindEntity(owner, 25, function(guy)

  if guy.components.combat and guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") then

  return guy.components.combat.target == owner or owner.components.combat.target == guy or guy:HasTag("monster")

  end

  end )

  if target0 then

  inst.components.projectile:Throw(owner, target0)

  else

  owner.components.inventory:Equip(inst)

  end

  end )

  inst.components.projectile:SetOnMissFn(function(inst, owner)

  owner.components.inventory:Equip(inst)

  end )

  inst:ListenForEvent("onthrown", function(inst)

  local pt = inst:GetPosition()

  inst.Transform:SetPosition(pt.x, 2, pt.z)

  inst.SoundEmitter:PlaySound("dontstarve/wilson/boomerang_throw")

  end )

  inst:AddComponent("workable")

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

  inst.components.workable:SetWorkLeft(3)

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

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

  inst:Remove()

  end )

  inst:AddTag("projectile")

  inst:AddTag("balls")

  end

  if data and data.colour_idx then

  inst.colour_idx = math.min(#colours, data.colour_idx)

  inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1)

  end

  end

  inst.OnSave = onsave

  inst.OnLoad = onload

  即可用陷阱种溜溜球(颜色随机),装备后对敌人按鼠标左键,可以扔出并连续打击附近所有敌人,消灭敌人后自动回到手中,完美代替回旋镖。不想要溜溜球时,用锤子砸掉即可。陷阱在生存选项(画着绳套)下,用2个树枝、6个草制造

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

作者:易宁     责任编辑:Shy夏夏

本文是否解决了您的问题

APP精彩推荐打开游民APP查看更多

  • 腾讯关闭天美蒙特利尔工作室!成立5年没有自己作品
    腾讯关闭天美蒙特利尔工作室!成立5年没有自己作品

  • 36斤活羊烤完只剩6.9斤引争议 商家称属正常损耗
    36斤活羊烤完只剩6.9斤引争议 商家称属正常损耗

  • 《夜王》女神黄洁琪试镜超低胸战衣:大雷浑圆饱满
    《夜王》女神黄洁琪试镜超低胸战衣:大雷浑圆饱满

攻略合集
近期更新
人物图鉴

相关内容

在线玩推荐更多

游民星空

打开App阅读体验更佳,攻略、资讯实时更新

下载APP