代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。
原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html
一八0.芦苇吹出催眠曲(在携带的芦苇上按鼠标右键,可催眠怪物)
用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/cutreeds.lua文件,在inst:AddComponent("inventoryitem")的下一行插入以下内容:
inst:AddTag("flute")
local function HearPanFlute(inst, musician, instrument)
if inst.components.sleeper then
inst.components.sleeper:AddSleepiness(10, TUNING.PANFLUTE_SLEEPTIME*1)
end
end
inst:AddComponent("tool")
inst.components.tool:SetAction(ACTIONS.PLAY)
inst:AddComponent("instrument")
inst.components.instrument.range = TUNING.PANFLUTE_SLEEPRANGE*2
inst.components.instrument:SetOnHeardFn(HearPanFlute)
即可在携带的芦苇上按鼠标右键,可催眠一片怪物。其中*1为催眠时间20秒,想催眠60秒就*3即可。其中*2为催眠范围30格,想扩大至60格就*4即可