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

Spawnrate/players online

Ocke

New Member
Joined
Feb 12, 2009
Messages
62
Reaction score
1
hey,

Ye i want the spawnrate should change as how many ppls online as rl tibia.
Someone got or someone know how to do a script like that?
 
You have to add something in spawn.cpp....

I want put
rates spawn = 1 + (playersonline / 50)

Its here?
Code:
void Spawn::checkSpawn()
{
#ifdef __DEBUG_SPAWN__
   std::clog << "[Notice] Spawn::checkSpawn " << this << std::endl;
#endif
   Monster* monster;
   uint32_t spawnId;

   checkSpawnEvent = 0;
   for(SpawnedMap::iterator it = spawnedMap.begin(); it != spawnedMap.end();)
   {
     spawnId = it->first;
     monster = it->second;
     if(monster->isRemoved())
     {
       if(spawnId)
         spawnMap[spawnId].lastSpawn = OTSYS_TIME();

       monster->unRef();
       spawnedMap.erase(it++);
     }
     else
     {
       /*if(spawnId && !isInSpawnZone(monster->getPosition()) && monster->getIdleStatus())
         g_game.internalTeleport(monster, monster->getMasterPosition(), true);

       */++it;
     }
   }

   uint32_t spawnCount = 0;
   for(SpawnMap::iterator it = spawnMap.begin(); it != spawnMap.end(); ++it)
   {
     spawnId = it->first;
     spawnBlock_t& sb = it->second;
     if(spawnedMap.count(spawnId))
       continue;

     if(OTSYS_TIME() < sb.lastSpawn + sb.interval)
       continue;

     if(findPlayer(sb.pos))
     {
       sb.lastSpawn = OTSYS_TIME();
       continue;
     }

     spawnMonster(spawnId, sb.mType, sb.pos, sb.direction);
     ++spawnCount;
     if(spawnCount >= (uint32_t)g_config.getNumber(ConfigManager::RATE_SPAWN))
       break;
   }

   if(spawnedMap.size() < spawnMap.size())
     checkSpawnEvent = Scheduler::getInstance().addEvent(createSchedulerTask(getInterval(), boost::bind(&Spawn::checkSpawn, this)));
#ifdef __DEBUG_SPAWN__
   else
     std::clog << "[Notice] Spawn::checkSpawn stopped " << this << std::endl;
#endif
}
 
Back
Top Bottom