• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

World Change

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,764
Solutions
1
Reaction score
227
Location
Chile, Santiago
Hey all,

I have been looking at forum about this topic, but just found this:

Here Rl Data 10.77 https://github.com/orts/server#orts-a-real-map-datapack
/data/globalevents/globalevents.xml
Code:
<!-- World Changes -->
<globalevent name="FuryGates" type="startup" script="worldchanges/furygates.lua" />

/data/globalevents/scripts/worldchanges/furygates.lua
Code:
function onStartup(interval)
    Game.setStorageValue(GlobalStorage.FuryGates, math.random(6))
end

I have been reading the code which is this one:

Code:
local config = {
[1] = { -- Ankrahmun
removeItems = {
{position = Position(33096, 32882, 6), itemId = 4978},
{position = Position(33096, 32883, 6), itemId = 4978},
{position = Position(33096, 32883, 6), itemId = 4922},
{position = Position(33096, 32884, 6), itemId = 4922},
{position = Position(33096, 32885, 6), itemId = 4922}
},
fromPosition = Position(33099, 32875, 7),
toPosition = Position(33106, 32893, 7),
mapName = 'ankrahmun',
yasirPosition = Position(33102, 32884, 6)
},
[2] = { -- Carlin
removeItems = {
{position = Position(32393, 31814, 6), itemId = 10408},
{position = Position(32393, 31815, 6), itemId = 10408},
{position = Position(32393, 31816, 6), itemId = 10408}
},
fromPosition = Position(32397, 31806, 7),
toPosition = Position(32403, 31824, 7),
mapName = 'carlin',
yasirPosition = Position(32400, 31815, 6)
},
[3] = { -- Liberty Bay
fromPosition = Position(32311, 32884, 1),
toPosition = Position(32318, 32904, 7),
mapName = 'libertybay',
yasirPosition = Position(32314, 32895, 6)
}
}
local yasirEnabled = true
local yasirChance = 33
local function spawnYasir(position)
local npc = Game.createNpc('Yasir', position)
if npc then
npc:setMasterPos(position)
end
end
function onStartup()
if yasirEnabled then
math.randomseed(os.time())
if math.random(100) <= yasirChance then
local randTown = config[math.random(#config)]
iterateArea(
function(position)
local tile = Tile(position)
if tile then
local items = tile:getItems()
if items then
for i = 1, #items do
items[i]:remove()
end
end
local ground = tile:getGround()
if ground then
ground:remove()
end
end
end,
randTown.fromPosition,
randTown.toPosition
)
if randTown.removeItems then
local item
for i = 1, #randTown.removeItems do
item = Tile(randTown.removeItems[i].position):getItemById(randTown.removeItems[i].itemId)
if item then
item:remove()
end
end
end
Game.loadMap('data/world/yasir/' .. randTown.mapName .. '.otbm')
addEvent(spawnYasir, 5000, randTown.yasirPosition)
end
end
end

So, with those functions I am able to remove tile ids and replace them one by one... But what about if I have a huge change like the volcano at goroma... Is there any other option to make this happen?

Any ideas, suggestions?
 
Back
Top