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

Linux Crash otbr 1.3

There are 1000 versions of otservbr. Post your monster.cpp file.

Lua:
void Monster::onThinkDefense(uint32_t interval)
{
    bool resetTicks = true;
    defenseTicks += interval;

    for (const spellBlock_t& spellBlock : mType->info.defenseSpells) {
        if (spellBlock.speed > defenseTicks) {
            resetTicks = false;
            continue;
        }

        if (defenseTicks % spellBlock.speed >= interval) {
            //already used this spell for this round
            continue;
        }

        if ((spellBlock.chance >= static_cast<uint32_t>(uniform_random(1, 100)))) {
            minCombatValue = spellBlock.minCombatValue;
            maxCombatValue = spellBlock.maxCombatValue;
            spellBlock.spell->castSpell(this, this);
        }
    }

    if (!isSummon() && summons.size() < mType->info.maxSummons && hasFollowPath) {
        for (const summonBlock_t& summonBlock : mType->info.summons) {
            if (summonBlock.speed > defenseTicks) {
                resetTicks = false;
                continue;
            }

            if (summons.size() >= mType->info.maxSummons) {
                continue;
            }

            if (defenseTicks % summonBlock.speed >= interval) {
                //already used this spell for this round
                continue;
            }

            uint32_t summonCount = 0;
            for (Creature* summon : summons) {
                if (summon->getName() == summonBlock.name) {
                    ++summonCount;
                }
            }

            if (summonCount >= summonBlock.max) {
                continue;
            }

            if (summonBlock.chance < static_cast<uint32_t>(uniform_random(1, 100))) {
                continue;
            }

            Monster* summon = Monster::createMonster(summonBlock.name);
            if (summon) {
                if (g_game.placeCreature(summon, getPosition(), false, summonBlock.force)) {
                    summon->setDropLoot(false);
                    summon->setSkillLoss(false);
                    summon->setMaster(this);
                    g_game.addMagicEffect(getPosition(), CONST_ME_MAGIC_BLUE);
                    g_game.addMagicEffect(summon->getPosition(), CONST_ME_TELEPORT);
                } else {
                    delete summon;
                }
            }
        }
    }

    if (resetTicks) {
        defenseTicks = 0;
    }
}
Post automatically merged:

Lua:
void Monster::onThinkDefense(uint32_t interval)
{
    bool resetTicks = true;
    defenseTicks += interval;

    for (const spellBlock_t& spellBlock : mType->info.defenseSpells) {
        if (spellBlock.speed > defenseTicks) {
            resetTicks = false;
            continue;
        }

        if (defenseTicks % spellBlock.speed >= interval) {
            //already used this spell for this round
            continue;
        }

        if ((spellBlock.chance >= static_cast<uint32_t>(uniform_random(1, 100)))) {
            minCombatValue = spellBlock.minCombatValue;
            maxCombatValue = spellBlock.maxCombatValue;
            spellBlock.spell->castSpell(this, this);
        }
    }

    if (!isSummon() && summons.size() < mType->info.maxSummons && hasFollowPath) {
        for (const summonBlock_t& summonBlock : mType->info.summons) {
            if (summonBlock.speed > defenseTicks) {
                resetTicks = false;
                continue;
            }

            if (summons.size() >= mType->info.maxSummons) {
                continue;
            }

            if (defenseTicks % summonBlock.speed >= interval) {
                //already used this spell for this round
                continue;
            }

            uint32_t summonCount = 0;
            for (Creature* summon : summons) {
                if (summon->getName() == summonBlock.name) {
                    ++summonCount;
                }
            }

            if (summonCount >= summonBlock.max) {
                continue;
            }

            if (summonBlock.chance < static_cast<uint32_t>(uniform_random(1, 100))) {
                continue;
            }

            Monster* summon = Monster::createMonster(summonBlock.name);
            if (summon) {
                if (g_game.placeCreature(summon, getPosition(), false, summonBlock.force)) {
                    summon->setDropLoot(false);
                    summon->setSkillLoss(false);
                    summon->setMaster(this);
                    g_game.addMagicEffect(getPosition(), CONST_ME_MAGIC_BLUE);
                    g_game.addMagicEffect(summon->getPosition(), CONST_ME_TELEPORT);
                } else {
                    delete summon;
                }
            }
        }
    }

    if (resetTicks) {
        defenseTicks = 0;
    }
}
line 1001
above
 

Attachments

  • capture-20220614-105059.png
    capture-20220614-105059.png
    39.9 KB · Views: 7 · VirusTotal
@jel
So there is something wrong with some monster 'defense spell' (healing/haste/invisible). Code says nothing about it. Maybe invalid config of spell in Lua can make it generate pointer to nothing (0x0000000000000045).

You can try to find monster name in gdb in interactive mode. Do you have core file?
If you don't know how to read name in gdb message me on Discord: Gesior.pl#3208

How many online do you have? How much CPU uses server?
You should compile server in debug mode, so after next crash, we would get nice report, not 'optimized out' everywhere.
 
Back
Top