Well, you can simply disable the AI for a hero by using the following command:, where heroname is the script name of the hero.EnableHeroAI("heroname", nil)
I tried adding a hero to a town and disabling him using EnableHeroAI("heroname", nil), but the computer continues to buy an army in the town and purchase units from dwellings.