代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。
原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html
九十八.养殖火鸡(用鸡蛋种会下蛋且不用圈养的火鸡) 1.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/egg.lua文件,在inst.components.cookable.product = "bird_egg_cooked"的下一行插入以下内容: local function OnDeploy (inst, pt) SpawnPrefab("perd").Transform:SetPosition(pt.x, pt.y, pt.z) inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy 2.用MT管理器打开游戏目录/assets/scripts/prefabs/perd.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: inst:AddComponent("periodicspawner") inst.components.periodicspawner:SetPrefab("bird_egg") inst.components.periodicspawner:SetRandomTimes(360, 480) inst.components.periodicspawner:Start() 3.用MT管理器打开游戏目录/assets/scripts/brains/perdbrain.lua文件,将下列内容: WhileNode(function() return clock and not clock:IsDay() end, "IsNight", DoAction(self.inst, GoHomeAction, "Go Home", true )), DoAction(self.inst, EatFoodAction, "Eat Food"), RunAway(self.inst, "scarytoprey", SEE_PLAYER_DIST, STOP_RUN_DIST), DoAction(self.inst, PickBerriesAction, "Pick Berries", true), Wander(self.inst, HomePos, MAX_WANDER_DIST), 替换为: DoAction(self.inst, EatFoodAction, "Eat Food"), RunAway(self.inst, "scarytoprey", SEE_PLAYER_DIST/2.5, STOP_RUN_DIST/3), 即可用鸡蛋种会下蛋且不用圈养的火鸡,火鸡不会乱跑,养在果树丛旁也不会消失,一天左右下一个蛋