Skip to content

Posts from Current questions and answers regarding the map editor.

5.0 (12 ratings)
User Avatar
12 years ago
ага
"RedHeavenHero01 doesn't exist"
In reply to MasteR
User Avatar
12 years ago
Auto-translated
Juss456
It doesn't work. Because the hero is inside the town, for the game he doesn't exist as an object.
As an object - yes, but as a hero, he exists for scripts even if he is dead or in a tavern.
User Avatar
12 years ago
Auto-translated
There's still the issue with TalkBox. function TalkBF(num) tlkb=num; end; TalkBoxForPlayers(1, '', '', GetMapDataPath().."skolko.txt", '', "TalkBF", 0, GetMapDataPath().."skolko.txt", '', 0, GetMapDataPath().."skolko1.txt", GetMapDataPath()..."skolko2.txt", GetMapDataPath()..."skolko3.txt", GetMapDataPath()..."skolko4.txt"); Instead of an icon, there's a white screen. This is understandable; I don't know where to find a suitable one. The main text isn't displayed (to the right of the icon). The function doesn't work as it should. Added 1 minute later
RedHeavenHero
As an object - yes, but as a hero, it exists for scripts even if it's dead or in the tavern.
function ubratF() while (ubr==0) do sleep(5); for i=0,6 do local t1, n1=GetObjectArmySlotCreature("RedHeavenHero01", i); if (t1~=0) and (n1>1) then RemoveHeroCreatures("RedHeavenHero01", t1, n1/4); end; end; sleep(8); MessageBox(GetMapDataPath().."chuma.txt"); ubr=1; end; sleep(5); end; startThread(ubratF); This snippet doesn't work
User Avatar
12 years ago
Auto-translated
Here, you can only use the functions I mentioned above, as well as some others that only work with heroes. `GetObjectArmySlotCreature` is not allowed.
In reply to MasteR
User Avatar
12 years ago
Auto-translated
Juss456
There remains a question regarding TalkBox.

function TalkBF(num)
tlkb=num;
end;

TalkBoxForPlayers(1, '', '', GetMapDataPath().."skolko.txt", '', "TalkBF", 0, GetMapDataPath().."skolko.txt", '', 0, GetMapDataPath().."skolko1.txt", GetMapDataPath().."skolko2.txt", GetMapDataPath().."skolko3.txt", GetMapDataPath().."skolko4.txt");
Instead of an icon, a white screen is displayed. This is understandable; I don't know where to find a suitable one. The main text is not displayed (to the right of the icon). The function doesn't work as it should.


if ((dd==3) and (tlkb==1)) or ((dd==4) and (tlkb==2)) or ((dd==5) and (tlkb==3)) or ((dd==6) and (tlkb==4)) then

no matter which option is chosen in the talk box, the condition in the first parenthesis is always met.

Added after 55 seconds
RedHeavenHero
Only the functions I mentioned above can be used here, as well as some others that only work with heroes. GetObjectArmySlotCreature cannot be used.
I understand, so I'll have to do it through other means. Thank you
In reply to MasteR
User Avatar
12 years ago
Auto-translated
The first argument in the called function is the player number, and the second is the answer. Why not use the 'j' variable directly? You can use a loop instead.
In reply to RedHeavenHero
User Avatar
12 years ago
Auto-translated
RedHeavenHero
The first argument in the called function is the player number, and the second is the response.

Why go straight to "ж"?
You can use a loop.
Aha, that's what it is.... Yes, that makes sense. Everything is clear now, thanks! And where do I get the icon address, and what should it look like? Why isn't the main text displayed in the center of the text box?

Added 22 minutes later
RedHeavenHero

Why go straight to "ж"?
You can use a loop.

Is this approximately what you mean?

function ubratF()
while (ubr==0) do
sleep(5);
for i=1,14 do
local t1=GetHeroCreatures("RedHeavenHero01", i);
if (t1>1) then
RemoveHeroCreatures("RedHeavenHero01", i, t1/4);
end;
end;
for i=106,112 do
local t1=GetHeroCreatures("RedHeavenHero01", i);
if (t1>1) then
RemoveHeroCreatures("RedHeavenHero01", i, t1/4);
end;
end;
sleep(8);
MessageBox(GetMapDataPath().."chuma.txt");
ubr=1;
end;
sleep(5);
end;
In reply to MasteR
User Avatar
12 years ago
Auto-translated
The path to the texture should be structured like this. First, the standard path relative to the data folder, but with the slashes reversed, followed by the .xdb extension and then a fragment like #xpointer(/Texture).

Something like this. However, instead of t1/4, it's more reliable to use ceil(t1/4) to avoid errors when the value is less than 4. And I don't quite understand why there's a while loop there.
User Avatar
12 years ago
Auto-translated
you can also close the loop with `break` to avoid unnecessary script overhead.
User Avatar
12 years ago
Auto-translated
Ah, here you can also use an if-then statement.
User Avatar
12 years ago
Auto-translated
Yeah, I get it now.

In that case, a loop isn't really necessary.
User Avatar
12 years ago
Auto-translated
The function is launched via startThread, so I added a while loop.
User Avatar
12 years ago
Auto-translated
Even if a function is started with `startThread`, it doesn't necessarily mean that the function must contain a loop.
In reply to MasteR
User Avatar
12 years ago
Auto-translated
Juss456

Instead of an icon, there's a white screen. But that's understandable; I don't know where to find a suitable one. The main text isn't displayed (to the right of the icon). The function doesn't work as it should.
You open the map with an archiver and put the folder from the archive there.
Regarding the image, here's an example:
'/UI/Tavern/RumorsIcon.(Texture).xdb#xpointer(/Texture)'
Attachments 1
1 file attached • Total size: 665 B
In reply to RedHeavenHero
User Avatar
12 years ago
Auto-translated
RedHeavenHero
If a function is started with startThread, it doesn't necessarily mean that the function must contain a loop.
Yeah, you can manage without a loop here. Thanks!)

Added after 38 seconds
Oligarch
You open the map with an archiver and put the folder from the archive there.
Regarding the image, here's an example:
'/UI/Tavern/RumorsIcon.(Texture).xdb#xpointer(/Texture)'
I'll try it later. Thank you very much!)

Statistics

Welcome our newest member: recijeb