pink_panther
Excellent OT User
It's probably something wrong with items inside containers with the script. Too long I made the script, I have no idea what it could be.
still good work
It's probably something wrong with items inside containers with the script. Too long I made the script, I have no idea what it could be.
The conversor is a library written for NodeJS, it uses Forby's OTBM2JSON(Inconcessus/OTBM2JSON) as dependency. You can use this on any map and you will get a 7.6 conversion, notice that it's a hand made conversion table made by me, so it's not perfect.
NodeJS is required.
1 - Unzip this to a folder, add your map, rename it to map.otb and run autorun.bat.
2 - After some seconds it will ask to press any key to continue, do it and it will close, converted_map.otbm should be added to the folder.
3 - Rename your house and spawn file to converted_map-house.xml and converted_map-spawn.xml
4 - Now go to menu bar, press "Map", than press "Cleanup...". Save it.
@Forby
The conversor is a library written for NodeJS, it uses Forby's OTBM2JSON(Inconcessus/OTBM2JSON) as dependency. You can use this on any map and you will get a 7.6 conversion, notice that it's a hand made conversion table made by me, so it's not perfect.
NodeJS is required.
1 - Unzip this to a folder, add your map, rename it to map.otb and run autorun.bat.
2 - After some seconds it will ask to press any key to continue, do it and it will close, converted_map.otbm should be added to the folder.
3 - Rename your house and spawn file to converted_map-house.xml and converted_map-spawn.xml
4 - Now go to menu bar, press "Map", than press "Cleanup...". Save it.
@Forby
C:\Windows\system32>node convert.js
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'C:\Windows\system32\convert.js'
←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)←[39m
←[90m at node:internal/main/run_main_module:17:47←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: []
}
C:\Windows\system32>pause
Presione una tecla para continuar . . .
Follow the guide lines, you failed first step.have installed node
does somebody know how to fix that?LUA:C:\Windows\system32>node convert.js node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module 'C:\Windows\system32\convert.js' ←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m ←[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m ←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)←[39m ←[90m at node:internal/main/run_main_module:17:47←[39m { code: ←[32m'MODULE_NOT_FOUND'←[39m, requireStack: [] } C:\Windows\system32>pause Presione una tecla para continuar . . .
C:\Windows\system32>node convert.js
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'C:\Windows\system32\convert.js'
←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)←[39m
←[90m at node:internal/main/run_main_module:17:47←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: []
}
printscreen the files in the map folderi downloaded everything again installed node.js 64 bits eith chocolatey + all build tools in c disk. reboot my pc then moved the tool to the exact folder as my map y renamep it to map.otbm tried renaming it to map.otb but im sure it must be wrong, then executed autorun.bat but im still get this
LUA:C:\Windows\system32>node convert.js node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module 'C:\Windows\system32\convert.js' ←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m ←[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m ←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)←[39m ←[90m at node:internal/main/run_main_module:17:47←[39m { code: ←[32m'MODULE_NOT_FOUND'←[39m, requireStack: [] }
p\converter_map>node convert.js
Finished conversion in 1594ms. Writing output to converted_map.otbm
Total process took less than 4s.
case 6648: - stone wall in my "good map"
return 4653; - it convert to border of shallow water
case 567:
return 4644;
case 567:
return 102:
return 4644;
// A tool to convert OpenTibia maps to https://github.com/peonso/opentibia_sprite_pack
// by Peonso
// dependencies https://github.com/Inconcessus/OTBM2JSON
// node --max-old-space-size=4096 convert.js
var start = Date.now();
const otbm2json = require("./OTBM2JSON/otbm2json");
// Read the map data using the otbm2json library
const mapData = otbm2json.read("map.otbm");
// converting to 7.6
mapData.data.itemsMinorVersion = 3;
// iterating through tiles converting items
mapData.data.nodes.forEach(function(x) {
x.features.forEach(function(x) {
if(x.type !== otbm2json.HEADERS.OTBM_TILE_AREA) return;
if(x.tiles == undefined) return;
x.tiles.forEach(function(x) {
if((x.type !== otbm2json.HEADERS.OTBM_TILE) && (x.type !== otbm2json.HEADERS.OTBM_HOUSETILE)) return;
if(x.tileid) {
x.tileid = convertId(x.tileid);
//removing invalid ids
if (x.tileid == 6666) {
delete x.tileid;
}
}
if(x.items) {
x.items.forEach(function(x) {
if(x.id) {
// TO DO: if mud wall, remove border items
x.id = convertId(x.id);
//removing invalid ids
if (x.id == 6666) {
delete x.id;
}
}
if(x.content) {
x.content.forEach(function(x) {
x.id = convertId(x.id);
if(x.content) {
x.content.forEach(function(x) {
x.id = convertId(x.id);
});
}
});
}
});
}
});
});
});
// Write the output to OTBM using the library
console.log("Finished conversion in " + (Date.now() - start) + "ms. Writing output to converted_map.otbm");
otbm2json.write("converted_map.otbm", mapData);
console.log("Total process took less than " + Math.ceil((Date.now() - start)/1000) + "s.");
// Returns an integer between min, max (inclusive)
function getRandomBetween(min, max) {
return Math.floor(Math.random() * (max - min + 1) ) + min;
}
// Return a random element based on a weight
function getWeightedRandom(weights) {
// Draw a random sample
var value = Math.random();
var sum = 0;
for(var i = 0; i < weights.length; i++) {
sum += weights[i].weight;
if(value < sum) {
return weights[i].id;
}
}
return weights[1].id;
}
function convertId(id) {
switch(id) {
case 567:
return 4644;
return 102;
break;
case 566:
return 4646;
return 102;
break;
case 568:
return 4645;
return 102;
break;
case 569:
return 4647;
return 102;
break;
case 570:
return 4655;
return 102;
break;
case 572:
return 4652;
return 102;
break;
case 573:
return 4653;
return 102;
break;
case 571:
return 4654;
return 102;
break;
case 574:
return 4651;
return 102;
break;
case 575:
return 4650;
return 102;
break;
case 576:
return 4648;
return 102;
break;
case 4649:
return 577;
return 102;
break;
case
default:
return id;
}
return id;
}
I have map with modified version of tibia.dat, tibia.spr, items.otb
I dont know, on which version of tibia sprites is it based on. But It presents itself as 7.6 map (because I checked it on properties and source engine). It was also advertised as 7.6
I want convert it to orginal 7.6 but it convert:
Example one of a lot:
So the conversion for this map is not working properlyJavaScript:case 6648: - stone wall in my "good map" return 4653; - it convert to border of shallow water
1) How can I check which sprites (which version of tibia) the custom map is based on?
2) and how can I check which item id's are new to 7.6? Then I would even manually adjust the items from 7.6 to which they should be changed
other ideas how convert it faster?
want to know if it's possible to export uniqueid and actionsid and replace or simply add them from one map to another is it's does anybody know how to?
or how do i add more than one value to replace in this script for just one id
something likeLUA:case 567: return 4644;
. Need to re-convert map borders to make then look as in 7.72 vversion because im using 7.4 ones and if i replace them with remeres map editor example from 567 to 4466 the new water borders they are replaced but unfilled with nothing and i need to add grassCode:case 567: return 102: return 4644;
I'm trying to do something like this vut it's giving me errors
LUA:// A tool to convert OpenTibia maps to https://github.com/peonso/opentibia_sprite_pack // by Peonso // dependencies https://github.com/Inconcessus/OTBM2JSON // node --max-old-space-size=4096 convert.js var start = Date.now(); const otbm2json = require("./OTBM2JSON/otbm2json"); // Read the map data using the otbm2json library const mapData = otbm2json.read("map.otbm"); // converting to 7.6 mapData.data.itemsMinorVersion = 3; // iterating through tiles converting items mapData.data.nodes.forEach(function(x) { x.features.forEach(function(x) { if(x.type !== otbm2json.HEADERS.OTBM_TILE_AREA) return; if(x.tiles == undefined) return; x.tiles.forEach(function(x) { if((x.type !== otbm2json.HEADERS.OTBM_TILE) && (x.type !== otbm2json.HEADERS.OTBM_HOUSETILE)) return; if(x.tileid) { x.tileid = convertId(x.tileid); //removing invalid ids if (x.tileid == 6666) { delete x.tileid; } } if(x.items) { x.items.forEach(function(x) { if(x.id) { // TO DO: if mud wall, remove border items x.id = convertId(x.id); //removing invalid ids if (x.id == 6666) { delete x.id; } } if(x.content) { x.content.forEach(function(x) { x.id = convertId(x.id); if(x.content) { x.content.forEach(function(x) { x.id = convertId(x.id); }); } }); } }); } }); }); }); // Write the output to OTBM using the library console.log("Finished conversion in " + (Date.now() - start) + "ms. Writing output to converted_map.otbm"); otbm2json.write("converted_map.otbm", mapData); console.log("Total process took less than " + Math.ceil((Date.now() - start)/1000) + "s."); // Returns an integer between min, max (inclusive) function getRandomBetween(min, max) { return Math.floor(Math.random() * (max - min + 1) ) + min; } // Return a random element based on a weight function getWeightedRandom(weights) { // Draw a random sample var value = Math.random(); var sum = 0; for(var i = 0; i < weights.length; i++) { sum += weights[i].weight; if(value < sum) { return weights[i].id; } } return weights[1].id; } function convertId(id) { switch(id) { case 567: return 4644; return 102; break; case 566: return 4646; return 102; break; case 568: return 4645; return 102; break; case 569: return 4647; return 102; break; case 570: return 4655; return 102; break; case 572: return 4652; return 102; break; case 573: return 4653; return 102; break; case 571: return 4654; return 102; break; case 574: return 4651; return 102; break; case 575: return 4650; return 102; break; case 576: return 4648; return 102; break; case 4649: return 577; return 102; break; case default: return id; } return id; }
trying to use, but seems its converting nothingHey! I have updated this project with more IDS and also the script via chatGPT to take input folder and output folder
Warning! It will take more time the more maps is in input folder!
I also added hella lot ids but still some missing so proceed with cation i also replaced megalot of ids into 0 because i was lazy!
View attachment 81522
you have to put map files in input foldertrying to use, but seems its converting nothing
View attachment 81528