So, I wanted to make heroes that were unique and only one of them could exist at once, so heres my solution. i created a new static resource which I called "soul". The hero unit consumes one soul and you start with one soul, so ultimately, the starting value for soul is zero. In the middle of the hero's "die" skill i added this line:
<resource-requirements>
<resource name="soul" amount="-1"/>
</resource-requirements>
So when the hero dies, you gain one soul. At the base you can respawn the hero, and this takes one soul, so basically you can only build a hero when the existing hero dies. Aside from this I remade the levels and added a special attack skill. (I have 5 levels for my hero and he levels relatively fast to compensate for losing his levels when he dies.) obviously, the fast leveling can result in balance issues in a normal mod, but I designed this for use in a mod I am working on where you only control your hero and a few extremely week cannon fodder-esque type units.