Ir para conteúdo
  • Cadastre-se

(Resolvido)[Ajuda] Action Quest


Ir para solução Resolvido por Dwarfer,

Posts Recomendados

Tá errado aí

 topLeftPos = {x = 1736, y = 1855, z = 8},

É a posição do canto superior esquerdo da sala, perto do pilar lá

 

bottomRightPos = {x = 1736, y = 1855, z = 8}

 

É a posição do canto inferior direito da sala, perto do ultimo pilar.

 

bQRE1de.png

 

 

E usa esse aqui, configura ali o monstro e tals

 

Spoiler

 local config = {
    money = 1000,
    daily = "no",
    level = 5,
    storage = 30015,
    areas = {
        [1] = {
            topLeftPos = {x = 1736, y = 1855, z = 8},
            bottomRightPos = {x = 1736, y = 1855, z = 8},
        },
        [2] = {
            topLeftPos = {x = 1736, y = 1855, z = 8},
            bottomRightPos = {x = 1736, y = 1855, z = 8},
        },
    },
    entry = {
        {x = 1085, y = 1145, z = 6},
    },
    destination = {
        {x = 1082, y = 11144, z = 6},
    }
}

local posmonstro = {x = 1083. y = 11144, z = 6}
local monstro = "Nome"
 
config.daily = getBooleanFromString(config.daily)

local function CheckAnihilationInUse()
    for i = 1, #config.areas do
        for x = config.areas.topLeftPos.x, config.areas.bottomRightPos.x do
            for y = config.areas.topLeftPos.y, config.areas.bottomRightPos.y do
                for z = config.areas.topLeftPos.z, config.areas.bottomRightPos.z do
                    local creature = getTopCreature({x = x, y = y, z = z}).uid
                    if isPlayer(creature) then
                        return true
                    end
                end
            end
        end
    end
    return false
end

local function RemoveMonsters()
    local monsters = {}
    for i = 1, #config.areas do
        for x = config.areas.topLeftPos.x, config.areas.bottomRightPos.x do
            for y = config.areas.topLeftPos.y, config.areas.bottomRightPos.y do
                for z = config.areas.topLeftPos.z, config.areas.bottomRightPos.z do
                    local position = {x = x, y = y, z = z, stackpos = 253}
                    local creature = getThingfromPos(position)
                    if isMonster(creature.uid) then
                        table.insert(monsters, creature.uid)
                    end
                end
            end
        end
    end
    for m in pairs(monsters) do
        doRemoveCreature(m)
    end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.itemid == 6265) then
        if(config.daily) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
        else
            doTransformItem(item.uid, item.itemid - 1)
        end
        return true
    end
     
    if(item.itemid ~= 6265) then
        return true
    end
    
    if CheckAnihilationInUse() then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "A arena esta em uso, espere.")
        return true
    end
    
    local players = {}
    for _, position in ipairs(config.entry) do
        local pid = getTopCreature(position).uid
        if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level or getPlayerMoney(cid) < config.money) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "No minimo players de level ".. config.level .." e possuir ".. config.money .." gold coins.")
            return true
        end
        table.insert(players, pid)
    end
    RemoveMonsters()
    doCreateMonster(monstro, posmonstro)
    doSendMagicEffect(config.entry, CONST_ME_POFF)
    doTeleportThing(cid, config.destination, false)
    doSendMagicEffect(config.destination, CONST_ME_ENERGYAREA)        
    
    doTransformItem(item.uid, item.itemid + 1)
    return true
end 

 

 

 

 

 

 

 

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

Life is so meaningless, there is nothing worth a smile
So goodbye, I'll miss you

 

 

sugestões?

 

 

Link para o post
Compartilhar em outros sites
  • Respostas 17
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Como assim não precisa estar na mão? Você colocou no tópico que "o Player clicka na porta com o XXX Item na mão", da próxima vez tente deixar seu pedido bem detalhado. Fiz a alteração para verificar se o player possui o item, independente de estar na mão.      Com relação ao erro, se você configurar as posições corretamente, vai funcionar.

Posted Images

@psychonaut

Deu errado :( , a porta ficou de lado dnv, e não aconteceu nada. :(

 

ItemID: [2091]. < ID Da Key

Editado por OfWar
Esqueci de por key (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
Spoiler


 local config = {
    money = 1000,
    daily = "no",
    level = 5,
    storage = 30015,
    areas = {
        [1] = {
            topLeftPos = {x = 1736, y = 1855, z = 8},
            bottomRightPos = {x = 1736, y = 1855, z = 8},
        },
        [2] = {
            topLeftPos = {x = 1736, y = 1855, z = 8},
            bottomRightPos = {x = 1736, y = 1855, z = 8},
        },
    },
    entry = {
        {x = 1085, y = 1145, z = 6},
    },
    destination = {
        {x = 1082, y = 11144, z = 6},
    }
}

local posmonstro = {x = 1083. y = 11144, z = 6}
local monstro = "Nome"
 
config.daily = getBooleanFromString(config.daily)

local function CheckAnihilationInUse()
    for i = 1, #config.areas do
        for x = config.areas.topLeftPos.x, config.areas.bottomRightPos.x do
            for y = config.areas.topLeftPos.y, config.areas.bottomRightPos.y do
                for z = config.areas.topLeftPos.z, config.areas.bottomRightPos.z do
                    local creature = getTopCreature({x = x, y = y, z = z}).uid
                    if isPlayer(creature) then
                        return true
                    end
                end
            end
        end
    end
    return false
end

local function RemoveMonsters()
    local monsters = {}
    for i = 1, #config.areas do
        for x = config.areas.topLeftPos.x, config.areas.bottomRightPos.x do
            for y = config.areas.topLeftPos.y, config.areas.bottomRightPos.y do
                for z = config.areas.topLeftPos.z, config.areas.bottomRightPos.z do
                    local position = {x = x, y = y, z = z, stackpos = 253}
                    local creature = getThingfromPos(position)
                    if isMonster(creature.uid) then
                        table.insert(monsters, creature.uid)
                    end
                end
            end
        end
    end
    for m in pairs(monsters) do
        doRemoveCreature(m)
    end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.itemid == 6265) then
        if(config.daily) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
      return true
        else
            doTransformItem(item.uid, item.itemid - 1)
        end        
    end
     
    if(item.itemid ~= 6265) then
        return true
    end
    
    if CheckAnihilationInUse() then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "A arena esta em uso, espere.")
        return true
    end
    
    local players = {}
    for _, position in ipairs(config.entry) do
        local pid = getTopCreature(position).uid
        if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level or getPlayerMoney(cid) < config.money) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "No minimo players de level ".. config.level .." e possuir ".. config.money .." gold coins.")
            return true
        end
        table.insert(players, pid)
    end
    RemoveMonsters()
    doCreateMonster(monstro, posmonstro)
    doSendMagicEffect(config.entry, CONST_ME_POFF)
    doTeleportThing(cid, config.destination, false)
    doSendMagicEffect(config.destination, CONST_ME_ENERGYAREA)        
    
    doTransformItem(item.uid, item.itemid + 1)
    return true
end 

soh mudei uma linha de lugar

Life is so meaningless, there is nothing worth a smile
So goodbye, I'll miss you

 

 

sugestões?

 

 

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.

  • Estatísticas dos Fóruns

    96844
    Tópicos
    519597
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo