游戏达人
  
- 贡献度
- 80
- 金元
- 19037
- 积分
- 2234
- 精华
- 1
- 注册时间
- 2010-11-27
|
RPhaodaobao 发表于 2013-11-23 09:38 
还有求牛帽只让牛跟随其他功能不要
带牛毛帽让牛群跟随
用记事本打开游戏目录\data\scripts\prefabs\hats.lua文件,将下列内容:
local function beefalo_equip(inst, owner)
onequip(inst, owner)
owner:AddTag("beefalo")
end
local function beefalo_unequip(inst, owner)
onunequip(inst, owner)
owner:RemoveTag("beefalo")
end
local function beefalo()
local inst = simple()
inst.components.equippable:SetOnEquip( beefalo_equip )
inst.components.equippable:SetOnUnequip( beefalo_unequip )
inst:AddComponent("insulator")
inst.components.insulator.insulation = TUNING.INSULATION_LARGE
inst:AddComponent("fueled")
inst.components.fueled.fueltype = "USAGE"
inst.components.fueled:InitializeFuelLevel(TUNING.BEEFALOHAT_PERISHTIME)
inst.components.fueled:SetDepletedFn(generic_perish)
return inst
end
替换为以下内容:
local function beefalo_disable(inst)
if inst.updatetask then
inst.updatetask:Cancel()
inst.updatetask = nil
end
local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner
owner.components.leader:RemoveFollowersByTag("beefalo")
end
local function beefalo_update(inst)
local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner
if owner and owner.components.leader then
local x,y,z = owner.Transform:GetWorldPosition()
local ents = TheSim:FindEntities(x,y,z, TUNING.SPIDERHAT_RANGE, {"beefalo"})
for k,v in pairs(ents) do
if v.components.follower and not v.components.follower.leader and not owner.components.leader:IsFollower(v) and owner.components.leader.numfollowers < 50 then
owner.components.leader:AddFollower(v)
end
end
end
end
local function beefalo_enable(inst)
local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner
if owner and owner.components.leader then
end
inst.updatetask = inst:DoPeriodicTask(0.5, beefalo_update, 1)
end
local function beefalo_equip(inst, owner)
onequip(inst, owner)
beefalo_enable(inst)
owner:AddTag("beefalo")
end
local function beefalo_unequip(inst, owner)
onunequip(inst, owner)
beefalo_disable(inst)
owner:RemoveTag("beefalo")
end
local function beefalo_perish(inst)
beefalo_disable(inst)
inst:Remove()
end
local function beefalo()
local inst = simple()
inst.components.equippable:SetOnEquip( beefalo_equip )
inst.components.equippable:SetOnUnequip( beefalo_unequip )
inst.components.inventoryitem:SetOnDroppedFn( beefalo_disable )
inst:AddComponent("insulator")
inst.components.insulator.insulation = TUNING.INSULATION_LARGE
inst:AddComponent("fueled")
inst.components.fueled.fueltype = "USAGE"
inst.components.fueled:InitializeFuelLevel(TUNING.BEEFALOHAT_PERISHTIME)
inst.components.fueled:SetDepletedFn(beefalo_perish)
return inst
end
|
|