• 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++ remove std::clog without fail

darknelson

Member
Joined
Jun 19, 2011
Messages
190
Solutions
1
Reaction score
15
when i start my server it show unique id repeat and lags it. cause i have a chest with unique id repeated.

i want to disable that std::clog how i can?


C++:
if(m_globalMap[item->getUniqueId()])
    {
        if(item->getActionId() != 2000) //scripted quest system
            std::clog << "Duplicate uniqueId " << item->getUniqueId() << std::endl;
    }
    else
        m_globalMap[item->getUniqueId()] = thing;
}

std::clog << "Duplicate uniqueId " << item->getUniqueId() << std::endl;


this is the line i want to dissapear, how i can do that?
 
Disabling this will cause you to make more mistakes in the future, since you will not know in any way if you are overwriting any other script with the uniqueID, and obviously they have that name, because they must be unique yes or yes, if you have 1000 scripts with the the same uniqueID will only work the first one that the server reads when starting the server.

But if you insists, you can only comment on that line:

Code:
//std::clog << "Duplicate uniqueId " << item->getUniqueId() << std::endl;
 
You're going about this the wrong way, unique id's are not meant to be repeated.
Unique, adjective: being the only one of its kind; unlike anything else.
What you should do is find the items with duplicate unique ids on your map in rme go to edit > find on map > find unique and either assign them to action ids or differing unique ids. Make sure to change your scripts too.
The only case in which unique ids should be repeated is for quest chests with different rewards but the player may only choose one (e.g annih)
If you're doing it for quest chests the action id should be set to 2000
 
i make my own lua scripts so i never gonna have troubles with uniques, i only use t o make chest unmoveable, i tried what you told me, but it show me error empty function
 
You can use this code to make a chest not move, it is worth mentioning that it is not the best method nor the only one.
Lua:
function Player:onMoveItem(player, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
Lua:
if item:getName() == "chest" and item:getActionId() > 100 then
    return false
end
 
Back
Top