local exemplo = addItemInFreeBag(pokeBag, 2394, 20) doItemSetAttribute(exemplo, "unique", getCreatureName(cid))
2394 = id do item
20 = quantidade
O resto você sabe!
info
Grupo: Herói
Registrado: 25/10/11
Posts: 2.2k
Reputação: +862
Gênero: Masculino
Char no Tibia: Sociopata

local exemplo = addItemInFreeBag(pokeBag, 2394, 20) doItemSetAttribute(exemplo, "unique", getCreatureName(cid))
2394 = id do item
20 = quantidade
O resto você sabe!
info
Grupo: Visconde
Registrado: 07/02/12
Posts: 427
Reputação: +112

27 minutos atrás, Deadpool disse:local exemplo = addItemInFreeBag(pokeBag, 2394, 20) doItemSetAttribute(exemplo, "unique", getCreatureName(cid))2394 = id do item
20 = quantidade
O resto você sabe!
Não adiciona o item na bag e :
[24/08/2016 13:17:59] [Error - Action Interface]
[24/08/2016 13:17:59] data/actions/scripts/madeira.lua:onUse
[24/08/2016 13:17:59] Description:
[24/08/2016 13:17:59] (luaDoItemSetAttribute) Item not found
info
Grupo: Herói
Registrado: 25/10/11
Posts: 2.2k
Reputação: +862
Gênero: Masculino
Char no Tibia: Sociopata

--'
local pokeBag = getPlayerItemById(cid, false, 1987).uid local item = addItemInFreeBag(pokeBag, 2392, 5) doItemSetAttribute(item, "unique", getCreatureName(cid)) doPlayerAddItemEx(cid, item)
Editado Agosto 24 por Deadpool
info
Grupo: Visconde
Registrado: 07/02/12
Posts: 427
Reputação: +112

J
13 minutos atrás, Deadpool disse:--'
item = doCreateItemEx(IDITEM, QTD) doItemSetAttribute(item, "unique", getCreatureName(cid)) doPlayerAddItemEx(cid, item)
Já fiz isso também -.-'
info
Grupo: Herói
Registrado: 14/02/14
Posts: 341
Reputação: +285
Gênero: Masculino
Char no Tibia: Night Wolf

1- não dá pra setar uniqueid em tempo de execução, o item que ser criado com o uniqueid e não adicionar o uniqueid depois de dar o item.
2- o uniqueid será único, não dá pra existir 2 itens com msmo uniqueid, por isso a source tem uma proteção de que se alguém tentar separar itens contáveis com uniqueid, os itens irão perder o uniqueid.
3- por que você não usa action id?
info
Grupo: Visconde
Registrado: 07/02/12
Posts: 427
Reputação: +112

