Posts from Current questions and answers regarding the map editor.
Auto-translated
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.
GetCreatureNumber(unitName);
.
And how do I trigger this tracking at a specific moment?
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.
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.
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?
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.
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.
Or, you can download the ncf mod, which has more IDs.
Thank you very much, I learned a lot of interesting information!
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?
2- Add `sleep(10)` between the dialogue and the message.
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!
Here's an example of how it can be used: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.function DefenderCreatureMove(Unit)
if GetCreatureType(Unit)==CREATURE_SNOW_APE then
SummonCreature(DEFENDER, 54, GetCreatureNumber(Unit), 13,8);
end;
end;
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?