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

Monster does not Respawn.

chucky91

Advanced OT User
Joined
Apr 8, 2010
Messages
278
Solutions
9
Reaction score
152
I'm having a problem with respawn, for example: the Black Knight even placing it at 12 sqm away from the afk player is not reappear.
Only if I go further there will it reappear.
Config.lua Nostalrius 7.4
-- Monsters
deSpawnRange = 2
deSpawnRadius = 0
 
Solution
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...
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 and once the monster spawn, you will notice because the monster will enter on screen to attack you.

Ps: I use Othire but i think you have the same or at least similar sources than me.
 
Solution
Nice!
I had messed with map.h and it didn't work. and this spawn.ccp
an error occurred during compilation.
so i did it again and
I ignored the error message and it worked anyway.

g_game.map.getSpectators(list...

1644624906518.png
 
Last edited:
Back
Top