if not heldx then return false end
Tenta mudar
if heldx then return false end
para
if not heldx then return false end
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

if not heldx then return false end
Tenta mudar
if heldx then return false end
para
if not heldx then return false end
info
Grupo: Visconde
Registrado: 07/01/12
Posts: 495
Reputação: +48
Gênero: Masculino
Char no Tibia: Nem Tenho

3 horas atrás, Xtibiadaniel disse:if not heldx then return false endTenta mudar
if heldx then return false endpara
if not heldx then return false end
Continua dando o mesmo erro amigo:
[06/04/2016 01:58:33] [Error - Action Interface]
[06/04/2016 01:58:33] data/actions/scripts/difusora.lua:onUse
[06/04/2016 01:58:33] Description:
[06/04/2016 01:58:33] (luaGetItemAttribute) Item not found
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

Você está selecionando o item através do outro item? ou você só clica no item?
Do jeito que está configurado, o item necessita que clique nele e depois clicar na pokebola desejada. Ou seja, seu item tem que ter use with.
Editado Abril 6 por Xtibiadaniel
info
Grupo: Visconde
Registrado: 07/01/12
Posts: 495
Reputação: +48
Gênero: Masculino
Char no Tibia: Nem Tenho

Não, esse não era meu objetivo, era tipo ser a boost machine, só com que com sloot só pra pokeball
Poderíamos saber como é a estrutura da máquina?
Para fazer um código adequado e com configuração simples, precisamos saber se há alguma relação entre a posição do slot e do botão. Por exemplo, como acontece no caso da máquina de boost, em que o container da pokebola se localiza sempre à direita do botão que ativa o processo. Sabendo isso, evitaríamos ter que configurar várias posições para cada máquina.
Editado Abril 6 por zipter98
info
Grupo: Visconde
Registrado: 07/01/12
Posts: 495
Reputação: +48
Gênero: Masculino
Char no Tibia: Nem Tenho

Sim, seria igual a de boost, o slot do pokemon ficaria sempre a direita e o botão que ativa a maquina ficaria sempre ao lado do lugar de por o slot da pokeball, a unica diferenca dela pra maquina de boost é que não teria o lugar pra por a stone que no caso fica na esquerda.
E quanto ao sistema de held item que você usa? O valor armazenado no atributo heldx por caso é um ID de item?
info
Grupo: Visconde
Registrado: 07/01/12
Posts: 495
Reputação: +48
Gênero: Masculino
Char no Tibia: Nem Tenho

Não, é que é assim que ele é setado no scripts dos helds, ai achei que precisaria dessa tabela e seria assim que checaria. Segue o script do held system, uso aquele do Gabriel que tem aqui no forum:
local heldTable = { [13976] = {attribute = "heldx", ident = 1}, [13941] = {attribute = "heldy", ident = 1}, } function onUse(cid, item, frompos, item2, topos) if not isPokeball(item2.itemid) or #getCreatureSummons(cid) > 0 then return false end if not heldTable[item.itemid] then return false end held = heldTable[item.itemid] pokename = getItemAttribute(item2.uid, "poke") heldname = getItemInfo(item.itemid).name doSetItemAttribute(item2.uid, held.attribute, held.ident) doRemoveItem(item.uid, 1) doSendMagicEffect(getThingPos(cid), 14) sendMsgToPlayer(cid, 27, "Your "..pokename.." has gained a "..heldname..".") return true end
info
Grupo: Marquês
Registrado: 25/09/10
Posts: 1.3k
Reputação: +446
Gênero: Masculino

@Pokemonultimatetwo, ele quis dizer se o atributo tem alguma relação com o item, pois para tirar o atributo e dar o item você precisa de um referencial, seria por exemplo uma tabela com itemids e atributos correspondentes aos ids.
Vamos dar um exemplo:
X Attack - id:2195
Então o atributo é attack, e o id é 2195, para isso, precisamos saber como funciona o seu sistema. Acho que o @zipter98 é melhor para te ajudar, por ele ser mais competente e ter experiência com poketibias...
info
Grupo: Visconde
Registrado: 07/01/12
Posts: 495
Reputação: +48
Gênero: Masculino
Char no Tibia: Nem Tenho

Sim o atributo tem uma relação com o item, por isso tem a tabela la no script dos held items, e eu tentei colocar no script da maquina tb,
52 minutos atrás, Caronte disse:@Pokemonultimatetwo, ele quis dizer se o atributo tem alguma relação com o item, pois para tirar o atributo e dar o item você precisa de um referencial, seria por exemplo uma tabela com itemids e atributos correspondentes aos ids.
Vamos dar um exemplo:
X Attack - id:2195
Então o atributo é attack, e o id é 2195, para isso, precisamos saber como funciona o seu sistema. Acho que o @zipter98 é melhor para te ajudar, por ele ser mais competente e ter experiência com poketibias...
Se você usa o sistema de held itens do Gabrielbsales, mova a tabela heldTable de HeldSystem.lua (data/actions/scripts) para um arquivo qualquer de data/lib.
local ball_slot, price = xxx, xxx --ID do slot em que a pokebola fica; Preço p/ remover o held item. function onUse(cid, item, fromPosition, itemEx, toPosition) local ball_pos = toPosition ball_pos.x = ball_pos.x + 1 local ball_slot = getTileItemById(ball_pos, ball_slot).uid local pokeball = getContainerItem(ball_slot, ).uid if pokeball <= or not getItemAttribute(pokeball, "poke") then doPlayerSendCancel(cid, "You must put on the pokeball slot a valid pokeball.") return true end local held_item = {} for itemid, held_info in pairs(heldTable) do local attr = getItemAttribute(pokeball, held_info.attribute) if attr and attr == held_info.ident then table.insert(held_item, itemid) end end if #held_item == 0 then doPlayerSendCancel(cid, "Your pokemon does not have a held item.") return true elseif getPlayerMoney(cid) < price then doPlayerSendCancel(cid, "You need more "..price - getPlayerMoney(cid).." gold to remove your pokemon's held item(s).") return true end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You removed your pokeball's held item(s) for the price of "..price.." gold.") doPlayerRemoveMoney(cid, price) for i = 1, #held_item do doPlayerAddItem(cid, held_item[i], 1) doItemSetAttribute(pokeball, heldTable[held_item[i]].attribute, false) end return trueend
Editado Abril 12 por zipter98
info
Grupo: Visconde
Registrado: 07/01/12
Posts: 495
Reputação: +48
Gênero: Masculino
Char no Tibia: Nem Tenho

