代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。
原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html
一00.养殖高鸟(种高鸟蛋得不攻击、下高鸟蛋的大高鸟)
1.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/tallbirdegg.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
local function OnDeploy (inst, pt)
SpawnPrefab("tallbird").Transform:SetPosition(pt.x, pt.y, pt.z)
inst.components.stackable:Get():Remove()
end
inst:AddComponent("deployable")
inst.components.deployable.ondeploy = OnDeploy
inst:AddComponent("stackable")
inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM
2.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/tallbird.lua文件,将inst.components.combat:SetRange(TUNING.TALLBIRD_ATTACK_RANGE)替换为inst.components.combat:SetRange(TUNING.TALLBIRD_ATTACK_RANGE*0)
3.在inst:AddComponent("inspectable")的下一行插入以下内容:
inst:AddComponent("periodicspawner")
inst.components.periodicspawner:SetPrefab("tallbirdegg")
inst.components.periodicspawner:SetRandomTimes(80, 110)
inst.components.periodicspawner:SetDensityInRange(20, 2)
inst.components.periodicspawner:SetMinimumSpacing(8)
inst.components.periodicspawner:Start()
即可种高鸟蛋得大高鸟,高鸟无攻击行为、下高鸟蛋,高鸟蛋可堆叠