Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to Heroist
User Avatar
Auto-translated
Heroist


Added 11 minutes ago
And here's something else I'd like to figure out: how to make the AI ignore the threat from the player? So that it behaves as usual, but isn't afraid to sail past with small armies?
You can assign it some routes using MoveHero, along which it will move, regardless of the player's heroes.

Added 5 minutes ago
Another option. At the beginning of the AI's turn, place special static objects without a model around the player's hero, but with a blocked cell. For the AI, the hero will be unreachable (and vice versa), and it will probably ignore the player's hero. At the beginning of the player's turn, remove the statics. You can also place these cells depending on the ratio of army strength (if needed, I have a table of creature strengths).
This method isn't as difficult as it might seem at first.

Added 13 minutes ago
Heroist
Yes, here's another question: if I place a hero on one island, and he needs to get to another, and a ship is standing in the harbor on his way ----> If I give him MoveHero, will he board the ship and sail, or will it display "cannot reach the coordinate point"? I'm asking in advance so I don't have to redo it later.
I don't know how relevant my answer will be, but I'll answer anyway. Yes, the hero will board the ship and sail.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to Ment
User Avatar
Auto-translated
The first thing that comes to mind is to give him some fictional unit with an extremely high threat level, so he'll think he's stronger. Or is the point that he shouldn't attack yet?
You can assign him some routes using MoveHero, along which he will move, regardless of the player's heroes.

Added 5 minutes later
Another option. At the beginning of the AI's turn, place special static objects without a model around the player's hero, but with a blocked cell. For the AI, the hero will be unreachable (and vice versa), and he will probably ignore the player's hero. At the beginning of the player's turn, remove the statics. You can also place these cells depending on the ratio of army strength (if needed, I have a table of creature strengths).
This method is not as difficult as it might seem at first.

Well, I need it so that for the AI heroes, attacking them is a kind of surprise. The merchants are sailing along, and then - bam, an attack. Moreover, I can easily resurrect these heroes and give them an army using a script.

Okay, I'll try using MoveHero. There was a good alliance system in Empire Earth that I remember: you could set one computer to "neutral" and yourself to "hostile," while also blocking the ability to change these conditions later. And that's it - the computer's heroes only defend themselves...
I don't know how relevant my answer will be, but I'll answer anyway. Yes, the hero will get on a ship and sail away.

Okay, clear, thanks.

Whatever
User Avatar
Auto-translated
Well, I need it so that for AI heroes, attacking them is a kind of surprise. Merchants are sailing along, and then – bam, an attack. Moreover, I can easily resurrect these heroes and give them an army using a script.
Make them allies, and then, upon contact, run a script that makes them enemies, and start the battle. I don't know how it will turn out in terms of performance, but the background should be good...
 

К А
Стикеры GBF в Telegram
User Avatar
Auto-translated
An interesting option, by the way. ;)

Whatever
In reply to Ment
User Avatar
Auto-translated
Ment
Make them allies, and then, upon contact, run a script that makes them enemies, and the battle begins. I don't know how well it will perform, but in terms of background, this option should be good...
Yes, it's better to make them allies. Just don't do it during contact, but during the AI's turn. Only then will this allied unit reveal the fog of war.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
Auto-translated
Yeah, I get it. Well, the fog of war isn't the worst thing. I think I'll make some of the merchants scripted, and some relatively free. Thanks to everyone for the help!

Whatever
User Avatar
Auto-translated
Does anyone know if it’s possible to pass (create) a special Faction through battle scripts?

Whatever
In reply to Heroist
User Avatar
Auto-translated
Heroist
Does anyone know if it's possible to pass (create) a special Faeidan spell through battle scripts?
Partially, but the damage will always be 100%.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
Auto-translated
RedHeavenHero
Partially, only the damage will always be 100%.

Well, that's okay. I just can't download the manual right now, and I don't remember half of the features.

Is there a function to check if there are archers in the hero's army? Or do I have to manually check the creature types?
And then, how does it work? Do I get an array of the enemy's creatures and then order them to shoot at the first one in the array? And what about skipping a turn after the shot? They (Archers) will be sent to the end of the turn order after that. Is there a way to let them shoot without affecting the turn order?

Whatever
In reply to Heroist
User Avatar
Auto-translated
Heroist
Well, that's okay. I just can't download the manual right now, and I don't remember half of the features.

Is there a function to check if there are archers in the hero's army? Or do I have to manually check the creature types?
And then, how does it work? Do you get an array of enemy creatures and then order them to shoot at the first one in the array? But what about skipping a turn after the shot? They (Archers) will be sent to the end of the action queue after that. Is there a way to let them shoot without affecting the turn order?
To determine the archers, you need to perform a type check.
If you follow Faidan's specialization, you can start by iterating through all enemies and finding the creature with the lowest level, then shoot.
And there's no way to restore the previous position in ATB either.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
Auto-translated
RedHeavenHero
To identify the targets, you need to check their type.
If you follow Faelan's specialization, you should start by iterating through all enemies, finding the creature with the lowest level, and then attacking it.
And in ATB, there's no way to restore the previous position.

What if you attack the first unit in the array? How is the array created after `getCreatures`? Does it have its own sorting? Or at least, what system does it use to number the creatures in the enemy army?

Whatever
In reply to Heroist
User Avatar
Auto-translated
Heroist
What if you fire at the first unit from an array? How is the array created after getCreatures? Does it have its own sorting? Or at least, what system does it use to number the creatures in the enemy army?
number_of_slots - slot_number
that is, by slots, but in reverse order.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
Auto-translated
Okay, I understand. And if the slot is empty, does it return nil or 0?

Whatever
User Avatar
Auto-translated
Okay, thank you, I have no further questions, and everything else seems clear.

Whatever

Statistics

Welcome our newest member: Emil