Skip to content

Posts from Automatic ballista control.

No ratings yet — be the first to rate!
User Avatar
Auto-translated
Ballista Killer for Heroes of Might & Magic III, version 2.0

Let's consider the following situation in battle mode: the player has 1 fairy in their army. They also have a ballista. They attack 100 zombies.
Theoretically, it is possible to win this battle. But in practice, it will take too much time.
A program designed to help solve this problem will be described and released below. The program description will be based on the example above.
This program can move the mouse cursor to the desired location on the battlefield and also click on the battlefield at the desired time.

Description.

Buttons:
Test - allows you to run 1 iteration for testing.
Exit - immediately exits the program.
Fight - starts the battle with the specified number of rounds (Rounds to pause).

Screenshots of the battle are created in the program's location after a specified number of rounds
(to enable screenshot creation, check the box in the CopyScreen after field).
A screenshot is also created during testing.

At the bottom, below the buttons, there are fields CurrentX and CurrentY.
They will help you quickly determine the desired screen coordinates (cursor position).

The Rounds to pause field indicates the number of battle rounds
during which the mouse will be controlled by the program.
After this number of rounds, the program will stop.

Pay attention when setting delays: the time is specified in milliseconds (1 s = 1000 ms).
Let's say we have a fairy + peasant + ballista vs. zombies. Let's assume our game cycle starts with the fairy.
Turn 1. The fairies will presumably run away from the zombies, after which the turn will pass to the zombies, and they will rush towards the fairies. And only then will the turn pass to the peasants. But before the turn reaches the peasants, you need to have time to move the fairies and zombies, which will take about 1-3 seconds.
Therefore, it is recommended to initially set all delays to at least 3000 ms during the testing phase.
After successful testing, the delays can be reduced.

Updates:
1) Now screenshots are only made of the Heroes window (in windowed mode).

2) The "Settings" and "?" buttons have appeared.
The "Settings" button currently only contains the version of Heroes you are running (H3 Rus/Eng, H4 Rus/Eng+, default is H3 Rus).

3) Another attempt has been made to prevent the program from "freezing". When you press the Esc key, the program will complete the current cycle and offer to stop. To stop prematurely, it is recommended to press and hold the Esc key until the corresponding message appears.

4) A hotkey has been added to immediately terminate the application: +Q.

5) Before starting, a message is displayed about the estimated program execution time.

6) A window has been added that displays the program's performance statistics.

7) The number of steps for one cycle has been increased to 14!

Attention!
It is not recommended to use the mouse while the program is running.
You can turn off the monitor during the battle; screenshots will be created!

In the current version of the program, you can perform 14 cursor movements:
1-6, followed by 7 - clicking the left mouse button (MoveTo + Click);
The 7th movement does not perform a mouse button click (only MoveTo);
It was developed to view the number of shots of the ballista, but, as it turned out later,
the number of shots of the ballista can only be viewed by clicking the right mouse button;

8-13 movements, similar to 1-6;
The 14th movement is similar to the 7th.

