Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
Auto-translated
Thank you for your help. By the way, the map script editor says that "%" is a serious script error. Although, I checked, and everything works. But still, I made a separate function, because I already have a lot of errors, especially with "()".

Whatever
In reply to Heroist
User Avatar
Auto-translated
That map script editor is designed for a different Lua version than the one used for the in-game scripts. Don't pay attention to the arrows! Let's rush straight towards the rebels!
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
Auto-translated
The thing is, if I make a mistake anywhere else, it will get stuck on the percentage and ignore everything else.

Whatever
In reply to Heroist
User Avatar
Auto-translated
Well, that's up to you. Overall, the map script editor is a decent tool, but when it comes to such nuances...
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
Auto-translated
Who here would argue that this isn't true? Back when I was typing out scripts in Notepad... =)

Whatever
Auto-translated
HEH, I mixed up this script; it needs to be looped so that it works constantly. ```html
garrisons={'G1', 'G2', 'G3', 'G4', 'G5', 'G6', 'G7', 'G8', 'G9'}
for i, gar in garrisons do
SetObjectEnabled(gar, nil)
Trigger(4, gar, "capture_gar")
end

function capture_gar(hero, gar)
local a = {}
a[1], a[3], a[5], a[7], a[9], a[11], a[13] = GetObjectCreaturesTypes(gar)
for i = 1, 7 do
if a[i*2-1] ~= 0 then
a[i*2] = 2 * GetObjectCreatures(gar, a[i*2-1])
end
end
SetObjectEnabled(gar, 1)
Trigger(4, gar, nil)
MakeHeroInteractWithObject(hero, gar)
local i = GetLastSavedCombatIndex()
while i == GetLastSavedCombatIndex() do
sleep(1)
end
if not IsHeroAlive(hero) then
SetObjectEnabled(gar, nil)
Trigger(4, gar, "capture_gar")
return
end
for i = 1, 7 do
if a[i*2] then
AddObjectCreatures(gar, a[i*2-1], a[i*2])
end
end
DenyGarrisonCreaturesTakeAway(gar, 1)
end
In reply to RedHeavenHero
Auto-translated
and this script
garrisons={'G1', 'G2', 'G3', 'G4', 'G5', 'G6', 'G7', 'G8', 'G9'}
for j, gar in garrisons do
Trigger(5, gar, 'capture_gar')
garrisons[gar] = {}
for i = 0, 6 do
local t, n = GetObjectArmySlotCreature(gar, i)
garrisons[gar]= {t, n}
end
end

function capture_gar(oldowner, newowner, hero, gar)
for i = 0, 6 do
if garrisons[gar][1] ~= 0 then
AddObjectCreatures(gar, garrisons[gar][1], garrisons[gar][2]*2)
end
end
DenyGarrisonCreaturesTakeAway(gar, 1)
Trigger(5, gar, nil)
end

produces an error
http://www.youtube.com/watch?v=OKEqx7rBzV8&feature=youtu.be
User Avatar
Auto-translated
What is the difference between writing a regular function and adding a semicolon (`;`) at the end after the parentheses?

Whatever
User Avatar
Auto-translated
Hmm... thanks anyway. By the way, this made me think of a question:
I had a map mod that made the message boxes larger (almost full screen). How can I create the same effect in my own map?

Whatever
In reply to Heroist
User Avatar
Auto-translated
Find this mod (most likely in the UI folder) within the archive containing this map and integrate it into your own.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
Auto-translated
it's more complicated... I'll try to find it now.

Added 25 minutes later
I couldn't find it... not even online. Apparently, it's not a separate mod...

Whatever
User Avatar
Auto-translated
There are probably maps with this mod on the forum. If not on the forum, I saw such maps, I think, at ogo-i's. You can take them from there and add them to your map.
 

К А
Стикеры GBF в Telegram
User Avatar
Auto-translated
Yes, I already found it, but not here, but on a Heroes forum (heroes.ag). Now, another interesting question: I found the modified message file, but what should I do next? The author has it in a sub-subfolder called UI; should I do the same, or can I just put it directly into the UI folder?

Whatever

Statistics