Skip to content

Posts from Current questions and answers regarding the map editor.

5.0 (12 ratings)
In reply to Gerter
User Avatar
Auto-translated
Gerter
You can have hundreds of threads running simultaneously, and the game will handle it fine. However, you shouldn't continuously check certain things in an infinite loop, such as calculating the path cost in movement using a specific function – this can crash the game even with a single thread.
Well, the fact that there's no low limit on the number of threads that can be opened is a good thing!

As for things that shouldn't be checked in an infinite loop: I use the following checks in my script; I assume these are acceptable?

1) Checking if an event occurs after a certain number of days (e.g., unlocking a region, updating a quest), eventDay is a global variable
function waitForEvent()
   while (1) do
      sleep(10)
      local currentDay = GetDate(DAY)
      if ((currentDay - eventDay) == 5) then
         --some code
         break
      end
      sleep(10)
   end
end

2) Checking if the player has no towns and active heroes
function checkGoalCompletion()
   while (1) do
      sleep(10)
      local heroes = GetPlayerHeroes(id)
      local townsNumber = 0;
      for i, town in TOWNS do
         if (GetObjectOwner(town) == id) then
            townsNumber = townsNumber + 1
         end
      end
      if (heroes == 0 and townsNumber == 0) then
         --some code
         break
      end
      sleep(10)
   end
end

3) Checking if the required number of creatures is present in the town's garrison
function checkTownCreatures()
   while (1) do
      sleep(10)
      local creatures = GetObjectCreatures(obj, id)
      if (creatures >= NEEDED) then
         --some code
         break
      end
      sleep(10)
   end
end

Сценарии:
"Холм мертвецов"
"Священное древо"
User Avatar
Auto-translated
Yes, all of this will work without any problems.
Нет войне.
In reply to IchGViji
Auto-translated

Hi everyone! I need some help. I don't quite understand how all these archives in the game files work...

Situation:
I downloaded a mod for Tribes of the East, which adds campaigns from the original game and Hammers of Fate. I want to edit the maps from this mod specifically within the Tribes of the East mod.

In short, I want to edit the campaign maps from the original game/Hammers of Fate within the Tribes of the East mod... How do I do that?

In reply to Vaklik1
User Avatar
Auto-translated
Vaklik1

Hello everyone! I need some help. I don't quite understand how all these archives in the game files work...

Situation:
I downloaded a mod for Tribes of the East that adds campaigns from the original game and Hammers of Fate. I want to edit the maps from this mod specifically within the Tribes of the East mod.

In short, I want to edit the campaign maps from the original game/Hammers of Fate in the Tribes of the East mod... How do I do that?

/
Open the archive with any archiver, for example, WinRAR. Go to Maps/Scenario/mission_code (e.g., A2C2M5). Inside, pay attention to 2 files: map.xdb and GroundTerrain.bin. In the editor, create an empty map, save it, and open it again with an archiver. Replace the map.xdb and GroundTerrain.bin files in the map with those from the mod. The newly created map will change to the desired one from the campaign. After completing all the changes, put the updated map.xdb and GroundTerrain.bin back into Maps/Scenario/mission_code of the mod.
Мои карты: Белый Храм, Поменяться местами, Судьба королевства, Стихийные острова.
In reply to Долгий
Auto-translated
Long
/
Open the archive with any archiver, for example, WinRAR. Go to Maps/Scenario/mission_code (e.g., A2C2M5). Inside, pay attention to 2 files: map.xdb and GroundTerrain.bin. In the editor, create an empty map, save it, and open it again with an archiver. Replace the map.xdb and GroundTerrain.bin files in the map with those from the mod. The newly created map will change to the desired one from the campaign. After completing all the changes, put the updated map.xdb and GroundTerrain.bin back into Maps/Scenario/mission_code of the mod.

Wonderful! Thank you very much for your help! It helped a lot; I tried many things, but only this worked! The only thing is that when replacing only these 2 files in a new map, editing them there, and then returning them to the map's folder from the mod, the map would break... The scripts wouldn't work, I don't know why. But I simply copied not only these 2 files but all the mission files, and that helped! Thank you very much again!
User Avatar
Auto-translated
Hello!
During the development of a combat script, a strange problem arose. The essence is as follows: I am trying to perform a simple action – obtaining a global variable using GetGameVar() – so that, depending on its value, the script behaves slightly differently.
I know that by default, a string value is returned, so I add 0 to it. As a result, an error appears in the console stating that I am trying to perform an arithmetic operation on a string, and the rest of the script crashes. Similarly, if I multiply this variable by 1.
Then I decided to check if I had somehow named the variable differently in the map script, but no, everything is correct. However, then I decided to continue the battle, call the same code in debug mode, and this time the variable, after adding 0, actually became a number.
Perhaps someone knows what the problem is and how to deal with it? I tried using sleep commands, but it didn't help.

Сценарии:
"Холм мертвецов"
"Священное древо"
User Avatar
Auto-translated
IchGViji, just as a suggestion, if you're calling GetGameVar() directly in a script, try moving it to the Start() function.
РПГ-сценарий для HoMM5: Путь героя
ЧаВо по созданию карт для HoMM5: ЧаВо
User Avatar
Auto-translated
Jack_of_shadows, even after moving this code to the Start() function, the variables are not converted to numbers. I tried moving it to the Prepare() function, but it also gives an error. Then I decided to combine them – I added reading the global variables both in the Prepare() function and in the Start() function – I thought that it might not be read in Prepare() in time (I didn't add any other code there), so it would be calculated in Start(). But that didn't help either...

Сценарии:
"Холм мертвецов"
"Священное древо"
User Avatar
Auto-translated
What does GetGameVar output for this variable? If it outputs "1", there won't be an error, but what if "HappyBirthday" somehow ended up there?
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to }{0TT@6bI4
User Avatar
Auto-translated
}{0TT@6bI4
What does GetGameVar output for this variable? If it outputs "1", there won't be an error, but what if something like "HappyBirthday" has crept in there?

This is a number, specifically the hero's level:

kasparLevel = GetGameVar("kasparLevel") + 0;

Added 3 minutes later
And it outputs the hero's level during debugging.

Сценарии:
"Холм мертвецов"
"Священное древо"
User Avatar
Auto-translated
local var = -(-GetGameVar("..."))
Try converting it like this:
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
User Avatar
Auto-translated
Okay, here's another option:
local var = GetGameVar("...")
var = var + 0
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
User Avatar
Auto-translated
How do I create a dialogue scene in a dungeon? There is a dungeon on the map, but it cannot be opened in the DialogScene window – the ShowUnderground function is blocked.
Модификация "New Era": 2%

Statistics

Welcome our newest member: Emil