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

Globalevent - Create and remove Wall from the map every two hours.

Mariuskens

Sword Art Online 2D-MMORPG
Joined
Nov 21, 2008
Messages
1,000
Reaction score
106
Location
Spain
GitHub
Olimpotibia
Hello Otland im working on the map at the moment and i have idea but i dont know how to write/build script to do one function, check here and i think anyone have someting to help me:

0b0e99260f408bab240e2881fa7ed33f.jpg


I need some script, he needs remove 1 of the 3 Energy Walls from the map every two hours randomly.
The important thing is if one wall is open, next two hours the next needs to be open but the old opened wall needs to be closed like regenerate the wall.
Thx you.
 
Solution
Hello Otland im working on the map at the moment and i have idea but i dont know how to write/build script to do one function, check here and i think anyone have someting to help me:

0b0e99260f408bab240e2881fa7ed33f.jpg


I need some script, he needs remove 1 of the 3 Energy Walls from the map every two hours randomly.
The important thing is if one wall is open, next two hours the next needs to be open but the old opened wall needs to be closed like regenerate the wall.
Thx you.
Try this one out:
Lua:
local previous_key = previous_key or nil
local walls_array = {
    [1] = {positions = {Position(1000, 1000, 7), Position(1000, 1000, 7)}, itemid = 25574},
    [2] = {positions = {Position(1000, 1000, 7)}...
Hello Otland im working on the map at the moment and i have idea but i dont know how to write/build script to do one function, check here and i think anyone have someting to help me:

0b0e99260f408bab240e2881fa7ed33f.jpg


I need some script, he needs remove 1 of the 3 Energy Walls from the map every two hours randomly.
The important thing is if one wall is open, next two hours the next needs to be open but the old opened wall needs to be closed like regenerate the wall.
Thx you.
Try this one out:
Lua:
local previous_key = previous_key or nil
local walls_array = {
    [1] = {positions = {Position(1000, 1000, 7), Position(1000, 1000, 7)}, itemid = 25574},
    [2] = {positions = {Position(1000, 1000, 7)}, itemid = 25574},
    [3] = {positions = {Position(1000, 1000, 7)}, itemid = 25574},
}

function onThink(interval)
    local random_key
    repeat
        random_key = math.random(#walls_array)
    until random_key ~= previous_key

    local wall_array = walls_array[random_key]
    for _, position in pairs(wall_array.positions) do
        local tile = Tile(position)
        local wall = tile and tile:getItemById(wall_array.itemid)
        if wall then
            wall:remove()
            addEvent(function(position, itemid)
                Game.createItem(itemid, 1, position)
            end, interval, position, wall_array.itemid)
        end
    end
    previous_key = random_key
    return true
end
 
Solution
Try this one out:
Lua:
local previous_key = previous_key or nil
local walls_array = {
    [1] = {positions = {Position(1000, 1000, 7), Position(1000, 1000, 7)}, itemid = 25574},
    [2] = {positions = {Position(1000, 1000, 7)}, itemid = 25574},
    [3] = {positions = {Position(1000, 1000, 7)}, itemid = 25574},
}

function onThink(interval)
    local random_key
    repeat
        random_key = math.random(#walls_array)
    until random_key ~= previous_key

    local wall_array = walls_array[random_key]
    for _, position in pairs(wall_array.positions) do
        local tile = Tile(position)
        local wall = tile and tile:getItemById(wall_array.itemid)
        if wall then
            wall:remove()
            addEvent(function(position, itemid)
                Game.createItem(itemid, 1, position)
            end, interval, position, wall_array.itemid)
        end
    end
    previous_key = random_key
    return true
end

Could you put to send a message broadcast when open and when close?
 
Back
Top