回答

收藏

升级给道具功能

Lua脚本区 Lua脚本区 164 人阅读 | 0 人回复 | 2024-08-02

基于财团框架可以直接使用

[Lua] 纯文本查看 复制代码
Global_Reg.RegLevelUpEvent("LevelUpEvent")
local 升级奖励={
10,20,30,40,50,60,70,80,90,100
}
local 升级道具={
73138,73139,73140,73141,73142,73143,73144,73144,73145,73146,73147
}
local 升级道具名称={
"10级礼包","20级礼包","30级礼包","40级礼包","50级礼包","60级礼包","70级礼包","80级礼包","90级礼包","100级礼包"
}
function LevelUpEvent(_PlayerIndex)
        if Char.GetData(_PlayerIndex, %对象_类型%)==1 then
                NLG.SystemMessage(_PlayerIndex, "恭喜玩家"..Char.GetData(_PlayerIndex, 2000).."升级了!")
                local LevelItem=Num(Field.Get(_PlayerIndex, "LevelUpItem"))
                local re = 0
                for i = 1,#升级奖励 do
                        if 升级奖励[i] <= Char.GetData(_PlayerIndex,%对象_等级%) and LevelItem < 升级奖励[i] then
                                re = i
                        end
                end
                if re > 0 then 
                        if Char.FindEmptyItemBox(_PlayerIndex) == 0 then
                                NLG.SystemMessage(_PlayerIndex, "由于你的道具栏满了,无法获得礼包 "..升级道具名称[re].."! 下一级升级时候会补给")
                        else
                                NLG.GiveItem(_PlayerIndex,升级道具[re])
                                Field.Set(_PlayerIndex, "LevelUpItem",Char.GetData(_PlayerIndex,%对象_等级%))
                                NLG.SystemMessage(-1, "恭喜玩家"..Char.GetData(_PlayerIndex, 2000).."获得"..升级道具名称[re].."一个!")
                        end
                end
        end
end

分享到:
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

61 积分
8 主题