代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。

原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html


 1
 2一八三.迷魂花阵(戴花环周围出现食人花眼睛保护主角)
 3
 4	1.MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/hats.lua文件,将下列内容:
 5
 6		inst:AddComponent("perishable")
 7		inst.components.perishable:SetPerishTime(TUNING.PERISH_FAST)
 8		inst.components.perishable:StartPerishing()
 9		inst.components.perishable:SetOnPerishFn(generic_perish)
10		inst.components.equippable:SetOnEquip( opentop_onequip )
11
12	替换为:
13
14local function flower_equip(inst, owner)
15	opentop_onequip(inst, owner)
16	inst:AddComponent("minionspawner")
17	inst.components.minionspawner.miniontype = "eyeplant"
18	inst.components.minionspawner.maxminions = 27
19	inst.components.minionspawner.minionspawntime = {min = 0.01, max = 0.01}
20	inst.components.minionspawner.numminions = 10
21	inst.components.minionspawner.shouldspawn = true
22	inst.components.minionspawner:StartNextSpawn()
23end
24local function flower_unequip(inst, owner)
25	onunequip(inst, owner)
26	inst.components.minionspawner.shouldspawn = false
27	inst.components.minionspawner:KillAllMinions()
28	inst:RemoveComponent("minionspawner")
29end
30	inst.components.equippable:SetOnEquip( flower_equip )
31	inst.components.equippable:SetOnUnequip( flower_unequip )
32
33
34	2.MT管理器打开游戏目录/assets/scripts/prefabs/eyeplant.lua文件,将下列内容:
35
36			return (guy:HasTag("character") or guy:HasTag("monster") or guy:HasTag("animal") or guy:HasTag("prey") or guy:HasTag("eyeplant") or guy:HasTag("lureplant")) and not checkmaster(guy, inst)
37
38	替换为:
39
40			return (guy:HasTag("character") or guy:HasTag("monster") or guy:HasTag("animal") or guy:HasTag("prey") or guy:HasTag("eyeplant") or guy:HasTag("lureplant")) and not guy:HasTag("player") and not checkmaster(guy, inst)
41
42	即可戴花环周围出现食人花眼睛保护主角,食人花眼睛被敌人打死一个又会再生一个。摘下花环,食人花眼睛立即消失