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