Ir para conteúdo

Featured Replies

Postado

Ola Tk, eu estava configurando um script de arena no meu servidor, mas eu tentei algumas vezes e todas elas acabavam dando algum erro, e queria uma pequena ajuda pra poder configurar o mesmo, se alguem puder me ajudar ficaria mto grato.

O Primeiro PIT que serve como base ja esta configurado, falta apenas os outros, e tambem resolver um erro que quando mata o boss o pilar sai do lugar, mas nao nasce um teleport ;x

 

Script



--[[
    TODO
        - Include PITS and ARENA table in SvargrondArena -> SvargrondArena.arenas / SvargrondArena.pits
        - Restructure PITS and ARENA table (reward.storage does not seem to be used)
]]

SvargrondArena = {
    -- kick time in seconds (10 minutes)
    kickTime = 600,
    kickPosition = Position(450, 760, 5),
    rewardPosition = Position(450, 760, 5),

    -- used to store event ids
    kickEvents = {},
    timerEvents = {},
    effectPositionCache = {},

    -- item ids used by the script
    itemTimer = 10288,
    itemPillar = 1354,
    itemTeleport = 5023,
    itemsNotErasable = {10288, 1354, 1543, 1544, 1545},
}

-- Script automatically derives other pit positions from this one
local firstPit = {
    fromPos = {x = 422, y = 760, z = 6},
    toPos = {x = 431, y = 769, z = 6},
    center = {x = 427, y = 764, z = 6},
    pillar = {x = 421, y = 764, z = 6},
    tp = {x = 426, y = 770, z = 6},
    summon = {x = 427, y = 766, z = 6}
}

