Terotrificy
Veteran OT User
Hi, i'm using Otclient 7.72 (edubart) and i have this problem:
When i autowalk or use keyboard to move into 2 or more parcels or walkeable stacked items, i have a loop trying to prewalking to the item and receiving the message "Sorry, not possible" again and again, instead of just stay in my position and get the message "Sorry, not possible".
I just checked game.cpp and tried a couple of things (adding checks to elevations items before prewalk), without success. I also looked into Kondra's client walkeable.lua, but couldn't think of a way to make it work like this.
Here is the game.cpp that contains the lines i think should be edited to make it work like the tibia client:
I tried editing this line:
into this:
Although you don't prewalk into it, you can't walk into stacked parcels that have more than 1 parcel, so i can't figure out a way to fix it.
Help please
When i autowalk or use keyboard to move into 2 or more parcels or walkeable stacked items, i have a loop trying to prewalking to the item and receiving the message "Sorry, not possible" again and again, instead of just stay in my position and get the message "Sorry, not possible".
I just checked game.cpp and tried a couple of things (adding checks to elevations items before prewalk), without success. I also looked into Kondra's client walkeable.lua, but couldn't think of a way to make it work like this.
Here is the game.cpp that contains the lines i think should be edited to make it work like the tibia client:
Lua:
bool Game::walk(Otc::Direction direction, bool dash)
{
if(!canPerformGameAction())
return false;
// must cancel follow before any new walk
if(isFollowing())
cancelFollow();
// must cancel auto walking, and wait next try
if(m_localPlayer->isAutoWalking() || m_localPlayer->isServerWalking()) {
m_protocolGame->sendStop();
if(m_localPlayer->isAutoWalking())
m_localPlayer->stopAutoWalk();
return false;
}
if(dash) {
if(m_localPlayer->isWalking() && m_dashTimer.ticksElapsed() < std::max<int>(m_localPlayer->getStepDuration(false, direction) - m_ping, 30))
return false;
}
else {
// check we can walk and add new walk event if false
if(!m_localPlayer->canWalk(direction)) {
if(m_lastWalkDir != direction) {
// must add a new walk event
float ticks = m_localPlayer->getStepTicksLeft();
if(ticks <= 0) { ticks = 1; }
if(m_walkEvent) {
m_walkEvent->cancel();
m_walkEvent = nullptr;
}
m_walkEvent = g_dispatcher.scheduleEvent([=] { walk(direction, false); }, ticks);
}
return false;
}
}
Position toPos = m_localPlayer->getPosition().translatedToDirection(direction);
TilePtr toTile = g_map.getTile(toPos);
// only do prewalks to walkable tiles (like grounds and not walls)
if(toTile && toTile->isWalkable()) {
m_localPlayer->preWalk(direction);
// check walk to another floor (e.g: when above 3 parcels)
} else {
// check if can walk to a lower floor
auto canChangeFloorDown = [&]() -> bool {
Position pos = toPos;
if(!pos.down())
return false;
TilePtr toTile = g_map.getTile(pos);
if(toTile && toTile->hasElevation(3))
return true;
return false;
};
// check if can walk to a higher floor
auto canChangeFloorUp = [&]() -> bool {
TilePtr fromTile = m_localPlayer->getTile();
if(!fromTile || !fromTile->hasElevation(3))
return false;
Position pos = toPos;
if(!pos.up())
return false;
TilePtr toTile = g_map.getTile(pos);
if(!toTile || !toTile->isWalkable())
return false;
return true;
};
if(canChangeFloorDown() || canChangeFloorUp() ||
(!toTile || toTile->isEmpty())) {
m_localPlayer->lockWalk();
} else
return false;
}
m_localPlayer->stopAutoWalk();
g_lua.callGlobalField("g_game", "onWalk", direction, dash);
forceWalk(direction);
if(dash)
m_dashTimer.restart();
m_lastWalkDir = direction;
return true;
}
I tried editing this line:
Code:
if(toTile && toTile->isWalkable()) {
into this:
Code:
if(toTile && toTile->isWalkable() && !(toTile->hasElevation(2))) {
Although you don't prewalk into it, you can't walk into stacked parcels that have more than 1 parcel, so i can't figure out a way to fix it.
Help please
Last edited: