Skip to content

Posts from Current questions and answers regarding the map editor. Auto-translated

5.0 (12 ratings)
User Avatar
#4874
Auto-translated
First, assign a script name to the desired creature. Make sure that the animation set contains the necessary animation (it is better to change the animation set from creature-adv to creature-arena). Then, at the desired time, play this animation using a script:
PlayObjectAnimation('your assigned script name for the object',
'animation name',
the third parameter - IDLE, if you want the animation to loop,
ONESHOT - to play it once,
ONESHOT_STILL - to make the creature stay in the final frame of the animation)
Нет войне.
In reply to Gerter
User Avatar
#4875
Auto-translated
Thank you both very much, I figured it out. I would also like to ask: Do you know of a script that would remove the faction skirt from creatures?
P.S. It would also be nice to know the delay command, so that a looped action repeats every few seconds, for example.
In reply to Min_Carolin
#4876
Auto-translated
Min_Carolin
Thank you both very much, I figured it out. I would also like to ask: Do you know of a script that would remove the faction skirt from creatures?
P.S. It would also be nice to know the delay command, so that a looped action would repeat every few seconds, for example.

First, you need to write the command SetObjectEnabled("object name", nil) - This is essential!

Next, enter the command SetMonsterSelectionType("object name", 0)

Added 30 seconds later
The delay command, as I understand it, is sleep(number).
Карты: Экспедиция ГрувераНаследие ШантириВременной парадоксПоиски рунной сферыПуть возвращения
In reply to AlekseyS
User Avatar
#4877
Auto-translated
I'm having a strange problem with delays. In the scripts, I write the following:
PlayObjectAnimation("SlaveGob_1", "attack00", IDLE);
sleep(2)
But instead of waiting for two seconds (which are seconds, right?), this goblin, as if ignoring the bottom line, gets stuck in a loop with the animation without any visible delays. I need it to hit the ore, wait two seconds, and then hit it again, repeating the cycle endlessly.
In reply to Min_Carolin
#4878
Auto-translated
Min_Carolin
I have a strange problem with delays. I write the following in the scripts:
PlayObjectAnimation("SlaveGob_1", "attack00", IDLE);
sleep (2)
But instead of waiting for two seconds (aren't those seconds?), this goblin, as if ignoring the bottom line, loops the animation without any visible delays. I need it to hit the ore, wait two seconds, and then hit it again, and so on, in a cycle endlessly.

Let's assume we create a separate function for the animation:

function goblin()
PlayObjectAnimation("SlaveGob_1", "attack00", IDLE);
sleep (2)
end
startThread(goblin)
Карты: Экспедиция ГрувераНаследие ШантириВременной парадоксПоиски рунной сферыПуть возвращения
User Avatar
#4879
Auto-translated
But instead of waiting for two seconds (aren't those seconds?),
sleep isn't measured in seconds; by experimenting a bit, you'll learn to choose the right values for it. It seems like the increment is 0.2 seconds, but I don't remember exactly.
function goblin()
PlayObjectAnimation("SlaveGob_1", "attack00", IDLE);
sleep (2)
end
startThread(goblin)
to make it happen infinitely, you also need an infinite loop, for example:
function goblin()
while (true) do
PlayObjectAnimation("SlaveGob_1", "attack00", IDLE);
sleep (2)
end
end
startThread(goblin)
РПГ-сценарий для HoMM5: Путь героя
ЧаВо по созданию карт для HoMM5: ЧаВо
In reply to AlekseyS
User Avatar
#4880
Auto-translated
Now I have a problem with the functionalities:smile04:
I'm trying to figure them out now, and I'm doing everything exactly as written in the Ogo manual, but in the game, when entering a region, nothing happens; the hero doesn't even stop.

function CyclopsFrontF ()
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "CyclopsFront", nil);
MessageBox ("\Maps\Multiplayer\OrcTown\CyclopsFrontF.txt");
end;
I've tried everything I can think of. I've re-uploaded the text document (which, by the way, is in Unicode format, so everything should be fine) to the map archive many times, and I've changed the slashes (sometimes \, sometimes /). I found a solution to the problem here (they said it's better to write GetMapDataPath().."Deadst.txt", but I didn't understand what the two dots after the parentheses mean, whether something needs to be written there, etc.) - nothing helped.
Maybe the problem is that I have a Multiplayer map, and half of the scripts can't be used there?
P.S. And what should be written in the goblin functionalities that you provide as an example here? Or can I just upload an empty file, and it will work?
User Avatar
#4881
Auto-translated
Min_Carolin, a systematic approach is needed to solve this problem.
I'm trying to figure it out now, and I'm doing everything exactly as written in the Ogo manual, but in the game, when entering a region, nothing happens; the hero doesn't even stop.
Stopping upon entering a region is performed automatically if the function
Trigger(REGION_ENTER_AND_STOP_TRIGGER, 'REGION_NAME', 'FUNCTION_NAME');
has been executed. If this hasn't happened, either this function is written with an error, or any other line of code before this function is written with an error (the code completely stops executing if even one major error is made). There are methods to check this (print, first of all). Multiplayer can also be a problem. And make sure the slashes are correct. In the manual, in my signature, I described many of these things.
And what, by the way, needs to be entered in the goblin functionalities that you provide here as an example? Or can I just throw in an empty file, and it will work?
This is a piece of code that is written in a code file and performs the function you specified (the goblin mines ore). I didn't understand what you meant by "empty file."
РПГ-сценарий для HoMM5: Путь героя
ЧаВо по созданию карт для HoMM5: ЧаВо
In reply to Jack_of_shadows
User Avatar
#4882
Auto-translated
Okay, thank you very much, I will look for the error more carefully. In general, yes, it seems that only my carelessness is to blame, perhaps I misunderstood something. I started reviewing your guide – it has already helped me with many nuances, and I will continue studying it. I decided that I will only start working with trigger scripts when I start working on a single-player map: maybe then things will go more smoothly. The only thing I would like to know is where the game's resources are located (I need this to, for example, change the icon of a hero's special ability in the shared section, which I already mentioned in my first comment). And is it possible to add something of my own to these resources (for example, add my own audio recording to the folder with ambient music, so that I can then attach it to the hero's adventure music in his shared section)?
And also, as I also wrote in my first comment, is it possible to attach a creature model from a mod to a hero. They are simply not visible; there are only vanilla models, there are even models from the campaign videos, but there are no custom models from NCF, I checked the neutral section.
P.S. By "function," I meant that the archive with the map should contain text documents with some kind of artistic text (as in the case of MessageBox), or, perhaps, I don't know, I just assumed, in the form of script snippets, and this text document performs the function, I apologize for the tautology.
User Avatar
#4883
Auto-translated
By "function," I meant that the map archive should contain text documents with some kind of narrative text (like in the case of MessageBox), or perhaps, I don't know, just pieces of script, and this text document performs the function, excuse the tautology, of a function.
It's simpler than that. The main map file is map.xdb, which stores the description of almost everything on the map in XML format. This includes a link to the map script. By default, the editor names it MapScript.lua. All the code should be in it or called from it. The code is written in Lua, which is why the file has that extension. Text files *.txt can be located anywhere - inside the map (most often), in the game's resources, next to the game; the main thing is to specify the correct path to them in the scripts.

Almost all game resources are in data/data.pak. Everything you put inside the map will also be added to the resources. The root of the map is the path "/". That is, if something is inside the map in the folder foobar, it will be accessible as "/foobar/...". If the editor doesn't allow you to edit the path somewhere, you can always open map.xdb in a text editor and change the path manually (at your own risk).
РПГ-сценарий для HoMM5: Путь героя
ЧаВо по созданию карт для HoMM5: ЧаВо
#4884
Auto-translated
I created a map using the map editor from the Tribes of the East directory. After saving and subsequently editing, the editor unexpectedly crashes. I launch the editor again, and when I try to edit the map, specifically to add a texture to the terrain (snow, sand, grass), it doesn't apply, and then the editor crashes. I can add and deform objects and terrain, but textures cannot be applied to the terrain. What could be the problem? :confused:

P.S. The map file is in the archive.
Attachments 3
3 files attached • Total size: 94.6 KB
User Avatar
#4885
Auto-translated
AlexBroAnimator, I'm having the same problems with your map. Maybe some setting was configured incorrectly, or the editor corrupted something in the map file.
РПГ-сценарий для HoMM5: Путь героя
ЧаВо по созданию карт для HoMM5: ЧаВо
In reply to Jack_of_shadows
User Avatar
#4886
Auto-translated
Hmm... I apologize for bothering you again, but I'm experiencing some issues. You gave me this function:

function goblin()
while (true) do
PlayObjectAnimation("SlaveGob_1", "attack00", IDLE);
sleep (0.5)
end
end
startThread(goblin)

I insert it into the map script and go to test it. I launch the map, it loads, and when I'm actually in the game, it freezes completely. At the same time, I can hear sounds of hooves, clanking armor, and so on. Can you tell me what I did wrong? I can't figure it out.

I also have another problem: on a different computer, when I'm using the editor, the properties function doesn't work. I don't know if everything else is broken, but when I was creating a custom hero based on one of the existing templates, I changed his special ability, biography, appearance, description, and everything else. All of this was saved, and I could even see the new skin in the editor, but when I entered the map in the game, I was presented with a completely vanilla hero. It was Nura with her vanilla biography, specialization, icon, and model, but it should have been a completely different hero. This isn't critical, but maybe there's a fix for this bug, because it's inconvenient for testing.
Attachments 1
1 file attached • Total size: 61.8 KB
User Avatar
#4887
Auto-translated
Min_Carolin, sleep can only accept integer values. Also, there's a bit of a mix-up here with two different approaches to solving the problem; we need to stick to either one or the other, as they don't make sense together.

Option 1:
PlayObjectAnimation("SlaveGob_1", "attack00", IDLE);

Option 2:
function goblin()
while (true) do
PlayObjectAnimation("SlaveGob_1", "attack00", ONESHOT);
sleep (10)
end
end
startThread(goblin)


Added 24 minutes later
I also have another problem: when I'm using the editor on another computer, the properties don't seem to work. I'm not sure if everything else is broken, but when I was creating a custom hero based on one of the existing templates, I changed his special ability, biography, appearance, description, and everything else. All of this was saved, and the new skin was even visible in the editor, but when I entered the map directly in the game, I was presented with a completely vanilla hero. It was Nura with her vanilla biography, specialization, icon, and model, but it should have been a completely different hero. This isn't critical, but maybe a fix can be found for this bug, as it's inconvenient for testing.
Did you create a new file with a new name for the new hero, or did you just edit the standard hero? If you edited it, then there will be 2 copies of the same file in the game resources - the original and yours within the map. It's possible that due to some peculiarities, the game loaded the original instead of yours. You can try changing the file name with your description so that it is a completely new resource in the game, check all of this in the editor, and then in the game.
РПГ-сценарий для HoMM5: Путь героя
ЧаВо по созданию карт для HoMM5: ЧаВо
In reply to Jack_of_shadows
User Avatar
#4888
Auto-translated
Thank you so much, everything is working now. The animation finally loops, and the bug is gone. If I ever manage to create my own map, you'll get the release version first:D. Although, considering my clumsy skills, it might be more of a torment than a reward and an expression of gratitude for your advice and manual ^__^.