PITS = {
    [1] = {
        fromPos = firstPit.fromPos,
        toPos = firstPit.toPos,
        center = firstPit.center,
        pillar = firstPit.pillar,
        tp = firstPit.tp,
        summon = firstPit.summon
    },
    [2] = {
        fromPos = {x = firstPit.fromPos.x - 14, y = firstPit.fromPos.y, z = firstPit.fromPos.z},
        toPos = {x = firstPit.toPos.x - 14, y = firstPit.toPos.y, z = firstPit.toPos.z},
        center = {x = firstPit.center.x - 14, y = firstPit.center.y, z = firstPit.center.z},
        pillar = {x = firstPit.pillar.x - 14, y = firstPit.pillar.y, z = firstPit.pillar.z},
        tp = {x = firstPit.tp.x - 14, y = firstPit.tp.y, z = firstPit.tp.z},
        summon = {x = firstPit.summon.x - 14, y = firstPit.summon.y, z = firstPit.summon.z}
    },
    [3] = {
        fromPos = {x = firstPit.fromPos.x - 28, y = firstPit.fromPos.y, z = firstPit.fromPos.z},
        toPos = {x = firstPit.toPos.x - 28, y = firstPit.toPos.y, z = firstPit.toPos.z},
        center = {x = firstPit.center.x - 28, y = firstPit.center.y, z = firstPit.center.z},
        pillar = {x = firstPit.pillar.x - 28, y = firstPit.pillar.y, z = firstPit.pillar.z},
        tp = {x = firstPit.tp.x - 28, y = firstPit.tp.y, z = firstPit.tp.z},
        summon = {x = firstPit.summon.x - 28, y = firstPit.summon.y, z = firstPit.summon.z}
    },
    [4] = {
        fromPos = {x = firstPit.fromPos.x - 42, y = firstPit.fromPos.y, z = firstPit.fromPos.z},
        toPos = {x = firstPit.toPos.x - 42, y = firstPit.toPos.y, z = firstPit.toPos.z},
        center = {x = firstPit.center.x - 42, y = firstPit.center.y, z = firstPit.center.z},
        pillar = {x = firstPit.pillar.x - 42, y = firstPit.pillar.y, z = firstPit.pillar.z},
        tp = {x = firstPit.tp.x - 42, y = firstPit.tp.y, z = firstPit.tp.z},
        summon = {x = firstPit.summon.x - 42, y = firstPit.summon.y, z = firstPit.summon.z}
    },
    [5] = {
        fromPos = {x = firstPit.fromPos.x - 35, y = firstPit.fromPos.y - 14, z = firstPit.fromPos.z},
        toPos = {x = firstPit.toPos.x - 35, y = firstPit.toPos.y - 14, z = firstPit.toPos.z},
        center = {x = firstPit.center.x - 35, y = firstPit.center.y - 14, z = firstPit.center.z},
        pillar = {x = firstPit.pillar.x - 35, y = firstPit.pillar.y - 14, z = firstPit.pillar.z},
        tp = {x = firstPit.tp.x - 35, y = firstPit.tp.y - 14, z = firstPit.tp.z},
        summon = {x = firstPit.summon.x - 35, y = firstPit.summon.y - 14, z = firstPit.summon.z}
    },
    [6] = {
        fromPos = {x = firstPit.fromPos.x - 21, y = firstPit.fromPos.y - 14, z = firstPit.fromPos.z},
        toPos = {x = firstPit.toPos.x - 21, y = firstPit.toPos.y - 14, z = firstPit.toPos.z},
        center = {x = firstPit.center.x - 21, y = firstPit.center.y - 14, z = firstPit.center.z},
        pillar = {x = firstPit.pillar.x - 21, y = firstPit.pillar.y - 14, z = firstPit.pillar.z},
        tp = {x = firstPit.tp.x - 21, y = firstPit.tp.y - 14, z = firstPit.tp.z},
        summon = {x = firstPit.summon.x - 21, y = firstPit.summon.y - 14, z = firstPit.summon.z}
    },
    [7] = {
        fromPos = {x = firstPit.fromPos.x - 7, y = firstPit.fromPos.y - 14, z = firstPit.fromPos.z},
        toPos = {x = firstPit.toPos.x - 7, y = firstPit.toPos.y - 14, z = firstPit.toPos.z},
        center = {x = firstPit.center.x - 7, y = firstPit.center.y - 14, z = firstPit.center.z},
        pillar = {x = firstPit.pillar.x - 7, y = firstPit.pillar.y - 14, z = firstPit.pillar.z},
        tp = {x = firstPit.tp.x - 7, y = firstPit.tp.y - 14, z = firstPit.tp.z},
        summon = {x = firstPit.summon.x - 7, y = firstPit.summon.y - 14, z = firstPit.summon.z}
    },
    [8] = {
        fromPos = {x = firstPit.fromPos.x - 14, y = firstPit.fromPos.y - 28, z = firstPit.fromPos.z},
        toPos = {x = firstPit.toPos.x - 14, y = firstPit.toPos.y - 28, z = firstPit.toPos.z},
        center = {x = firstPit.center.x - 14, y = firstPit.center.y - 28, z = firstPit.center.z},
        pillar = {x = firstPit.pillar.x - 14, y = firstPit.pillar.y - 28, z = firstPit.pillar.z},
        tp = {x = firstPit.tp.x - 14, y = firstPit.tp.y - 28, z = firstPit.tp.z},
        summon = {x = firstPit.summon.x - 14, y = firstPit.summon.y - 28, z = firstPit.summon.z}
    },
    [9] = {
        fromPos = {x = firstPit.fromPos.x - 28, y = firstPit.fromPos.y - 28, z = firstPit.fromPos.z},
        toPos = {x = firstPit.toPos.x - 28, y = firstPit.toPos.y - 28, z = firstPit.toPos.z},
        center = {x = firstPit.center.x - 28, y = firstPit.center.y - 28, z = firstPit.center.z},
        pillar = {x = firstPit.pillar.x - 28, y = firstPit.pillar.y - 28, z = firstPit.pillar.z},
        tp = {x = firstPit.tp.x - 28, y = firstPit.tp.y - 28, z = firstPit.tp.z},
        summon = {x = firstPit.summon.x - 28, y = firstPit.summon.y - 28, z = firstPit.summon.z}
    },
    [10] = {
        fromPos = {x = firstPit.fromPos.x - 21, y = firstPit.fromPos.y - 42, z = firstPit.fromPos.z},
        toPos = {x = firstPit.toPos.x - 21, y = firstPit.toPos.y - 42, z = firstPit.toPos.z},
        center = {x = firstPit.center.x - 21, y = firstPit.center.y - 41, z = firstPit.center.z},
        pillar = {x = firstPit.pillar.x - 21, y = firstPit.pillar.y - 41, z = firstPit.pillar.z},
        tp = {x = firstPit.tp.x - 21, y = firstPit.tp.y - 41, z = firstPit.tp.z},
        summon = {x = firstPit.summon.x - 21, y = firstPit.summon.y - 41, z = firstPit.summon.z}
    }
}

