Skip to content

Posts from Current questions and answers regarding the map editor.

5.0 (12 ratings)
In reply to Эритроцитоз
User Avatar
13 years ago
Auto-translated
I've never written combat scripts before. Can you tell me how to make it so that when an enemy deals damage to the player's creatures and kills a certain number of them, the same number of creatures immediately respawn on the enemy's side of the battlefield?
User Avatar
13 years ago
Auto-translated
Combat scripts have one unpleasant feature: there is practically no information about them in the standard manual. I would suggest using developer maps for training; some of them (such as campaign 6, mission 5) have good combat scripts. In particular, the function that tracks the movement of a defending hero's creature:
function DefenderCreatureMove(Unit)
This function summons creatures (temporary summoning):
SummonCreature(to whom, which, how many, coordinates)
I would track the number of deaths using:
GetCreatureNumber(unitName);
Something like that.
In reply to Ment
User Avatar
13 years ago
Auto-translated
Ment

GetCreatureNumber(unitName);
.
How do I assign a value to unitName?
And how do I trigger this tracking at a specific moment?
User Avatar
13 years ago
Auto-translated
Here's an example of how it can be used: `
function DefenderCreatureMove(Unit)
if GetCreatureType(Unit)==CREATURE_SNOW_APE then
SummonCreature(DEFENDER, 54, GetCreatureNumber(Unit), 13,8);
end;
end;
What will happen: each time it's the enemy's turn and a Yeti is present, a number of creatures with ID 54 will be summoned, equal to the number of Yetis in the stack. It looks a bit unconventional for a scripting language, but it works.
User Avatar
13 years ago
Auto-translated
I have a question: I've encountered so-called map-mods several times, and unfortunately, most of them don't work on my version 3.0, but that's okay. So, as I understand it, players have created bosses there – probably monsters with high stats, and modified heroes, etc. I've also tried to do something similar; I've modified the entire data folder, changing everything for creatures/heroes, but fortunately, these changes aren't transferred to my maps downloaded from the internet because the map requests the specific game resources that are on the computer where it's installed.
Well, that's all the background; the point is this:
How can I make it so that I can transfer my "mods" along with the map over the internet?
Thanks in advance.
User Avatar
13 years ago
Auto-translated
If mods are created in the editor, everything is transferred together with the map automatically. If created in a text editor, everything must be manually added to the map archive, while preserving the entire folder structure.
User Avatar
13 years ago
Auto-translated
What exactly does it mean to have mods in the editor? For example, I placed a hero on the map, changed his shared settings, and now he looks like a druid. If I upload this map to the internet, will he still look like a druid there? And also, if I create a new map later and place this hero, will he look normal again, but when I start the game, he still turns into a druid?
User Avatar
13 years ago
Auto-translated
Well... for example, I put a hero on a map, changed his shared data, and now he looks like a druid. If I upload this map to the internet, will he look the same there too?
Exactly.
And also - if I then create a new map and put this hero on it, he looks normal again, but when I launch the game, he still turns into a druid.
Yes, that's also true.
Here's how it works. When the game starts, it searches for all zip archives with a specific extension in certain directories. First, it scans the data folder and loads all archives with the .pak extension from there. Then, it goes to the Maps folder and loads .h5m archives. Similarly, it does the same in UserMODs; I believe it loads all archives from there, regardless of the extension, but it definitely loads .h5u archives. If two files with the same name are loaded, the newest one (with the creation date closest to the current date) is used in the game. That's all there is to it. Therefore, if your map is in the Maps folder, it will be loaded into the database when the game starts, and all the mods from that map will be applied everywhere.
User Avatar
13 years ago
Auto-translated
Okay. But what about creating bosses? I can modify creatures in the advanced editor, but for some reason, I couldn't create my own.
User Avatar
13 years ago
Auto-translated
It's simple: the number of available creature IDs in the game is limited. There are only two unused IDs: the Yeti and the Black Knight (one of the two). You can safely change them to these.
Or, you can download the ncf mod, which has more IDs.
User Avatar
13 years ago
Auto-translated
The black knight, by the way, I really don't understand why he was treated so unfairly. But the yeti, yes, I'll use them instead.
Thank you very much, I learned a lot of interesting information!
In reply to Heroist
13 years ago
Auto-translated
Heroist
I would write it using auxiliary values. For example, at the very beginning of the map, I would set
a = 0;

In the second trigger, I would add a check
if a == 1 then
Your function
Trigger reset
else
if a == 0 then
Text: you have not visited the first hut
end;
end;

And in the first hut, write your function, and at the end add
a = 1;

If it's not clear, I can write a detailed template later.

I tried to do it - it all worked out. Thanks again. I just don't quite understand: what exactly is "a"? I understand very little about programming; I only have a basic understanding of CSS. How does this "a" work? I tried to assign a numerical value to another letter - "b", but when both "a" and "b" are in the script, the editor gives an error and doesn't save the map for some reason.

Added after 48 seconds
Here's a question: I need to start a dialog, and then display a text message summarizing the idea of the dialog, something like, "You need to go there." I'm writing:
StartAdvMapDialog("0");
MessageBox("path\name.txt");
But this message appears before the dialog, not after it. Is there a function to separate them in time?
In reply to Эритроцитоз
User Avatar
13 years ago
Auto-translated
1- 'a' is a variable. If you write 'b', you need to replace all instances of 'a' with 'b'.
2- Add `sleep(10)` between the dialogue and the message.
In reply to Олегарх
13 years ago
Auto-translated
Oligarch
1. 'a' is a variable. If you write 'b', you need to replace all instances of 'a' with 'b'.
2. Add sleep(10) between the dialogue and the message.

Concise and clear – thank you!
In reply to Ment
User Avatar
13 years ago
Auto-translated
Ment
Here's an example of how it can be used:
function DefenderCreatureMove(Unit)
if GetCreatureType(Unit)==CREATURE_SNOW_APE then
SummonCreature(DEFENDER, 54, GetCreatureNumber(Unit), 13,8);
end;
end;
What will happen: each time it's an enemy's turn and a Yeti is present, a number of creatures with ID 54 will be summoned, equal to the number of Yetis in the stack. It looks a bit unconventional for a scripting language, but it works.

If a player can have any number of creature stacks and any number of creatures in those stacks, how can you count the number of creatures in each stack at the beginning of the battle, and then perform a comparison for each of them?

Statistics

Welcome our newest member: recijeb