第195页:口袋猴子
展开一九五.口袋猴子(用蜂蜜绷带种猴子,帮你活捉兔子、鸟、鼹鼠等小动物)
用记事本打开游戏目录\data\scripts\prefabs\bandage.lua文件,在inst:AddComponent("inventoryitem")的下一行插入以下内容:
local function OnDeploy (inst, pt)
local helper = SpawnPrefab("bandage")
helper.Transform:SetPosition(pt.x, pt.y, pt.z)
helper.AnimState:SetBank("kiki")
helper.AnimState:SetBuild("kiki_basic")
helper.AnimState:PlayAnimation("idle_loop", true)
helper.Transform:SetFourFaced()
helper.Transform:SetScale(0.8, 0.8, 0.8)
helper:RemoveComponent("stackable")
helper:RemoveComponent("healer")
local sound = helper.entity:AddSoundEmitter()
helper.soundtype = ""
local brain = require "brains/abigailbrain"
helper:SetBrain(brain)
helper:AddComponent("locomotor")
helper.components.locomotor:SetTriggersCreep(false)
helper.components.locomotor.pathcaps = { ignorecreep = false }
helper.components.locomotor.walkspeed = 12
helper:SetStateGraph("SGmonkey")
helper:AddComponent("follower")
GetPlayer().components.leader:AddFollower(helper)
helper:AddComponent("combat")
helper.components.combat.hiteffectsymbol = "torso"
helper.components.combat:SetRetargetFunction(1, function(helper)
if not helper.components.health:IsDead() then
return FindEntity(helper, 20, function(guy)
if guy.components.health and not guy.components.health:IsDead() then
return guy.prefab == "crow" or guy.prefab == "robin" or guy.prefab == "robin_winter" or guy.prefab == "bee" or guy.prefab == "killerbee" or guy.prefab == "rabbit" or guy.prefab == "butterfly" or guy.prefab == "mole"
end
end)
end
end )
helper.components.combat:SetKeepTargetFunction(function(helper, target) return target and target:IsValid() end )
helper.components.combat:SetAttackPeriod(1)
helper.components.combat:SetRange(1, 2)
helper.components.combat:SetDefaultDamage(1)
helper.components.combat.onhitotherfn = function(helper, other, damage)
if other.prefab == "crow" then
local prey = SpawnPrefab("crow")
GetPlayer().components.inventory:GiveItem(prey)
end
if other.prefab == "robin" then
local prey = SpawnPrefab("robin")
GetPlayer().components.inventory:GiveItem(prey)
end
if other.prefab == "robin_winter" then
local prey = SpawnPrefab("robin_winter")
GetPlayer().components.inventory:GiveItem(prey)
end
if other.prefab == "bee" then
local prey = SpawnPrefab("bee")
GetPlayer().components.inventory:GiveItem(prey)
end
if other.prefab == "killerbee" then
local prey = SpawnPrefab("killerbee")
GetPlayer().components.inventory:GiveItem(prey)
end
if other.prefab == "rabbit" then
local prey = SpawnPrefab("rabbit")
GetPlayer().components.inventory:GiveItem(prey)
end
if other.prefab == "butterfly" then
local prey = SpawnPrefab("butterfly")
GetPlayer().components.inventory:GiveItem(prey)
end
if other.prefab == "mole" then
local prey = SpawnPrefab("mole")
GetPlayer().components.inventory:GiveItem(prey)
end
other:Remove()
end
helper:AddComponent("health")
helper.components.health:SetMaxHealth(1000)
helper.components.health:SetInvincible(true)
helper.components.health.nofadeout = true
helper.components.inventoryitem:ChangeImageName("cave_banana")
helper:AddComponent( "playerprox" )
helper.components.playerprox:SetDist(3,5)
helper.components.playerprox:SetOnPlayerNear(function(helper) helper.components.locomotor.walkspeed = 5 end )
helper.components.playerprox:SetOnPlayerFar(function(helper) helper.components.locomotor.walkspeed = 12 end )
helper:AddTag("helpers")
inst.components.stackable:Get():Remove()
end
inst:AddComponent("deployable")
inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
if inst:HasTag("helpers") then
data.helpers = true
end
end
local function onload(inst, data)
if data and data.helpers then
inst.AnimState:SetBank("kiki")
inst.AnimState:SetBuild("kiki_basic")
inst.AnimState:PlayAnimation("idle_loop", true)
inst.Transform:SetFourFaced()
inst.Transform:SetScale(0.8, 0.8, 0.8)
inst:RemoveComponent("stackable")
inst:RemoveComponent("healer")
local sound = inst.entity:AddSoundEmitter()
inst.soundtype = ""
local brain = require "brains/abigailbrain"
inst:SetBrain(brain)
inst:AddComponent("locomotor")
inst.components.locomotor:SetTriggersCreep(false)
inst.components.locomotor.pathcaps = { ignorecreep = false }
inst.components.locomotor.walkspeed = 12
inst:SetStateGraph("SGmonkey")
inst:AddComponent("follower")
GetPlayer().components.leader:AddFollower(inst)
inst:AddComponent("combat")
inst.components.combat.hiteffectsymbol = "torso"
inst.components.combat:SetRetargetFunction(1, function(inst)
if not inst.components.health:IsDead() then
return FindEntity(inst, 20, function(guy)
if guy.components.health and not guy.components.health:IsDead() then
return guy.prefab == "crow" or guy.prefab == "robin" or guy.prefab == "robin_winter" or guy.prefab == "bee" or guy.prefab == "killerbee" or guy.prefab == "rabbit" or guy.prefab == "butterfly" or guy.prefab == "mole"
end
end)
end
end )
inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
inst.components.combat:SetAttackPeriod(1)
inst.components.combat:SetRange(1, 2)
inst.components.combat:SetDefaultDamage(1)
inst.components.combat.onhitotherfn = function(inst, other, damage)
if other.prefab == "crow" then
local prey = SpawnPrefab("crow")
GetPlayer().components.inventory:GiveItem(prey)
end
if other.prefab == "robin" then
local prey = SpawnPrefab("robin")
GetPlayer().components.inventory:GiveItem(prey)
end
if other.prefab == "robin_winter" then
local prey = SpawnPrefab("robin_winter")
GetPlayer().components.inventory:GiveItem(prey)
end
if other.prefab == "bee" then
local prey = SpawnPrefab("bee")
GetPlayer().components.inventory:GiveItem(prey)
end
if other.prefab == "killerbee" then
local prey = SpawnPrefab("killerbee")
GetPlayer().components.inventory:GiveItem(prey)
end
if other.prefab == "rabbit" then
local prey = SpawnPrefab("rabbit")
GetPlayer().components.inventory:GiveItem(prey)
end
if other.prefab == "butterfly" then
local prey = SpawnPrefab("butterfly")
GetPlayer().components.inventory:GiveItem(prey)
end
if other.prefab == "mole" then
local prey = SpawnPrefab("mole")
GetPlayer().components.inventory:GiveItem(prey)
end
other:Remove()
end
inst:AddComponent("health")
inst.components.health:SetMaxHealth(1000)
inst.components.health:SetInvincible(true)
inst.components.health.nofadeout = true
inst.components.inventoryitem:ChangeImageName("cave_banana")
inst:AddComponent( "playerprox" )
inst.components.playerprox:SetDist(3,5)
inst.components.playerprox:SetOnPlayerNear(function(inst) inst.components.locomotor.walkspeed = 5 end )
inst.components.playerprox:SetOnPlayerFar(function(inst) inst.components.locomotor.walkspeed = 12 end )
inst:AddTag("helpers")
end
end
inst.OnSave = onsave
inst.OnLoad = onload
即可用蜂蜜绷带种猴子,鼠标左键点猴子,可将其放入物品栏(显示为香蕉的图标)。在附近有兔子、鸟、蜜蜂、杀人蜂、蝴蝶、鼹鼠等小动物时,可将猴子放在地上,会为你捕捉小动物,如果同时修改了“网上宠宠店”,就可以将捉到的小动物卖掉换黄金。如果不想要猴子了,在物品栏中对其按鼠标右键即可。蜂蜜绷带在生存选项(画着绳套)下,用1张纸、2个蜂蜜制造
更多相关内容请关注:饥荒专区
责任编辑:Shy夏夏