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

very nice script thank you for shareing it here.
1 question can it be made to where you need a certain lvl to use gem?
 
Thanks dude, thats an awesome script! Reped+!

Well I have an question, have how you edit for put only X itens which can be enchanted?
Cuz I tested and I can enchant any itens like ropes, shovel, flowers, books, etc... (except not moveable items, runes, stackable items, containers and corpses as you said)
Ill be glad and thanks for attetion! :thumbup:

Regards.
 
#up
if you need to not can upgrade ropes etc. you can set it in config:

notAllowed = {ROPE ID, SHOVEL ID, NEXT ID, ETC..} : )
 
I thing I have better idea, change:
Code:
isInArray(config.notAllowed, itemEx.itemid) == 0
to:
Code:
isInArray(config.Allowed, itemEx.itemid) == 1

And change:
Code:
notAllowed = {} -- items id between comma which you cannot upgrade it
to:
Code:
Allowed = {} -- items id between comma which you can upgrade it

Now you can upgarde only items in "local Allowed", no more rope and shovel upgarding :p

PS: Sorry for noobish english :/
 
This script don't work on TFS 0.3.4.. Always say "You cannot upgrade this item!" Can anybody help me ;s?
 
for me its the same
it said me
you cannot upgrade this item

and i am trying to updrage a magic plate armor =\ can someone help me?
 
Code:
[05/05/2009  15:17:19] Lua Script Error: [Action Interface] 
[05/05/2009  15:17:19] data/actions/scripts/upgrade.lua:onUse

[05/05/2009  15:17:19] data/actions/scripts/upgrade.lua:19: attempt to call global 'getItemNameById' (a nil value)
[05/05/2009  15:17:19] stack traceback:
[05/05/2009  15:17:19] 	data/actions/scripts/upgrade.lua:19: in function <data/actions/scripts/upgrade.lua:8>

i have that error i use The Forgotten Server - Version 0.2.1 (Mystic Spirit)
can fix this for that version?
 
[06/05/2009 18:24:25] Lua Script Error: [Action Interface]
[06/05/2009 18:24:25] data/actions/scripts/upgrade.lua:eek:nUse

[06/05/2009 18:24:25] data/actions/scripts/upgrade.lua:18: attempt to call global 'getItemNameById' (a nil value)
[06/05/2009 18:24:25] stack traceback:
[06/05/2009 18:24:25] data/actions/scripts/upgrade.lua:18: in function <data/actions/scripts/upgrade.lua:8>

Why is dont work help me ;)
 
Last edited:
When i use it on a Weapon i get this error
Code:
[09/05/2009  04:20:44] Lua Script Error: [Action Interface] 
[09/05/2009  04:20:44] data/actions/scripts/upgrade.lua:onUse

[09/05/2009  04:20:44] data/actions/scripts/upgrade.lua:18: attempt to call global 'getItemNameById' (a nil value)
[09/05/2009  04:20:44] stack traceback:
[09/05/2009  04:20:44] 	data/actions/scripts/upgrade.lua:18: in function <data/actions/scripts/upgrade.lua:8>
 
you don't have function "getItemNameById" - this function is deleted in new version, i update script soon ; )
 
Good, but i want upgrates by gems. How to change gems to use with ? I need to change items.otb or something else ? Please tell me. I really need this and i know some other servers have this (gems to upgrade). I will rep++

Edit:
I was changing script for small topaz and i wanted to add stages of broke chance.
Code:
-- Azis item upgrading system -- 
config = {
    brokeChance1 = 10, -- % chance to broke upgrading item
    brokeChance2 = 25, -- % chance to broke of medium item level
    brokeChance3 = 50, -- % chance to broke of high item level
    brokeChance4 = 75, -- % chance to broke realy hight level item
    upgradePercent = 1, -- % of rise upgrading item atributtes 
    maxUpgrade = 100, -- maximum level of item
    Allowed = {2472} -- items id between comma which you cannot upgrade it
}
function onUse(cid, item, fromPosition, itemEx, toPosition)

    local getUpgraded = itemEx.actionid-10000
    local brokeChance = 0
    if getUpgraded < 0 then
    getUpgraded = 0
    end

	
	if getUpgraded >= 0 and getUpgraded <= 4 then
		brokeChance = config.brokenChance1
	end
	if getUpgraded >=5 and getUpgraded <=8 then
		brokeChance = config.brokenChance2
	end
	if getUpgraded >=9 and getUpgraded <=12 then
		brokeChance = config.brokenChance3
	end
	if getUpgraded >=12 then
		brokeChance = config.brokenChance4
	end

    if getUpgraded < config.maxUpgrade then
        if itemEx.itemid > 100 then
            if isInArray(config.Allowed, itemEx.itemid) == 1 then
                if 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 .
And had this error :
Code:
[10/05/2009 12:58:20] data/actions/scripts/upgrade.lua:36: attempt to compare nil with number
[10/05/2009 12:58:20] stack traceback:
[10/05/2009 12:58:20] 	data/actions/scripts/upgrade.lua:36: in function <data/actions/scripts/upgrade.lua:11>

I found bug. How to make it works with distance weapons ?
Edit:
To make dist weapon work You must add this to items.xml :
Code:
		<attribute key="attack" value="1"/>
 
Last edited:
Maybe is somethink wrong in TFS 0.3.4 because this commend is bad

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

And only see you can not upgrate this waepon.
When i delte this commend scripts is good.

I Forgot i try change
isItemMoveable = isItemMovable and nothink
 
Thanks, i rep you.
I added line to broking topaz. 50% to destroy small topaz and write "Small topaz was not much powerful. Puff" : P
 
Back
Top