Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to Олегарх
Auto-translated
Oligarch
In my opinion, the talkbox still doesn't work in version 3.1. The game also doesn't recognize it as a command.
Really, it doesn't work? Here's proof: :smile08:
In reply to Олегарх
User Avatar
Auto-translated
Oligarch
In my opinion, the talkbox still doesn't work in version 3.1. The game also doesn't recognize it as a command.
It seems that it doesn't work in 3.0. Or even worse. In multiplayer, using it is like inviting disaster – there will be countless glitches, for example, in the TE mod. Especially not on the first day and during simultaneous gameplay.
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
In reply to JonnyP
User Avatar
Auto-translated
JonnyP
Really, it doesn't work? Here's the confirmation: :smile08:
The console says "value was nil when getting global with name TalkBoxForPlayers."
This means the game doesn't recognize it as a command. But I'm using version 3.1.
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
In reply to Олегарх
Auto-translated
Oligarch
The console displays "value was nil when getting global with name TalkBoxForPlayers".
This means the game doesn't recognize it as a command. But I'm using version 3.1.


Provide your code snippet – it seems like your script is poorly written.
In reply to antonag07
User Avatar
Auto-translated
antonag07
share your code snippet - because it looks like your script is poorly written
TalkBoxForPlayers(1, "face_Dugal", "kuzn_might", "otv", 0, "mes", GetMapDataPath().."mes2", 2);
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
In reply to Олегарх
Auto-translated
Oligarch
TalkBoxForPlayers(1, "face_Dugal", "kuzn_might", "otv", 0, "mes", GetMapDataPath().."mes2", 2);
TalkBoxForPlayers (PLAYER_1,face_Dugal,bio_Dugal,nil,nil,'TALK',0,name_Dugal,GetMapDataPath().."names_and_desc/q000.txt",1,GetMapDataPath().."dialogs/derin001.txt");
Now, let's play a game of 'find five differences':smile09:
In reply to JonnyP
User Avatar
Auto-translated
JonnyP
TalkBoxForPlayers (PLAYER_1,face_Dugal,bio_Dugal,nil,nil,'TALK',0,name_Dugal,GetMapDataPath().."names_and_desc/q000.txt",1,GetMapDataPath().."dialogs/derin001.txt");
Now let's play a game of 'find five differences':smile09:
I'm an idiot!!!!! I have version 3.0!!!:smile35:
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
In reply to Олегарх
User Avatar
Auto-translated
Oligarch
I'm an idiot!!!!! I have version 3.0!!!:smile35:

:)

--------------
The command: EnableAutoFinish() doesn't work for me. I set it to nil, but the battle ends when unsummoned creatures are destroyed... Does anyone know how to use it correctly?)

Added 15 minutes later
Oligarch
I'm an idiot!!!!! I have version 3.0!!!:smile35:

:)

--------------
The command: EnableAutoFinish() doesn't work for me. I set it to nil, but the battle ends when unsummoned creatures are destroyed... Does anyone know how to use it correctly?)
============
I'm also interested in how the wait function works, what parameters does it have? For example, the situation is as follows:
There is a function - AttackerCreatureDeath. When the creature I need dies, I summon another creature to its position (for now, it's simple), but I also remove its body, and that's where the fun begins)). No matter how many seconds of delay I set (sleep(1-100)), the body disappears before the creature (which is still alive) is actually hit. Visually, it looks like an enemy creature is hitting an empty space, from which the number of dead creatures flies away, and then other creatures are summoned. So I decided to try using wait, but I can't understand how this function works and what parameters it can have.

P.S. sorry for the long text :smile26:
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
User Avatar
Auto-translated
I'm not very good with combat scripts. I've encountered a similar problem, but I managed to work around it without finding a solution. In general, I think it's better not to change the victory conditions in battles; nothing good will come of it anyway. For example, in the developers' map (campaign 6, mission 5 – by the way, that's the best place to look at combat scripts, as there weren't any more complex scripts in the entire game), the "banishment" spell allowed you to end the battle as soon as it was your hero's turn, which is, to put it mildly, imbalanced.
 

