otland / forgottenserver

A free and open-source MMORPG server emulator written in C++
https://otland.net
GNU General Public License v2.0
1.61k stars 1.06k forks source link

LoadMap #1796

Open urban119 opened 8 years ago

urban119 commented 8 years ago

Hello It is possible, to loadMap as specified start position x,y,z ?

If i use loadMap(data/map.otbm) it imposes two map... Can You direct me, what function i need edit, when map Starts load?

Maybe class Map: void setTile(uint16_t x, uint16_t y, uint8_t z, Tile* newTile); void setTile(const Position& pos, Tile* newTile) {
setTile(pos.x, pos.y, pos.z, newTile); }

Regards

marksamman commented 8 years ago

No, it's not possible, but loadMap could be extended to allow offset arguments.

EvilHero90 commented 8 years ago

do you just want to load a certain part of the map and re create it somewhere else, or what are you trying to achieve?

urban119 commented 8 years ago

I try load fragment part of the map in Main map. Just put a little fragment... It is possible, because second fragment a map been added to Main map, started as x,y (because position xyz on loaded second map has been the same in Main map when it been loaded). I just need moved example x + 50, y + 50 loading fragment map.

I just do function like Dungeon, Raids, BattleMap for TeamPlayers. (Like dungeon system in World Of Warcraft).

ranisalt commented 8 years ago

That idea is very nice.

EvilHero90 commented 8 years ago

actually you can do that pretty easy completly in lua aswell, I've once written what you suggested here using coroutines and such, so it didn't affect server performence and such here's the youtube link https://youtu.be/sqSWUJy_wa4 https://www.youtube.com/watch?v=HG8hFqU0zI0 If you want it feel free to hit me up.

totolol123 commented 8 years ago

Nice, would be very useful

urban119 commented 8 years ago

I search function, to add offset and moved generated fragment map. Why i have problem and want this to do? Becouse if I am load more copy of fragment map, I am need do loadmap with offset + 1000 example. If i do that, i can load example x5 fragment map for x5 team. Each of the teams have separate map for myself. (other thema is delete nousing map and other clearing function, but not yet to speak). I do that in luascript.... but i wanna do werry fast, accurate and without errors load map... and source give exacly that for me. Youtube for You: https://youtu.be/xkvfVS5VZIg

EvilHero90 commented 8 years ago

Well my function does exactly what you are asking for, it's combined with an indexing system to be able to locate all maps with their coordinates, you have to keep in mind if you copy a map and it contains levers and such you need to provide the scripts the offset aswell or it wont work at all

urban119 commented 8 years ago

How to contact you @EvilHero90 ?

EvilHero90 commented 8 years ago

Skype: evilhero19, I'm still at work tho

urban119 commented 8 years ago

Okey I am end that work and say It is Done! Watch me video 0:48: https://youtu.be/gNEJnYDhcT8

I don't want do that functions with lua files (probably lags server).... I am edit only source and me new function loadMapU (its not laging server). It is exacly what i want ;)

ranisalt commented 8 years ago

Lua performance is generally not an issue. Please do consider the effort of recompiling everytime and the extra issues of lower level programming of C++ when choosing not to use Lua.

totolol123 commented 8 years ago

@urban119 can you do a pull request with it?

urban119 commented 8 years ago

1837

Codex-NG commented 8 years ago

I've accomplished a lot more with c++ than I ever have with lua, sometimes editing or making a slight change in the source is much easier and less time consuming than writing a complex script.