• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

upgrade item

szajker123

New Member
Joined
May 12, 2012
Messages
195
Reaction score
0
Hi, I have a request to me someone could rewrite the script to improve Items that would be so that when we improve object and fails to object to reset to the normal attack because now works so that if we can not improve this item disappears and writes that he :/ and so broke it can not be
REP + + +
thanks
function onUse(cid, item, fromPosition, itemEx, toPosition)
local maxlvl = 3 --maxymalny poziom ulepszenia
local szansa = 40 -- szansa na powodzienie sie ulepszenia

if getItemInfo(itemEx.itemid).attack > 0 or getItemInfo(itemEx.itemid).defense > 0 or getItemInfo(itemEx.itemid).armor > 0 then

if getItemAttribute(itemEx.uid,"itemlevel") == nil then
doItemSetAttribute(itemEx.uid, "itemlevel",0)
end
if (getItemAttribute(itemEx.uid,"itemlevel") + 1) <= maxlvl then
if szansa>=math.random(1,100) then
if getItemInfo(itemEx.itemid).attack > 0 and getItemAttribute(itemEx.uid,"attack") == nil then
doItemSetAttribute(itemEx.uid, "attack",getItemInfo(itemEx.itemid).attack)
end
if getItemInfo(itemEx.itemid).defense > 0 and getItemAttribute(itemEx.uid,"defense") == nil then
doItemSetAttribute(itemEx.uid, "defense",getItemInfo(itemEx.itemid).defense)
end
if getItemInfo(itemEx.itemid).armor > 0 and getItemAttribute(itemEx.uid,"armor") == nil then
doItemSetAttribute(itemEx.uid, "armor",getItemInfo(itemEx.itemid).armor)
end
if getItemAttribute(itemEx.uid, "attack") ~= nil then
doItemSetAttribute(itemEx.uid, "attack",getItemAttribute(itemEx.uid, "attack") + (math.random(4,8+getItemAttribute(itemEx.uid,"itemlevel"))))
end
if getItemAttribute(itemEx.uid, "armor") ~= nil then
doItemSetAttribute(itemEx.uid, "armor",getItemAttribute(itemEx.uid, "armor") + (math.random(1,5)))
end
if getItemAttribute(itemEx.uid, "defense") ~= nil then
doItemSetAttribute(itemEx.uid, "defense",getItemAttribute(itemEx.uid, "defense") + (math.random(4,8+getItemAttribute(itemEx.uid,"itemlevel"))))
end
doItemSetAttribute(itemEx.uid, "name", getItemInfo(itemEx.itemid).name .. " +" .. getItemAttribute(itemEx.uid,"itemlevel") + 1)
doItemSetAttribute(itemEx.uid, "itemlevel",getItemAttribute(itemEx.uid,"itemlevel") + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have successfully enchanted " .. getItemArticleById(itemEx.itemid) .. " " .. getItemInfo(itemEx.itemid).name .. " to +".. getItemAttribute(itemEx.uid,"itemlevel") ..".")
doSendMagicEffect(getPlayerPosition(cid),254)
doRemoveItem(item.uid,1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Sorry, your item has broken.")
doRemoveItem(itemEx.uid,1)
doRemoveItem(item.uid,1)
end
else
doPlayerSendCancel(cid,"You may not upgrade this item higher.")
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
end

else
doPlayerSendCancel(cid,"You can only upgrade armors and weapons.")
end
return true
end
 
Uhm... remove this line?
LUA:
 doRemoveItem(itemEx.uid,1)

Try this:
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 local maxlvl = 3 --maxymalny poziom ulepszenia
 local szansa = 40 -- szansa na powodzienie sie ulepszenia

 if getItemInfo(itemEx.itemid).attack > 0 or getItemInfo(itemEx.itemid).defense > 0 or getItemInfo(itemEx.itemid).armor > 0 then

 if getItemAttribute(itemEx.uid,"itemlevel") == nil then
 doItemSetAttribute(itemEx.uid, "itemlevel",0)
 end
 if (getItemAttribute(itemEx.uid,"itemlevel") + 1) <= maxlvl then
 if szansa>=math.random(1,100) then
 if getItemInfo(itemEx.itemid).attack > 0 and getItemAttribute(itemEx.uid,"attack") == nil then
 doItemSetAttribute(itemEx.uid, "attack",getItemInfo(itemEx.itemid).attack)
 end
 if getItemInfo(itemEx.itemid).defense > 0 and getItemAttribute(itemEx.uid,"defense") == nil then
 doItemSetAttribute(itemEx.uid, "defense",getItemInfo(itemEx.itemid).defense)
 end
 if getItemInfo(itemEx.itemid).armor > 0 and getItemAttribute(itemEx.uid,"armor") == nil then
 doItemSetAttribute(itemEx.uid, "armor",getItemInfo(itemEx.itemid).armor)
 end
 if getItemAttribute(itemEx.uid, "attack") ~= nil then
 doItemSetAttribute(itemEx.uid, "attack",getItemAttribute(itemEx.uid, "attack") + (math.random(4,8+getItemAttribute(itemEx.uid,"item level"))))
 end 
 if getItemAttribute(itemEx.uid, "armor") ~= nil then
 doItemSetAttribute(itemEx.uid, "armor",getItemAttribute(itemEx.uid, "armor") + (math.random(1,5)))
 end 
 if getItemAttribute(itemEx.uid, "defense") ~= nil then
 doItemSetAttribute(itemEx.uid, "defense",getItemAttribute(itemEx.uid, "defense") + (math.random(4,8+getItemAttribute(itemEx.uid,"item level"))))
 end 
 doItemSetAttribute(itemEx.uid, "name", getItemInfo(itemEx.itemid).name .. " +" .. getItemAttribute(itemEx.uid,"itemlevel") + 1)
 doItemSetAttribute(itemEx.uid, "itemlevel",getItemAttribute(itemEx.uid,"itemlevel ") + 1)
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have successfully enchanted " .. getItemArticleById(itemEx.itemid) .. " " .. getItemInfo(itemEx.itemid).name .. " to +".. getItemAttribute(itemEx.uid,"itemlevel") ..".")
 doSendMagicEffect(getPlayerPosition(cid),254)
 doRemoveItem(item.uid,1)
 else
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Sorry, you were unable to upgrade.")
 doRemoveItem(item.uid,1)
 end
 else
 doPlayerSendCancel(cid,"You may not upgrade this item higher.")
 doSendMagicEffect(getPlayerPosition(cid),CONST_ME_ POFF)
 end

 else
 doPlayerSendCancel(cid,"You can only upgrade armors and weapons.")
 end
 return true
 end
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 local maxlvl = 3 --maxymalny poziom ulepszenia
 local szansa = 40 -- szansa na powodzienie sie ulepszenia
 
 if getItemInfo(itemEx.itemid).attack > 0 or getItemInfo(itemEx.itemid).defense > 0 or getItemInfo(itemEx.itemid).armor > 0 then
 
 if getItemAttribute(itemEx.uid,"itemlevel") == nil then
 doItemSetAttribute(itemEx.uid, "itemlevel",0)
 end
 if (getItemAttribute(itemEx.uid,"itemlevel") + 1) <= maxlvl then
 if szansa>=math.random(1,100) then
 if getItemInfo(itemEx.itemid).attack > 0 and getItemAttribute(itemEx.uid,"attack") == nil then
 doItemSetAttribute(itemEx.uid, "attack",getItemInfo(itemEx.itemid).attack)
 end
 if getItemInfo(itemEx.itemid).defense > 0 and getItemAttribute(itemEx.uid,"defense") == nil then
 doItemSetAttribute(itemEx.uid, "defense",getItemInfo(itemEx.itemid).defense)
 end
 if getItemInfo(itemEx.itemid).armor > 0 and getItemAttribute(itemEx.uid,"armor") == nil then
 doItemSetAttribute(itemEx.uid, "armor",getItemInfo(itemEx.itemid).armor)
 end
 if getItemAttribute(itemEx.uid, "attack") ~= nil then
 doItemSetAttribute(itemEx.uid, "attack",getItemAttribute(itemEx.uid, "attack") + (math.random(4,8+getItemAttribute(itemEx.uid,"item level"))))
 end 
 if getItemAttribute(itemEx.uid, "armor") ~= nil then
 doItemSetAttribute(itemEx.uid, "armor",getItemAttribute(itemEx.uid, "armor") + (math.random(1,5)))
 end 
 if getItemAttribute(itemEx.uid, "defense") ~= nil then
 doItemSetAttribute(itemEx.uid, "defense",getItemAttribute(itemEx.uid, "defense") + (math.random(4,8+getItemAttribute(itemEx.uid,"item level"))))
 end 
 doItemSetAttribute(itemEx.uid, "name", getItemInfo(itemEx.itemid).name .. " +" .. getItemAttribute(itemEx.uid,"itemlevel") + 1)
 doItemSetAttribute(itemEx.uid, "itemlevel",getItemAttribute(itemEx.uid,"itemlevel ") + 1)
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have successfully enchanted " .. getItemArticleById(itemEx.itemid) .. " " .. getItemInfo(itemEx.itemid).name .. " to +".. getItemAttribute(itemEx.uid,"itemlevel") ..".")
 doSendMagicEffect(getPlayerPosition(cid),254)
 doRemoveItem(item.uid,1)
 else
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Sorry, you were unable to upgrade.")
 doRemoveItem(item.uid,1)
 end
 else
 doPlayerSendCancel(cid,"You may not upgrade this item higher.")
 doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
 end
 
 else
 doPlayerSendCancel(cid,"You can only upgrade armors and weapons.")
 end
 return true
 end

that error must had been before i modifed this script, anyways try now.
 
Now in this way not only pops up an error that nothing at all to improve hinterland of the like that this item had nothing to do :/ Help
@Edit
I'm sorry, an error is not noticed it before here's a screen shot
bug.JPG
 
Last edited:
Back
Top