• 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 move creature to

Marcelo Druida

Intermediate OT User
Joined
Nov 17, 2014
Messages
429
Solutions
1
Reaction score
134
Location
Brazil
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
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:
sorry, you dont get it

i need that the creature move to the pos like a player moves when click in the minimap
actually this function is working fine for Players and NPCs, but fails at monsters, what i need

I would like you compile the function to understand, can be useful for you
 
Back
Top