Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to JonnyP
User Avatar
Auto-translated
JonnyP
I'm also curious about how it works. It's unclear how to specify the map name – that is, what name to write in the function. I tried it – it runs (I don't remember exactly, it was a while ago, I don't remember how I did it), and it's also unclear how it behaves with modified maps.
P.S.: If the function could be made to work correctly, it would be ideal for combining heavily modified maps into a single campaign. Unfortunately, it's not yet possible to combine maps with mods into a campaign.

The path is very simple:
Put the second map into the archive with the first one, for example, name it map_2.xdb and add another map_tag to it, and then in the script
WarpToMap('AdvMapDescTag:Maps/Singleplayer/map name/map-tag_2.xdb.(AdvMapDescTag).xdb#xpointer(/AdvMapDescTag)');
the second parameter is the player ID, by default 1.
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
In reply to KioM
User Avatar
Auto-translated
KioM
the process is very simple:
you move the second map into the archive with the first one, for example, name it map_2.xdb and create a corresponding map_tag file, and then in the script
WarpToMap('AdvMapDescTag:Maps/Singleplayer/map name/map-tag_2.xdb.(AdvMapDescTag).xdb#xpointer(/AdvMapDescTag)');
the second parameter is the player ID, by default 1.
and can't you just place another map in the maps folder and point to it? because putting a map in the archive with the second one... there's not just map and map_tag, but also ground and underground terrain.bin, which, I think, contains the map's landscape.
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
In reply to Олегарх
User Avatar
Auto-translated
Oligarch
Couldn't you just place another map in the maps folder and reference it? Because putting a map in the archive for the second game... there's not just map and map_tag there, but also ground and underground terrain.bin, which, it seems, contains the map's landscape.
I don't know, it needs to be tested, tried out. I tried the method described above; maybe there's a simpler way.

Added 7 hours 14 minutes later
Tactical scripts: I've run into a problem. I'm trying to make a spell work on all of a hero's creatures at once. I select the creatures using GetCreatures(side), load the data into the "creatures" variable, and use it to target the final target:
for i = 0, length(creatures)-1 then
UnitCastAimedSpell(GetHero(side), spell_id, creatures);
end;

As a result, the spell is only cast on part of the creatures... what am I doing wrong? Maybe someone has successfully done something similar...

Added 2 minutes later
I suspect that some spells have a limit on their use, meaning you can't use a spell more than n times at once
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
In reply to KioM
Auto-translated
KioM
I don't know, it needs to be tested, tried out. I tried the method described above, maybe there's an easier way.

Added after 7 hours and 14 minutes
Tactical scripts: I encountered a problem, I'm trying to make a spell work on all the hero's creatures at once. I select the creatures using GetCreatures(side), load the data into the "creatures" variable, and use it to target the final target:
for i = 0, length(creatures)-1 then
UnitCastAimedSpell(GetHero(side), spell_id, creatures);
end;

As a result, the spell is cast on only part of the creatures... what am I doing wrong? Maybe someone has successfully done something similar...

Added after 2 minutes
I assume that if a creature is immune to the spell being used, the script will give an error. Or maybe there isn't enough mana, for example.
It seems that if a creature is immune to the spell being used, the script will give an error. Or maybe there isn't enough mana, for example.
Check out the map 'Reconquista', I don't remember the author - it has a very large and fully functional combat script.
In reply to JonnyP
User Avatar
Auto-translated
JonnyP
it seems that if a creature is immune to the spell being used, the script will produce an error. Or maybe there isn't enough mana, for example.
Check out the map 'Reconquista', I don't remember the author - it has a very large and fully functional combat script.

thanks, I looked at his scripts... my jaw dropped :smile01: this guy is simply a coding maestro (I glanced through it, I haven't seen such extensive functionality yet).
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
Auto-translated
I once asked a question related to prohibiting the construction of buildings in a town for a certain period. If anyone needs it, the command is:
SetTownBuildingLimitLevel(townName, buildingLevel, limit)
Limit is the building level. It cannot be less than the current level. If I understand correctly, 0 means a ban on construction, 1 means a built building, 2... means upgrades.
Мои карты:
SinglePlayer: Выбор Зехира
Падение Стедвика(pre-release)
Готовится: Зима Титанов, Столетняя война
In reply to djulian13
User Avatar
Auto-translated
Is it possible to place markers on the map? For example, during gameplay, a quest is given, and a location on the map is marked, indicating where the player needs to go.
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
User Avatar
Auto-translated
Yeah, just make the losing effect a bit more noticeable. If you mean a mini-map, I would create an object with a non-standard model, but its type should be a dwelling (there won't be arrows on the global map, but there will be a white dot). You could even add another player for this (an inactive one).
 

К А
Стикеры GBF в Telegram
Auto-translated
Hello everyone!
Here's the situation: I need to make it so that in battle, a hero fights not with their own troops, but with an army specifically defined by a script. What script is used to achieve this?
Sincerely.
Мои карты:
SinglePlayer: Выбор Зехира
Падение Стедвика(pre-release)
Готовится: Зима Титанов, Столетняя война
In reply to djulian13
User Avatar
Auto-translated
djulian13
Hello everyone!
I need to make it so that in battle, the hero fights not with his own troops, but with a clearly defined army specified in the script. What script is used for this?
Sincerely.
You can use a script to specify AddHeroCreatures and give him the desired army.

Added 2 hours and 50 minutes later
Can you write "end" in the middle of the script, for example, after an "if" statement?
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
Auto-translated
"Is it possible to write 'end' in the middle of a script, for example, after an 'if' statement?"
Yes.
"Is it possible to use a script to specify 'AddHeroCreatures' and give it the desired army?"
No. He has five paladins, one hundred peasants, and I need to give him one hundred griffins and remove the rest. Moreover, I need to return them afterward.
AddHeroCreatures is a rather obscure command; it simply refused to work, so I had to use AddHeroCreatures.
Sincerely.
Мои карты:
SinglePlayer: Выбор Зехира
Падение Стедвика(pre-release)
Готовится: Зима Титанов, Столетняя война
In reply to djulian13
User Avatar
Auto-translated
djulian13

AddHeroCreatures is a really strange command; it simply refused to work for me, so I had to use AddHeroCreatures.
Best regards.
Huh? What did I say?
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
Auto-translated
Damn. I should have used AddObjectCreatures; I was in a hurry when I wrote it.
Best regards.
Мои карты:
SinglePlayer: Выбор Зехира
Падение Стедвика(pre-release)
Готовится: Зима Титанов, Столетняя война
In reply to djulian13
User Avatar
Auto-translated
djulian13
Damn. I should have used AddObjectCreatures, I was in a hurry =)
Best regards.
Hehe, AddHeroCreatures seemed to work fine for me.
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
User Avatar
Auto-translated
Hey, I read your dialogues, but I still don't understand how to make a creature attack.

Statistics

Welcome our newest member: Emil