搜索
查看: 1104|回复: 5

M2里提示LUA出错,buff求助!

[复制链接]
发表于 2021-5-13 01:18:35 | 显示全部楼层 |阅读模式

不加蓝色这行无错,加上蓝色这行就出错,求解!


function MagicBuff_E(ActName,TagName,play)
        if(TagName:getRace()~=0 and TagName:getRace()~=66) then

        for i in pairs(Buff_5) do
                if Buff_5.name == ActName:getFasguinWeapon() then
                        if s.share.getRandom(1,Buff_5.buff) == 1 then
                        local omaxhp = TagName:getMaxHp()
                        local ohp = TagName:getHp()
                        local ohpf = math.round(ohp / omaxhp * 100)
                        --print("怪物剩余百分百血量:"..ohpf.." 他的血量"..omaxhp.."-"..ohp)
                                if ohpf < 9 then
                                        TagName:setHp(0)
                                        play:sendCenterMsg(0,254,play:getCharName().."佩戴["..ActName:getFasguinWeapon().."]斩首buff生效,直接斩杀目标!",1, 3, 3)
                                end
                        end
                end
        end

end



补充内容 (2021-5-13 01:29):
字体斜了看不清,看二楼!
 楼主| 发表于 2021-5-13 01:28:56 | 显示全部楼层
function MagicBuff_E(ActName,TagName,play)
        if(TagName:getRace()~=0 and TagName:getRace()~=66) then

        for i in pairs(Buff_5) do
                if Buff_5.name == ActName:getFasguinWeapon() then
                        if s.share.getRandom(1,Buff_5.buff) == 1 then
                        local omaxhp = TagName:getMaxHp()
                        local ohp = TagName:getHp()
                        local ohpf = math.round(ohp / omaxhp * 100)
                        --print("怪物剩余百分百血量:"..ohpf.." 他的血量"..omaxhp.."-"..ohp)
                                if ohpf < 9 then
                                        TagName:setHp(0)
                                        play:sendCenterMsg(0,254,play:getCharName().."佩戴["..ActName:getFasguinWeapon().."]斩首buff生效,直接斩杀目标!",1, 3, 3)
                                end
                        end
                end
        end

end
发表于 2021-5-13 11:14:47 | 显示全部楼层
是不是要先定义
发表于 2021-5-13 13:31:53 | 显示全部楼层
蓝色那行加上后面添加end了吗
 楼主| 发表于 2021-5-13 14:53:34 | 显示全部楼层
乌木剑 发表于 2021-5-13 13:31
蓝色那行加上后面添加end了吗

最后加上以后就好了,谢谢
发表于 2021-5-23 19:05:16 | 显示全部楼层
都是大佬  完全看不懂
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|HGEM2论坛

GMT+8, 2024-9-21 15:41 , Processed in 0.538473 second(s), 14 queries .

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表