ARENA = {
    [1] = {
        name = 'Greenhorn',
        price = 1000,
        questLog = Storage.SvargrondArena.QuestLogGreenhorn,
        achievement = 'Greenhorn',
        creatures = {
            [1] = 'frostfur',
            [2] = 'bloodpaw',
            [3] = 'bovinus',
            [4] = 'achad',
            [5] = 'colerian the barbarian',
            [6] = 'the hairy one',
            [7] = 'axeitus headbanger',
            [8] = 'rocky',
            [9] = 'cursed gladiator',
            [10] = 'orcus the cruel'
        },
        reward = {
            trophy = 5807,
            trophyStorage = Storage.SvargrondArena.TrophyGreenhorn,
            desc = 'It is given to the courageous victor of the barbarian arena in greenhorn difficulty. Awarded to %s',
        }
    },
    [2] = {
        name = 'Scrapper',
        price = 5000,
        questLog = Storage.SvargrondArena.QuestLogScrapper,
        achievement = 'Scrapper',
        creatures = {
            [1] = 'avalanche',
            [2] = 'kreebosh the exile',
            [3] = 'the dark dancer',
            [4] = 'the hag',
            [5] = 'slim',
            [6] = 'grimgor guteater',
            [7] = 'drasilla',
            [8] = 'spirit of earth',
            [9] = 'spirit of water',
            [10] = 'spirit of fire'
        },
        reward = {
            trophy = 5806,
            trophyStorage = Storage.SvargrondArena.TrophyScrapper,
            desc = 'It is given to the courageous victor of the barbarian arena in scrapper difficulty. Awarded to %s.',
        }
    },
    [3] = {
        name = 'Warlord',
        price = 10000,
        questLog = Storage.SvargrondArena.QuestLogWarlord,
        achievement = 'Warlord of Svargrond',
        creatures = {
            [1] = 'webster',
            [2] = 'darakan the executioner',
            [3] = 'norgle glacierbeard',
            [4] = 'the pit lord',
            [5] = 'svoren the mad',
            [6] = 'the masked marauder',
            [7] = 'gnorre chyllson',
            [8] = 'fallen mooh\'tah master ghar',
            [9] = 'deathbringer',
            [10] = 'the obliverator'
        },
        reward = {
            trophy = 5805,
            trophyStorage = Storage.SvargrondArena.TrophyWarlord,
            desc = 'It is given to the courageous victor of the barbarian arena in warlord difficulty. Awarded to %s.',
        }
    }
}