К А
Стикеры GBF в Telegram
In reply to Ment
User Avatar
Auto-translated
Ment
Not very strong in combat scripts. I also encountered a similar problem, but I somehow managed without solving it. In general, I think it's better not to change the victory conditions in battle; nothing good will come of it anyway. For example: on the developers' map (campaign 6, mission 5, by the way, it's best to look at combat scripts there, as there were no more complex scripts in the entire game), the "banishment" spell allowed you to end the battle as soon as your hero's turn came, which is, to put it mildly, imbalanced.

By the way, I've been wanting to know for a long time where the scripts from the original Heroes 5 campaigns are located? I only find the campaigns from the 2nd add-on "Hammers of Fate" in data.pak, and there are no campaigns from the 3rd add-on "Tribes of the East" either.
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
User Avatar
Auto-translated
Actually, this applies to the original Heroes of Might and Magic V. If you don't have them, you can get the necessary files here.
 

К А
Стикеры GBF в Telegram
In reply to KioM
Auto-translated
KioM

The command EnableAutoFinish() doesn't work for me. I set it to nil, but the battle ends when unsummoned creatures are destroyed... Does anyone know what I'm doing wrong?
It probably just didn't work ;)
Put it in the Start() function.
As for the creature death function, it's simple: it's called when the creature is already dead - it was given the task to attack - that's it, it's immediately considered dead. But the computer doesn't have time to play the animation, and it doesn't look good visually :smile18:
It's better not to use sleeps at all - they are not very useful in combat. I haven't encountered any problems with wait. :)
In reply to JonnyP
User Avatar
Auto-translated
JonnyP
So, it just didn't work ;)
Put it in the Start() function.
As for the function that handles creature death, it's simple: it's called when the creature is already dead – you give it the task to attack, and it's immediately considered dead. But the computer doesn't have time to play the animation, and it doesn't look good visually :smile18:
It's better not to use sleeps at all – they're not very useful in combat. I haven't encountered any problems with wait. :)

Well, maybe they're not *that* useful, but without them, you can't cast spells properly... So, I decided to use a delay in the function, and it seems logical:
function AttackerCreatureDeath(creatureName)
if GetCreatureType(creatureName) ~= 36 then
AttackerDeathCount = AttackerDeathCount-1;
count = GetCreatureNumber(creatureName);
spawnCount = count/3;
if spawnCount ~= 0 then
local x, y = GetUnitPosition(creatureName);
sleep(50);
removeUnit(creatureName);
sleep(5);
SummonCreature(ATTACKER, 36, spawnCount, x, y);
end;
end;
end;
But sleep(50) is a whole 10 seconds, and all this happens in 2 seconds... What could be wrong here? Maybe I messed something up :smile39: ?

Added 7 minutes later
By the way, while I was browsing the common scripts, I came across a function that wasn't mentioned in any of the guides (or maybe I just didn't look hard enough): showMessage(parameter, some number)

If I understand correctly, this command can be used to send a message to the combat log (where it shows who hit whom and for how much)
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
User Avatar
Auto-translated
No, this is needed for the training battle mode. The combat functions are best viewed in data.pak/scripts/combat-startup.lua. Oh, well, you probably looked there already.
 

К А
Стикеры GBF в Telegram
In reply to KioM
Auto-translated
KioM
Well, it doesn't really help; without them, you can't cast spells properly (for example)... So, I decided on the function and logically implemented it using a delay:
function AttackerCreatureDeath(creatureName)
if GetCreatureType(creatureName) ~= 36 then
AttackerDeathCount = AttackerDeathCount-1;
count = GetCreatureNumber(creatureName);
spawnCount = count/3;
if spawnCount ~= 0 then
local x, y = GetUnitPosition(creatureName);
sleep(50);
removeUnit(creatureName);
sleep(5);
SummonCreature(ATTACKER, 36, spawnCount, x, y);
end;
end;
end;
But sleep(50) is a whole 10 seconds, and all this happens in 2 seconds... What could be wrong here? Maybe I messed something up :smile39: ?

Added 7 minutes later
By the way, while browsing the common scripts, I came across a function that isn't mentioned in any guide (or maybe I just didn't look hard enough): showMessage(parameter, some number)

If I understand correctly, this command can be used to send a message to the combat log (where it shows who hit whom and for how much).
I don't know, I'm not very good with combat scripts - they're just too 'fickle'. It seems correct. Maybe you should delete the creature through a variable and summon the creature on the next turn?!

Statistics

Welcome our newest member: Emil