spawn monster

Discussion in 'Requests & Support' started by Kjhgfd, Dec 27, 2016.

  1. Kjhgfd

    Kjhgfd Member

    Joined:
    Dec 25, 2016
    Messages:
    63
    Likes Received:
    1
    Best Answers:
    0
    Hello guys i have source 0.4 8.60
    need to edite it before monster spawn make effect {MAGIC_EFFECT_TELEPORT} for 5 second like rl tibia
     
  2. Kjhgfd

    Kjhgfd Member

    Joined:
    Dec 25, 2016
    Messages:
    63
    Likes Received:
    1
    Best Answers:
    0
  3. tetra20

    tetra20 DD

    Joined:
    Jan 17, 2009
    Messages:
    1,304
    Likes Received:
    290
    Best Answers:
    2
    Code (Text):
    1. spawnMonster(it->first, sb.mType, sb.pos, sb.direction, 4200);
    Code (Text):
    1.  
    2. bool Spawn::spawnMonster(uint32_t spawnId, MonsterType* mType, const Position& pos, Direction dir, int16_t t,
    3.     bool startup /*= false*/)
    4. {
    5.     Monster* monster = Monster::createMonster(mType);
    6.     if(!monster)
    7.         return false;
    8.  
    9.     if(startup)
    10.     {
    11.         //No need to send out events to the surrounding since there is no one out there to listen!
    12.         if(!g_game.internalPlaceCreature(monster, pos, false, true))
    13.         {
    14.             delete monster;
    15.             return false;
    16.         }
    17.     }
    18.     else if (t == 0)
    19.     {
    20.         if (!g_game.placeCreature(monster, pos, false, true))
    21.         {
    22.             delete monster;
    23.             return false;
    24.         }
    25.     }
    26.     else {
    27.         g_game.addMagicEffect(pos, MAGIC_EFFECT_TELEPORT);
    28.         Scheduler::getInstance().addEvent(createSchedulerTask(
    29.             1400, boost::bind(&Spawn::spawnMonster, this, spawnId, mType, pos, dir, t - 1400,false)));
    30.         return true;
    31.     }
    32.  
    33.         monster->setSpawn(this);
    34.         monster->setMasterPosition(pos, radius);
    35.         monster->setDirection(dir);
    36.  
    37.         monster->addRef();
    38.         spawnedMap.insert(SpawnedPair(spawnId, monster));
    39.         spawnMap[spawnId].lastSpawn = OTSYS_TIME();
    40.    
    41.     return true;
    42. }
    Code (Text):
    1. bool spawnMonster(uint32_t spawnId, MonsterType* mType, const Position& pos, Direction dir, int16_t t,bool startup = false);
    And Remove the Player Checker
     
    Kjhgfd and Znote like this.
  4. Kjhgfd

    Kjhgfd Member

    Joined:
    Dec 25, 2016
    Messages:
    63
    Likes Received:
    1
    Best Answers:
    0
    noway u are my love work 100% :D
     
    tetra20 likes this.
  5. Ron'sPepe

    Ron'sPepe New Member

    Joined:
    Jul 11, 2014
    Messages:
    25
    Likes Received:
    2
    Best Answers:
    0


    What are 1400, t-1400 and 4200 values?
     
  6. tetra20

    tetra20 DD

    Joined:
    Jan 17, 2009
    Messages:
    1,304
    Likes Received:
    290
    Best Answers:
    2
    Time in milliseconds,4200 = 4.2s
    It takes 4.2s to summon the monster after first flash(a new flash appear each 1.4 second)..you can set it to whatever you want..

    Code (Text):
    1. Scheduler::getInstance().addEvent(createSchedulerTask(
    2.             x, boost::bind(&Spawn::spawnMonster, this, spawnId, mType, pos, dir, t - x,false)));
    you first set t to anything,let's say 5000..then you find t divisors

    which are (5,10,20,25,50,100,250,1000,1250 and so on)

    then x has to be one of those numbers

    So let's say X = 1250,then each 1250 ms,a flash will appear and after 5000/1250 = 4s, the monster will summon..
     

Share This Page

Loading...