YN100-养殖高鸟(种高鸟蛋得不攻击、下高鸟蛋的大高鸟)
代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2一00.养殖高鸟(种高鸟蛋得不攻击、下高鸟蛋的大高鸟) 3 4 1.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/tallbirdegg.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function OnDeploy (inst, pt) 7 SpawnPrefab("tallbird").Transform:SetPosition(pt.x, pt.y, pt.z) 8 inst.components.stackable:Get():Remove() 9end 10 inst:AddComponent("deployable") 11 inst.components.deployable.ondeploy = OnDeploy 12 inst:AddComponent("stackable") 13 inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM 14 15 16 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) 17 18 19 3.在inst:AddComponent("inspectable")的下一行插入以下内容: 20 21 inst:AddComponent("periodicspawner") 22 inst.components.periodicspawner:SetPrefab("tallbirdegg") 23 inst.components.periodicspawner:SetRandomTimes(80, 110) 24 inst.components.periodicspawner:SetDensityInRange(20, 2) 25 inst.components.periodicspawner:SetMinimumSpacing(8) 26 inst.components.periodicspawner:Start() 27 28 即可种高鸟蛋得大高鸟,高鸟无攻击行为、下高鸟蛋,高鸟蛋可堆叠