代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。
原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html
一六五.死神之光(拿提灯时右键点空地,满屏敌人通杀)
用MT管理器打开游戏目录/assets/scripts/prefabs/mininglantern.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
local function cancreatelight(staff, caster, target, pos)
local fuelpercent = inst.components.fueled:GetPercent()
if fuelpercent > 0.5 then
return true
else
return false
end
end
local function createlight(staff, target, pos)
local SHAKE_DIST = 40
local player = GetClosestInstWithTag("player", inst, SHAKE_DIST)
if player then
player.components.playercontroller:ShakeCamera(inst, "VERTICAL", 1, 0.03, 2, SHAKE_DIST)
end
inst:DoTaskInTime(0, function()
inst.components.combat:DoAreaAttack(inst, 30)
end)
GetClock():DoLightningLighting()
inst.components.fueled.currentfuel = 50
end
inst:AddComponent("spellcaster")
inst.components.spellcaster:SetSpellFn(createlight)
inst.components.spellcaster:SetSpellTestFn(cancreatelight)
inst.components.spellcaster.canuseonpoint = true
inst.components.spellcaster.canusefrominventory = false
inst:AddComponent("combat")
inst.components.combat:SetDefaultDamage(3000)
inst.components.combat.playerdamagepercent = 0
即可拿提灯时右键点空地,满屏敌人通杀。注意提灯燃料超过50%时,才能释放死神之光,释放后提灯燃料接近耗尽,想再释放需要向提灯中填充荧光果(拿荧光果对装备格中的提灯按右键),大约3颗即可