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

Solved Potion causing debug

70011983

Ners
Joined
Nov 21, 2011
Messages
354
Solutions
1
Reaction score
56
Location
Croatia
Hello,
I'm using an 8.54 server, I've made the potions stackable, they work fine, but whenever I create a great spirit potion, it crashes the client. I don't think it's the potions.lua because other potions work alright but this one. Checked dat and otb file and I didn't find any difference between GSP and other potions. Any idea on whats wrong?
 
Did you modify odb and dat before? Or just the potion.lua?
In case you changed the otb and dat files when you added stack try standard files and see if you corrupted the files.
 
Crash Onuse?
made by is your script
post here
I didn't make it, it isn't on use, but when I create the item, I can't see it, it just crashes the client, but anyway, here it is:
Code:
local config = {
    removeOnUse = "no",
    usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
    splashable = "no",
    realAnimation = "no", -- make text effect visible only for players in range 1x1
    healthMultiplier = 1.0,
    manaMultiplier = 1.0
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
    [8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion
    [7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion
    [7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8, 11, 12}, vocStr = "knights and paladins"}, -- strong health potion
    [7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8, 12}, vocStr = "knights"}, -- great health potion
    [8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8, 12}, vocStr = "knights"}, -- ultimate health potion

    [7620] = {empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion
    [7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7, 9, 10 ,11}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
    [7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6, 9, 10}, vocStr = "sorcerers and druids"}, -- great mana potion

    [8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7, 11}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local potion = POTIONS[item.itemid]
    if(not potion) then
        return false
    end

    if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
        if(not config.splashable) then
            return false
        end

        if(toPosition.x == CONTAINER_POSITION) then
            toPosition = getThingPos(item.uid)
        end

        doDecayItem(doCreateItem(2016, potion.splash, toPosition))
        doTransformItem(item.uid, potion.empty)
        return true
    end

    if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        return true
    end

    if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
        not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
    then
        doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
        return true
    end

    local health = potion.health
    if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
        return false
    end

    local mana = potion.mana
    if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
        return false
    end

    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    if(not realAnimation) then
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
             setPlayerStorageValue(cid, 21066, getCreatureStorage(cid, 21066) + 1)
    else
        for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
            if(isPlayer(tid)) then
                doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
            end
        end
    end

    doAddCondition(cid, exhaust)
    if(not potion.empty or config.removeOnUse) then
        doRemoveItem(item.uid, 1)
        return true
    end
    doRemoveItem(item.uid, 1)
    doPlayerAddItem(cid, potion.empty, 1)
    pot_count = getPlayerItemCount(cid, potion.empty)
    doPlayerRemoveItem(cid, potion.empty, pot_count)
    return true
    end

Did you modify odb and dat before? Or just the potion.lua?
In case you changed the otb and dat files when you added stack try standard files and see if you corrupted the files.
I did change the otb and dat files, but dont get it why other potions work and this one not, they look all the same in the dat and otb file.
 
Can you post the log of client crash?
Code:
...
Last Packet Types: 100 110 109 131 160 180 109 030 109 131
Last Packet: 110 000 037 011 003 000 098 097 103 008 000 001 218 029 100 000
Player Position: [32095,32209,7]
Player Name: Testing Dude (Online)
Player Action: 056 051 046 049 051 049 046 055 057 046 050 057 058 055 049 055 050
Player.cpp 361: exception occurred, reason:
Network.cpp 992: exception occurred (ErrorCode = 0), reason:
Control.cpp 1330: exception occurred (Type = 100) (MainWindow = 20551824), reason:
Communication.cpp 1640: exception occurred (PlayerX = 0) (PlayerY = 0), reason:
Network.cpp 513: exception occurred, reason:
Utils.cpp 501: assertion failed (Position = 23) (Size = 23), reason:
Position<=Size-2
Sat May 24 22:53:29 2014
Debug Assertion 8.54 Utils.cpp 501
It happens whenever I summon the item and when I move the bag from my slot to the ground (to delete it).
 
When you create the potions, the client crash? have you tried to create other items and also tried to do: /i potionid, 1

Maybe the stack is overflowing.
 
When you create the potions, the client crash? have you tried to create other items and also tried to do: /i potionid, 1

Maybe the stack is overflowing.

Tried to creat every potion type and there was no problem with it except Great Spirit Potion. It crashes the client, tried to add amount but it's still same result.
If I summon the item without opening the bag first, nothing happens, I can move the bag around (while it's closed), once I open it the crash begins and every time I move it around, the client crashes.
This time its another error, guess it's the same but anyway here it is:
Code:
...
Last Packet Types: 008 110 160 106 121 109 210 162 141 130
Last Packet: 121 003 106 097 125 211 125 007 001 037 011 160 094 001 094 001
Player Position: [32096,32211,7]
Player Name: Testing Dude (Online)
Player Action: 056 051 046 049 051 049 046 055 051 046 049 055 048 058 055 049 055 050
Player.cpp 361: exception occurred, reason:
Network.cpp 992: exception occurred (ErrorCode = 0), reason:
Control.cpp 1330: exception occurred (Type = 8) (MainWindow = 20551824), reason:
Control.cpp 1324: unknown packet type during game (Type = 8)
Mon May 26 20:55:41 2014
Debug Assertion 8.54 Control.cpp 1324
 
Dont see anything here, no errors when I run up the server :S
Code:
...
    <item id="8459" article="a" name="strange statue"/>
    <item fromid="8460" toid="8471" name="earth"/>
    <item id="8472" article="a" name="great spirit potion">
        <attribute key="weight" value="220"/>
        <attribute key="description" value="This potion can only be consumed by paladins of level 80 or higher."/>
    </item>
    <item id="8473" article="an" name="ultimate health potion">
        <attribute key="weight" value="220"/>
        <attribute key="description" value="This potion can only be consumed by knights of level 130 or higher."/>
    </item>
...
 
It was there already.
Have you tried removing the script and making the potion just to see if its the script causing the error or another problem?

If that is not the cause then its your items.otb more than likely and the easiest way would be to find your rev from another post and take the items.otb and replace them
 
Have you tried removing the script and making the potion just to see if its the script causing the error or another problem?

If that is not the cause then its your items.otb more than likely and the easiest way would be to find your rev from another post and take the items.otb and replace them

Removed completely potions.lua from actions.xml and no, it's not that causing it.
 
Back
Top