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

Edit monster sight (Othire 1.0)

Terotrificy

Veteran OT User
Joined
Oct 18, 2020
Messages
402
Solutions
13
Reaction score
255
Location
Santiago, Chile.
Hi, i was wondering how/where can i edit the monster's sight? At the momment, the monster's sight is of 12 sqm, i want to make it work to 10 sqm (for example, to be able to wait black knight respawn, or giant spider respawn in bloodherb.

I thought it was this part of creature.ccp:

C++:
void Creature::getPathSearchParams(const Creature* creature, FindPathParams& fpp) const
{
    fpp.fullPathSearch = !hasFollowPath;
    fpp.clearSight = true;
    fpp.maxSearchDist = 12;
    fpp.minTargetDist = 1;
    fpp.maxTargetDist = 1;
}

I tried modifying the fpp.maxSearchDist to 10, but nothing changed at all.

Also, i don't know if changing the creature's sight it will be able to respawn when player is at 10 sqm of distance or if i have to modify something else too.

I'm using OThire 1.0.
 
Solution
After working on it thank to @Sarah Wesker and @kay , i managed to fix the issue as intended:

To modify the monster view (range in which monster will attack you if respawn) you need to edit map.h, this lines:


C++:
    static const int32_t maxViewportX = 10;        //here you set x sqms of monster sight to west-east, counting the standing position as 0
    static const int32_t maxViewportY = 10;        //here you set x sqms of monster sight to north-south, counting the standing position as 0
    static const int32_t maxClientViewportX = 8;
    static const int32_t maxClientViewportY = 6;

And for set the distance at where the monster respawn, you must edit this line in spawn.cpp:


C++:
bool Spawn::findPlayer(const Position& pos)
{
    SpectatorVec list;
    SpectatorVec::iterator it;
    g_game.getSpectators(list, pos, false, false, 7+1/*WEST*/, 7+2/*EAST*/ , 5+1 /*NORTH*/, 5+2/*SOUTH*/);  //Here you edit the area in sqms where if the player stands monster can't spawn

    Player* tmpPlayer = NULL;
    for(it = list.begin(); it != list.end(); ++it) {
        if((tmpPlayer = (*it)->getPlayer()) && !tmpPlayer->hasFlag(PlayerFlag_IgnoredByMonsters)){
            return true;
        }
    }

    return false;
}

That way, you can wait Black Knight or Giant Spider in bloodherb, and once the monster spawn, you will notice because the monster will enter on screen to attack you.

Ps: I marked the above question as the solution because indeed it's the solution for what i wanted, you just need to adjust to your own needs.
 
Last edited:
Back
Top