logoHourGlass
Recipe 擴充

Recipe 擴充

通過Lua引擎,我們可以擴充現有的Recipe數量,突破GMSV限制的255個。

這種方式的優勢在於,我們可以不用修改原有的數據庫模型,方便老的服務器無縫擴充。

GMSV會在運行中自動調用指定作用的Lua函數,做到Recipe擴展的支持。

定義方式

在lua腳本的init.lua或其他腳本中加入幾個lua函數,函數的參數下面會介紹

RecipeExpandCheckFlgCall 參數定義

獲取旗標的結果 RecipeExpandCheckFlgCall(player, flg)

  • player:[數值型] 玩家的對象實例的索引
  • flg:[數值型] 旗標數,一般爲大於255的值,最大65535

返回值 0 或者 1,0表示未包含當前狀態,1表示包含

RecipeExpandSetFlgCall 參數定義

設置旗標的結果 RecipeExpandSetFlgCall(player, flg)

  • player:[數值型] 玩家的對象實例的索引
  • flg:[數值型] 旗標數,一般爲大於255的值,最大65535

將指定玩家的指定旗標設置爲包含(1)狀態

RecipeExpandClsFlgCall 參數定義

取消旗標的結果 RecipeExpandClsFlgCall(player, flg)

  • player:[數值型] 玩家的對象實例的索引
  • flg:[數值型] 旗標數,一般爲大於255的值,最大65535

將指定玩家的指定旗標設置爲不包含(0)狀態

其他說明

擴充的旗標可以在gmsv自帶腳本、稱號判定等情況中正常使用。

例子

function RecipeExpandCheckFlgCall(player, flg)
    NLG.SystemMessage(player, "獲取角色是否習得"..flg.."號Recipe狀態")
    return 1
end

function RecipeExpandSetFlgCall(player, flg)
    NLG.SystemMessage(player, "設置角色習得"..flg.."號Recipe")
    return 1
end

function RecipeExpandClsFlgCall(player, flg)
    NLG.SystemMessage(player, "設置角色忘記"..flg.."號Recipe")
    return 1
end