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

Looking at items npc trade server crash

loreal

Member
Joined
Oct 1, 2014
Messages
57
Reaction score
8
Looking at items npc trade server crash..

I have that problem, the Feature - Attributes MOD system,

could anyone help?

ItemAttributes::getAttribute (this=this@entry=0x0, key=0x619fcd "skillfist")
at itemattributes.cpp:76
76 if(!attributes)
(gdb) Undefined command: "ItemAttributes". Try "help".ItemAttributes::getAttrib")e (this=this@entry=0x0, key=0x619fcd "skillfist

(gdb) at itemattributes.cpp:76


at itemattributes.cpp:76

code ---->
C++:
boost::any ItemAttributes::getAttribute(const char* key) const
{
    if(!attributes)
        return boost::any();

    AttributeMap::iterator it = attributes->find(key);
    if(it != attributes->end())
        return it->second.get();

    return boost::any();
}

up
 
Last edited:
and that I installed this system Feature - Attributes MOD, only problem of it and that of the crash when I look at items in the npc trade.

i use OTX Server 3 - Based on TFS 1.2 8.60
Obviously the code isn't compatible with your source. I see you posted over a year ago on that same thread and then kept bumping it without any reply. Might be time to move on to something that works. Not with the code but whatever it is you want to accomplish and I am sure whatever it is a script would work just the same and if not better and without error.
 
This error is probably because item in npc trade does not exist as an object. Its not created, only the info about it is send and getAttribute requires real item to exist, because it has to access it. If your modifications are in source then check item::getDescription, because thats where you probably get the error, you should make a check like „if (item) {}”
 
Last edited:
The error is occurring because it is not finding the new system attributes Feature - Attributes MOD when I give look at the npc items, what I need and know how I will set these new attributes.

and if I know c ++, I do not want to just copy and paste, but a path.

the ItemAttributes :: getAttribut class is not encountering these new system attributes.

Code:
const char * CONVERSION :: SKILL [7] =
{
     skillfist
     skillclub
     "skillsword"
     "skillaxe",
     skilldist
     skillshield
     "skillfish"
};

const char* CONVERSION::STATS[5] =
{
    "maxhealthpoints",          // Increase max health
    "maxmanapoints",            // Increase max mana
    "soulpoints",               // Soul points bonus
    "level_not_implemented",    // Level increase not implemented, but can easily be
                                // Just set an appropriate attribute name here and follow the comments in movement.cpp and item.cpp
    "magiclevel"                // Magic level bonus
};
 
The error is occurring because it is not finding the new system attributes Feature - Attributes MOD when I give look at the npc items, what I need and know how I will set these new attributes.

and if I know c ++, I do not want to just copy and paste, but a path.

the ItemAttributes :: getAttribut class is not encountering these new system attributes.

Code:
const char * CONVERSION :: SKILL [7] =
{
     skillfist
     skillclub
     "skillsword"
     "skillaxe",
     skilldist
     skillshield
     "skillfish"
};

const char* CONVERSION::STATS[5] =
{
    "maxhealthpoints",          // Increase max health
    "maxmanapoints",            // Increase max mana
    "soulpoints",               // Soul points bonus
    "level_not_implemented",    // Level increase not implemented, but can easily be
                                // Just set an appropriate attribute name here and follow the comments in movement.cpp and item.cpp
    "magiclevel"                // Magic level bonus
};
No, thats not the error.
It does not find the item you are looking for in npc trade.
For example in this link you gave us.
16 step
" boost::any attr = item->getAttribute(CONVERSION::SKILL);"
if item is nullptr it will crash the server, it is when you look at the item in trade, because it is not created.
In every code like this when it is in getDescription you have to check if the item is not nullptr.
so.

Code:
if (item) {
   boost::any attr = item->getAttribute(CONVERSION::SKILL[i]);
}
 
Last edited:
@loreal Could you try to find what calls the ItemAttributes::getAttribute when you look at an item in NPC window? Perhaps some onLook event?
 
No, thats not the error.
It does not find the item you are looking for in npc trade.
For example in this link you gave us.
16 step
" boost::any attr = item->getAttribute(CONVERSION::SKILL);"
if item is nullptr it will crash the server, it is when you look at the item in trade, because it is not created.
In every code like this when it is in getDescription you have to check if the item is not nullptr.
so.

Code:
if (item) {
   boost::any attr = item->getAttribute(CONVERSION::SKILL[i]);
}
Thanks for the tip I already managed to solve.
 
Back
Top