P.S. The program only works in Heroes windowed mode (F4 key in the game).
If you are going to allow the program to take screenshots,
remember that there must be enough free space on the disk.
For a resolution of 800 x 600 (and the Heroes window has exactly this resolution), a *.bmp file takes up about 1 MB.
For a battle of 5000 rounds and one screenshot every 100 rounds
you will need about 50 MB of free disk space.
User Avatar
Auto-translated
Is this like a skill for controlling a ballista, but we're too lazy to control it ourselves, so the program does it for us?
Умирает не тот, кто устал, а тот, кто остановился.
User Avatar
Auto-translated
In short, the program conducts the battle, but not according to the computer's will, but according to our needs, right? And what does morality have to do with it?
Умирает не тот, кто устал, а тот, кто остановился.
User Avatar
Auto-translated
I believe that the condition of lacking morality is necessary for correct calculations – because morality disrupts the order of unit movement, which means the program might not work as intended.
Im Herzen der Stille
Im Herzen der Nacht
Wie oft hab ich mich schon gefragt
Wo Du gerade bist
Wie oft hab ich mich schon gefragt
Ob Dir gerade Liebe widerfahrt...
User Avatar
Auto-translated
Why does the Fairy have +1 morale? And besides, morale doesn't decrease for 2 factions – as far as I know, the minimum number of factions that lowers morale is 3 or more...
Im Herzen der Stille
Im Herzen der Nacht
Wie oft hab ich mich schon gefragt
Wo Du gerade bist
Wie oft hab ich mich schon gefragt
Ob Dir gerade Liebe widerfahrt...
User Avatar
Auto-translated
Really? Although, it seems that way... I'm just used to building large armies through diplomacy, recruiting from all sorts of factions – and sometimes I end up with 7 different factions in one army... Never mind, that's already off-topic. I just thought that having 2 factions wouldn't affect morale.
Im Herzen der Stille
Im Herzen der Nacht
Wie oft hab ich mich schon gefragt
Wo Du gerade bist
Wie oft hab ich mich schon gefragt
Ob Dir gerade Liebe widerfahrt...
User Avatar
Auto-translated
vbn;81248
Exactly, but the hero might not have the skill to control a ballista. Depending on this, the program needs to be made to work differently.
If the hero has the skill to control a ballista, then, in my opinion, in the battle settings menu, you can enable automatic control, so there will be no need to configure the program for two options (for a hero with the control skill and for a hero without the control skill). I haven't checked this (just thinking out loud) - check it yourself.
vbn;81248

Now I'm uploading a map on which the program will be tested,
and for which a description will be provided.
If it works as I wrote above, then reflect this in the program description (the program's functionality will be improved without additional changes and settings to the program itself :)
vbn;81248

This program will only work under the condition
that the morale of the attacking and defending armies is neutral.
Uh-huh :) Noted.
vbn;81248

The following options are possible here:
1) apply the "Spirit of Oppression" morale debuff;
I agree with this.
vbn;81248

2) take armies from another Castle to lower the morale to neutral.
But this needs to be checked. There is no guarantee that the enemy monster squad will not rush to the additional unit, and then not attack the ballista itself. And one more clarification. If the monster squad is divided into 7 squads :) Then, as you understand, it will most likely be a disaster. Without the program, you might still be able to try. But with the program, it's over. I remember in Best of Best, I defeated a lot of dendroids (somewhere around 250-300) with 25-30 vampires (without a ballista). The only thing that saved me was "General Slowdown". Moreover, there was such a bug. Single slowdown, in my opinion, does not work on dendroids, but general slowdown does :) Somehow, I had enough mana :)
User Avatar
Auto-translated
vbn;81268
Yeah, if the hero has the skill to control a ballista, you can enable it to automatic control in the battle settings menu. But in our case, the battle isn't being fought in auto mode :(.
Therefore, there are still 2 options.
You didn't understand. If the hero has the control skill, you need to disable EVERYTHING in this automatic battle settings menu, EXCEPT for the ballista. Then, press the automatic battle button. Then you will control everything yourself, but only the ballista should work on auto. Accordingly, the program should still work correctly according to the previous algorithm! Check it! Maybe it will work that way :)
vbn;81268

Regarding the guarantee that the enemy monster unit won't rush to the additional unit, and then won't attack the ballista itself - you are right. But in the example we are considering, the ballista and the peasant are very far apart; the zombies will only hunt the fairy.
So, how about sending me the program and the source code by email (just in case)
Because in the attached file, I only found this: Ballista.h3m
I have some ideas for improving the program's algorithm, but it probably won't be possible to do it in 10 lines, but it will work and probably take into account the morale of your own unit. Are you interested? Should I describe the idea here?
User Avatar
Auto-translated
vbn;81294
"...Then press the auto-battle button."
Something is making us misunderstand each other.
We are not going to press the auto-battle button.
The battle will proceed in normal mode.
But why wouldn't we :) Just try doing what I wrote above. When the auto-battle setting is configured exactly that way, then when you press the auto-battle button, no one will rush anywhere :) Everyone will wait for how you move them, and only the ballista should work on auto, which is exactly what's needed to make the second option like the first one!
vbn;81294

