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

Lua Dota event movements

gremlee

Qumora.com
Joined
Jul 15, 2008
Messages
511
Reaction score
16
Hello i need to config this one so it only spawn one stone after event because if they are 10 ppl running into the teleport it will spawn 10 stones :S

Code:
    for posx = 1, #positionsx do
        if getTileItemById(positionsx[posx], 1353).uid < 1 and getGlobalStorageValue(1904) < os.time() then
            addEvent(doCreateItem, 30*60*1000, 1353, 1, positionsx[posx])
            if posx == #positionsx then
                setGlobalStorageValue(1904, os.time() + 30*60)
            end
        end
    end
    for posz = 1, #positionsz do
        if getTileItemById(positionsz[posz], 1354).uid < 1 and getGlobalStorageValue(1905) < os.time() then
            addEvent(doCreateItem, 30*60*1000, 1354, 1, positionsz[posz])
            if posz == #positionsz then
                setGlobalStorageValue(1905, os.time() + 30*60)
            end
        end
    end
 
Before spawning a new TP, check the globalstorage and make sure the time has been expired.
 
Its event called dota 2 teams fighting against eachother they need to kill 3 towers each, and its like stones that blocks so they just cant pass everthing when they kill 1 tower they remove at the end when they go into teleport for reward the script reseting the stones, but if they are like 10 peoples it will spawn 10 stones inside eachother i need to make it only 1 time but dont know how :S

@Znote
 
Last edited by a moderator:
Put the full LUA so we can assist you

Code:
local config = {
  rewards_id = {10141, 10140, 10137, 11261}, -- Rewards ID
}

local positions = { -- itemid 1304
  {x=685,y=44,z=7},
  {x=685,y=43,z=7},
  {x=685,y=42,z=7},
  {x=685,y=41,z=7},
  {x=685,y=40,z=7},
  {x=673,y=44,z=7},
  {x=601,y=44,z=7},
  {x=601,y=43,z=7},
  {x=601,y=42,z=7},
  {x=601,y=41,z=7},
  {x=601,y=40,z=7}
}
local positionst = { -- itemid 1354
  {x=673,y=43,z=7},
  {x=673,y=42,z=7},
  {x=673,y=41,z=7},
  {x=673,y=40,z=7},
  {x=661,y=44,z=7},
  {x=661,y=43,z=7},
  {x=661,y=42,z=7},
  {x=661,y=41,z=7},
  {x=661,y=40,z=7}
}
local positionsy = { -- itemid 1353 
  {x=613,y=44,z=7},
  {x=613,y=43,z=7},
  {x=613,y=42,z=7},
  {x=613,y=41,z=7},
  {x=613,y=40,z=7},
  {x=625,y=44,z=7},
  {x=625,y=43,z=7},
  {x=625,y=42,z=7},
  {x=625,y=41,z=7},
  {x=625,y=40,z=7}
}

local positionsx = { -- itemid 1353
  {x=640,y=42,z=7},
  {x=638,y=43,z=7}
}
local positionsz = { -- itemid 1354
  {x=648,y=40,z=7},
  {x=646,y=42,z=7}
}


function onStepIn(cid, item, frompos, item2, topos)
    local random_item = config.rewards_id[math.random(1, #config.rewards_id)]
    local item_name =  getItemNameById(random_item)

    for pos = 1, #positions do
        if getTileItemById(positions[pos], 1304).uid < 1 then
            doCreateItem(1304, 1, positions[pos])
        end
    end
    for post = 1, #positionst do
        if getTileItemById(positionst[post], 1354).uid < 1 then
            doCreateItem(1354, 1, positionst[post])
        end
    end
    for posy = 1, #positionsy do
        if getTileItemById(positionsy[posy], 1353).uid < 1 then
            doCreateItem(1353, 1, positionsy[posy])
        end
    end
    for posx = 1, #positionsx do
        if getTileItemById(positionsx[posx], 1353).uid < 1 and getGlobalStorageValue(1904) < os.time() then
            addEvent(doCreateItem, 30*60*1000, 1353, 1, positionsx[posx])
            if posx == #positionsx then
                setGlobalStorageValue(1904, os.time() + 30*60)
            end
        end
    end
    for posz = 1, #positionsz do
        if getTileItemById(positionsz[posz], 1354).uid < 1 and getGlobalStorageValue(1905) < os.time() then
            addEvent(doCreateItem, 30*60*1000, 1354, 1, positionsz[posz])
            if posz == #positionsz then
                setGlobalStorageValue(1905, os.time() + 30*60)
            end
        end
    end
    doPlayerSetTown(cid, 1)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Your team won the dota round! You winner: '.. item_name ..' !')
    doPlayerAddItem(cid, random_item, 1)
    return true
end
 
Back
Top