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

Action Item's Upgrading by Jewels! : )

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Reaction score
53
Location
Włocławek
Items upgrading ala mu online, you can upgrade (+1 level) items by jewel, each upgrade set item attributes more than x% of item status. If upgrading failed you item has been destroyed.
Not for commercial uses ! If you wan't add it to sms shop - pay me 5€! You earn money - me too want!
in actions.xml:
PHP:
<action itemid="2147" script="upgrade.lua"/>
you cann add more upgrading jewels, only copy this line and set jewel item id on itemid="HERE" ; )

and
actions/scripts/upgrade.lua
PHP:
-- Azi's item upgrading system -- 
config = {
    brokeChance = 10, -- % chance to broke upgrading item
    upgradePercent = 10, -- % of rise upgrading item atributtes 
    maxUpgrade = 100, -- maximum level of item
    notAllowed = {} -- items id between comma which you cannot upgrade it
}
function onUse(cid, item, fromPosition, itemEx, toPosition)

    local getUpgraded = itemEx.actionid-10000
    if getUpgraded < 0 then
    getUpgraded = 0
    end
    if getUpgraded < config.maxUpgrade then
        if itemEx.itemid > 100 then
            if isItemMoveable(itemEx.itemid) == 1 and isItemRune(itemEx.itemid) == 0 and isCorpse(itemEx.uid) == 0 and isContainer(itemEx.uid) == 0 and isItemStackable(itemEx.itemid) == 0 and isItemFluidContainer(itemEx.itemid) == 0 and isInArray(config.notAllowed, itemEx.itemid) == 0 then
                if config.brokeChance <= math.random(1,100) then
                    setItemName(itemEx.uid, getItemNameById(itemEx.itemid) .. "+" .. (getUpgraded+1))
                    doSetItemActionId(itemEx.uid, 10000+(getUpgraded+1))
                    doSendMagicEffect(toPosition, 30)
                    doPlayerSendTextMessage(cid, 22, "You successfuly upgraded " .. getItemNameById(itemEx.itemid) .. " to " .. (getUpgraded+1) .. " level.")
                    if getItemAttack(itemEx.uid) > 0 then
                        setItemAttack(itemEx.uid, (getItemAttack(itemEx.uid)+((getItemAttack(itemEx.uid)/100)*config.upgradePercent))+1)
                    end        
                    if getItemExtraAttack(itemEx.uid) > 0 then
                        setExtraItemAttack(itemEx.uid, (getExtraItemAttack(itemEx.uid)+((getExtraItemAttack(itemEx.uid)/100)*config.upgradePercent))+1)
                    end            
                    if getItemDefense(itemEx.uid) > 0 then
                        setItemDefense(itemEx.uid, (getItemDefense(itemEx.uid)+((getItemDefense(itemEx.uid)/100)*config.upgradePercent))+1)
                    end            
                    if getItemExtraDefense(itemEx.uid) > 0 then
                        setItemExtraDefense(itemEx.uid, (getItemExtraDefense(itemEx.uid)+((getItemExtraDefense(itemEx.uid)/100)*config.upgradePercent))+1)
                    end        
                    if getItemArmor(itemEx.uid) > 0 then
                        setItemArmor(itemEx.uid, (getItemArmor(itemEx.uid)+((getItemArmor(itemEx.uid)/100)*config.upgradePercent))+1)
                    end        
                    if getItemAttackSpeed(itemEx.uid) > 0 then
                        setItemAttackSpeed(itemEx.uid, (getItemAttackSpeed(itemEx.uid)+((getItemAttackSpeed(itemEx.uid)/100)*config.upgradePercent))+1)
                    end        
                    if getItemHitChance(itemEx.uid) > 0 then
                        setItemHitChance(itemEx.uid, (getItemHitChance(itemEx.uid)+((getItemHitChance(itemEx.uid)/100)*config.upgradePercent))+1)
                    end
                else
                    doPlayerSendTextMessage(cid, 22, getItemNameById(itemEx.itemid).." upgrading to level " .. (getUpgraded+1) .. " fail! You lose item!")
                    doRemoveItem(itemEx.uid, 1)
                    doSendMagicEffect(toPosition, 34)
                end
                doRemoveItem(item.uid, 1)
            else
                doPlayerSendCancel(cid, "You cannot upgrade this item!")
            end
        end
    else
        doPlayerSendCancel(cid, "This item is already upgraded to maximum item level.")
    end
        return TRUE
end
please set config in the script. : ))

Please, don't copy this script to other forums.

azi. :)
 
Last edited:
error fixed (please take new version)
and this script made for tfs 0.3b2
 
I use a small topaz on the sword, and nothing :S
 
This version (3.1 cry) dont show any error from scripts :S
 
Pretty nice ;p you could also make function for adding/changing attributes ;) Then u can check if item is armor/weapon/shield or whatever and use different attributes (armor, attack, def, speed~ ect.) for them, that should speed-up script, you can also make random number of attributes updated and random attributes as well :D I did that for my server, but it's hardcoded in C++ ;< I like yours :D So I'll re-write it to my version's usability.
 
ok, fixed 100% : )

Code:
19:02 You see a magic plate armor+13 (Arm:46).
It can only be wielded properly by knights and paladins.
It weighs 85.00 oz.
An enchanted gem glows on the plate armor.

update in top post
 
And if I wanna do this for levers?

For example (I put a picture because i don't know inglish and i think this is better):
upgradejq3.png


EDIT: A lot of thanks, this script is very nice
 
Last edited:
Back
Top