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

Windows doSetItemActionId?

Trader

New Member
Joined
Aug 12, 2009
Messages
219
Reaction score
2
attempt to call global 'doSetItemActionId' (a nil value)

What does this error mean?
How come this function doesn't work?

How to fix it? Rep+ ofc
Thanks
 
What TFS are you Using?? if it's 0.3.6 and up then thats the thing, it changed to doSetItemAttribute(uid, "Attribute here", #) attributes that I know are:
aid, uid, description, attack, defense, etc. there are more, but I can't remember.
 
Code:
        doSetItemAttribute(item.uid, new)
        doSetItemAttribute(itemEx.uid, 100+(amount+1))

This should work, but it doesn't?
 
It's a item upgrade system, but the item upgrader doesn't set the actionid :/
Maybe I can send it to you and you can fix it? That would be awesomes :D?
 
Code:
  local messagetype = MESSAGE_EVENT_ORANGE
local fetishs = {
    [7800] = {chance = 100, amount = 1, set = setItemAttack, get = getItemAttack, name = "attack"},
    [7801] = {chance = 90, amount = 2, set = setItemAttack, get = getItemAttack, name = "attack"},
    [7802] = {chance = 75, amount = 3, set = setItemAttack, get = getItemAttack, name = "attack"},
    [7803] = {chance = 60, amount = 4, set = setItemAttack, get = getItemAttack, name = "attack"},
    [7804] = {chance = 50, amount = 5, set = setItemAttack, get = getItemAttack, name = "attack", destroy = TRUE},
    [7805] = {chance = 100, amount = 1, set = setItemDefense, get = getItemDefense, name = "defense"},
    [7806] = {chance = 90, amount = 2, set = setItemDefense, get = getItemDefense, name = "defense"},
    [7807] = {chance = 75, amount = 3, set = setItemDefense, get = getItemDefense, name = "defense"},
    [7808] = {chance = 60, amount = 4, set = setItemDefense, get = getItemDefense, name = "defense"},
    [7809] = {chance = 50, amount = 5, set = setItemDefense, get = getItemDefense, name = "defense", destroy = TRUE},
    [7810] = {chance = 100, amount = 1, set = setItemArmor, get = getItemArmor, name = "armor"},
    [7811] = {chance = 90, amount = 2, set = setItemArmor, get = getItemArmor, name = "armor"},
    [7812] = {chance = 75, amount = 3, set = setItemArmor, get = getItemArmor, name = "armor"},
    [7813] = {chance = 60, amount = 4, set = setItemArmor, get = getItemArmor, name = "armor"},
    [7814] = {chance = 50, amount = 5, set = setItemArmor, get = getItemArmor, name = "armor", destroy = TRUE},
    [7850] = {chance = 100, amount = 5, set = setItemAttack, get = getItemAttack, name = "attack"}, -- only given when access >= 5
    [7851] = {chance = 100, amount = 5, set = setItemDefense, get = getItemDefense, name = "defense"}, -- only given when access >= 5
    [7852] = {chance = 100, amount = 5, set = setItemArmor, get = getItemArmor, name = "armor"}, -- only given when access >= 5
}
local minmax = {
    min1 = 7800, -- minimum of the random fetishs for access < 5
    max1 = 7814, -- maximum of the random fetishs for access < 5
    min2 = 7850, -- minimum of the random fetishs for access >= 5
    max2 = 7852, -- maximum of the random fetishs for access >= 5
}
-- WARNING: look further down and your eyes will burn. --
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.actionid == 0 then
        local new = getPlayerAccess(cid) >= 5 and math.random(minmax.min2, minmax.max2) or math.random(minmax.min1, minmax.max1)
        local text = "You remove the dust and reveal that it is a "..fetishs[new].chance.."% upgrade crystal for "..fetishs[new].name.." +"..fetishs[new].amount.."."..(fetishs[new].destroy ~= nil and " It has a slight chance of breaking your item." or "")
        doPlayerSendTextMessage(cid, messagetype, text)
        doSetItemAttribute(item.uid, new)
        doSetItemSpecialDescription(item.uid, text)
        setItemName(item.uid, fetishs[new].chance.."% upgrade crystal for "..fetishs[new].name.." +"..fetishs[new].amount)
    elseif fetishs[item.actionid] ~= nil then
        if fetishs[item.actionid].get(itemEx.uid) > 0 then
            if itemEx.actionid < 110 then
                local amount = math.max(0, itemEx.actionid - 100)
                local chance = math.random(0, 100)
                local text = fetishs[item.actionid].name.." upgrade on "..getItemNameById(itemEx.itemid).." failed."
                if chance <= fetishs[item.actionid].chance then
                    fetishs[item.actionid].set(itemEx.uid, (fetishs[item.actionid].get(itemEx.uid)+fetishs[item.actionid].amount))
                    text = getItemNameById(itemEx.itemid).." "..fetishs[item.actionid].name.." +"..fetishs[item.actionid].amount.."."
                elseif fetishs[item.actionid].destroy ~= nil or fetishs[item.actionid].destroy == TRUE then
                    if math.random(0, 1) == 1 then
                        doRemoveItem(itemEx.uid)
                        text = getItemNameById(itemEx.itemid).." has been destroyed."
                    end
                end
		if (chance <= fetishs[item.actionid].chance) then
                doPlayerSendTextMessage(cid, messagetype, text)
                doSetItemAttribute(itemEx.uid, 100+(amount+1))
                setItemName(itemEx.uid, getItemNameById(itemEx.itemid).." (+ "..(amount+1)..")")
                doSendMagicEffect(toPosition,13)
		doSendAnimatedText(toPosition,"Success!",TEXTCOLOR_WHITE)
		else
		doSendMagicEffect(toPosition,2)
		doSendAnimatedText(toPosition,"Failed!",TEXTCOLOR_RED)
		end		 
		doRemoveItem(item.uid)
            else
                doPlayerSendCancel(cid, "This weapon has already been upgraded 10 times.")
            end
        else
            doPlayerSendCancel(cid, "This item may not be upgraded.")
        end
    else
        doPlayerSendCancel(cid, "Sorry, not possible.")
    end
        return TRUE
