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

C++ TFS 0.3.6 - 8.60 Spawn Monsters

samuel157

Banned User
Joined
Mar 19, 2010
Messages
624
Solutions
4
Reaction score
124
Location
São Paulo, Brazil
GitHub
Samuel10M
Code: spawnMonster(it->first, sb.mType, sb.pos, sb.direction, 4200);

C++:
bool Spawn::spawnMonster(uint32_t spawnId, MonsterType* mType, const Position& pos, Direction dir, int16_t t,
    bool startup /*= false*/)
{
    Monster* monster = Monster::createMonster(mType);
    if(!monster)
        return false;

    if(startup)
    {
        //No need to send out events to the surrounding since there is no one out there to listen!
        if(!g_game.internalPlaceCreature(monster, pos, false, true))
        {
            delete monster;
            return false;
        }
    }
    else if (t == 0)
    {
        if (!g_game.placeCreature(monster, pos, false, true))
        {
            delete monster;
            return false;
        }
    }
    else {
        g_game.addMagicEffect(pos, MAGIC_EFFECT_TELEPORT);
        Scheduler::getInstance().addEvent(createSchedulerTask(
            1400, boost::bind(&Spawn::spawnMonster, this, spawnId, mType, pos, dir, t - 1400,false)));
        return true;
    }

        monster->setSpawn(this);
        monster->setMasterPosition(pos, radius);
        monster->setDirection(dir);

        monster->addRef();
        spawnedMap.insert(SpawnedPair(spawnId, monster));
        spawnMap[spawnId].lastSpawn = OTSYS_TIME();
 
    return true;
}

Code:
bool spawnMonster(uint32_t spawnId, MonsterType* mType, const Position& pos, Direction dir, int16_t t,bool startup = false);

---> Whats And Remove the Player Checker???
 
Back
Top