Skip to content

Current questions and answers regarding the map editor.

User Avatar
#5550
Auto-translated
Bezimennyy
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
Shiroyasha2910
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.
Look at it as an analogy to the existing quest to destroy all players, only instead of OBJECTIVE_KIND_DEFEAT_ALL, you should have OBJECTIVE_CAPTURE_OBJECT, add a slot in Parameters to assign the target (in your case, the town), and enter the script name of the target town there, which you also assign to the town in the Name field. Change the name and description of the quest, and it should work) Try it out and let me know :)