Any time you see a modifier tooltip using a non-static number it's getting its value from one of that modifier's MODIFIERPROPERTY's
and approximately 560 more examples in valve's abilities_english.txt
As you can see, all of those numbers are not manually written into the modifier description, they are dynamically grabbed from the modifier.
Because if you manually write the numbers into the tooltip then any time you make a number change in the ability you will have to remember to update every related tooltip, and hassle aside you're bound to miss some.
Using the dynamic tooltip you only have to change the number in one place and it gets updated everywhere. And you can change the number you are returning in your script during the game.
First, please note that this only works with Lua Modifiers and Valve's built in modifiers. It cannot be done with datadriven modifiers.
Any time you use a modifier property in a lua modifier the value you
return will be available for use in the modifier's description tooltip.
In your modifier script:
In your addon_\<language>.txt
This would result in a tooltip that says:
Granting 100 bonus damage!
In the tooltip the percentage
% sign surrounds the MODIFIERPROPERTY to mark it as text to be replaced with the value of the modifier property.
If the contents between the %'s don't match the format then it wont work.
Snippet from abilities_english.txt:
The first thing needed is a
d for integer (whole number), or
f for float (floating point number)
Note that this is case sensitive, they must be lowercase.
And one of these is required, if you try to omit it, it will not work.
Next is the modifier property name, make sure there is no empty space.
That's it, that's all you need for your tooltip to display.
But, there are 2 more options you can use.
By default the returned number will be absolute.
Meaning that even if you return a negative number it will be positive in the tooltip.
Putting a dash/minus sign
- before the d/f will make it not abs() the number, so it can be negative.
And with a float you can add a number before the
f to choose how many decimals to display (default 1)
and finally, if you want to write a percentage sign
% in your modifier tooltip you simply put 2
%% next to eachother where ever you want it in the tooltip.
"This is a percentage sign: %%"
"Gaining %dMODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE%%% bonus movement speed"
I'll leave a special note here for MODIFIER_PROPERTY_TOOLTIP and MODIFIER_PROPERTY_TOOLTIP2 These modifier properties do not do anything functionality wise, they exist only to display a custom number in your tooltip.
A simple example could be:
If you're having this issue then your returned value is probably only seen on the Server and not the Client. See this guide for instruction: Sending Server values to the Client