跳转至

移动与传送

gObjMoveGate(aIndex, gate)

将玩家传送到预定义的移动门。

gObjMoveGate(aIndex, 27) -- 移动到门 27(如 Lorencia)

gObjTeleport(aIndex, map, x, y)

将玩家传送到地图上的精确坐标。

gObjTeleport(aIndex, 0, 130, 130) -- 传送到 Lorencia (130,130)

MoveObjectTo(lpObj, map, x, y, autoStartHelper)

将玩家移动到地图上的坐标,跨地图移动时使用门系统。可选启动助手(自动移动)系统。

MoveObjectTo(player, 0, 130, 130, false)

gObjTeleportMagicUse(aIndex, map, x, y)

使用传送魔法移动玩家(带传送动画)。

gObjTeleportMagicUse(aIndex, 0, 130, 130)

gObjGetRandomFreeLocation(map, ox, oy, tx, ty, count)

在地图上指定坐标附近查找随机空闲位置。

  • 返回值: boolean(通过引用修改 ox, oy)
local ok = gObjGetRandomFreeLocation(0, player.X, player.Y, player.X, player.Y, 10)

gObjGetTargetPos(lpObj, sx, sy)

计算从对象偏移的目标位置。

  • 返回值: boolean, tx, ty(元组)
local ok, tx, ty = gObjGetTargetPos(player, 3, 3)
if ok then
    LogAdd(LOG_BLUE, "Target pos: " .. tx .. "," .. ty)
end

gObjGetPositionTarget(lpObj)

获取对象当前的移动目标位置。

gObjGetPositionTarget(monster)

gObjSetPosition(aIndex, x, y)

直接设置对象的位置(无传送动画)。

gObjSetPosition(aIndex, 130, 130)

PathFindMoveMsgSend(lpObj, x, y)

发送寻路移动消息,使对象步行到指定位置。

PathFindMoveMsgSend(monster, 130, 140)

gObjConbertTimeGetTIckCount(secondsBlock)

将秒数转换为天、小时、分、秒。

  • 返回值: days, hours, minutes, seconds(元组)
local d, h, m, s = gObjConbertTimeGetTIckCount(90061)
LogAdd(LOG_BLUE, d .. "d " .. h .. "h " .. m .. "m " .. s .. "s")
-- 输出: "1d 1h 1m 1s"