• 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++ random crash backtrace full

S

Shadow_

Guest
so after running GDB and bt full when the server crashed i got this, which is nothing useful the server was good till the last update, the update was related to creaturescripts and actions, new items only added like progress boosting (counts 2 kills per 1 kill for tasks counter)
unknown.png
 
yea post the file lol
well i did some changes not 1-2 files so thats why i didn't add, here we go.
Lua:
local cfg = {
    chance = 8,
    chancedon = 15,            -- chance that the player will succeed in getting the ore
    skill = SKILL_FIST,      -- skill required to mine
    skillStr = ' FIST',      -- string for skill name | note: add a space before skill name
    stage2Regen = 5 * 60 * 1000, -- 3 seconds
    stage3Regen = 10 * 60 * 1000, -- 2 seconds
    ores = {
        {effect = CONST_ME_BLOCKHIT, ore = 18415, amount = {1, 1}, amountdon = {2,4}, skillReq = 10, veins = {
                {id = 17574, lv = 75},
                {id = 17575, lv = 50}
            },
        },
        {effect = CONST_ME_BLOCKHIT, ore = 18413, amount = {1, 1}, amountdon = {2,4}, skillReq = 10, veins = {
                {id = 17580, lv = 75},
                {id = 17581, lv = 50}
            },
        },
        {effect = CONST_ME_BLOCKHIT, ore = 18414, amount = {1, 1}, amountdon = {2,4}, skillReq = 10, veins = {
                {id = 17586, lv = 75},
                {id = 17587, lv = 50}
            },
        },
}
}

local function isInTable(value)
    for i = 1, #cfg.ores do
        for j = 1, #cfg.ores[i].veins do
            if cfg.ores[i].veins[j].id == value then
                return i, j -- Return ore row and vein index
            end
        end
    end
    return false
end

local regenerating = {}

local function regenVein(pos, id, row, index)
    local item = Tile(pos):getItemById(id)
    if not item then
        return false
    end
    local currVein = cfg.ores[row].veins
    local transformId = currVein[index].id
    item:transform(transformId)
    if currVein[index-1] and currVein[index-1].id then
        regenerating[pos] = addEvent(regenVein, cfg.stage3Regen, pos, transformId, row, index-1)
    end
end

exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) + 275))

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
        if player:getCondition(CONDITION_EXHAUST_HEAL) then
            return player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        end
    local row, vein = isInTable((Tile(toPosition):getTopVisibleThing()):getId())
    if (row and vein) then
        local playerPos = player:getPosition()
        local currOre = cfg.ores[row]
        local currVein = currOre.veins[vein]
        local skillLevel = player:getSkillLevel(cfg.skill)

        -- Check player skill level
        if not (skillLevel >= currOre.skillReq) then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You must have '.. currOre.skillReq .. cfg.skillStr ..' before you may mine.')
            return true
        end
       
        -- Check player level
        if not (player:getLevel() >= currVein.lv) then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You must have '.. cfg.level ..' level before you may mine.')
            return true
        end

        -- If the vein is at the last stage, tell the player to wait
        if #currOre.veins == vein then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You must wait for this vein to regen.')
            playerPos:sendMagicEffect(CONST_ME_POFF)
            return true
        end

        -- Stop current regeneration process (since the player hit the rock again)
        if regenerating[toPosition] then
            stopEvent(regenerating[toPosition])
        end

        -- If chance is correct, add the item to the player and start regeneration process
        local newchance = 8
        local newamount1 = 1
        local newamount2 = 1
        if player:getIsSVip() then
            newchance = cfg.chancedon
            newamount1 = currOre.amountdon[1]
            newamount2 = currOre.amountdon[2]
        end
        if math.random(100) <= (newchance) then
            local nextId = currOre.veins[vein+1].id
            local it = player:addItem(currOre.ore, math.random(newamount1, newamount2))
            local count = it:getCount()
            local name = count > 1 and it:getPluralName() or it:getName()
            player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You have mined '.. count .. ' '.. name)
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have mined '.. count .. ' '.. name)
            player:addSkillTries(cfg.skill, math.random(3000, 5000) / skillLevel)
    player:addCondition(exhaust)
            toPosition:sendMagicEffect(currOre.effect)
            regenerating[toPosition] = addEvent(regenVein, (vein == 2) and cfg.stage2Regen or cfg.stage3Regen, toPosition, nextId, row, vein)
            target:transform(nextId)
        else
            playerPos:sendMagicEffect(CONST_ME_POFF)
    player:addCondition(exhaust)
        end

    end
    return true
