• 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++ How to make monsters stay still if no players in the same POSZ - TFS 1.5 Downgrade

mano368

Senior Support Team Member
Staff member
Support Team
Joined
Sep 2, 2011
Messages
646
Solutions
46
Reaction score
296
Location
Brazil
As written in the title, how do I make the monsters stand still if the player is not in the same Z position as them, like old tibia?

Another problem in case anyone knows how to solve it, how to make the player unable to enter pz if he attacks a player that attacked him (just like in the old days)

TFS 1.5 downgrade.

Thanks in advance!
 
Solution
Try this why don't you:

C++:
bool Creature::canSee(const Position& myPos, const Position& pos, int32_t viewRangeX, int32_t viewRangeY)
{
    if (myPos.z != pos.z) {
        return false;
    }

    return (pos.getX() >= myPos.getX() - viewRangeX) && (pos.getX() <= myPos.getX() + viewRangeX)
        && (pos.getY() >= myPos.getY() - viewRangeY) && (pos.getY() <= myPos.getY() + viewRangeY);
}

And in
C++:
void Monster::updateTargetList()

Change true to false
C++:
g_game.map.getSpectators(spectators, position, true);
Try this why don't you:

C++:
bool Creature::canSee(const Position& myPos, const Position& pos, int32_t viewRangeX, int32_t viewRangeY)
{
    if (myPos.z != pos.z) {
        return false;
    }

    return (pos.getX() >= myPos.getX() - viewRangeX) && (pos.getX() <= myPos.getX() + viewRangeX)
        && (pos.getY() >= myPos.getY() - viewRangeY) && (pos.getY() <= myPos.getY() + viewRangeY);
}

And in
C++:
void Monster::updateTargetList()

Change true to false
C++:
g_game.map.getSpectators(spectators, position, true);
 
Solution
Try this why don't you:

C++:
bool Creature::canSee(const Position& myPos, const Position& pos, int32_t viewRangeX, int32_t viewRangeY)
{
    if (myPos.z != pos.z) {
        return false;
    }

    return (pos.getX() >= myPos.getX() - viewRangeX) && (pos.getX() <= myPos.getX() + viewRangeX)
        && (pos.getY() >= myPos.getY() - viewRangeY) && (pos.getY() <= myPos.getY() + viewRangeY);
}

And in
C++:
void Monster::updateTargetList()

Change true to false
C++:
g_game.map.getSpectators(spectators, position, true);
Thanks Bro!
 
Back
Top