跳转至

坐骑函数


gObjGetMountIndex(lpItem)

从特定物品对象获取坐骑索引。

  • 参数:
    • lpItem (GameItem): 坐骑物品对象。
  • 返回值: integer — 坐骑索引,非坐骑物品时返回 0
local mountIdx = gObjGetMountIndex(player.Inventory[8])

GetMountIndex(lpObj)

返回玩家当前装备的坐骑索引。

  • 参数:
    • lpObj (GameObject): 玩家对象。
  • 返回值: integer — 坐骑索引,未装备坐骑时返回 0
local mount = GetMountIndex(player)
if mount > 0 then
    LogAdd(LOG_BLUE, "Riding mount index: " .. mount)
end

GetMountSlot(lpObj, index, checkValid, checkDur, checkPeriod)

返回坐骑槽位,可选验证标志。

  • 参数:
    • lpObj (GameObject): 玩家对象。
    • index (integer): 坐骑槽位索引。
    • checkValid (boolean): 验证坐骑物品是否存在。
    • checkDur (boolean): 检查耐久度 > 0。
    • checkPeriod (boolean): 检查有效期。
  • 返回值: integer — 坐骑槽位值,验证失败时返回 -1
local slot = GetMountSlot(player, 0, true, true, false)

MountDestroyMoveProc(lpObj)

玩家切换地图时移除坐骑(传送时下马)。

  • 参数:
    • lpObj (GameObject): 玩家对象。
  • 返回值: void
MountDestroyMoveProc(player)