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

Removing items from houses before OT start

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,764
Solutions
1
Reaction score
227
Location
Chile, Santiago
Like topic name says I need to put a query that removes items from houses before the OT loads the items inside them... Any one has an idea on how doing this?

If you put this on globalevent, it will remove items from database, but not the items that already has been put on the house... I don't know if you understand.
 
House items are loaded in this function, so you should add the query either before loadMap is called or before "std::string config = asLowerCaseString(g_config.getString(ConfigManager::HOUSE_STORAGE));" in the function..
[cpp]bool IOMapSerialize::loadMap(Map* map)
{
std::string config = asLowerCaseString(g_config.getString(ConfigManager::HOUSE_STORAGE));
bool result = false;
if(config == "binary-tilebased")
result = loadMapBinaryTileBased(map);
else if(config == "binary")
result = loadMapBinary(map);
else
result = loadMapRelational(map);[/cpp]

Probably it is the best to execute it on start before loading the map:
Before this part..

[cpp] std::clog << ">> Loading map and spawns..." << std::endl;
if(!g_game.loadMap(g_config.getString(ConfigManager::MAP_NAME)))
startupErrorMessage();[/cpp]
 
This should be enough or:

Code:
	query << "DELETE FROM `tile_items` WHERE `itemtype` = 9956";
	std::clog << ">> Deleting magical torchs from houses" << std::endl;

?
 
Back
Top