魔力宝贝

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz

[附录] Event Flg 扩充

[复制链接]
发表于 前天 20:21 | 显示全部楼层 |阅读模式

Event Flg 扩充
通过Lua引擎,我们可以扩充现有的EventFlg数量,突破GMSV限制的255个。

这种方式的优势在于,我们可以不用修改原有的数据库模型,方便老的服务器无缝扩充。

定义方式
在lua脚本的init.lua或其他脚本中加入几个lua函数,函数的参数下面会介绍

EventExpandCheckFlgCall 参数定义
获取旗标的结果 EventExpandCheckFlgCall(player, type, flg)

player: [数值型] 玩家的对象实例的索引
type: [数值型] 类型,NowEvent:0;EndEvent:1
flg: [数值型] 旗标数,一般为大于255的值,最大65535
返回值 0 或者 1,0表示未包含当前状态,1表示包含

EventExpandSetFlgCall 参数定义
设置旗标的结果 EventExpandSetFlgCall(player, type, flg)

player: [数值型] 玩家的对象实例的索引
type: [数值型] 类型,NowEvent:0;EndEvent:1
flg: [数值型] 旗标数,一般为大于255的值,最大65535
将指定玩家的指定旗标设置为包含(1)状态

EventExpandClsFlgCall 参数定义
取消旗标的结果 EventExpandClsFlgCall(player, type, flg)

player: [数值型] 玩家的对象实例的索引
type: [数值型] 类型,NowEvent:0;EndEvent:1
flg: [数值型] 旗标数,一般为大于255的值,最大65535
将指定玩家的指定旗标设置为不包含(0)状态

其他说明
扩充的旗标可以在gmsv自带脚本、称号判定等情况中正常使用。

例子
function EventExpandCheckFlgCall(player, type, flg)
    NLG.SystemMessage(player, "获取角色的"..type.."类"..flg.."号旗标状态")
    return 1
end

function EventExpandSetFlgCall(player, type, flg)
    NLG.SystemMessage(player, "设置角色的"..type.."类"..flg.."号旗标状态为1")
    return 1
end

function EventExpandClsFlgCall(player, type, flg)
    NLG.SystemMessage(player, "设置角色的"..type.."类"..flg.."号旗标状态为0")
    return 1
end
回复

使用道具 举报

Archiver|魔力研究社

GMT+8, 2025-5-12 19:40 , Processed in 0.089416 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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