How would i script a custom stat and then acquire the amount of this stat a hero currently has?

Let's say I make every have "Cursed" stat and this stat could effect the ability's damage to themselves and/or their enemies depending on the value they have of this stat. This custom stat can also be increased and/or decreased in value by both items and abilities.

Comments

  • Posts: 149

    hero.cursed = X

    In a damage filter, check the unit's .cursed value and apply the modifications to the damage based on the value.

    To show it on the UI you might want to store it in a Custom Net Table

  • Posts: 1,670

    Damage filter is solid for deciding damage.

    For calculating how much bonus you have you either need to get the OnCreated/OnDestroy intrinsic modifier or OnEquip event of the item, or alternatively a running timer going through all items every 0.1 seconds or so, which calculates how much Cursed stat each hero has.

    On the item KVs you can do it as ability special value for your stat, because you will want to show it as a stat on the item. You can do item:GetAbilityKeyValues() and compare with a standarized "cursed_stat" special or similar

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