Applying an item's modifier to a unit

edited November 2015 in Questions

e/ solved q.q shouldve used ApplyDataDrivenModifier

So i have an item like this

//Shield
  "item_basic_longsword"
  {
    "BaseClass" "item_datadriven"
    "AbilityTextureName" "item_broadsword"
    "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_PASSIVE"
    "Slot" "Weapon"
    "Category" "longsword"
    "LevelTable" "1 9 17 30 55 73"
    "UseDropTable" "1"

    "ItemStats"
    {
        "Damage" "3-5 10-17 31-45 65-83 100-132 211-299"
        "BaseAttackRate" "1.55"
    }

    "Modifiers"
    {
        "yaol_carver_modifier"
        {
            "Properties"
            {
                "MODIFIER_PROPERTY_EXTRA_HEALTH_BONUS"      "500000"
            }
        }
    }
  } 

and I'm trying to apply the "yaol_carver_modifier_ buff in LUA but I can't seem to be able to. I tried


print("adding modifier", "yaol_carver_modifier") unit:AddNewModifier(unit, nil, "yaol_carver_modifier_, {}) print("has modifier", unit:HasModifier("yaol_carver_modifier"))

but that printed false. any help?

MAKE CUSTOM GAMES GREAT AGAIN

Finished-
kv checker - https://arhowk.github.io
panorama video series - https://moddota.com/forums/discussion/2021/inclusive-panorama-tutorial-quest-box

My pet project This Cursed World/Crestfallen (name pending)
https://moddota.com/forums/discussion/986/this-cursed-world-rpg#latest

Comments

  • edited November 2015 Posts: 1,670

    Those random ItemStats are pretty gud, does item_lua not work well for that? Or is it still a bugged/unusable

    The concept of Modding Community doesn't go well together with Competitive Business
    My Project Page || My GitHub Profile ||

  • Posts: 858

    Well for all of the processing and management, I try to keep every stat applied to Heroes kept in a database (table) and than apply to the hero the summation of all the different items, rather than just individual modifiers and whatnot. For this purpose, using data driven makes more sense because the item specification is nothing more than something I LoadKeyValues on later, so data driven makes more sense.

    too confusing didn't read: the item file doesn't actually do anything

    (I just wanted the modifier to make custom effects for legendaries. Putting the respective modifiers in their items kv looks nice)

    MAKE CUSTOM GAMES GREAT AGAIN

    Finished-
    kv checker - https://arhowk.github.io
    panorama video series - https://moddota.com/forums/discussion/2021/inclusive-panorama-tutorial-quest-box

    My pet project This Cursed World/Crestfallen (name pending)
    https://moddota.com/forums/discussion/986/this-cursed-world-rpg#latest