Ir para conteúdo
  • Cadastre-se

(Resolvido)Action para canivetes


Ir para solução Resolvido por Wise,

Posts Recomendados

Olá, não manjo de scripts, aí então estou pedindo a ajuda de vocês, estou com um problema nos canivetes, gostaria que eles não quebrassem...

 

aqui está a action deles.

 

 

local holes = {468, 481, 483, 7932}
local holeId = {294, 369, 370, 383, 392, 408, 409, 427, 428, 430, 462, 469, 470, 482, 484, 485, 489, 924, 3135, 3136}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local value = getPlayerStorageValue(cid, 10)
if(value ~= -1 and os.clock()-value < 60)then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The tool jammed. Please wait " .. 60-math.floor(os.clock()-value) .. " seconds before using it again.")
return TRUE
end
if(math.random(1, 10) == 1)then
setPlayerStorageValue(cid, 10, os.clock())
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The tool jammed. Please wait 60 seconds before using it again.")
return TRUE
end
-- Shovel
if isInArray(holes, itemEx.itemid) == TRUE then
doTransformItem(itemEx.uid, itemEx.itemid + 1) 
doDecayItem(itemEx.uid)
return FALSE
-- Rope
elseif toPosition.x == CONTAINER_POSITION or toPosition.x == 0 and toPosition.y == 0 and toPosition.z == 0 then
return FALSE
end
local groundTile = getThingfromPos(toPosition)
if groundTile.itemid == 384 or groundTile.itemid == 418 or groundTile.itemid == 8278 then
doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, FALSE)
elseif isInArray(holeId, itemEx.itemid) == TRUE then
local hole = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
if hole.itemid > 0 then
doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, FALSE)
else
doPlayerSendCancel(cid, "Sorry, not possible.")
end
return FALSE
-- Pick
elseif (itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355 or itemEx.itemid == 9024 or itemEx.itemid == 9025) then
doTransformItem(itemEx.uid, 392)
doDecayItem(itemEx.uid)
return TRUE
elseif itemEx.uid == 60001 then
doTeleportThing(cid, {x=329, y=772, z=10})
doSendMagicEffect({x=329, y=772, z=10},10)
return TRUE
-- Machete
elseif itemEx.itemid == 2782 then
doTransformItem(itemEx.uid, 2781)
doDecayItem(itemEx.uid)
return TRUE
elseif itemEx.itemid == 1499 then
doRemoveItem(itemEx.uid)
return TRUE
-- Scythe
elseif itemEx.itemid == 2739 then 
doTransformItem(itemEx.uid, 2737)
doCreateItem(2694, 1, toPosition)
doDecayItem(itemEx.uid)
return TRUE
end
return destroyItem(cid, itemEx, toPosition)
end
Link para o post
Compartilhar em outros sites

Quais os id's dos canivetes que vc não qr que quebrem?

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

Link para o post
Compartilhar em outros sites

Quais os id's dos canivetes que vc não qr que quebrem?

 

Todos!

 

22:33 You see whacking driller of fate.
ItemID: [10515].
 
22:33 You see squeezing gear of girlpower.
ItemID: [10513].
 
22:33 You see sneaky stabber of eliteness.
ItemID: [10511].
Editado por nrkdelirium (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Bom cara, ñ sei se vai dar certo (provavelmente ñ, pois sempre qnd faço algo na pressa nunca dar certo) mas tenta ae:

local holes = {468, 481, 483, 7932}
local holeId = {294, 369, 370, 383, 392, 408, 409, 427, 428, 430, 462, 469, 470, 482, 484, 485, 489, 924, 3135, 3136}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local value = getPlayerStorageValue(cid, 10)
if(value ~= -1 and os.clock()-value < 60)then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The tool jammed. Please wait " .. 60-math.floor(os.clock()-value) .. " seconds before using it again.")
return TRUE
end
if(math.random(1, 10) == 1)then
setPlayerStorageValue(cid, 10, os.clock())
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The tool jammed. Please wait 60 seconds before using it again.")
return TRUE
end
-- Shovel
if isInArray(holes, itemEx.itemid) == TRUE then
return FALSE
-- Rope
elseif toPosition.x == CONTAINER_POSITION or toPosition.x == 0 and toPosition.y == 0 and toPosition.z == 0 then
return FALSE
end
local groundTile = getThingfromPos(toPosition)
if groundTile.itemid == 384 or groundTile.itemid == 418 or groundTile.itemid == 8278 then
doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, FALSE)
elseif isInArray(holeId, itemEx.itemid) == TRUE then
local hole = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
if hole.itemid > 0 then
doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, FALSE)
else
doPlayerSendCancel(cid, "Sorry, not possible.")
end
return FALSE
-- Pick
elseif (itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355 or itemEx.itemid == 9024 or itemEx.itemid == 9025) then
return TRUE
elseif itemEx.uid == 60001 then
doTeleportThing(cid, {x=329, y=772, z=10})
doSendMagicEffect({x=329, y=772, z=10},10)
return TRUE
-- Machete
elseif itemEx.itemid == 2782 then
doTransformItem(itemEx.uid, 2781)
return TRUE
elseif itemEx.itemid == 1499 then
return TRUE
-- Scythe
elseif itemEx.itemid == 2739 then 
return TRUE
end
return
end

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

