Lua Function Game.loadMapChunk(path, position, remove)

Delusion

Divine Intellect
Support Team
Joined
Feb 14, 2015
Messages
4,935
Best answers
451
Reaction score
2,547
Loads/unloads an OTBM file live into your server by using an offset.
File must be mapped starting from x:0 y:0 coordinates to make offset work properly.

Params:
Path: The path to the OTBM file (with the .otbm extension in it, example "data/world/test.otbm")
Position: The position offset (remember to put the map you're loading at x:0 y:0 in map editor so the offset works properly, example: Position(1000, 1000, 0) will offset x with +1000, y +1000, and z +0, so the map will load at Position(1000, 1000, 7) if you map it on the 7th floor)
Remove: Boolean, true makes it remove all items instead of adding them, if you want to just add/load the chunk you don't have to set this argument or set it to false if you do.

Code: dynamic map loader · delusionx/[email protected] (https://github.com/delusionx/forgottenserver/commit/2ab6f9a0a7e56e53fa1c2a84c95c5cc599ed0ed2)

Example:
Lua:
Game.loadMapChunk("data/world/test.otbm", Position(1000, 1000, 0)) -- load the chunk
addEvent(Game.loadMapChunk, 10000, "data/world/test.otbm", Position(1000, 1000, 0), true) -- remove it after 10 sec
 

Ochman

Premium User
Premium User
Joined
Feb 27, 2016
Messages
234
Best answers
3
Reaction score
144
This...
This, sir, is a big thing especially if you want event's to trigger different pieces of map.
I am impressed.
 
OP
Delusion

Delusion

Divine Intellect
Support Team
Joined
Feb 14, 2015
Messages
4,935
Best answers
451
Reaction score
2,547
This is for 1.3 right? 😁👍
Yes.
This...
This, sir, is a big thing especially if you want event's to trigger different pieces of map.
I am impressed.
That's exactly what the goal of it was, seamlessly replacing a section of a map like real tibia does with certain events.
 
Top