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: