代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。
原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html
二三一.随笔涂鸦(用蓝魔杖为物品涂上色彩)
用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/staff.lua文件,在local inst = commonfn("blue")的下一行插入以下内容:
local function cancreatecolour(staff, caster, target, pos)
return true
end
local function createcolour(staff, target, pos)
local caster = staff.components.inventoryitem.owner
if caster.components.sanity then
caster.components.sanity:DoDelta(5)
end
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}, }
inst.colour_idx = math.random(#colours)
target.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1)
end
inst:AddComponent("spellcaster")
inst.components.spellcaster:SetSpellFn(createcolour)
inst.components.spellcaster:SetSpellTestFn(cancreatecolour)
inst.components.spellcaster.canuseontargets = true
inst.components.spellcaster.canusefrominventory = false
即可用蓝魔杖右键点任何物品,为其涂上随机色彩,存档退出后消失。每涂鸦一次补脑5点。将你涂好的缤纷世界截下图片,给朋友秀秀吧