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

Problem with upgrade stone

elo1989

New Member
Joined
Jun 30, 2010
Messages
56
Reaction score
2
Hi, I have a strange problem as the topic . Namely, when I use the US for example, the sword is the damage nicely growing but if you use the US on a ranged weapon , and when I do the "look" I have "You see Reishi Scout (Atk:72)" after the upgrade have "You see Reishi Scout+4 (Atk:94)" but the damage with these weapons and so is the same whether I have +4 or +10 .

Code:
items.xml
<item id="8884" name="Reishi Scout">
        <attribute key="weight" value="4000"/>
        <attribute key="attack" value="72"/>
        <attribute key="weaponType" value="distance"/>
        <attribute key="range" value="6"/>
        <attribute key="hitChance" value="100"/>
        <attribute key="shootType" value="piercingbolt"/>
        <attribute key="slotType" value="two-handed"/>
</item>

upgrade stone.lua
Code:
local conf = {}

conf["level"] = {
-- [item_level] = {successParcent=PARCENT FOR UPGRADING SUCCESS, downrageLevel = IF UPGRADING FAIL - ITEM WAS DECRASED TO LEVEL HERE}
 [1] = {successParcent = 90, downrageLevel = 0},
 [2] = {successParcent = 75, downrageLevel = 1},
 [3] = {successParcent = 50, downrageLevel = 2},
 [4] = {successParcent = 40, downrageLevel = 0},
 [5] = {successParcent = 35, downrageLevel = 0},
 [6] = {successParcent = 30, downrageLevel = 0},
 [7] = {successParcent = 25, downrageLevel = 0},
 [8] = {successParcent = 25, downrageLevel = 0},
 [9] = {successParcent = 20, downrageLevel = 0},
 [10] = {successParcent = 20, downrageLevel = 0},
}

conf["upgrade"] = {
    attack = 5,
    extraAttack = 10,
    defense = 5,
    extraDefense = 10,
    armor = 5,
    hitChance = 5,
}

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, 14)
                doPlayerSendTextMessage(cid, 22, "Upgraded was successful!")
            else
                doSendMagicEffect(toPosition, 31)
                doPlayerSendTextMessage(cid, 22, "Upgrading fail!")
            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


Please help solve this problem.
Regards.
 
Because distant weapons are handled differently by the server than that of melee weapons, might want to create a script and add it to your weapons.xml file to determine the amount/type of damage your distant weapons do.
 
Hello guys, I am a bit tempted to start my own ot server but i would need someones help. If anyone here knows what program i need to use to open a datapack please give me a link and i will try it because now i can't even open a start pack ;D

Mgs me as fast as you can please.
 
Back
Top