Link para o post
Compartilhar em outros sites

 

Bom cara, ñ sei se vai dar certo (provavelmente ñ, pois sempre qnd faço algo na pressa nunca dar certo) mas tenta ae:

local holes = {468, 481, 483, 7932}
local holeId = {294, 369, 370, 383, 392, 408, 409, 427, 428, 430, 462, 469, 470, 482, 484, 485, 489, 924, 3135, 3136}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local value = getPlayerStorageValue(cid, 10)
if(value ~= -1 and os.clock()-value < 60)then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The tool jammed. Please wait " .. 60-math.floor(os.clock()-value) .. " seconds before using it again.")
return TRUE
end
if(math.random(1, 10) == 1)then
setPlayerStorageValue(cid, 10, os.clock())
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The tool jammed. Please wait 60 seconds before using it again.")
return TRUE
end
-- Shovel
if isInArray(holes, itemEx.itemid) == TRUE then
return FALSE
-- Rope
elseif toPosition.x == CONTAINER_POSITION or toPosition.x == 0 and toPosition.y == 0 and toPosition.z == 0 then
return FALSE
end
local groundTile = getThingfromPos(toPosition)
if groundTile.itemid == 384 or groundTile.itemid == 418 or groundTile.itemid == 8278 then
doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, FALSE)
elseif isInArray(holeId, itemEx.itemid) == TRUE then
local hole = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
if hole.itemid > 0 then
doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, FALSE)
else
doPlayerSendCancel(cid, "Sorry, not possible.")
end
return FALSE
-- Pick
elseif (itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355 or itemEx.itemid == 9024 or itemEx.itemid == 9025) then
return TRUE
elseif itemEx.uid == 60001 then
doTeleportThing(cid, {x=329, y=772, z=10})
doSendMagicEffect({x=329, y=772, z=10},10)
return TRUE
-- Machete
elseif itemEx.itemid == 2782 then
doTransformItem(itemEx.uid, 2781)
return TRUE
elseif itemEx.itemid == 1499 then
return TRUE
-- Scythe
elseif itemEx.itemid == 2739 then 
return TRUE
end
return
end

é irmao, deu não... hehe! aproveite o ano novo e depois voce me ajuda, abraço!

Link para o post
Compartilhar em outros sites

Não é esse o action script dos items que você citou (10511, 10513, 10515).
Procure pelos IDs deles em seu actions.xml e vai saber a partir da tag, qual o diretório do arquivo correto. Depois, informe os códigos aqui.

The corrupt fear us.

The honest support us.

The heroic join us.

Link para o post
Compartilhar em outros sites

Não é esse o action script dos items que você citou (10511, 10513, 10515).

Procure pelos IDs deles em seu actions.xml e vai saber a partir da tag, qual o diretório do arquivo correto. Depois, informe os códigos aqui.

é esse mesmo...

 

<action fromid="10511" toid="10516" event="script" value="tools/squeezings.lua"/>

 

e esse lua é oq eu copiei ali em cima...

 

tbm tentei fazer uma escrotisse, mas nao deu certo... q foi tirar o "decayTo" no items.xml kkk

