代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。
原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html
1
2二三一.随笔涂鸦(用蓝魔杖为物品涂上色彩)
3
4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/staff.lua文件,在local inst = commonfn("blue")的下一行插入以下内容:
5
6local function cancreatecolour(staff, caster, target, pos)
7 return true
8end
9local function createcolour(staff, target, pos)
10 local caster = staff.components.inventoryitem.owner
11 if caster.components.sanity then
12 caster.components.sanity:DoDelta(5)
13 end
14 local colours= { {198/255,43/255,43/255}, {79/255,153/255,68/255}, {35/255,105/255,235/255}, {233/255,208/255,69/255}, {109/255,50/255,163/255}, {222/255,126/255,39/255}, }
15 inst.colour_idx = math.random(#colours)
16 target.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1)
17end
18 inst:AddComponent("spellcaster")
19 inst.components.spellcaster:SetSpellFn(createcolour)
20 inst.components.spellcaster:SetSpellTestFn(cancreatecolour)
21 inst.components.spellcaster.canuseontargets = true
22 inst.components.spellcaster.canusefrominventory = false
23
24 即可用蓝魔杖右键点任何物品,为其涂上随机色彩,存档退出后消失。每涂鸦一次补脑5点。将你涂好的缤纷世界截下图片,给朋友秀秀吧