end

Made by Jajajiji, here
http://otland.net/f81/release-upgrading-system-click-v-2-0-a-37264/
I need it to work with 0.3.6 Thank you...~~
 
Just paste this into lib/050-function.lua, this will fix your problem:
Code:
function doItemSetActionId(uid, aid)
	return doItemSetAttribute(uid, "aid", aid)
end
doSetItemActionId = doItemSetActionId
 
doItemSetAttribute(uid,"aid",number of actionid)
here is a list of things that you can do with this function:


-attribute key "aid" = return the action id
-attribute key "armor" = return the item armor
-attribute key "article" = return the item article
-attribute key "attack" = return the item attack
-attribute key "attackspeed" = return the item attackspeed
-attribute key "charges" = return the item charges
-attribute key "date" = return the item data when was written
-attribute key "decaying" = return if the item is decaying
-attribute key "defense" = return the item defense
-attribute key "depotid" = return the item depot id
-attribute key "description" = return the item description
-attribute key "duration" = return the duration of decaying
-attribute key "extraattack" = return the item extra attack
-attribute key "extradefense" = return the item extra defense
-attribute key "fluidtype" = return the item fluid type
-attribute key "hitchance" = return the item hitchance
-attribute key "name" = return the item name
-attribute key "pluralname" = return the item plural name (gold conin -> gold coins)
-attribute key "scriptprotected" = not sure what this means exactly
-attribute key "shootrange" = return the item shoot range
-attribute key "text" = return the item text
-attribute key "uid" = return the unique id
-attribute key "weight" = return the item weight
-attribute key "writer" = return the item writer
 
Back
Top