function SvargrondArena.getPitCreatures(pitId)
    if not PITS[pitId] then
        return {}
    end

    local ret = {}
    local specs = Game.getSpectators(PITS[pitId].center, false, false, 5, 5, 5, 5)
    for i = 1, #specs do
        ret[#ret+1] = specs
    end

    return ret
end

function SvargrondArena.resetPit(pitId)
    if not PITS[pitId] then
        return
    end

    for x = PITS[pitId].fromPos.x, PITS[pitId].toPos.x do
        for y = PITS[pitId].fromPos.y, PITS[pitId].toPos.y do
            for z = PITS[pitId].fromPos.z, PITS[pitId].toPos.z do
                local tile = Tile({x=x, y=y, z=z})
                if tile then
                    local movableItem = tile:getThing(255)
                    if movableItem and movableItem:isItem() then
                        local itemType = ItemType(movableItem:getId())
                        if itemType and itemType:isMovable() and not isInArray(SvargrondArena.itemsNotErasable, movableItem:getId()) then
                            moveableItem:remove()
                        end
                    end

                    local creature = tile:getTopCreature()
                    if creature and creature:isMonster() then
                        creature:remove()
                    end
                end
            end
        end
    end

    local pillarTile = Tile(PITS[pitId].pillar)
    if pillarTile then
        local teleportItem = pillarTile:getItemById(SvargrondArena.itemTeleport)
        if teleportItem then
            teleportItem:remove()
        end

        local pillarItem = pillarTile:getItemById(SvargrondArena.itemPillar)
        if not pillarItem then
            Game.createItem(SvargrondArena.itemPillar, 1, PITS[pitId].pillar)
        end
    end
end

function SvargrondArena.getPitOccupant(pitId, ignorePlayer)
    local creatures = SvargrondArena.getPitCreatures(pitId)
    for i = 1, #creatures do
        if creatures:isPlayer() and creatures:getId() ~= ignorePlayer:getId() then
            return creatures
        end
    end

    return nil
end

function SvargrondArena.kickPlayer(cid, hideMessage)
    SvargrondArena.cancelEvents(cid)
    local player = Player(cid)
    if not player then
        return
    end

    if player:getStorageValue(Storage.SvargrondArena.Pit) > 0 then
        player:teleportTo(SvargrondArena.kickPosition)
        SvargrondArena.kickPosition:sendMagicEffect(CONST_ME_TELEPORT)
        player:setStorageValue(Storage.SvargrondArena.Pit, 0)
        if not hideMessage then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Your time ran out!')
        end
    end
end

function SvargrondArena.cancelEvents(cid)
    local kickEvent = SvargrondArena.kickEvents[cid]
    if kickEvent then
        SvargrondArena.removeTimer(kickEvent.pitId)
        stopEvent(kickEvent.eventId)
    end
    SvargrondArena.kickEvents[cid] = nil
end

function SvargrondArena.scheduleKickPlayer(cid, pitId)
    SvargrondArena.cancelEvents(cid)
    SvargrondArena.startTimer(pitId)
    local eventId = addEvent(SvargrondArena.kickPlayer, SvargrondArena.kickTime * 1000, cid)
    SvargrondArena.kickEvents[cid] = {eventId = eventId, pitId = pitId}
end

function SvargrondArena.startTimer(pitId)
    local tile = Tile(PITS[pitId].fromPos)
    if not tile then
        return
    end

    local timerItem = tile:getItemById(SvargrondArena.itemTimer)
    if timerItem then
        timerItem:remove()
    end

    timerItem = Game.createItem(SvargrondArena.itemTimer, 1, PITS[pitId].fromPos)
    if timerItem then
        timerItem:decay()
    end

    if SvargrondArena.timerEvents[pitId] then
        stopEvent(SvargrondArena.timerEvents[pitId])
    end
    SvargrondArena.timerEvents[pitId] = addEvent(SvargrondArena.removeTimer, SvargrondArena.kickTime * 1000, pitId)
end

function SvargrondArena.removeTimer(pitId)
    local tile = Tile(PITS[pitId].fromPos)
    if not tile then
        return
    end

    local timerItem = tile:getItemById(SvargrondArena.itemTimer)
    if timerItem then
        timerItem:remove()
    end
    SvargrondArena.timerEvents[pitId] = nil
end

function .sendPillarEffect(pitId)
    local positions = SvargrondArena.effectPositionCache[pitId]
    if not positions then
        local position = PITS[pitId].pillar
        local effectPositions = {
                Position(position.x - 1, position.y,     position.z),
                Position(position.x + 1, position.y,     position.z),
                Position(position.x + 1, position.y - 1, position.z),
                Position(position.x + 1, position.y + 1, position.z),
                Position(position.x,     position.y,     position.z)
        }
        SvargrondArena.effectPositionCache[pitId] = effectPositions
        positions = effectPositions
    end

    for i = 1, #positions do
        positions:sendMagicEffect(CONST_ME_MAGIC_BLUE)
    end
end
 

 

Aqui tem algumas fotos que podem ajudar a configurar.

Se faltar alguma informação por favor me avisem 

 

QXlJCGJ.jpg

 

cFooHln.jpg

 

sLYqi8V.jpg

 

 

 

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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo