Adding the number of current modifier stacks to a modifier description?

edited December 3 in Questions

Hello all, I came across this particular question which is bugging me quite a lot: is it possible to show the number of stacks in a modifier description? If it is how can show it?

Comments

  • Posts: 158

    needs to be a lua modifier and you would use

    function modifier_lua_tooltip:DeclareFunctions()
        local funcs = { MODIFIER_PROPERTY_TOOLTIP, }
    
        return funcs
    end
    
    function modifier_lua_tooltip:OnTooltip(params)
        return self:GetStackCount()
    end
    

    and then in your description

    "DOTA_Tooltip_modifier_lua_tooltip_Description" "this modifier has %dMODIFIER_PROPERTY_TOOLTIP% stacks"
    

    valves modifier description format

    // substitution for modifier tooltips
    // %MODIFIER_PROPERTY_MAGICAL_RESISTANCE_BONUS% - 'd' prints the value returned by the 
    function as an integer
    // 'd' for integer
    // 'f' for float
    // optional '-' to not abs() the values
    // optional number to specify the number of decimals to print after a float
    // eg: %-2fMODIFIER_PROPERTY_BASEDAMAGEOUTGOING_PERCENTAGE% 
    // use %% to draw a percentage sign