• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Feature TFS 0.4 overspawn monsters like old tibia

Competitibia

Pain & Glory WHole
Premium User
Joined
Apr 1, 2021
Messages
545
Solutions
3
Reaction score
205
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:

Evil Puncker

I know nothing
TFS Developer
Joined
May 30, 2009
Messages
8,537
Solutions
260
Reaction score
4,526

emil92b

Intermediate OT User
Joined
Aug 21, 2013
Messages
325
Solutions
13
Reaction score
125
Location
Sweden
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.
 
OP
OP
Competitibia

Competitibia

Pain & Glory WHole
Premium User
Joined
Apr 1, 2021
Messages
545
Solutions
3
Reaction score
205
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
 

Felipe93

Ghost Member
Joined
Mar 21, 2015
Messages
1,991
Solutions
9
Reaction score
324
Location
Chile
does anybody got the code related to made the monster gain skill if they don't get killed?
 

wizinx

Active Member
Joined
Jul 6, 2010
Messages
181
Solutions
3
Reaction score
42
Location
Chile, Santiago
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?
 
OP
OP
Competitibia

Competitibia

Pain & Glory WHole
Premium User
Joined
Apr 1, 2021
Messages
545
Solutions
3
Reaction score
205
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
 

tarantonio

Old School Player
Joined
Jun 21, 2009
Messages
827
Solutions
1
Reaction score
243
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;
        }
 

dawnking

Member
Joined
Jun 23, 2016
Messages
176
Reaction score
22
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 :)
 

johnsamir

Banned User
Joined
Oct 13, 2009
Messages
555
Solutions
5
Reaction score
99
Location
Nowhere
Wonder, how would it work if despawn range is 0 in config.The code will review it or nah?
 
Last edited:

pink_panther

Excellent OT User
Joined
Sep 10, 2016
Messages
1,132
Solutions
13
Reaction score
582
Location
Kazordoon
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

Felipe93

Ghost Member
Joined
Mar 21, 2015
Messages
1,991
Solutions
9
Reaction score
324
Location
Chile
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
 

Felipe93

Ghost Member
Joined
Mar 21, 2015
Messages
1,991
Solutions
9
Reaction score
324
Location
Chile
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
 
Top