Muito Obrigado, assim que der eu testo, rep+ desde ja...
15 horas atrás, zipter98 disse:Se você usa o sistema de held itens do Gabrielbsales, mova a tabela heldTable de HeldSystem.lua (data/actions/scripts) para um arquivo qualquer de data/lib.
local ball_slot, price = xxx, xxx --ID do slot em que a pokebola fica; Preço p/ remover o held item. function onUse(cid, item, fromPosition, itemEx, toPosition) local ball_pos = toPosition ball_pos.x = ball_pos.x + 1 local ball_slot = getTileItemById(ball_pos, ball_slot).uid local pokeball = getContainerItem(ball_slot, 0).uid if pokeball <= 0 or not getItemAttribute(pokeball, "poke") then doPlayerSendCancel(cid, "You must put on the pokeball slot a valid pokeball.") return true end local held_item = {} for itemid, held_info in pairs(heldTable) do local attr = getItemAttribute(pokeball, held_info.attribute) if attr and attr == held_info.ident then table.insert(held_item, itemid) end end if #held_item == 0 then doPlayerSendCancel(cid, "Your pokemon does not have a held item.") return true elseif getPlayerMoney(cid) < price then doPlayerSendCancel(cid, "You need more "..price - getPlayerMoney(cid).." gold to remove your pokemon's held item(s).") return true end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You removed your pokeball's held item(s) for the price of "..price.." gold.") doPlayerRemoveMoney(cid, price) for i = 1, #held_item do doPlayerAddItem(cid, held_item[i], 1) doItemSetAttribute(pokeball, heldTable[held_item[i]].attribute, nil) end return trueend
info
Grupo: Visconde
Registrado: 07/01/12
Posts: 495
Reputação: +48
Gênero: Masculino
Char no Tibia: Nem Tenho

Eu criei um arquivo chamado helds.lua em data/lib e da o seguinte erro:
[10/04/2016 21:32:37] [Error - Action Interface] [10/04/2016 21:32:37] data/actions/scripts/difusora.lua:onUse [10/04/2016 21:32:37] Description: [10/04/2016 21:32:37] data/actions/scripts/difusora.lua:17: bad argument #1 to 'pairs' (table expected, got nil) [10/04/2016 21:32:37] stack traceback: [10/04/2016 21:32:37] [C]: in function 'pairs' [10/04/2016 21:32:37] data/actions/scripts/difusora.lua:17: in function <data/actions/scripts/difusora.lua:3>
ai tentei adicionar a tabela no proprio script em data/actions/scripts e da esse erro:
[10/04/2016 21:31:40] [Error - Action Interface] [10/04/2016 21:31:40] data/actions/scripts/difusora.lua:onUse [10/04/2016 21:31:40] Description: [10/04/2016 21:31:40] (luaDoItemSetAttribute) Invalid data type
Ao colocar a tabela no arquivo em lib, você por acaso removeu o local que precedia a nomeação da tabela? Se não, esta é a causa do primeiro erro.
Quanto ao segundo, troque:
doItemSetAttribute(pokeball, heldTable[held_item[i]].attribute, nil)
por:
doItemSetAttribute(pokeball, heldTable[held_item[i]].attribute, false)
Caso o erro continue, imagino que a causa esteja ainda na tabela.
info
Grupo: Visconde
Registrado: 07/01/12
Posts: 495
Reputação: +48
Gênero: Masculino
Char no Tibia: Nem Tenho
Olá galera, eu estava tentando criar um script pra um amigo que é o seguinte: a maquina vai ter 1 slot e 1 botão, ai vc coloca seu pokemon no slot e ao apertar o botão ele vai checar se seu pokemon tem algum held item, se tiver, ele vai remover o held do seu pokemon e voltar ele pra sua bag por custo x, se não, vai mandar uma msg de erro. Não consegui terminar, mas empaquei aqui, um amigo tambem estava ajudando mas ele não consegiu terminar, se alguem puder ajudar ficarei grato.
Codigo que meu amigo estava fzd, mas n deu certo:
local tab = { -- X -- [13976] = {attribute = "heldx", ident = 1}, -- Defense 1 } function onUse(cid, item, frompos, item2, topos) pokename = getItemAttribute(item2.uid, "poke") heldname = getItemInfo(item.itemid).name local heldx = getItemAttribute(item2.uid, tab.attribute, tab.ident) if not isPokeball(item2.itemid) or #getCreatureSummons(cid) > 0 then return false end if heldx then return false end if heldx then removeItemAttribute(item2.uid, tab[item.itemid].attribute, "nil") sendMsgToPlayer(cid, 27, "Your "..pokename.." lost as "..heldname..".") else sendMsgToPlayer(cid, 27, "Your pokemon dont have an "..heldname..".") return true end endObrigado desde ja.