CreatureEvent [TFS 1.1] Ultimate item stat system (elements, skills, exp, loot and more)

oshrigames

Intermediate OT User
Joined
Nov 9, 2012
Messages
191
Best answers
0
Reaction score
32
Location
israel
how complicated will it be for me to add few more item attributes to those lists?
or if at all possible?

manadrain = 2, -- add to weapons & wands
lifedrain = 5, -- add to weapons & wands
hp = 5, - all gear but weapons & wands
mana = 5, - all gear but weapons & wands
exp = +x0.2%, - rings & boots
loot = +x0.2% - rings & boots

Lua:
    -- spells and values for certain types of item
    UPGRADE_STATS_VALUES_PER_LVL = {
        -- value per level
            atk = 1,
            def = 1,
            extradef = 1,
            arm = 1,
            hitchance = 2,
            shootrange = 1
    },

Lua:
local upgradable_stats = {
    [1] = {ITEM_ATTRIBUTE_ATTACK, function(id) return id:getAttack() end, STATS_SYSTEM_CONFIG.UPGRADE_STATS_VALUES_PER_LVL.atk},
    [2] = {ITEM_ATTRIBUTE_DEFENSE, function(id) return id:getDefense() end, STATS_SYSTEM_CONFIG.UPGRADE_STATS_VALUES_PER_LVL.def},
    [3] = {ITEM_ATTRIBUTE_EXTRADEFENSE, function(id) return id:getExtraDefense() end, STATS_SYSTEM_CONFIG.UPGRADE_STATS_VALUES_PER_LVL.extradef},
    [4] = {ITEM_ATTRIBUTE_ARMOR, function(id) return id:getArmor() end, STATS_SYSTEM_CONFIG.UPGRADE_STATS_VALUES_PER_LVL.arm},
    [5] = {ITEM_ATTRIBUTE_HITCHANCE, function(id) return id:getHitChance() end, STATS_SYSTEM_CONFIG.UPGRADE_STATS_VALUES_PER_LVL.hitchance},
    [6] = {ITEM_ATTRIBUTE_SHOOTRANGE, function(id) return id:getShootRange() > 1 and id:getShootRange() or 0 end, STATS_SYSTEM_CONFIG.UPGRADE_STATS_VALUES_PER_LVL.shootrange}
}
Lua:
[7] = {ITEM_ATTRIBUTE_LIFEDRAIN, function(id) return id:getLifeDrain() > 1 and id:getLifeDrain(() or 0 end, STATS_SYSTEM_CONFIG.UPGRADE_STATS_VALUES_PER_LVL.lifedrain(}
Lua:
function getItemAttribute(uid, key, force)
    local i = ItemType(Item(uid):getId())
    local string_attributes = {
        [ITEM_ATTRIBUTE_NAME] = i:getName(),
        [ITEM_ATTRIBUTE_ARTICLE] = i:getArticle(),
        [ITEM_ATTRIBUTE_PLURALNAME] = i:getPluralName(),
        ["name"] = i:getName(),
        ["article"] = i:getArticle(),
        ["pluralname"] = i:getPluralName()
    }

    local numeric_attributes = {
        [ITEM_ATTRIBUTE_WEIGHT] = i:getWeight(),
        [ITEM_ATTRIBUTE_ATTACK] = i:getAttack(),
        [ITEM_ATTRIBUTE_DEFENSE] = i:getDefense(),
        [ITEM_ATTRIBUTE_EXTRADEFENSE] = i:getExtraDefense(),
        [ITEM_ATTRIBUTE_ARMOR] = i:getArmor(),
        [ITEM_ATTRIBUTE_HITCHANCE] = i:getHitChance(),
        [ITEM_ATTRIBUTE_SHOOTRANGE] = i:getShootRange(),
        ["weight"] = i:getWeight(),
        ["attack"] = i:getAttack(),
        ["defense"] = i:getDefense(),
        ["extradefense"] = i:getExtraDefense(),
        ["armor"] = i:getArmor(),
        ["hitchance"] = i:getHitChance(),
        ["shootrange"] = i:getShootRange()
    }

i mean its the biggest script i've read in my entire life 2k+ lines and too advanced for me to understand to completion :x
 
Last edited:
Top