Good afternoon. How do I make an enemy hero stay in a Castle and not leave?
Place a town, select it, select GarrisonHero, and assign the hero who will "rest" there. After that, in the scripts, enter EnableHeroAI("script name of the hero", false); and for a greater effect (if you want the hero not to gather an army with the help of other player heroes, and also not receive artifacts from them), also enter SetHeroRoleMode("script name of the hero", HERO_ROLE_MODE_HERMIT); into the script. I also advise you to prohibit the construction of buildings for hiring creatures in this town, if, of course, the planned hero will be of the same race and with the same army as the Castle in which he will be, and you generally plan a fixed army.
Try it out
Added after 13 minutes
Hello, sorry if I'm asking a too stupid question, but I need a little help. How do I make capturing a specific Castle the victory condition in a map? I found the field Primary -> Common -> Objective in the editor, and there I found the victory condition to capture an object, but I still don't understand what to do next.