end
^ Minning code (It is originally yours, the editted part from line 92 to line 99)
Code:
local config = {
     ['roc'] = {amount = 1000, storage = 29691, startstorage = 93046, startvalue = 1},
     ['eradicator'] = {amount = 750, storage = 29692, startstorage = 93046, startvalue = 3},
     ['hellflayer'] = {amount = 2, storage = 29693, startstorage = 93046, startvalue = 5},
     ['mad mage'] = {amount = 2, storage = 29695, startstorage = 93046, startvalue = 5},
     ['glooth slasher'] = {amount = 2, storage = 29696, startstorage = 93046, startvalue = 5},
     ['deathstrike'] = {amount = 2, storage = 29694, startstorage = 93046, startvalue = 5},
     ['crystal wolf'] = {amount = 500, storage = 29697, startstorage = 94046, startvalue = 2},
     ['thornfire wolf'] = {amount = 500, storage = 29698, startstorage = 94046, startvalue = 2},
     ['midnight panther'] = {amount = 500, storage = 29700, startstorage = 94046, startvalue = 2},
     ['starving wolf'] = {amount = 500, storage = 29699, startstorage = 94046, startvalue = 2},
     ['verminor'] = {amount = 2, storage = 29701, startstorage = 94046, startvalue = 3},
     ['rupture'] = {amount = 1500, storage = 29702, startstorage = 94046, startvalue = 3},
     ['despair'] = {amount = 1000, storage = 29703, startstorage = 94046, startvalue = 3},
     ['humongous covid-19'] = {amount = 2, storage = 29705, startstorage = 94046, startvalue = 5},
     ['fatal'] = {amount = 2, storage = 29704, startstorage = 94046, startvalue = 5},
}
function onKill(player, target)
     local monster = config[target:getName():lower()]
     if target:isPlayer() or not monster or target:getMaster() then
         return true
     end
     local stor = player:getStorageValue(monster.storage)+1
     if player:getIsSVip() then
        if stor < monster.amount and player:getStorageValue(monster.startstorage) >= monster.startvalue then
            player:setStorageValue(monster.storage, stor)
            if monster.startstorage == 93046 then
                player:sendChannelMessage(nil, '[Zilor]: '..(stor +1)..' of '..monster.amount..' '..target:getName()..'s killed.', TALKTYPE_CHANNEL_R1, 11)
            else
                player:sendChannelMessage(nil, '[Kaur]: '..(stor +1)..' of '..monster.amount..' '..target:getName()..'s killed.', TALKTYPE_CHANNEL_R1, 11)
            end
        end
     if (stor +1) == monster.amount then
         player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations, you have killed '..(stor +1)..' '..target:getName()..'s and completed the '..target:getName()..'s mission.')
         player:setStorageValue(monster.storage, stor +1)
     end
    end
    stor = player:getStorageValue(monster.storage)+1
     if stor < monster.amount and player:getStorageValue(monster.startstorage) >= monster.startvalue then
         player:setStorageValue(monster.storage, stor)
         if monster.startstorage == 93046 then
         player:sendChannelMessage(nil, '[Zilor]: '..(stor +1)..' of '..monster.amount..' '..target:getName()..'s killed.', TALKTYPE_CHANNEL_R1, 11)
        else
         player:sendChannelMessage(nil, '[Kaur]: '..(stor +1)..' of '..monster.amount..' '..target:getName()..'s killed.', TALKTYPE_CHANNEL_R1, 11)
        end
    end
     if (stor +1) == monster.amount then
         player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations, you have killed '..(stor +1)..' '..target:getName()..'s and completed the '..target:getName()..'s mission.')
         player:setStorageValue(monster.storage, stor +1)
     end
     return true
end
Tasks counter (Editted from line 24 to 37)
Note that : the first (#0) << was written like this in the backtrace, it was executeconditions( in creature.cpp line 1292
 
Last edited by a moderator:
It would be easier to help if you posted creature.cpp since the crash occurred in Creature::executeConditions (frame 0).
 
so that was caused the crashes? nothing from lua side?
Yes, but it's highly possible it's something from the Lua side (i.e. attempting to remove a condition in onPrepareDeath callback)
 
Solution
Yes, but it's highly possible it's something from the Lua side (i.e. attempting to remove a condition in onPrepareDeath callback)
didn't test it yet but from what is written i think this was my issue thanks alot!, i gave ninja the best answer as he already told me the same thing thank you both will edit this comment if the problem is really solved.
 
Back
Top