19 horas atrás, Night Wolf disse:1- não dá pra setar uniqueid em tempo de execução, o item que ser criado com o uniqueid e não adicionar o uniqueid depois de dar o item.
2- o uniqueid será único, não dá pra existir 2 itens com msmo uniqueid, por isso a source tem uma proteção de que se alguém tentar separar itens contáveis com uniqueid, os itens irão perder o uniqueid.
3- por que você não usa action id?
Omg o mito do Night Wolf come back... ![]()
actiondID pode ser dropado não? a intenção é do item não ser dropavel!
Editado Agosto 26 por KarlKalvin
info
Grupo: Visconde
Registrado: 07/02/12
Posts: 427
Reputação: +112
Eu li em alguns tópicos aqui que o @zipter98 mencionou que itens stackables não recebem ou não podem adquirir o atributo unique pelo menos não no PDA.
Ele disse que até funciona mas dá bastante erros... na base DXP existe a função unique no main fuctions e também um script que trabalha com o move itens na pasta creature que é
function onMoveItem(cid, item, count, toContainer, fromContainer, fromPos, toPos)
if not isCreature(cid) then return false end
if isWatchingTv(cid) then return false end
local name = getCreatureName(cid)
local transform = false
--- nao retirar item que estao no slot 8 e sao uniques
if fromPos.x ~= 0 and toContainer.uid == 0 and fromContainer.uid == 0 and toPos.x == 65535 and getPlayerSlotItem(cid, 8).uid ~= 0 then
doPlayerSendCancel(cid, MSG_NAO_E_POSSIVEL)
return false
end
local itemID = item.itemid
if itemID >= 14795 and itemID <= 14879 or pokeballs[getPokeballType(itemID)] and (itemID == pokeballs[getPokeballType(itemID)].use and (#getCreatureSummons(cid) > 0 or isRiderOrFlyOrSurf(cid))) then
doPlayerSendCancel(cid, "Você não pode mover este item.")
return false
end
if isFly(cid) and (getTileThingByPos(toPos).itemid == 460 or getTileThingByPos(toPos).itemid == 12171 or getTileThingByPos(toPos).itemid == 12172 or (toContainer.uid == 0 and getThingPos(cid).z ~= toPos.z)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_CANNOTTHROW)
return false
end
if isInArray({2589, 15446, 15447, 15448, 15449, 12355}, toContainer.itemid)then -- nao fazer nada no cp
return true
end
local pos = toPos
local items = getItemsfromPos(pos)
for i = 1, #items do
local name = getItemInfo(items.itemid).name
if string.find(name, "fainted") or string.find(name, "defeated") then
doSendMsg(cid, "Não pode jogar lá.")
return false
end
end
if isPokeball(item.itemid) and toPos.x == 65535 then
if not getItemAttribute(item.uid, "unique") and getPlayerFreeCap(cid) > 1 then
doTransformPokeballIcon(cid, item, count, toContainer, fromContainer, fromPos, toPos)
end
else
if not getItemAttribute(item.uid, "unique") and not getItemAttribute(item.uid, "torneio") then
doTransformPokeballIcon(cid, item, count, toContainer, fromContainer, fromPos, toPos)
end
end
if isPokeball(item.itemid) or isContainer(item.uid) then
if hasSqm(toPos) then
if isContainer(item.uid) then
local itens = getItensUniquesInContainer(item.uid)
local sendMsg = false
if #itens >= 1 then
doSendMsg(cid, #itens.." item"..(#itens < 2 and "" or "s").." neste recipiente "..(#itens < 2 and "é exclusivo" or "são exclusivos")..". Você não pode joga-lo"..(#itens < 2 and "" or "s").." fora!")
return false
end
else
if getItemAttribute(item.uid, "unique") or getItemAttribute(item.uid, "torneio") then
doSendMsg(cid, "Isso é um item exclusivo, você não pode joga-lo fora!")
return false
end
end
elseif isContainer(toContainer.uid) and (isPokeball(item.itemid) or isContainer(item.uid)) then
if toContainer.itemid == getPlayerSlotItem(cid, 3).itemid then -- nao fazer nada na poke bag principal
return true
end
if not isPosEqual(getThingPos(toContainer.uid), getThingPos(cid)) then
if isContainer(item.uid) then
local itens = getItensUniquesInContainer(item.uid)
local sendMsg = false
if #itens >= 1 then
doSendMsg(cid, #itens.." item"..(#itens < 2 and "" or "s").." neste recipiente "..(#itens < 2 and "é exclusivo" or "são exclusivos")..". Você não pode joga-lo"..(#itens < 2 and "" or "s").." fora!")
return false
end
else
if getItemAttribute(item.uid, "unique") or getItemAttribute(item.uid, "torneio") then
doSendMsg(cid, "Isso é um item exclusivo, você não pode joga-lo fora!")
return false
end
end
end
end
end
return true
end
function getItemsfromPos(position, fromStackpos)
local toret = { } -- table to return items
position.stackpos = fromStackpos
if position.stackpos == nil then
position.stackpos = 1 -- default
end
while true do -- loop to catch the items and insert them in toret table
local thing = getThingfromPos(position)
if thing.itemid == 0 then -- thing doesn't exist, break the loop...
break
end
if getWholeThing ~= nil and getWholeThing ~= 0 then
-- if getWholeThing isn't nil and isn't 0
table.insert(toret,thing)
else
-- else, insert only item uid in toret table
table.insert(toret,thing)
end
position.stackpos = position.stackpos + 1 -- get next item
end
return toret
end
Se eu fosse querer editar para que funcione unique com os itens stackables, onde eu teria que editar? alguém pode me ajudar?