Treebeard is a bit different from normal heroes. I did similar things with the first game, which turned out OK for Nazgûl, Gollum and so on, but the fact that Treebeard comes from the Entmoot and not the Fortress means his coding will be a bit different. This didn't matter for the game makers, because Treebeard didn't get experience.
I recommend you compare the Treebeard code to the coding of one of the other heroes that already does what you want, and see if there's a point where it's different.
P. S. Once you manage, would you mind telling me how to do it?
~
Signature closed for refurbishment ~
BILL POSTERS WILL BE PROSECUTED