Ir para conteúdo

Featured Replies

Postado

Fala comunidade do TK

 

Alguém poderia fazer um script de 7 alavancas que removem 7 paredes? Cada alavanca remove sua própria parede em tal position, como se fosse uma POI, mas não pisando em tronos e sim puxando alavancas, e também precisa só apenas um player puxar elas que a parede sumirá .

 

Não consigo fazer isso de forma simplificada usando arrays , por mais simples que deve ser...

 

Agradeço e REP+ para a solução

 

Editado por Jordan422 (veja o histórico de edições)

  • Jordan422 mudou o título para [ACTION] (TFS 1x) Alavancas que removem paredes específicas
Postado

Olha, eu encontrei o script para TFS 1X... Não sei se deve funcionar.

local config = {
    walls = {
        {position = Position(330, 1716, 9), itemid = 2233},
        {position = Position(331, 1716, 9), itemid = 2233},
        {position = Position(332, 1716, 9), itemid = 2233}
    },
    lever = {
        duration = 60*60,
        storage = 13337
    }
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local currentTime = os.time()

    -- disallow to pull the lever for some time since last pull
    local timerAllowPullLeverAt = Game.getStorageValue(config.lever.storage)
    if timerAllowPullLeverAt ~= nil and currentTime < timerAllowPullLeverAt then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
        return true
    end
    
    -- disallow to pull the lever if any of walls does not exist
    local wallsToRemove, wallItem = {}
    for _, wall in ipairs(config.walls) do
        wallItem = Tile(wall.position):getItemById(wall.itemid)
        if wallItem == nil then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
            return true
        end

        wallsToRemove[#wallsToRemove + 1] = wallItem
    end

    -- remove walls
    for _, wallToRemove in ipairs(wallsToRemove) do
        wallToRemove:remove(1)
    end

    -- set timer to next lever pull
    Game.setStorageValue(config.lever.storage, currentTime + config.lever.duration)

    -- set event to recreate walls
    addEvent(function(walls)
        for _, wall in ipairs(walls) do
            Game.createItem(wall.itemid, 1, wall.position)
        end
    end, config.lever.duration * 1000, config.walls)

    -- pull the lever
    item:transform(item.itemid == 1946 and 1945 or 1946)
    return true
end

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 520.3k

Informação Importante

Confirmação de Termo