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

TFS 0.X Reading game locations from separate map files?

Slime

Active Member
Joined
Jan 25, 2014
Messages
115
Reaction score
32
Would it be possible to chunk my map into smaller .otbm files, like Diablo has spearate maps for each floor dungeon for example? It would be cool if players could use a command that shows current map and their x,y position, that would make finding npcs and other stuff way easier. My server is not going to use maps or ladders like in real tibia, stairs = teleport to other place, z = 7 always.
 
I guess a workaround is that you could just make it so that when a player is in a specific area of the map, it shows up where he is by using a command for it.
Let's say someone is in Thais, and if I want to use !find playername, it'll display "playername is in Thais, at (x,y,z).
Like, it wouldn't really be beneficial to chunk the map into smaller maps would it? You could just map the areas separately in one big mapfile.
 
You could utilize waypoints in RME to map out areas (instead of trying to split the map into chunks).
 
I guess a workaround is that you could just make it so that when a player is in a specific area of the map, it shows up where he is by using a command for it.
Let's say someone is in Thais, and if I want to use !find playername, it'll display "playername is in Thais, at (x,y,z).
Like, it wouldn't really be beneficial to chunk the map into smaller maps would it? You could just map the areas separately in one big mapfile.
Would it be something like creating a table with upper left and lower right corner of a certain location to determine map name? Then if Thais' upper corner is 950x750, calculating player position for !whereami command would be playerx - 949, playery - 749. Right?
 
Would it be something like creating a table with upper left and lower right corner of a certain location to determine map name? Then if Thais' upper corner is 950x750, calculating player position for !whereami command would be playerx - 949, playery - 749. Right?
Yes. Talkaction example:
PHP:
local locations = {
   { name = 'Thais', minX = 950, minY = 750, maxX = 1200, maxY = 1000 },
   { name = 'Carlin', minX = 150, minY = 250, maxX = 450, maxY = 350 },
}

function onSay(cid)
   local playerPosition = getCreaturePosition(cid)
   for _, location in pairs(locations) do
      if location.minX <= playerPosition.x and playerPosition.x <= location.maxX and
            location.minY <= playerPosition.y and playerPosition.y <= location.maxY then
         local posX = playerPosition.x - location.minX
         local posY = playerPosition.y - location.minY
         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are now in ' .. location.name .. '. ' ..
               'Your position is ' .. posX .. ',' .. posY .. '.')
         return false
      end
   end

   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are now in UNKNOWN LOCATION!')
   return false
end
 
Back
Top