Ir para conteúdo

Dúvida No Sistema De Forja "blacksmith" Do Garou


Sanf

Posts Recomendados

Quero usar o The Blacksmith System do Garou postado aqui no Xtibia..

o script funciona, porém tem uma parte que era pra apareçer o nome de quem forjou o item, no item forjado..

mas além do nome não apareçer dá um erro

 

[17/07/2011 00:56:06] [Error - Action Interface]

[17/07/2011 00:56:07] data/actions/scripts/iron hammer.lua:onUse

[17/07/2011 00:56:07] Description:

[17/07/2011 00:56:07] (luaDoItemSetAttribute) Item not found

 

o post é:

 

 

alguem sabe como resolvo?

Editado por semruela
Link para o comentário
Compartilhar em outros sites

cara não entendo de scripts,

mas tenta isso:

 

local chance = nil

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

if isInArray({0, 65535}, toPosition.x) then

return false

elseif getTileItemById(toPosition, 2555).uid < 1 then

return doPlayerSendCancel(cid, 'You must put the ingredients on an anvil.')

end

 

local tmp, match = {}

 

for ret, v in pairs(forges) do

for i = 1, #v.recipe do

local g = getTileItemById(toPosition, v.recipe[1])

if g.uid > 0 and math.max(1, g.type) == v.recipe[2] then

table.insert(tmp, g.uid)

if i == #v.recipe then

match = ret

chance = v.chance

end

else

tmp = {}

break

end

end

if match then

break

end

end

 

if match then

for i = 1, #tmp do

doRemoveItem(tmp, forges[match].recipe[2])

end

if(chance >= math.random(1, 1000)) then

doCreateItem(match, 1, toPosition)

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have created ".. getItemInfo(match).article .." ".. getItemNameById(match)..".")

doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)

doSendAnimatedText(toPosition, "Success!", TEXTCOLOR_GREEN)

getItemInfo(match).description .."".. (config.credits == true and "\nIt has forged by ".. getCreatureName(cid) .."." or ""))

doItemSetAttribute(create, "description", "".. getItemInfo(match).description .."".. (config.credits == true and "\nIt has forged by ".. getCreatureName(cid) .."." or ""))

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Something went wrong.")

doSendMagicEffect(toPosition, CONST_ME_POFF)

doSendAnimatedText(toPosition, "Failure!", TEXTCOLOR_RED)

end

return true

end

return doPlayerSendCancel(cid, "This forge recipe doesn't exist.")

end

Editado por PsyMcKenzie
Link para o comentário
Compartilhar em outros sites

local chance = nil

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if isInArray({0, 65535}, toPosition.x) then
       return false
   elseif getTileItemById(toPosition, 2555).uid < 1 then
       return doPlayerSendCancel(cid, 'You must put the ingredients on an anvil.')
   end

   local tmp, match = {}

   for ret, v in pairs(forges) do
       for i = 1, #v.recipe do
           local g = getTileItemById(toPosition, v.recipe[i][1])
           if g.uid > 0 and math.max(1, g.type) == v.recipe[i][2] then
               table.insert(tmp, g.uid)
               if i == #v.recipe then
                   match = ret
                                       chance = v.chance
               end
           else
               tmp = {}
               break
           end
       end
       if match then
           break
       end
   end

       if match then
               for i = 1, #tmp do
                       doRemoveItem(tmp[i], forges[match].recipe[i][2])
               end
               if(chance >= math.random(1, 1000)) then
                doItemSetAttribute(doCreateItem(match, 1, toPosition), "description", "".. getItemInfo(match).description .."".. (config.credits == true and "\nIt has forged by ".. getCreatureName(cid) .."." or ""))
                       doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have created ".. getItemInfo(match).article .." ".. getItemNameById(match)..".")
                       doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
                       doSendAnimatedText(toPosition, "Success!", TEXTCOLOR_GREEN)
	else
                       doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Something went wrong.")
                       doSendMagicEffect(toPosition, CONST_ME_POFF)
                       doSendAnimatedText(toPosition, "Failure!", TEXTCOLOR_RED)
               end
               return true
       end
       return doPlayerSendCancel(cid, "This forge recipe doesn't exist.")
end

 

Vamos ver se assim vai...

Editado por Demonbholder
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...