Editado por nrkdelirium (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Solução

é esse mesmo...


Está certo, fui eu quem confundi. Você quer que eles não "emperrem".
Tente:
local holes = {468, 481, 483, 7932}
local holeId = {294, 369, 370, 383, 392, 408, 409, 427, 428, 430, 462, 469, 470, 482, 484, 485, 489, 924, 3135, 3136}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    -- Shovel
    if isInArray(holes, itemEx.itemid) == true then
        doTransformItem(itemEx.uid, itemEx.itemid + 1)
        doDecayItem(itemEx.uid)
        return false
    -- Rope
    elseif toPosition.x == CONTAINER_POSITION or toPosition.x == 0 and toPosition.y == 0 and toPosition.z == 0 then
        return false
    end
    
        local groundTile = getThingfromPos(toPosition)
        if groundTile.itemid == 384 or groundTile.itemid == 418 or groundTile.itemid == 8278 then
            doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, false)
        elseif isInArray(holeId, itemEx.itemid) == true then
            local hole = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
            if hole.itemid > 0 then
                doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false)
            else
                doPlayerSendCancel(cid, "Sorry, not possible.")
            end
            return false
        -- Pick
        elseif (itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355 or itemEx.itemid == 9024 or itemEx.itemid == 9025) then
            doTransformItem(itemEx.uid, 392)
            doDecayItem(itemEx.uid)
            return true
        elseif itemEx.uid == 60001 then
            doTeleportThing(cid, {x=329, y=772, z=10})
            doSendMagicEffect({x=329, y=772, z=10},10)
            return true
        -- Machete
        elseif itemEx.itemid == 2782 then
            doTransformItem(itemEx.uid, 2781)
            doDecayItem(itemEx.uid)
            return true
        elseif itemEx.itemid == 1499 then
            doRemoveItem(itemEx.uid)
            return true
        -- Scythe
        elseif itemEx.itemid == 2739 then
            doTransformItem(itemEx.uid, 2737)
            doCreateItem(2694, 1, toPosition)
            doDecayItem(itemEx.uid)
            return true
        end
        
    return destroyItem(cid, itemEx, toPosition)
end

The corrupt fear us.

The honest support us.

The heroic join us.

Link para o post
Compartilhar em outros sites

Está certo, fui eu quem confundi. Você quer que eles não "emperrem".

Tente:

local holes = {468, 481, 483, 7932}
local holeId = {294, 369, 370, 383, 392, 408, 409, 427, 428, 430, 462, 469, 470, 482, 484, 485, 489, 924, 3135, 3136}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    -- Shovel
    if isInArray(holes, itemEx.itemid) == true then
        doTransformItem(itemEx.uid, itemEx.itemid + 1)
        doDecayItem(itemEx.uid)
        return false
    -- Rope
    elseif toPosition.x == CONTAINER_POSITION or toPosition.x == 0 and toPosition.y == 0 and toPosition.z == 0 then
        return false
    end
    
        local groundTile = getThingfromPos(toPosition)
        if groundTile.itemid == 384 or groundTile.itemid == 418 or groundTile.itemid == 8278 then
            doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, false)
        elseif isInArray(holeId, itemEx.itemid) == true then
            local hole = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
            if hole.itemid > 0 then
                doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false)
            else
                doPlayerSendCancel(cid, "Sorry, not possible.")
            end
            return false
        -- Pick
        elseif (itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355 or itemEx.itemid == 9024 or itemEx.itemid == 9025) then
            doTransformItem(itemEx.uid, 392)
            doDecayItem(itemEx.uid)
            return true
        elseif itemEx.uid == 60001 then
            doTeleportThing(cid, {x=329, y=772, z=10})
            doSendMagicEffect({x=329, y=772, z=10},10)
            return true
        -- Machete
        elseif itemEx.itemid == 2782 then
            doTransformItem(itemEx.uid, 2781)
            doDecayItem(itemEx.uid)
            return true
        elseif itemEx.itemid == 1499 then
            doRemoveItem(itemEx.uid)
            return true
        -- Scythe
        elseif itemEx.itemid == 2739 then
            doTransformItem(itemEx.uid, 2737)
            doCreateItem(2694, 1, toPosition)
            doDecayItem(itemEx.uid)
            return true
        end
        
    return destroyItem(cid, itemEx, toPosition)
end

Funcionou, parceiro! Valeu!

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo