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

TFS 1.X+ Bad reaction/dodge from monsters

Drucken

Member
Joined
Mar 7, 2023
Messages
45
Solutions
1
Reaction score
15
Monsters in TFS 1.5 have a very different reaction(dodge, in TFS 0.4 the monster could dodge the players, which is quite necessary, in TFS 1.5 (it may happen the same in some other TFS) this doesn't happen... Besides other bugs which were seen by @Levi999x

Well, I have added the changes of @Gesior.pl in the post of:

It has improved the reaction when the monster escapes, but the problem of dodge is still there, the monster gets stuck in the corners.

giphy.gif

 
Last edited:
Solution
Monsters in TFS 1.5 have a very different reaction(dodge, in TFS 0.4 the monster could dodge the players, which is quite necessary, in TFS 1.5 (it may happen the same in some other TFS) this doesn't happen... Besides other bugs which were seen by @Levi999x

Well, I have added the changes of @Gesior.pl in the post of:

It has improved the reaction when the monster escapes, but the problem of dodge is still there, the monster gets stuck in the corners.

giphy.gif

I'm pretty sure that there are some extra IFs in new TFS to...
mine looks like this is this okey?
Lua:
void Creature::goToFollowCreature()
{
    if (followCreature)
    {
        FindPathParams fpp;
        getPathSearchParams(followCreature, fpp);

        Monster* monster = getMonster();
        if (monster && !monster->getMaster() && (monster->isFleeing() || fpp.maxTargetDist > 1)) {
            Direction dir = DIRECTION_NONE;

            if (monster->isFleeing()) {
                const Position& targetPosition = followCreature->getPosition();
                const Position& thisPosition = getPosition();

                const int_fast32_t distanceToTarget = Position::getDistanceX(thisPosition, targetPosition) + Position::getDistanceY(thisPosition, targetPosition);
                if (distanceToTarget <= 2 && !hasFollowPath) {
                    listWalkDir.clear();
                    if (getPathTo(followCreature->getPosition(), listWalkDir, fpp)) {
                        hasFollowPath = true;
                        startAutoWalk();
                    }
                }
              
                    if (getPathTo(followCreature->getPosition(), listWalkDir, fpp)) {
                        hasFollowPath = true;
                        startAutoWalk();
                    }
                    else {
                        hasFollowPath = false;
                    }
                    return;
                }
            }

            if (dir != DIRECTION_NONE) {
                listWalkDir.clear();
                listWalkDir.push_back(dir);

                hasFollowPath = true;
                startAutoWalk();
            }
        }
        else {
            listWalkDir.clear();
            if (getPathTo(followCreature->getPosition(), listWalkDir, fpp)) {
                hasFollowPath = true;
                startAutoWalk();
            }
            else {
                hasFollowPath = false;
            }
        //}
    }

    onFollowCreatureComplete(followCreature);
}
 
Last edited:
Lua:
void Creature::goToFollowCreature()
{
    if (followCreature) {
        FindPathParams fpp;
        getPathSearchParams(followCreature, fpp);

        Monster* monster = getMonster();
        if (monster && !monster->getMaster() && (monster->isFleeing() || fpp.maxTargetDist > 1)) {
            Direction dir = DIRECTION_NONE;

            if (monster->isFleeing()) {
                monster->getDistanceStep(followCreature->getPosition(), dir, true);
            } else { // maxTargetDist > 1
                if (!monster->getDistanceStep(followCreature->getPosition(), dir)) {
                    // if we can't get anything then let the A* calculate
                    listWalkDir.clear();
                    if (getPathTo(followCreature->getPosition(), listWalkDir, fpp)) {
                        hasFollowPath = true;
                        startAutoWalk();
                    } else {
                        hasFollowPath = false;
                    }
                    return;
                }
            }

            if (dir != DIRECTION_NONE) {
                listWalkDir.clear();
                listWalkDir.push_back(dir);

                hasFollowPath = true;
                startAutoWalk();
            }
        } else {
            listWalkDir.clear();
            if (getPathTo(followCreature->getPosition(), listWalkDir, fpp)) {
                hasFollowPath = true;
                startAutoWalk();
            } else {
                hasFollowPath = false;
            }
        }
    }

    onFollowCreatureComplete(followCreature);
}
to this
Lua:
void Creature::goToFollowCreature()
{
    if (followCreature)
    {
        FindPathParams fpp;
        getPathSearchParams(followCreature, fpp);

        if (getPathTo(followCreature->getPosition(), listWalkDir, fpp))
        {
            hasFollowPath = true;
            startAutoWalk(listWalkDir);
        }
        else
            hasFollowPath = false;
    }

    onFollowCreatureComplete(followCreature);
}
so i must change this
Lua:
void Creature::goToFollowCreature()
{
    if (followCreature)
    {
        FindPathParams fpp;
        getPathSearchParams(followCreature, fpp);

        Monster* monster = getMonster();
        if (monster && !monster->getMaster() && (monster->isFleeing() || fpp.maxTargetDist > 1)) {
            Direction dir = DIRECTION_NONE;

            if (monster->isFleeing()) {
                const Position& targetPosition = followCreature->getPosition();
                const Position& thisPosition = getPosition();

                const int_fast32_t distanceToTarget = Position::getDistanceX(thisPosition, targetPosition) + Position::getDistanceY(thisPosition, targetPosition);
                if (distanceToTarget <= 2 && !hasFollowPath) {
                    listWalkDir.clear();
                    if (getPathTo(followCreature->getPosition(), listWalkDir, fpp)) {
                        hasFollowPath = true;
                        startAutoWalk();
                    }
                }
                else {
                    monster->getDistanceStep(followCreature->getPosition(), dir, true);
                    // hasFollowPath = false;
                }
            }
            else { // maxTargetDist > 1
                if (!monster->getDistanceStep(followCreature->getPosition(), dir)) {
                    // if we can't get anything then let the A* calculate
                    listWalkDir.clear();
                    if (getPathTo(followCreature->getPosition(), listWalkDir, fpp)) {
                        hasFollowPath = true;
                        startAutoWalk();
                    }
                    else {
                        hasFollowPath = false;
                    }
                    return;
                }
            }

            if (dir != DIRECTION_NONE) {
                listWalkDir.clear();
                listWalkDir.push_back(dir);

                hasFollowPath = true;
                startAutoWalk();
            }
        }
        else {
            listWalkDir.clear();
            if (getPathTo(followCreature->getPosition(), listWalkDir, fpp)) {
                hasFollowPath = true;
                startAutoWalk();
            }
            else {
                hasFollowPath = false;
            }
        }
    }

    onFollowCreatureComplete(followCreature);
}
to this?
Code:
void Creature::goToFollowCreature()
{
    if (followCreature)
    {
        FindPathParams fpp;
        getPathSearchParams(followCreature, fpp);

        if (getPathTo(followCreature->getPosition(), listWalkDir, fpp))
        {
            hasFollowPath = true;
            startAutoWalk(listWalkDir);
        }
        else
            hasFollowPath = false;
    }

    onFollowCreatureComplete(followCreature);
}
 
Back
Top