Without further delay. Lets get to it!
npc_abilities_custom.txt entry for our ability.
This is your basic start for lua ability.
The magic happens here.
CreateModifierThinker creates sort of invisible unit with modifier attached to it.
Now for the next piece of magic we need to setup our cool modifier. In this example the file path would be "vscripts/lua_abilities/enchant_tree/modifier.lua".
There are two major parts for every 'tree enchantment'. First is making sure that we have tree nearby. Because of engine limitations the trees are difficult to interact with. For our solution we are simply requesting from gridnav every half a second if there is trees in very small area at our thinker unit's location.
The last part is minor optimization that may become redundant but was not at the time of developing this. There was issue where the thinker unit would remain on the map for some time after the modifier was destroyed.
Now comes the fun part. What do we want to do with this modifier.
I decided to go with soul collecting tree: if enemy hero is killed in radius(you need to add this to special values of your
npc_abilities_custom.txt) the owner of the spell steal up to 2 of victim's primary stat.
For those fancy effects that ironwood tree has you might want to add these lines
Next Topic: Stacking Modifiers