yoiker
Member
- Joined
- Jan 21, 2012
- Messages
- 194
- Solutions
- 1
- Reaction score
- 9
Hello! Today I came because I need professional help you to manage well the scripts, I wanted to ask you a favor
I want this script by rising from +11 to +15 (with the upgrading system)
You will also go up the attributes you have in items.xml ..
I mean the helmet of items.xml gives 20 magic level +0 to +10
At the next level, the item I want it go the attribute of this helmet which in this case is "magic level + 20" but would be magic level +11 + 30, and so on until +15.
I hope I explained, thereafter the script:
I want this script by rising from +11 to +15 (with the upgrading system)
You will also go up the attributes you have in items.xml ..
I mean the helmet of items.xml gives 20 magic level +0 to +10
At the next level, the item I want it go the attribute of this helmet which in this case is "magic level + 20" but would be magic level +11 + 30, and so on until +15.
I hope I explained, thereafter the script:
Code:
local conf = {}
conf["level"] = {
-- [item_level] = {successParcent=PARCENT FOR UPGRADING SUCCESS, downrageLevel = IF UPGRADING FAIL - ITEM WAS DECRASED TO LEVEL HERE}
[1] = {successParcent = 100, downrageLevel = 0},
[2] = {successParcent = 100, downrageLevel = 0},
[3] = {successParcent = 100, downrageLevel = 0},
[4] = {successParcent = 100, downrageLevel = 0},
[5] = {successParcent = 100, downrageLevel = 0},
[6] = {successParcent = 100, downrageLevel = 0},
[7] = {successParcent = 100, downrageLevel = 0},
[8] = {successParcent = 100, downrageLevel = 0},
[9] = {successParcent = 100, downrageLevel = 0},
[10] = {successParcent = 100, downrageLevel = 0},
[11] = {successParcent = 100, downrageLevel = 0},
[12] = {successParcent = 100, downrageLevel = 0},
[13] = {successParcent = 100, downrageLevel = 0},
[14] = {successParcent = 100, downrageLevel = 0},
[15] = {successParcent = 100, downrageLevel = 0}
}
conf["upgrade"] = { -- how many parcent attributes are rised?
attack = 4.2, -- attack %
extraAttack = 0, -- extra Attack %
defense = 3.1, -- defence %
extraDefense = 0, -- extra defence %
armor = 2.1, -- armor %
hitChance = 200, -- hit chance % ---- <attribute key="maxhealthpercent" value="125" />
MaxHitPercent = 200,
MaxHealthPercent = 200,
}
-- // do not touch // --
-- Upgrading system v.3.1 by Azi [Ersiu] --
local upgrading = {
upValue = function (value, level, parcent)
if(not(value>0))then return 0 end
for i=1,level do
value = math.ceil(((value/100)*parcent)+value)+1
end
return (value > 0) and value or 0
end,
getLevel = function (item)
local name = string.explode(getItemName(item), '+')
return (#name == 1) and 0 or math.abs(name[2])
end,
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local getItem = getItemInfo(itemEx.itemid)
if((getItem.weaponType > 0 or getItem.armor > 0) and not isItemStackable(itemEx.itemid))then
local level = upgrading.getLevel(itemEx.uid)
if(level < #conf["level"])then
local nLevel = (conf["level"][(level+1)].successParcent >= math.random(1,100)) and (level+1) or conf["level"][level].downrageLevel
if(nLevel > level)then
doSendMagicEffect(toPosition, 30)
doSendAnimatedText(getCreaturePosition(cid), 'Succes!', TEXTCOLOR_DARKORANGE)
else
doSendMagicEffect(toPosition, 2)
doPlayerSendTextMessage(cid, 22, "Argh! Upgrading fail... you item lost some of strong!")
end
doItemSetAttribute(itemEx.uid, "name", getItem.name..((nLevel>0) and " +"..nLevel or ""))
doItemSetAttribute(itemEx.uid, "attack", upgrading.upValue(getItem.attack, nLevel, conf["upgrade"].attack))
doItemSetAttribute(itemEx.uid, "extraattack", upgrading.upValue(getItem.extraAttack, nLevel, conf["upgrade"].extraAttack))
doItemSetAttribute(itemEx.uid, "defense", upgrading.upValue(getItem.defense,nLevel, conf["upgrade"].defense))
doItemSetAttribute(itemEx.uid, "extradefense", upgrading.upValue(getItem.extraDefense, nLevel, conf["upgrade"].extraDefense))
doItemSetAttribute(itemEx.uid, "armor", upgrading.upValue(getItem.armor, nLevel, conf["upgrade"].armor))
doItemSetAttribute(itemEx.uid, "hitChance", upgrading.upValue(getItem.hitChance,nLevel, conf["upgrade"].hitChance))
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, 19, "Sorry this item is on max level.")
end
else
doPlayerSendTextMessage(cid, 19, "You cannot upgrade this item.")
end
end