• 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!

C++ Npc walking on tables, chairs, box

Fortera Global

Intermediate OT User
Joined
Nov 20, 2015
Messages
1,180
Solutions
2
Reaction score
117
Hello someone know edit for avoid npc walk into charis, tables, box, etc?

C++:
bool Npc::canWalkTo(const Position& fromPos, Direction dir) const
{
    if (masterRadius == 0) {
        return false;
    }

    Position toPos = getNextPosition(dir, fromPos);
    if (!Spawns::isInZone(masterPos, masterRadius, toPos)) {
        return false;
    }

    Tile* tile = g_game.map.getTile(toPos);
    if (!tile || tile->queryAdd(0, *this, 1, 0) != RETURNVALUE_NOERROR) {
        return false;
    }

    if (!floorChange && (tile->hasFlag(TILESTATE_FLOORCHANGE) || tile->getTeleportItem())) {
        return false;
    }

    if (!ignoreHeight && tile->hasHeight(1)) {
        return false;
    }

    return true;
}
 
Back
Top