• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua IsPathBlocked(fromPos, toPos)

Tufte

Active Member
Joined
Nov 19, 2007
Messages
652
Reaction score
25
Location
Norway
I need a function that checks whether a player can walk to a location or not. Can this be done in lua or does it require source editing? I was looking at the autowalk sourcecode, and tried to make a lua function using the existing code but I failed. Here is what I tried:
Code:
int32_t LuaScriptInterface::luaCanMoveTo(lua_State* L)
{
    uint32_t cid = popNumber(L);
    LuaVariant var = popVariant(L);
    Player* player = g_game.getPlayerByID(cid);


    std::list<Direction> listDir;

    if (g_game.getPathTo(player, var.pos, listDir, 7)) {
        return 1;
    }
    return 0;
}
 
Last edited:
Back
Top