Hm, apparently this will be something like an x-starter.
Then the program will be useless, and if anything, just download starter. :)
The program is better and simpler. And besides, what about improving the program to work with morale? Check your ICQ ;)
User Avatar
Auto-translated
vbn;81312
Yeah, I finally understood about the ballista. You're right.
But the program won't care.
vbn, you wrote something great here :) Especially in the last post where you already posted the finished program :) Especially - "Yeah, I finally understood about the ballista." I fell off my chair :)
--------------------------------------------------------------------
But what did I want to write here?!
vbn!!! This is awesome! Huge thanks for the program. This is how useful utilities should be made and shared with everyone. So that all players are on equal footing in tournaments and compete based on their skill in the game, and not on who has more free time for long battles and who is a better programmer!! Imagine if vbn hadn't shown this utility to anyone and hadn't shared it.

vbn!! My personal respect to you - from Iron!

In my opinion, this could only have happened on this resource!! Maybe also on Hugo's. But I've been everywhere and seen everything :)

PS. I achieved my personal best honest playthrough in the 6th hour of the game!! Now find another idiot who will manually play a 20-hour battle when there is such a program available!!!!!!
User Avatar
Auto-translated
vbn - I agree with IronAxe, the main thing is to start, and then people will be found who will continue...
Thank you very much for your efforts to improve our beloved game.
Герой в каждом из нас...:rolleyes:

"Истинно могуч тот, кто побеждает самого себя"
In reply to Geksorin
User Avatar
Auto-translated
vbn, thanks for the program! But I have two questions:
1) How can I find the cursor's location on the screen (coordinates)?
2) How can I make units skip their turns?
User Avatar
Auto-translated
vbn;81663
1) The cursor's location on the screen is displayed in the CurrentX and CurrentY fields, located directly below the buttons...
Yes, I saw that, but when the game is running, it's impossible to view the cursor coordinates (except by remembering the position in the game, minimizing it, and checking in the program. But there's another problem: in the game, the screen resolution is 800x600, while the program is only fully visible at 1024x768 and higher, so the coordinates will be incorrect.)
User Avatar
Auto-translated
vbn;81684
When the game is running, you can view the cursor coordinates.
To do this, you need to switch the game to windowed mode (F4 key).

By default, the program is located on the left side of the screen.
It is best to place the Heroes window slightly to the right of the program.

And regarding the coordinates - everything works fine ;)

P.S. Heroes 3 runs in windowed mode at any resolution of at least 800 x 600.
Thank you, I figured it out.
In reply to Ataman
User Avatar
Auto-translated
VDV, everything you deleted here was related to the discussion of the program; the program is related to long battles, and long battles are related to the rules and players' attitudes toward such battles. We spent a ton of traffic using our own money—and you dropped posts that directly relate to this topic :( Fine, we'll draw conclusions—we'll write less on the forum—they'll just delete it anyway :) So why even spend money :) To make sure this post doesn't get dropped, I'm now writing about the program:
vbn - how do you launch the program so that the battle is full screen?? Otherwise, the screenshot captures the running program itself. Does that mean first you have to set the coordinates, then expand Heroes to full screen, set yourself up in battle, minimize Heroes to the taskbar, click the Fight button in the program and quickly bring Heroes back up from the taskbar? Is that correct? Is it possible to do this in time or will the mouse already be captured. Or should you press the F4 key on the keyboard after clicking the Fight button in the program?

Statistics

Welcome our newest member: Emil