Added 10 minutes later
Okay, hmm. What version of the game are you using? If it's 3.0, then everything is clear; it doesn't correctly identify whose town it is. Consequently, you won't be able to capture the town and complete the mages' quest.
If not, I can't say what the problem is, as the script has been tested repeatedly, and there are no errors. If you're playing the light side, after completing the quest, you can approach the neutral town again and buy it for 50,000 gold; if you're playing the dark side, even after successfully completing the quest, the siege of the town will still begin.
Now, regarding the second question about transformations. Another hero should not be transforming them at all.
function replace_hut(hero, hut)
if hero == 'Gottai' thenWell, that's okay anyway; you should already have a rebel town.There are no errors with the mages' town. Everything comes down to the rebels.