Marcelo Druida
Intermediate OT User
Hello!
im asking for help to adjust this for TFS 1.x
https://otland.net/threads/movecreatureto-cid-pos-mindist-maxdist.95009/
i need to make a creature go for a walk
why this doesnt work
thanks!
im asking for help to adjust this for TFS 1.x
https://otland.net/threads/movecreatureto-cid-pos-mindist-maxdist.95009/
i need to make a creature go for a walk
why this doesnt work
Code:
int32_t LuaScriptInterface::luaMoveCreatureTo(lua_State* L)
{
//creature:moveCreatureTo(pos)
Creature* creature = getUserdata<Creature>(L, 1);
if (!creature) {
lua_pushnil(L);
return 1;
}
const Position& position = getPosition(L, 2);
FindPathParams fpp;
fpp.minTargetDist = getNumber<int32_t>(L, 3, 0);
fpp.maxTargetDist = getNumber<int32_t>(L, 4, 1);
fpp.fullPathSearch = getBoolean(L, 5, fpp.fullPathSearch);
fpp.clearSight = getBoolean(L, 6, fpp.clearSight);
fpp.maxSearchDist = getNumber<int32_t>(L, 7, fpp.maxSearchDist);
std::forward_list<Direction> dirList;
if (creature->getPathTo(position, dirList, fpp)) {
creature->startAutoWalk(dirList);
pushBoolean(L, true);
}
else { pushBoolean(L, false); }
return 1;
}
thanks!
Last edited: