Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
Auto-translated
Are you sure that the numbering starts from one? Shouldn't it start from zero?
 

К А
Стикеры GBF в Telegram
User Avatar
Auto-translated
I don't know why it's like that, usually it always starts from 0 (at least in C++), but here, when trying to start the numbering from 0, the console shows an error; if you start from 1, all the elements of the list are passed starting from the first one. (I don't know for sure, I haven't studied Lua, but I looked it up in the reference, and the for loop is written in that format there too).
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
User Avatar
Auto-translated
Hmm, then the code seems to be fine...
I didn't understand the last question.
 

К А
Стикеры GBF в Telegram
User Avatar
Auto-translated
Stupidity wrote :)
Here, you can choose from a list, for example, 8 names, and select one for the specific case (example: blockedTavern[3]). Is it possible to exclude a specific name? Specifically for my case, i.e., select all 8 names and then exclude, for example, the 3rd one.
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
In reply to KioM
User Avatar
Auto-translated
function regF () if IsObjectExist ('mon') ~= nil then MessageBox (GetMapDataPath().."mes.txt"); else MessageBox (GetMapDataPath().."mes2.txt"); end; end; Trigger (REGION_ENTER_WITHOUT_STOP_TRIGGER, "reg", "regF"); ``` doesn't work. It says "attempt to call a nil value".
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
User Avatar
Auto-translated
Olegarch, wouldn't it be simpler to write it like this:
if IsObjectExist('mon') == true then
MessageBox(GetMapDataPath().."mes.txt");
else...

and in general, you can use:
if IsObjectExist('mon') == not nil then
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
User Avatar
Auto-translated
You can choose from a list, for example, 8 names, and select one for the specific case (example: blockedTavern[3]), but is it possible to exclude a specific name? This is exactly what I need – to select all 8 names and then exclude, for example, the 3rd one.
Either put the number i in the if statement, or simply iterate through the first two elements in the array, and then through the rest.
It still doesn't work. It says "attempt to call a nil value".
Don't compare with nil, but with true. Or, as I think, it should be compared with false, but then for equality, and not the opposite.
 

К А
Стикеры GBF в Telegram
In reply to Ment
User Avatar
Auto-translated
Ment
Either put it in the array at index i, or simply iterate through the first two elements of the array first, and then through the rest. Don't compare with nil, but with true. Or, as I think, still with false, but then for equality, and not the other way around.
i.e.
function regF()
if IsObjectExist('mon')=true then
MessageBox(GetMapDataPath().."mes2.txt");
else MessageBox(GetMapDataPath().."mes.txt");
end;
end;
Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER, "reg", "regF");?
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
User Avatar
function regF ()
if IsObjectExist ('mon')==true then
MessageBox (GetMapDataPath().."mes2.txt");
else MessageBox (GetMapDataPath().."mes.txt");
end;
end;
Trigger (REGION_ENTER_WITHOUT_STOP_TRIGGER, "reg", "regF");
 

К А
Стикеры GBF в Telegram
Auto-translated
if IsObjectExists ('mon')==true then, sorry, here's a suggestion - but there's an error in the IsObjectExists function - the letter S is required at the end. If the monster doesn't exist, it outputs nil (specifically nil, and not various true or false values).
(It happens :smile04:, that's why I advised using a script editor to check).
Oligarch, in your case, you need
if IsObjectExists ('mon')==nil ...
Use prints - it's the ideal option for catching errors
print (IsObjectExists('mon')); - and check the console.
In reply to JonnyP
User Avatar
Auto-translated
JonnyP
if IsObjectExists ('mon')==true then, sorry, here's my advice - but there's an error in the IsObjectExists function - the letter S is required at the end. If there is no monster, it outputs nil (exactly nil, and not all sorts of true and false).
(It happens :smile04:, that's why I advised using a script editor to check).
Oligarch, in your case, you need
if IsObjectExists ('mon')==nil ...
Use prints - it's the perfect option for catching errors
print (IsObjectExists('mon')); - and look in the console

And I wrote Exist instead of Exists! I fixed it, and it worked right away.:smile52:
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
User Avatar
Auto-translated
Does anyone know how to increase the creature growth rate in an existing dwelling (if the dwelling is not a town)? Unfortunately, SetObjectDwellingCreatures only works with towns...
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
User Avatar
Auto-translated
I know how to do it with mods (then it will affect all the bonuses for creatures of that type). Unfortunately, I don't know how to do it with scripts.
 

К А
Стикеры GBF в Telegram
User Avatar
Auto-translated
Ah... if only it were possible to modify the way Get|SetObjectDwellingCreatures works, so that it would apply to all objects, not just towns.
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
In reply to KioM
User Avatar
Auto-translated
In my opinion, the talkbox still doesn't work in version 3.1. The game also doesn't recognize it as a command.
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля

Statistics

Welcome our newest member: Emil