• 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!

Lua How change damage wands if use stone upgrade

Izaack

Member
Joined
Jun 18, 2012
Messages
70
Solutions
1
Reaction score
17
Location
México
Hi Otland, how can I modify the damage of the wands if I use an upgrade stone an example I have damage of the wands min = 70 max = 100 if I use a stone on the wand then the damage it does is min= 71 and max =101 If I use two stones then the damage will continue to increase 1 by 1 here I have my upgrade script but it only works for weapons in the atk. someone could help me?

Lua:
local conf = {}

conf["level"] = {
 [1] = {successParcent = 100, downrageLevel = 0},
 [2] = {successParcent = 100, downrageLevel = 1},
 [3] = {successParcent = 100, downrageLevel = 2},
 [4] = {successParcent = 100, downrageLevel = 3},
 [5] = {successParcent = 100, downrageLevel = 4},
 [6] = {successParcent = 100, downrageLevel = 5},
 [7] = {successParcent = 100, downrageLevel = 6},
 [8] = {successParcent = 100, downrageLevel = 7},
 [9] = {successParcent = 100, downrageLevel = 8}
}
conf["upgrade"] = {
    attack = 1, 
}

local upgrading = {
    upValue = function (value, level, parcent)
        if(not(value>0))then return 0 end
        for i=1,level do
            value = math.ceil(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 and getItem.weaponType <= 7) 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)
                doPlayerSendTextMessage(cid, 22, "Congratz! El refinado a sido todo un Exito, Tu item ahora es mas fuerte!")
            else
                doSendMagicEffect(toPosition, 2)
                doPlayerSendTextMessage(cid, 22, "Argh! El Refinado fallo... TU ITEM A PERDIDO FUERZA!")
            end
            doItemSetAttribute(itemEx.uid, "name", getItem.name..((nLevel>0) and "+"..nLevel or ""))
            doItemSetAttribute(itemEx.uid, "attack",  upgrading.upValue(getItem.attack, nLevel, conf["upgrade"].attack))
            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
Post automatically merged:

@BUMP!
 
Last edited:
Is that even possible with wands? Wands have a predamage value, so, you cant change with +attack in the weapon.

But, if you create a file that read the weapon attack and give more damage?

Something like:

Predamage 100 + (getItemAttribute.attack*2)
 
Back
Top