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

Solved Player walks over field

czouski

Banned User
Joined
Nov 2, 2024
Messages
166
Solutions
1
Reaction score
64
When rightclicking a corpse player walks over Fields or any other thing on the map.
is there any simple way to fix it?
for example walking with left click takes correct path and avoids things.
can anyone atleast point me in the right function as this stuff just seems scattered half of the time meaninglessly
fix:

C++:
//path finding fix for walking over fields.
    if (hasBitSet(FLAG_PATHFINDING, flags) && hasFlag(TILESTATE_BLOCKPATH)) {
        return RETURNVALUE_THEREISNOWAY;
    }
before fix:
after fix:


extra before clip:
extra after clip:
 
Last edited:
fixed tfs 1.4.2

C++:
const CreatureVector* creatures = getCreatures();
if (const Player* player = creature->getPlayer()) {
    if (creatures && !creatures->empty() && !hasBitSet(FLAG_IGNOREBLOCKCREATURE, flags) && !player->isAccessPlayer()) {
        for (const Creature* tileCreature : *creatures) {
            if (getGround() && (getGround()->getID() == 11063)) {
                return RETURNVALUE_NOTENOUGHROOM; // Prevent another player from standing on this tile
            }
            if (!player->canWalkthrough(tileCreature)) {
                return RETURNVALUE_NOTPOSSIBLE;
            }
        }
    }

    if (player->getParent() == nullptr && hasFlag(TILESTATE_NOLOGOUT)) {
        //player is trying to login to a "no logout" tile
        return RETURNVALUE_NOTPOSSIBLE;
    }
    //path finding fix for walking over fields.
    if (hasBitSet(FLAG_PATHFINDING, flags) && hasFlag(TILESTATE_BLOCKPATH)) {
        return RETURNVALUE_THEREISNOWAY;
    }
 
Last edited:
patch **
C++:
//path finding fix for walking over fields.

if (hasBitSet(FLAG_PATHFINDING, flags) && hasFlag(TILESTATE_MAGICFIELD)) {

    return RETURNVALUE_THEREISNOWAY;

}

because parcels etc was blocking.
 
Explain the solution more because it does not work
C++:
const CreatureVector* creatures = getCreatures();
        if (const Player* player = creature->getPlayer()) {
            if (creatures && !creatures->empty() && !hasBitSet(FLAG_IGNOREBLOCKCREATURE, flags) && !player->isAccessPlayer()) {
                for (const Creature* tileCreature : *creatures) {
                    if (!player->canWalkthrough(tileCreature)) {
                        return RETURNVALUE_NOTPOSSIBLE;
                    }
                }
            }

            if (player->getParent() == nullptr && hasFlag(TILESTATE_NOLOGOUT)) {
                //player is trying to login to a "no logout" tile
                return RETURNVALUE_NOTPOSSIBLE;
            }
            //path finding fix for walking over fields.

            if (hasBitSet(FLAG_PATHFINDING, flags) && hasFlag(TILESTATE_MAGICFIELD)) {

                return RETURNVALUE_THEREISNOWAY;

            }
I added it and nothing happened
Tfs 1.5
 
Explain the solution more because it does not work
C++:
const CreatureVector* creatures = getCreatures();
        if (const Player* player = creature->getPlayer()) {
            if (creatures && !creatures->empty() && !hasBitSet(FLAG_IGNOREBLOCKCREATURE, flags) && !player->isAccessPlayer()) {
                for (const Creature* tileCreature : *creatures) {
                    if (!player->canWalkthrough(tileCreature)) {
                        return RETURNVALUE_NOTPOSSIBLE;
                    }
                }
            }

            if (player->getParent() == nullptr && hasFlag(TILESTATE_NOLOGOUT)) {
                //player is trying to login to a "no logout" tile
                return RETURNVALUE_NOTPOSSIBLE;
            }
            //path finding fix for walking over fields.

            if (hasBitSet(FLAG_PATHFINDING, flags) && hasFlag(TILESTATE_MAGICFIELD)) {

                return RETURNVALUE_THEREISNOWAY;

            }
I added it and nothing happened
Tfs 1.5
so if you use item from a far it calls query add and in query add if ur using pathfinding functions and the tile has magicfield it should return thereisnoway text instead of proceeding with walk unless there is way to get around the fields.
 
Last edited:
Haha, what nonsense, why do you publish failed code and say that you fixed it?
it works for me. and for 1.4.2 why do you try to put it into 1.5 and claim its not working?
Computer Working GIF
 
Explain the solution more because it does not work
C++:
const CreatureVector* creatures = getCreatures();
        if (const Player* player = creature->getPlayer()) {
            if (creatures && !creatures->empty() && !hasBitSet(FLAG_IGNOREBLOCKCREATURE, flags) && !player->isAccessPlayer()) {
                for (const Creature* tileCreature : *creatures) {
                    if (!player->canWalkthrough(tileCreature)) {
                        return RETURNVALUE_NOTPOSSIBLE;
                    }
                }
            }

            if (player->getParent() == nullptr && hasFlag(TILESTATE_NOLOGOUT)) {
                //player is trying to login to a "no logout" tile
                return RETURNVALUE_NOTPOSSIBLE;
            }
            //path finding fix for walking over fields.

            if (hasBitSet(FLAG_PATHFINDING, flags) && hasFlag(TILESTATE_MAGICFIELD)) {

                return RETURNVALUE_THEREISNOWAY;

            }
I added it and nothing happened
Tfs 1.5
I use TFS 1.5 (tibia 8.0), too and it works. Just only add:

Code:
//path finding fix for walking over fields.
    if (hasBitSet(FLAG_PATHFINDING, flags) && hasFlag(TILESTATE_BLOCKPATH)) {
        return RETURNVALUE_THEREISNOWAY;
    }
nothing more...
 
I use TFS 1.5 (tibia 8.0), too and it works. Just only add:

Code:
//path finding fix for walking over fields.
    if (hasBitSet(FLAG_PATHFINDING, flags) && hasFlag(TILESTATE_BLOCKPATH)) {
        return RETURNVALUE_THEREISNOWAY;
    }
nothing more...
but then player wont walk on top of crates boxes etc use TILESTATE_MAGICFIELD for proper anti field pathfinding** it was due to people receiving dmg from walking on them by accident
 
but then player wont walk on top of crates boxes etc use TILESTATE_MAGICFIELD for proper anti field pathfinding** it was due to people receiving dmg from walking on them by accident
For me, this is sufficient. In Tibia version 7.4, when a parcel stood on the road, the message 'There is no way' also appeared. However, what I noticed is that in TFS, when we set follow directly on a creature, our character will run through a magic field, but when we set attack on a creature and the follow function, our character will not go through the magic field. No message is displayed either (it should again display 'There is no way').

Edit: Sorry, my mistake.
"when we set follow directly on a creature, our character will run through a magic field", that was a campfire, not magic field. Our character doesn't run through magic field, but the message still doesn't appear.
 
Last edited:
Explain the solution more because it does not work
C++:
const CreatureVector* creatures = getCreatures();
        if (const Player* player = creature->getPlayer()) {
            if (creatures && !creatures->empty() && !hasBitSet(FLAG_IGNOREBLOCKCREATURE, flags) && !player->isAccessPlayer()) {
                for (const Creature* tileCreature : *creatures) {
                    if (!player->canWalkthrough(tileCreature)) {
                        return RETURNVALUE_NOTPOSSIBLE;
                    }
                }
            }

            if (player->getParent() == nullptr && hasFlag(TILESTATE_NOLOGOUT)) {
                //player is trying to login to a "no logout" tile
                return RETURNVALUE_NOTPOSSIBLE;
            }
            //path finding fix for walking over fields.

            if (hasBitSet(FLAG_PATHFINDING, flags) && hasFlag(TILESTATE_MAGICFIELD)) {

                return RETURNVALUE_THEREISNOWAY;

            }
I added it and nothing happened
Tfs 1.5
C++:
if (hasBitSet(FLAG_PATHFINDING, flags) && hasFlag(TILESTATE_MAGICFIELD)) {
                return RETURNVALUE_NOERROR;
            }
 
Back
Top