I saw somebody else suggest making a custom resource, like "hero points" or something. You could start with one hero point, and that special unit would require one hero point, just like how other units take energy. If you want to expand the possibilities a little more, you could have your main building (Caste/Mage Tower/whatever) produce one hero point, so you could have one hero unit per main building. I hope that helps!