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

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

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

第213页:红胡子强盗团

展开

二一三.红胡子强盗团(强盗团通过冒险之门入侵,烧杀抢掠,打死强盗可得黄金、武器)

  1.用记事本打开游戏目录\data\DLC0001\scripts\prefabs\forest.lua文件,在"puppet_wes",的下一行插入"puppet_woodie",

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

  local function createbandit(inst)

  for k = 1,math.random(20,35) do

  local pt = inst:GetPosition()

  local bandit = SpawnPrefab("beardhair")

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

  bandit.AnimState:SetBank("wilson")

  bandit.AnimState:SetBuild("woodie")

  bandit.AnimState:OverrideSymbol("swap_hat", "hat_feather", "swap_hat")

  bandit.AnimState:OverrideSymbol("swap_body", "armor_slurper", "swap_body")

  bandit.AnimState:Show("HAT")

  bandit.AnimState:Show("HAT_HAIR")

  bandit.AnimState:Hide("HAIR_NOHAT")

  bandit.AnimState:Hide("HAIR")

  bandit.AnimState:Hide("ARM_carry")

  bandit.AnimState:Show("ARM_normal")

  bandit.AnimState:PlayAnimation("idle")

  local sound = bandit.entity:AddSoundEmitter()

  local shadow = bandit.entity:AddDynamicShadow()

  shadow:SetSize( 1.3, .6 )

  bandit.Transform:SetFourFaced()

  local brain = require "brains/frogbrain"

  bandit:SetBrain(brain)

  bandit:AddComponent("locomotor")

  bandit.components.locomotor.walkspeed = 5

  bandit.components.locomotor.runspeed = 10

  bandit:SetStateGraph("SGshadowwaxwell")

  MakeCharacterPhysics(bandit, 75, .5)

  bandit:RemoveComponent("inventoryitem")

  bandit:RemoveComponent("stackable")

  bandit:RemoveComponent("fuel")

  bandit:RemoveComponent("burnable")

  bandit:RemoveComponent("propagator")

  bandit:AddComponent("inventory")

  bandit:AddComponent("thief")

  bandit:AddComponent("knownlocations")

  bandit:AddComponent("health")

  bandit.components.health:SetMaxHealth(1500)

  bandit:ListenForEvent("death", function()

  local pt1 = bandit:GetPosition()

  for k = 1,math.random(15,25) do

  local gold = SpawnPrefab("goldnugget")

  gold.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3)))

  end

  if math.random() < 0.1 then

  local weapons = {"goldenaxe","spear","tentaclespike","batbat","ruins_bat"}

  local weapon = weapons[math.random(#weapons)]

  SpawnPrefab(weapon).Transform:SetPosition(pt1.x, 0, pt1.z)

  end

  end )

  bandit:AddComponent("combat")

  bandit.components.combat:SetDefaultDamage(20)

  bandit.components.combat:SetAttackPeriod(1)

  bandit.components.combat:SetRetargetFunction(2, function(bandit)

  if not bandit.components.health:IsDead() then

  return FindEntity(bandit, 20, function(guy)

  return bandit.components.combat:CanTarget(guy) and not guy:HasTag("bandits")

  end )

  end

  end )

  bandit.components.combat.onhitotherfn = function(bandit, other, damage) bandit.components.thief:StealItem(other) end

  bandit:ListenForEvent("attacked", function(bandit, data)

  bandit.components.combat:SetTarget(data.attacker)

  bandit.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("bandits") and not dude.components.health:IsDead() end, 5)

  end )

  bandit.Physics:SetCollisionCallback(function(bandit, other)

  if other and other.components.workable and other.components.workable.workleft > 0 then

  other.components.workable:Destroy(bandit)

  end

  end)

  bandit:DoPeriodicTask(1, function(bandit)

  local pos = Vector3(bandit.Transform:GetWorldPosition())

  local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3)

  for k,v in pairs(ents) do

  if v.components.pickable and v.components.pickable:CanBePicked() then

  v.components.pickable:Pick(bandit)

  end

  if v.components.crop then

  v.components.crop:Harvest(bandit)

  end

  end

  end )

  local minimap = bandit.entity:AddMiniMapEntity()

  minimap:SetIcon( "lucy_axe.png" )

  bandit:AddTag("monster")

  bandit:AddTag("bandits")

  end

  end

  local function delbandit(inst)

  local range = 3000

  local pos = Vector3(inst.Transform:GetWorldPosition())

  local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, range)

  for k,v in pairs(ents) do

  if v:HasTag("bandits") then

  v:Remove()

  end

  end

  end

  inst:ListenForEvent( "daytime", function() createbandit(inst) end , GetWorld())

  inst:ListenForEvent( "nighttime", function() delbandit(inst) end , GetWorld())

  3.用记事本打开游戏目录\data\scripts\prefabs\beardhair.lua文件,在Asset("ANIM", "anim/beardhair.zip"),的下一行插入以下内容:

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

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

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

  local names = {"swap_goldenaxe","swap_spear","swap_spike","swap_batbat","swap_ruins_bat"}

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

  local items = { SWORD = weapon }

  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 onsave(inst, data)

  if inst:HasTag("bandits") then

  data.bandits = true

  end

  end

  local function onload(inst, data)

  if data and data.bandits then

  inst.AnimState:SetBank("wilson")

  inst.AnimState:SetBuild("woodie")

  inst.AnimState:OverrideSymbol("swap_hat", "hat_feather", "swap_hat")

  inst.AnimState:OverrideSymbol("swap_body", "armor_slurper", "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")

  local sound = inst.entity:AddSoundEmitter()

  local shadow = inst.entity:AddDynamicShadow()

  shadow:SetSize( 1.3, .6 )

  inst.Transform:SetFourFaced()

  local brain = require "brains/frogbrain"

  inst:SetBrain(brain)

  inst:AddComponent("locomotor")

  inst.components.locomotor.walkspeed = 5

  inst.components.locomotor.runspeed = 10

  inst:SetStateGraph("SGshadowwaxwell")

  MakeCharacterPhysics(inst, 75, .5)

  inst:RemoveComponent("inventoryitem")

  inst:RemoveComponent("stackable")

  inst:RemoveComponent("fuel")

  inst:RemoveComponent("burnable")

  inst:RemoveComponent("propagator")

  inst:AddComponent("inventory")

  inst:AddComponent("thief")

  inst:AddComponent("knownlocations")

  inst:AddComponent("health")

  inst.components.health:SetMaxHealth(1500)

  inst:ListenForEvent("death", function()

  local pt1 = inst:GetPosition()

  for k = 1,math.random(15,25) do

  local gold = SpawnPrefab("goldnugget")

  gold.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3)))

  end

  if math.random() < 0.1 then

  local weapons = {"goldenaxe","spear","tentaclespike","batbat","ruins_bat"}

  local weapon = weapons[math.random(#weapons)]

  SpawnPrefab(weapon).Transform:SetPosition(pt1.x, 0, pt1.z)

  end

  end )

  inst:AddComponent("combat")

  inst.components.combat:SetDefaultDamage(20)

  inst.components.combat:SetAttackPeriod(1)

  inst.components.combat:SetRetargetFunction(2, function(inst)

  if not inst.components.health:IsDead() then

  return FindEntity(inst, 20, function(guy)

  return inst.components.combat:CanTarget(guy) and not guy:HasTag("bandits")

  end )

  end

  end )

  inst.components.combat.onhitotherfn = function(inst, other, damage) inst.components.thief:StealItem(other) end

  inst:ListenForEvent("attacked", function(inst, data)

  inst.components.combat:SetTarget(data.attacker)

  inst.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("bandits") and not dude.components.health:IsDead() end, 5)

  end )

  inst.Physics:SetCollisionCallback(function(inst, other)

  if other and other.components.workable and other.components.workable.workleft > 0 then

  other.components.workable:Destroy(inst)

  end

  end)

  inst:DoPeriodicTask(1, function(inst)

  local pos = Vector3(inst.Transform:GetWorldPosition())

  local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3)

  for k,v in pairs(ents) do

  if v.components.pickable and v.components.pickable:CanBePicked() then

  v.components.pickable:Pick(inst)

  end

  if v.components.crop then

  v.components.crop:Harvest(inst)

  end

  end

  end )

  local minimap = inst.entity:AddMiniMapEntity()

  minimap:SetIcon( "lucy_axe.png" )

  inst:AddTag("monster")

  inst:AddTag("bandits")

  end

  end

  inst.OnSave = onsave

  inst.OnLoad = onload

  即可有红胡子强盗通过冒险之门入侵你的大陆(修改后第2天早晨出现),他们将盘踞在冒险之门附近,毁坏森林、拆毁建筑、抢掠农作物,所到之处没有活口。通过小地图可查询强盗所在位置,显示为红斧子图标。与强盗交战时,他们会抢掠你身上的物品,并且附近的强盗将一起来围攻你,蛮干无异于送死,争取各个击破吧。从此在冒险之门周围,白天和傍晚都是危险的,只有漆黑的夜里,才是你可以喘息之际。打死强盗可获得战利品(不菲的黄金和他们抢来的赃物),还有一定概率掉落武器。如果同时修改了“雇佣兵工厂”,你的铁甲战团终于有了用武之地。同胞们,饥荒世界正遭遇重大危机,亿万苍生期盼着你,起兵去攻打强盗吧,这是旷日持久的反抗,也是正义而光荣的战争,用你的每一滴鲜血去证明,新一代的救世主,从此诞生了

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

责任编辑:Shy夏夏

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

本文是否解决了您的问题

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