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

Unique Item Bug: Item reverting

Jaykwon

New Member
Joined
Nov 9, 2010
Messages
6
Reaction score
0
Hello,

My plans to craft an interesting server got thwarted, when I came upon this problem.
I assume it's a bug, since the function exists but (at least for me) is working abnormally.

I first asked for help on the subject Here, but we were unable to solve it. After that I stopped working on my OT, since a large part of it (including already made quests) relied on custom items.


Long story short:
Whenever I (or other people in the aforementioned thread) created a "unique" item via a script, it would only be unique until the item is moved in the inventory.
(A unique item, meaning it has a different name due to SetItemName and extra attack from a similiar function)
As soon as the item was moved around the inventory (Changed slots, dropped on ground etc) it would revert back to the original item.


Does anyone know how to fix this?
Thanks in advance,
Jaykwon

I suggest reading the original thread btw
 
in 0.3.6 main function is setItemAttribute(uid, attr, value)
and the only problem I experiened was getItemAttribute returning strange values when I was trying to code some upgrades etc
after using /attr attributes stay as they should, not sure about setItemAttribute
 
Thanks for the reply,

My setItemName is just a simplification of the setItemAttribute,
this is from my global function list:

Code:
function setItemName(uid, text)
     return doItemSetAttribute(uid, "name", text)
end

function setItemPluralName(uid, text)
     return doItemSetAttribute(uid, "plural", text)
end

function setItemAttack(uid, attack)
     return doItemSetAttribute(uid, "attack", attack)
end
 
I'll add this to a new post so the last won't get messy:

This is my crude code for rewarding players with a modified spear after completing a quest on rookgard:
Code:
if item.uid == 35006 then
    queststatus = getPlayerStorageValue(cid,item.uid)
    if queststatus == -1  then
        if getPlayerFreeCap(cid) > 100 then
 
            doPlayerSendTextMessage(cid,22,"You have found some goblin spears.")
            setPlayerStorageValue(cid,item.uid,1)
                for i=1, 5 do
                    local spear = doPlayerAddItem(cid,2389,1)
                    setItemName(spear, 'goblin spear')
                    setItemPluralName(spear, 'goblin spears')
                    setItemAttack(spear, 32)
                    setItemBreakChance(spear, 32)
                end
        else
            doPlayerSendTextMessage(cid,22,"You need 100 oz free cap to collect this reward.")
        end
 
    else
        doPlayerSendTextMessage(cid,22,"The chest is now empty.")
    end
            return false
end

And this is from a quest that give the players a ruby to dispense in rookgard:
Code:
if item.uid == 35015 then
    queststatus = getPlayerStorageValue(cid,item.uid)
    if queststatus == -1 then
        doPlayerSendTextMessage(cid,22,"You have found a ruby.")
        local ruby = doPlayerAddItem(cid,2147,1)
        doSetItemSpecialDescription(ruby, 'It probably belongs to someone.')
        setPlayerStorageValue(cid,item.uid,1)
    else
        doPlayerSendTextMessage(cid,22,"It is empty.")
    end
end

The ruby gets created successfully with the special description, and at least 1 out of 5 spears will be a "Goblin Spear". (The 4 remaining spears are due to bad scripting on my part, but best to focus on that later)

Upon placing the spear in my hand (Or if it started in my hand then this happens when I put the spear in my bag or on the floor) the former "Goblin Spear" is now naught but a regular spear, both name-and-attackwise.

Same thing with the ruby, and other things I've created. After players have manipulated them in-game they are reverted.
 
stackable items just have to stay with default attributes cause its not that easy to remember attributes of every single item in stack
you can probably try to make edited stackable items impossible to stack/split etc, but I'm not sure if it gonna help
 
Reasonable, but the problem still remains when I have only 1 spear/Ruby and never stack it, its simply the "moving it around my inventory"-part that makes it revert.
 
I never tried just moving them, or at least I dont remember if it changed while moving(I guess no...)
Well, hope that some dev or any other c++ coder can solve it, cause its strange
 
Thanks for the replis zakius, yeah.
I'm hoping someone who has experienced (or duplicated) my bug replies.
 
Last edited:
Just a shameless self bump, does anyone know the answer to this?
 
Back
Top