Well, it was something like this (found it in an old map draft :). Basically, it destroys the tavern and dwellings for the player and restores them for the AI after capturing the town. It's designed for 6 towns. It worked fine.... I don't think I missed anything.
Oh, I noticed that the function is completely different for you :D
That's the thing, the building isn't constructed, and setting a limit on construction doesn't work... after the transformation.
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация