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

Get house tiles?

TibiCAM

Advanced OT User
Joined
Feb 3, 2020
Messages
165
Reaction score
213
Hi,

Is there any way to get all the tiles (x,y,z) that belong to a specific house?
In houses.xml I can only see where the entrance is.

Where do I see all the tile positions that are inside the house?
Is there a way to edit this (I assume it's in the .otbm) without RME?

For example, editing with Notepad.
 
Yes you can, what version are you using? if you are using tfs1.2+ you can just iterate via Lua
just wrote some stuff
LUA:
function checkHouseTiles(house)
    if (house) then
        local tiles = house:getTiles()
        for i = 1, #tiles do
            local tile = tiles[i]
            print(tile:getId(), tile:getName())
        end
    end
end
 
In the older .30/.40 servers it was this.
LUA:
getHouseInfo(houseId).tiles


On the new server it looks like house is a class and getTiles is a method
https://github.com/otland/forgottenserver/blob/master/src/luascript.cpp#L2553
So something like this:
LUA:
getHouse(somePosition).getTiles()

I'm absolutely terrible at C++ though - so making a new tool from scratch in C++ only to extract the coordinates is a no-no for me.
I'll do my work manually, I guess - since that always turns out to be the best result - but slowest.
Post automatically merged:

Yes you can, what version are you using? if you are using tfs1.2+ you can just iterate via Lua
just wrote some stuff
LUA:
function checkHouseTiles(house)
    if (house) then
        local tiles = house:getTiles()
        for i = 1, #tiles do
            local tile = tiles[i]
            print(tile:getId(), tile:getName())
        end
    end
end

How would I be able to edit them and then save it back into the map?
For example, I want to (via code) add or remove new houses into the map. I have the coordinates for them.
I also want to delete some coordinates I have.

I understand it is not a one-liner, and this may be quite a "big project". But I'm just wondering if anyone has done it and if so how.
I did see some "OTB2JSON" on Github but that's Node.JS and I've never even touched anything with Node.
 
I'm absolutely terrible at C++ though - so making a new tool from scratch in C++ only to extract the coordinates is a no-no for me.
I'll do my work manually, I guess - since that always turns out to be the best result - but slowest.
Post automatically merged:



How would I be able to edit them and then save it back into the map?
For example, I want to (via code) add or remove new houses into the map. I have the coordinates for them.
That is something I have never tried, I can guess you will need to create some kind of house register and add that information with house params and house tiles to the house list, but I can not help :/
 
I'm absolutely terrible at C++ though

I was linking the C++ Lua bindings.... as in the Lua fuctions you can globally use in your server Lua scripts

That file is just where they get defined. The code block below the CPP file line is Lua
 
That is something I have never tried, I can guess you will need to create some kind of house register and add that information with house params and house tiles to the house list, but I can not help :/

I know RME has compatibility for extensions but I've never seen an extension for it. Maybe there is a way to loop through houses there, export an XML with all their respective coordinates, edit it, and then load it back into RME somehow. No idea..
 
It's been a while since I fired up a map editor, but last I knew house tiles were set in RME the same way PZ tiles are.. Even if you had some sort of house tile overlay export it would be a huge pain in the ass to edit manually.


What exactly is the problem you are trying to solve? 🧐
 
You need to save the changes to the otbm file from in-game which have been made on the map. That experimental functions are on the forum, just search in codes section.
 
How would I be able to edit them and then save it back into the map?
For example, I want to (via code) add or remove new houses into the map. I have the coordinates for them.
I also want to delete some coordinates I have.

I understand it is not a one-liner, and this may be quite a "big project". But I'm just wondering if anyone has done it and if so how.
I did see some "OTB2JSON" on Github but that's Node.JS and I've never even touched anything with Node.

This would definitely require source mods. Are you planning on having something like donor houses being deployed via scripts? Or dynamically generated modular castles?

This big problem I see is you will definitely have to save this directly into the server OTBM or dynamically regenerate houses at startup.

If you do the first one map updates become a huge problem because after server shutdown your new edited map and your freshly saved server map have diffs. And this means you have to merge them. Which means a longer downtime everytime.

If you do the later, you will have to modify the code that loads and saves house time item stacks, so that those houses are loaded before the items are loaded, and possibly saved separately during regular server saves and before server shutdown. You'll also have to never open the server to players immediately, because you'll need to wait for houses to be loaded. I think sleeping players may be a problem too.
 
Back
Top