Skip to content

Posts from Current questions and answers regarding the map editor.

5.0 (12 ratings)
User Avatar
#2592
Auto-translated
Mine is almost the same. That's strange. So, the maps are in Latin characters, and the path is correct. Okay, but what does it mean – "he didn't see them"? The first time it opened, everything was fine. And the second time? Was it impossible to load them? What error message did it show?

Whatever
#2593
Auto-translated
You can open and edit them in the editor, but they are not available in the game; they simply don't exist.
User Avatar
#2594
Auto-translated
So, do they disappear after editing? Maybe the editor saves them in the wrong place? In the wrong folder?

Whatever
In reply to Олегарх
User Avatar
#2595
Auto-translated
Oligarch
Loads another map. As I understand it, you need to specify the correct map.xdb (or specify it somewhere and then indicate its number).
Apparently, it only works in single-player mode in version 3.1, but I haven't found any use for it in the developers' files.
However, it throws you back to the main menu. Even if you write a fairly simple example:
WarpToMap(GetMapDataPath().."map.xdb#xpointer(/AdvMapDesc)", 1)
And in the main menu, it says that it failed to load the map, etc.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#2596
Auto-translated
Heroist, if I understand correctly, then the "if" condition for the hero's attribute is not mandatory, right? And also, shouldn't we add a condition to the "kind" parameter, stating that a specific unit in the hero's army must survive, as in one of the "Hammers of Fate" missions involving the Dark Elves, where you couldn't lose the dragon, although this can be bypassed with scripts, but still?
User Avatar
#2597
Auto-translated
No, of course not.
Trigger(REGION_ENTER_AND_STOP_TRIGGER , 'trigger name' , 'function name')

function function name ()
--This is where the check is triggered when any hero enters the region. Write whatever you want here. If you need to complete a quest:
SetObjectiveState ('objname' , OBJECTIVE_COMPLETED)
Trigger(REGION_ENTER_AND_STOP_TRIGGER , 'trigger name' , nil)
end

Now, this function will react to any contact with this region. The only thing is, the computer might also enter this region, and then the function will trigger for it. If you do it like this:
Trigger(REGION_ENTER_AND_STOP_TRIGGER , 'trigger name' , 'function name')

function function name ()
if GetCurrentPlayer() == 1 then
--This is where the check is triggered when any hero of the first player enters the region. Write whatever you want here. If you need to complete a quest:
SetObjectiveState ('objname' , OBJECTIVE_COMPLETED)
Trigger(REGION_ENTER_AND_STOP_TRIGGER , 'trigger name' , nil)
end
end

Then the function will work for any hero of the first player - by default, a human.

Whatever
In reply to Heroist
User Avatar
#2598
Auto-translated
Do you happen to know about a unit that shouldn't die, because I really need it?
User Avatar
#2599
Auto-translated
In other words, does a creature in a hero's army not have to die? Or on the map?

Whatever
In reply to Heroist
User Avatar
#2600
Auto-translated
In the hero's army.
User Avatar
#2601
Auto-translated
Agas.

function proverka()
while 1 do
sleep(1)
if GetHeroCreatures ('heroname' , creature_id) < 1 then
--what happens if the number of creatures in the hero's army is less than 1
break -- if you need to disable the check later
end
end
end
startThread(proverka)

Whatever
#2602
Auto-translated
Could you please tell me if it's possible to edit a map without using an editor (by opening it as an archive)? And which files are responsible for what?
User Avatar
#2603
Auto-translated
Are you planning to place objects on the map without an editor? Most of the map information is stored in the map.xdb file. You can open xdb files with Notepad. h5m/h5u/pak and similar files can be opened with WinRAR.

Whatever
In reply to Heroist
User Avatar
#2604
Auto-translated
Umm, I'm a bit confused. It seems like "slip" is something we're supposed to wait for, so why is it here? And this "while 1 do" part is also a little unclear. What do you mean, can this "while 1 do" be used for different things, like checking the level of old resources, without having to write anything else? If it's not too much trouble, could you explain it?
User Avatar
#2605
Auto-translated
while 1 do -- an infinite loop, meaning we've simply created a cycle that checks something.
sleep(1) -- a small pause for checking; if you remove it, the check will be continuous, and the game will crash. But with it, there's a very small, imperceptible pause between checks for the player.
if -- an argument for the check. In this case, while starts the check, sleep prevents the game from being overloaded; it itself is ignored, and only what is written in if and далее is checked.
startThread(funcname) -- starts this check-function right from the beginning of the game. You can write it at any time you need. The if check will start immediately, with an interval of sleep(1), and will continue until break.

function funcname ()
while 1 do
sleep(1)
if
--what you need to check continuously
break -- after it, the entire cycle stops working. It simply ends to avoid overloading the game.
end
end
end
startThread(funcname)

Here is the code for checking something. In if and далее, you write what you need to check. In the parentheses of startThread, you specify (without quotes) the function that needs to be launched -- funcname.
Something like that. ;)

Whatever
In reply to Heroist
User Avatar
#2606
Auto-translated
Thank you very much, I was having a lot of trouble with these scripts. Here, have a little something. ;)

Statistics

Welcome our newest member: Emil