• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

[TFS 0.3.6] Change Item ActionID?

rangoo

New Member
Joined
Jan 9, 2010
Messages
7
Reaction score
0
Hello, how can I change the actionID of the item by LUA Script?

PHP:
doItemSetAttribute(itemEx.uid, "actionid", 10030)
That script doesn't work in TFS 0.3.6 :/
 
doItemSetAttribute(teleport, "aid", t.aid)
the same thing, elf just shortened some things o_O
and, why you didnt just tried putting here aid if in most places its aid not actionid?
 
I was trying to do good script. I have now:
PHP:
--Item Upgrading released by granaria.hopto.org for TFS 0.3.6
--Another guy made this script(TFS 0.3.5), I don't know who it was. I'll not take credit for this script whatsoever.

local config = {
	brokeChance = 5,
	upgradePercent = 8,
	maxUpgrade = 50,
	notAllowed = {}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getItemAttribute(item.uid, "aid") != nil then
		local getUpgraded = getItemAttribute(item.uid, "aid") - 10000
	end
	if getItemAttribute(item.uid, "aid") == nil then
		local getUpgraded = 0
	if getUpgraded < 0 then
		getUpgraded = 0
	end
	if getUpgraded < config.maxUpgrade then
		if itemEx.itemid > 100 then
			if isItemMoveable(itemEx.itemid) and not isItemRune(itemEx.itemid) and not isCorpse(itemEx.uid) and not isContainer(itemEx.uid)and not isItemStackable(itemEx.itemid) and not isItemFluidContainer(itemEx.itemid) and not isInArray(config.notAllowed, itemEx.itemid) then
				if config.brokeChance <= math.random(100) then
					doItemSetAttribute(itemEx.uid, "name", getItemNameById(itemEx.itemid) .. "+" .. (getUpgraded+1))
					doItemSetAttribute(itemEx.uid, "aid", 10000+(getUpgraded+1))
					doSendMagicEffect(toPosition, 30)
					doPlayerSendTextMessage(cid, 22, "You successfuly upgraded " .. getItemNameById(itemEx.itemid) .. " to " .. (getUpgraded+1) .. " level.")
					if getItemAttribute(itemEx.uid, "attack") and getItemAttribute(itemEx.uid, "attack") > 0 then
						doItemSetAttribute(itemEx.uid, "attack", (getItemAttribute(itemEx.uid, "attack")+((getItemAttribute(itemEx.uid, "attack")/100)*config.upgradePercent))+1)
					end        
					if getItemAttribute(itemEx.uid, "extraattack") and getItemAttribute(itemEx.uid, "extraattack") > 0 then
						doItemSetAttribute(itemEx.uid, "extraattack", (getExtraItemAttack(itemEx.uid)+((getExtraItemAttack(itemEx.uid)/100)*config.upgradePercent))+1)
					end            
					if getItemAttribute(itemEx.uid, "defense") and getItemAttribute(itemEx.uid, "defense") > 0 then
						doItemSetAttribute(itemEx.uid, "defense", (itemEx.uid), (getItemAttribute(itemEx.uid, "defense")+((getItemAttribute(itemEx.uid, "defense")/100)*config.upgradePercent))+1)
					end            
					if getItemAttribute(itemEx.uid, "extradefense") and getItemAttribute(itemEx.uid, "extradefense") > 0 then
						doItemSetAttribute(itemEx.uid, "extradefense", (itemEx.uid), (getItemAttribute(itemEx.uid, "extradefense")+((getItemAttribute(itemEx.uid, "extradefense")/100)*config.upgradePercent))+1)
					end        
					if getItemAttribute(itemEx.uid, "armor") and getItemAttribute(itemEx.uid, "armor") > 0 then
						doItemSetAttribute(itemEx.uid, "armor", (itemEx.uid), (getItemAttribute(itemEx.uid, "armor")+((getItemAttribute(itemEx.uid, "armor")/100)*config.upgradePercent))+1)
					end        
					if getItemAttribute(itemEx.uid, "attackspeed") and getItemAttribute(itemEx.uid, "attackspeed") > 0 then
						doItemSetAttribute(itemEx.uid, "attackspeed", (itemEx.uid), (getItemAttribute(itemEx.uid, "attackspeed")+((getItemAttribute(itemEx.uid, "attackspeed")/100)*config.upgradePercent))+1)
					end        
					if getItemAttribute(itemEx.uid, "hitchance") and getItemAttribute(itemEx.uid, "hitchance") > 0 then
						doItemSetAttribute(itemEx.uid, "hitchance", (itemEx.uid), (getItemAttribute(itemEx.uid, "hitchance")+((getItemAttribute(itemEx.uid, "hitchance")/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
but now it say me "You do not have enough mana."...... What there can be problem?
 
umm, this script dont have anything connected with mana, so I have no idea ;d

i will test it now maybe ;d

You cannot use this object, still trying with another items, but no effect
 
Last edited:
if getItemAttribute(item.Exuid, "aid") != nil then

change ! to ~, I will edit with other bugs and later post working script

You get the mana thing cause you probably used one of gems that can be enchanted, just disable enchanting gems system...
But I still get you cannot use o_O

Lua:
--Item Upgrading released by granaria.hopto.org for TFS 0.3.6
--Another guy made this script(TFS 0.3.5), I don't know who it was. I'll not take credit for this script whatsoever.

local config = {
    brokeChance = 5,
    upgradePercent = 8,
    maxUpgrade = 50,
    notAllowed = {}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local getUpgraded = 0
    if getItemAttribute(itemEx.uid, "aid") ~= nil then
        local getUpgraded = getItemAttribute(itemEx.uid, "aid") - 10000
	end        
    if getUpgraded < 0 then
        getUpgraded = 0
    end
    if getUpgraded < config.maxUpgrade then
        if itemEx.itemid > 100 then
            if isItemMoveable(itemEx.itemid) and not isItemRune(itemEx.itemid) and not isCorpse(itemEx.uid) and not isContainer(itemEx.uid)and not isItemStackable(itemEx.itemid) and not isItemFluidContainer(itemEx.itemid) and not isInArray(config.notAllowed, itemEx.itemid) then
                if config.brokeChance <= math.random(100) then
                    doItemSetAttribute(itemEx.uid, "name", getItemNameById(itemEx.itemid) .. "+" .. (getUpgraded+1))
                    doItemSetAttribute(itemEx.uid, "aid", 10000+(getUpgraded+1))
                    doSendMagicEffect(toPosition, 30)
                    doPlayerSendTextMessage(cid, 22, "You successfuly upgraded " .. getItemNameById(itemEx.itemid) .. " to " .. (getUpgraded+1) .. " level.")
                    if getItemAttribute(itemEx.uid, "attack") and getItemAttribute(itemEx.uid, "attack") > 0 then
                        doItemSetAttribute(itemEx.uid, "attack", (getItemAttribute(itemEx.uid, "attack")+((getItemAttribute(itemEx.uid, "attack")/100)*config.upgradePercent))+1)
                    end        
                    if getItemAttribute(itemEx.uid, "extraattack") and getItemAttribute(itemEx.uid, "extraattack") > 0 then
                        doItemSetAttribute(itemEx.uid, "extraattack", (getExtraItemAttack(itemEx.uid)+((getExtraItemAttack(itemEx.uid)/100)*config.upgradePercent))+1)
                    end            
                    if getItemAttribute(itemEx.uid, "defense") and getItemAttribute(itemEx.uid, "defense") > 0 then
                        doItemSetAttribute(itemEx.uid, "defense", (itemEx.uid), (getItemAttribute(itemEx.uid, "defense")+((getItemAttribute(itemEx.uid, "defense")/100)*config.upgradePercent))+1)
                    end            
                    if getItemAttribute(itemEx.uid, "extradefense") and getItemAttribute(itemEx.uid, "extradefense") > 0 then
                        doItemSetAttribute(itemEx.uid, "extradefense", (itemEx.uid), (getItemAttribute(itemEx.uid, "extradefense")+((getItemAttribute(itemEx.uid, "extradefense")/100)*config.upgradePercent))+1)
                    end        
                    if getItemAttribute(itemEx.uid, "armor") and getItemAttribute(itemEx.uid, "armor") > 0 then
                        doItemSetAttribute(itemEx.uid, "armor", (itemEx.uid), (getItemAttribute(itemEx.uid, "armor")+((getItemAttribute(itemEx.uid, "armor")/100)*config.upgradePercent))+1)
                    end        
                    if getItemAttribute(itemEx.uid, "attackspeed") and getItemAttribute(itemEx.uid, "attackspeed") > 0 then
                        doItemSetAttribute(itemEx.uid, "attackspeed", (itemEx.uid), (getItemAttribute(itemEx.uid, "attackspeed")+((getItemAttribute(itemEx.uid, "attackspeed")/100)*config.upgradePercent))+1)
                    end        
                    if getItemAttribute(itemEx.uid, "hitchance") and getItemAttribute(itemEx.uid, "hitchance") > 0 then
                        doItemSetAttribute(itemEx.uid, "hitchance", (itemEx.uid), (getItemAttribute(itemEx.uid, "hitchance")+((getItemAttribute(itemEx.uid, "hitchance")/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

just made it not show stupid errors, nothing more
 
Last edited:
Thanks, I only change start in this to:
PHP:
local getUpgraded = itemEx.actionid - 10000
Now it can work, but... I can't get Attack/Def/Arm etc. values... Nil ;/
 
Thanks, I only change start in this to:
PHP:
local getUpgraded = itemEx.actionid - 10000
Now it can work, but... I can't get Attack/Def/Arm etc. values... Nil ;/

Yes, I encountered that when scripting aswell(0.3.6)

getItemAttribute() returns nil, is there any other way to get the, for example, armor of an item? :(
 
There's probably something wrong with the function =(

Can someone help us? xD
 
Back
Top