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

Monster random level...

Status
Not open for further replies.

crimm

New Member
Joined
Dec 7, 2008
Messages
44
Reaction score
4
Location
Poland
Hi, I want to do 'monster level', but something I did not quit. Here is the screen:



Please help me.

Here is code

C++:
bool Spawn::addMonster(const std::string& _name, const Position& _pos, Direction _dir, uint32_t _interval)
{
    if(!g_game.getTile(_pos))
    {
        std::cout << "[Spawn::addMonster] NULL tile at spawn position (" << _pos << ")" << std::endl;
        return false;
    }

    MonsterType* mType = g_monsters.getMonsterType(_name);
    if(!mType)
    {
        std::cout << "[Spawn::addMonster] Cannot find \"" << _name << "\"" << std::endl;
        return false;
    }

    if(_interval < interval)
        interval = _interval;

    spawnBlock_t sb;
    sb.mType = mType;
    sb.pos = _pos;
    sb.direction = _dir;
    sb.interval = _interval;
    sb.lastSpawn = 0;

    int32_t r = random_range(1,7);
    std::stringstream Msg;
    Msg << r;
    mType->name = mType->name + " [" + Msg.str().c_str() + "]";;
    mType->nameDescription = "a " + mType->name;
    mType->experience = mType->experience + (mType->experience/10 * r);
    mType->health = mType->health + (mType->health/10 * r);
    mType->healthMax = mType->healthMax + (mType->healthMax/10 * r);

    uint32_t spawnId = (int32_t)spawnMap.size() + 1;
    spawnMap[spawnId] = sb;
    return true;
}

I do not know why this is happening.
Sorry for bad english, use translate.
 
Last edited by a moderator:
I guess you don't know how onSpawn works. It only works for creatures that were killed and spawned again, not with server start, and he wants the server start code.

You can do simply with a globalevent onStartUp, and "playing" with the function 'getMonstersOnline()' and I think that should work correctly.
 
You can do simply with a globalevent onStartUp, and "playing" with the function 'getMonstersOnline()' and I think that should work correctly.

If there's 50k monsters on server it'd couse massive lag or crash.
 
Ayuda :D

:)hola alguien tiene este system complete xfavor mi coreo es [email protected] lo necesito para pokemon o alguien que me oriente de como empesar mas o menos


hi anyone has this system please complete my core is the need for pokemon [email protected] or someone like me get started east more or less
 

Yea I also think its not effective. I think that is better to create new "attribute" to monster which will we can edit in monster file something like this:

Code:
experience="0" speed="200" [COLOR="#FF0000"]minLevel="12" maxLevel="15"[/COLOR] manacost="250">

And then random_range and also add code to increases monster health and mana.

Bump
That idea is great ;3
 
Hmm. Everything looks good, awesome etc. but it doesn't solve the problem:
  • How to add (random) level to name (eg. "Rat [1]") without repeating (eg. "Rat [1][1][1][1][...")
  • Or how to make that levels will be random not the same for each kind of monster
 
Status
Not open for further replies.
Back
Top