Ir para conteúdo
  • Cadastre-se

Action%2FTalkaction [TFS 1.2] The Silencer Plateau - Lure Silencers


Posts Recomendados

Video de Demonstração

 

________________________________________________

Baseado neste evento: 

http://www.tibiawiki.com.br/wiki/Silencer_Plateau

________________________________________________

data/actions/script/ResonanceChamber.lua

--Config
local config = {
        item = 22535,
        storage = 34380,
        position = {
        Position(33637, 32516, 5), -- Top Left
                Position(33664, 32537, 5), -- botton Right
                Position(33650, 32527, 5)  -- Center
    },
    raid = {
        [1] = {"silencer", math.random(8,15) },
        [2] = {"silencer", math.random(11,18) },
        [3] = {"silencer", math.random(8,15) },
        [4] = {"Sight of Surrender", math.random(3,8) }
        },
        globalEventTime = 30 * 60 * 1000, -- [30min] waiting time to get started again
        timeBetweenraid = 1  * 60 * 1000, -- [1min] Waiting time between each raid
        cleanraid = true -- Clean zone after globalEventTime
}
 
 
local function isWalkable(position)
    local tile = Tile(position)
    if not tile then
        return false
    end
 
    local ground = tile:getGround()
    if not ground or ground:hasProperty(CONST_PROP_BLOCKSOLID) then
        return false
    end
 
    local items = tile:getItems()
    for i = 1, tile:getItemCount() do
        local item = items[i]
        local itemType = item:getType()
        if itemType:getType() ~= ITEM_TYPE_MAGICFIELD and not itemType:isMovable() and item:hasProperty(CONST_PROP_BLOCKSOLID) then
            return false
        end
    end
    return true
end
 
local function raids(monster)
        local randX,randY,randZ = 0,0,0
        randX = math.random(config.position[1].x, config.position[2].x)
        randY = math.random(config.position[1].y, config.position[2].y)
        randZ = math.random(config.position[1].z, config.position[2].z)
        if isWalkable(Position(randX, randY, randZ)) then
                Game.createMonster(monster, Position(randX, randY, randZ))
        else
                raids(monster)
        end
end
 
local function cleanRaid()
        local mostersraid= Game.getSpectators(config.position[3], false, false, 13, 13, 11, 11)
    for i = 1, #mostersraid do
        if mostersraid[i]:isMonster() then
                        mostersraid[i]:remove()
                end
        end
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
        local player = Player(cid)
        local max,time,monster = 0,0,""
 
    if item.itemid ~= config.item then
        return true
    end
    local spectators,hasPlayer,hasMonsters = Game.getSpectators(config.position[3], false, false, 13, 13, 11, 11),false,false
    for i = 1, #spectators do
        if spectators[i]:isPlayer() then
                        if spectators[i]:getName() == player:getName() then
                                hasPlayer = true
                        end
                elseif spectators[i]:isMonster() then
                        hasMonsters = true
                end
        end
        if not hasPlayer then
                player:sendCancelMessage('Use on Silencer Plateau is located in the south-eastern part of Roshamuul')
                return true
        end
        if hasMonsters then
                player:sendCancelMessage('You need kill all monsters')
                return true
        end
 
 
        if Game.getStorageValue(config.storage) <= 0 then
                if math.random(0,10000) < 7000 then
                        player:say("PRRRR...*crackle*", TALKTYPE_MONSTER_SAY)
                        item:remove(1)
                        return true
                else
                        player:say("PRRRROOOOOAAAAAHHHH!!!", TALKTYPE_MONSTER_SAY)
                end
                local raid = config.raid
                for y, x in pairs(raid) do
                        local i = 1
                        while i <= #x  do
                                print(x[i])
                                print(x[i+1])
                                time = time + config.timeBetweenraid
                                for j = 1, x[i+1] do
                                        Game.setStorageValue(config.storage,x[i+1])
                                        addEvent(raids,time,x[i])
                                end
                                i = i + 2
                    end
                end
                addEvent(Game.setStorageValue, config.globalEventTime, config.storage, 0)
                if config.cleanraid then
                        addEvent(cleanRaid, config.globalEventTime)
                end
                item:remove(1)
        else
                player:sendCancelMessage('You need to wait')
        end    
end

data/actions/actions.xml

<action itemid="22535" script=ResonanceChamber.lua"/>

________________________________________________

Créditos: Omin

Editado por Azhaurn (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
Em nome da comunidade do TK, muito obrigado pela contribuição! :wow: Seu tópico de conteúdo foi aprovado e será movido para a seção adequada. Você ganhou 1 REP+!
                              _
                          .-'` `}
                  _./)   /       }
                .'o   \ |       }
                '.___.'`.\    {`
                /`\_/  , `.    }                                      ME DA UMA NOZ!
                \=' .-'   _`\  {
                 `'`;/      `,  }
                    _\   @   ;  }
                   /__`;-...'--'

Cluck!

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por Tricoder
      Preview

       
      Script
      data/items/items.xml
      <item id="8981" article="a" name="gold premium card"> <attribute key="weight" value="0" /> <attribute key="description" value="Use this card to receive 7 premium days." /> </item> data/actions/actions.xml
      <action itemid="8981" script="other/premiumcard.lua"/> data/actions/scripts/premium_card
      local t = { days = 7, effect = CONST_ME_HOLYAREA } function onUse(cid, item, fromPosition, itemEx, toPosition) doPlayerRemoveItem(cid, 8981, 1) return TRUE, doPlayerAddPremiumDays(cid, t.days), doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You now have +" .. t.days .. " premium days!"), doSendMagicEffect(fromPosition, t.effect) end Créditos: God Mythera
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo