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

Feature TFS 0.4 overspawn monsters like old tibia

Competitibia

Pain & Glory WHole
Joined
Apr 1, 2021
Messages
545
Solutions
3
Reaction score
210
Hello I have paid someone to create this code and would like to share it to community as I requested it on support and nobody had it.
C++:
void Monster::onThink(uint32_t interval)
{
    Creature::onThink(interval);
    if(despawn())
    {
        if(spawn)
        {
            spawn->removeMonster(this);
            spawn->startEvent();
            spawn = NULL;
            masterRadius = -1;
        }
    }

    updateIdleStatus();
    if(isIdle)
        return;

Created by @SwagMaster

i tested it and it works instead of despawn feature which nobody uses in 7.4 :)
 
Last edited:
I don't know what overspawn monsters means but isn't this what you are looking for?

it means that if the monster is lured outside of its spawn radius / changed floor or if its starts fleeing while outside the radius, it will respawn.

but if the monster is within its spawn radius and starts fleeing it cannot respawn.
 
it means that if the monster is lured outside of its spawn radius / changed floor or if its starts fleeing while outside the radius, it will respawn.

but if the monster is within its spawn radius and starts fleeing it cannot respawn.
exactly the readius however here is not just by floorchange it needs to be by x amount of tiles which counts floor change as 1 tile i am not sure whether from the spawnpoint or the monsters actual position but its one or another. that means if u lure out monster from tomb room it will immediately start spawning because player is not on screen ( i think i will have to increase the 60 seconds back to 240 xD) for all mobs

but hey all in all I hope more people that pay for custom c++ code will share it I will for sure and there is quite a few changes coming for tfs 0.4! :)
I share the code in hope for more cool 7.4 servers for everyone. and in most importantly to kill the worst bug those have ( if you rope all monsters from rookgaard sewer what are people gonna kill ? xD
 
does anybody got the code related to made the monster gain skill if they don't get killed?
 
Hello I have paid someone to create this code and would like to share it to community as I requested it on support and nobody had it.
C++:
void Monster::onThink(uint32_t interval)
{
    Creature::onThink(interval);
    if(despawn())
    {
        if(spawn)
        {
            spawn->removeMonster(this);
            spawn->startEvent();
            spawn = NULL;
            masterRadius = -1;
        }
    }

    updateIdleStatus();
    if(isIdle)
        return;

Created by @SwagMaster

i tested it and it works instead of despawn feature which nobody uses in 7.4 :)

Hello, could you explain what it consists of?
 
Hello, could you explain what it consists of?
when monster leaves despawn radius it does not disappear and make new one it simply loses its spawn home position and new monster begin to spawn
 
In TFS 1.x I think it could be implemented on that part of code in monster.cpp:
Lua:
    if (!isInSpawnRange(position) || (lifetime > 0 && (OTSYS_TIME() >= lifetime))) {
        // Despawn creatures if they are out of their spawn zone
        g_game.removeCreature(this);
        g_game.addMagicEffect(getPosition(), CONST_ME_POFF);

Instead of despawn, we need to insert the code to make lured monster lose his spawn home position and start a new spawn on his original spawn.

I don't know if this code works the same on newer tfs:
Lua:
if(spawn)
        {
            spawn->removeMonster(this);
            spawn->startEvent();
            spawn = NULL;
            masterRadius = -1;
        }
 
it means that if the monster is lured outside of its spawn radius / changed floor or if its starts fleeing while outside the radius, it will respawn.

but if the monster is within its spawn radius and starts fleeing it cannot respawn.
put this description in main topic :)
 
Wonder, how would it work if despawn range is 0 in config.The code will review it or nah?
 
Last edited:
I don't know what overspawn monsters means but isn't this what you are looking for?

This just warps them back to their spawn point, it doesn't create over spawn.

Over spawn was the old tibia feature where monsters that move out of their radius, by lure or fleeing, would cause them to spawn again...

That's why mino hell on rook was called mino hell... It would spawn WAY more than the 6 Minotaurs down there.


Careful implementing this and that you don't just create a memory leak... Server might not crash on respawn, but might crash hours later.
 

Attachments

In TFS 1.x I think it could be implemented on that part of code in monster.cpp:
Lua:
    if (!isInSpawnRange(position) || (lifetime > 0 && (OTSYS_TIME() >= lifetime))) {
        // Despawn creatures if they are out of their spawn zone
        g_game.removeCreature(this);
        g_game.addMagicEffect(getPosition(), CONST_ME_POFF);

Instead of despawn, we need to insert the code to make lured monster lose his spawn home position and start a new spawn on his original spawn.

I don't know if this code works the same on newer tfs:
Lua:
if(spawn)
        {
            spawn->removeMonster(this);
            spawn->startEvent();
            spawn = NULL;
            masterRadius = -1;
        }
how it would be for tfs 1.5? masterradius doesnt not works here and startevent neither
 
I don't know what overspawn monsters means but isn't this what you are looking for?

how should it be to make that instead of remove creature on despawn, creates another one in spawn without removing the main monster?
i've tried thing like this
Lua:
if (!isInSpawnRange(position)) {
        g_game.addMagicEffect(this->getPosition(), CONST_ME_POFF);
        if (g_config.getBoolean(ConfigManager::REMOVE_ON_DESPAWN)) {
            //g_game.removeCreature(this, false);
        }
        else {
          
            g_game.placeCreature(this, masterPos);
            setIdle(true);
        }
    }

when the monster is out of it's spawn range, it's start to constan
does not work
 
Back
Top