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

Lua attributes for (doItemSetAttribute())

televolt

Member
Joined
Jun 21, 2010
Messages
153
Reaction score
9
Hello, can anyone help with a list of all possible attributes in doItemSetAttribute()?
 
You can technically set any attribute, then pull it up later.
For Example I recently made a friend a script that gives Items Experience and Levels using doItemSetAttribute(item, "Experience", number) etc.

A list of things you can edit depends on the version of TFS you are using.

I think the most common of them are:
attack, defense, armor, attackspeed, name, specialdescription.

If you let me know what you want to edit I can let you know if it is possible.
 
i'm trying to use a script to upgrade wands but nothing happen without error :(
tfs 0.3.7
LIB
Code:
function getHand(player)
local _ALLOWEDS = {2187} -- example {2723, 8329, 8921}
local slotRight = getPlayerSlotItem(player, 5)
local slotLeft = getPlayerSlotItem(player, 6)
    if isInArray(_ALLOWEDS, slotRight.itemid) then
        return "right"
    elseif isInArray(_ALLOWEDS, slotLeft.itemid) then
      return "left"
    end
    return nil
end
function getWandDmg(itemId)
local file = io.open("data/weapons/weapons.xml", "r")
 
    for info in string.gmatch(file:read("*a"), "<weapons(.-)</weapons>") do
        if info:match("wand id=\"(.-)\"") == itemId then
            local min = info:match("min=(.-)")
            local max = info:match("max=(.-)")
            return math.random(min, max)
        end
    end
 
    file:close()
    return nil
end
function getWandDmgType(itemId)
local file = io.open("data/weapons/weapons.xml", "r")
 
    for info in string.gmatch(file:read("*a"), "<weapons(.-)</weapons>") do
        if info:match("wand id=\"(.-)\"") == itemId then
            local type = info:match("type=(.-)")
            return tostring(type)
        end
    end
 
    file:close()
    return nil
end
function setWandExtraDmg(wand, extra)
    local value = tonumber(getWandExtraDmg(wand))
    return doItemSetAttribute(wand.uid, "extraDmg", value + extra)
end
function getWandExtraDmg(wand)
    if getItemAttribute(wand.uid, "extraDmg") == nil then
        doItemSetAttribute(wand.uid, "extraDmg", 0)
    end
    return getItemAttribute(wand.uid, "extraDmg")
end

ACTION

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local _VAL = 100 -- value of upgrade, example damage is 100 boost + 5 = damage 150
local _ALLOWEDS = {2187} -- example {2723, 8329, 8921}
    if isInArray(_ALLOWEDS, itemEx.itemid) then
        setWandExtraDmg(itemEx, _VAL)
        doSendMagicEffect(fromPosition, 28)
        --doRemoveItem(item.uid, 1)
        --doSendAnimatedText(fromPosition, "+ 1", math.random(210, 250))
    end
    return true
end

CREATUREEVENTS

Code:
function onStatsChange(cid, attacker, type, combat, value)
local _TYPES = {
    ["fire"] = {efect = 36, dmg = COMBAT_FIREDAMAGE},
    ["ice"] = {efect = 42, dmg = COMBAT_ICEDAMAGE},
    ["earth"] = {efect = 45, dmg = COMBAT_POISONDAMAGE},
    ["death"] = {efect = 17, dmg = COMBAT_DEATHDAMAGE},
    ["energy"] = {efect = 11, dmg = COMBAT_ENERGYDAMAGE},
    ["holy"] = {efect = 49, dmg = COMBAT_HOLYDAMAGE}
}
local slotRight = getPlayerSlotItem(attacker, 5)
local slotLeft = getPlayerSlotItem(attacker, 6)
    local _HAND = getHand(attacker) == "right" and slotRight or slotLeft
    local _TYPE = _TYPES[getWandDmgType(_HAND.itemid)]
    local _EXTRA = getWandExtraDmg(_HAND)
    local _MIN, _MAX = getWandDmg(_HAND.itemid) + _EXTRA, getWandDmg(_HAND.itemid) + _EXTRA
    if _MIN > _MAX then
      _MIN = _MAX
    end
    if _EXTRA > 0 then
        if getCreatureCondition(cid, CONDITION_MANASHIELD) then
            doTargetCombatMana(attacker, cid, _MIN, _MAX, _TYPE.efect)
        else
            doTargetCombatHealth(attacker, cid, _TYPE.dmg, - _MIN, - _MAX, _TYPE.efect)
        end
    end
    return true
end
 
Back
Top