Skip to content
#2080
Auto-translated
Pert17
Hello! I'm a complete beginner, I don't understand anything about scripts, so I would like to know... How can I make enemies automatically attack a city? That is, so that they don't collect resources, don't fight with mobs, etc., but immediately go to the city.

Well, there are a few options.

You can paint over all the resources and mobs in the regions and prevent the computer from attacking these regions using the SetRegionBlocked script. This is time-consuming, but it guarantees 100% that it will not touch these resources, and it will have no choice but to run to the city. But there is no guarantee that it will 100% run to the city; if it is too dangerous for it, it will simply stand still or run around its territory. This is the most dubious option.

You can place a hero on the map and use EnableHeroAl and MoveHero to direct him to the city. This is a good option; the hero will not collect resources and will definitely attack the city, even if he has only 1 skeleton in his army, but it is not universal because after the hero dies, he will not attack again. This is a good option if you need to make an attack on your city at the start of the map.

You can place the hero in reserve and use NewDayTrigger, EnableHeroAl, and MoveHero to make the enemy's reserved hero attack your castle after a certain period of time (for example, attack every week).
Pros: it will definitely attack the castle and will not collect resources along the way; it is a universal option; after the hero dies, the attack will be guaranteed to repeat after a certain period of time.
Cons: it requires the most work.

Which option do you like best?

Added after 15 minutes
RedHeavenHero
mod(GetDate(), 14) == 1

Thank you very much.

And could you also tell me:

1) Is it possible to make it so that when a hero's mana drops below 10, the player loses? (well, as if the hero is a Necromancer and needs to have 10 mana to sustain his life, otherwise he will die). There is a similar script in the campaign for Ilia, where the player loses when the black dragon is lost; maybe it is possible to do the same for a decrease in the amount of mana...

2) What script can be used to transfer all the AI's property to the player's control? For example, in the last mission for Frida, when you save Duncan, all the turquoise property is transferred to the blue. I searched through the manuals, but I didn't see anything about this. Thank you very much in advance!

Statistics

Welcome our newest member: dodoD0D0