Posts from Scripts
no, the point isn't that it becomes mine
but that the entire army I defeated is reborn
but now under my command
and, of course, it's non-removable
plus, it's doubled.
SetObjectEnabled("garrison_name", nil);
Trigger(4, "garrison_name", "capture_gar");
function capture_gar(hero)
local a = {};
a[1], a[3], a[5], a[7], a[9], a[11], a[13] = GetObjectCreaturesTypes("garrison_name");
for i = 1, 7 do
if a[i*2-1] ~= 0 then
a[i*2] = 2 * GetObjectCreatures("garrison_name", a[i*2-1]);
end;
end;
SetObjectEnabled("garrison_name", 1);
Trigger(4, "garrison_name", nil);
MakeHeroInteractWithObject(hero, "garrison_name");
local i = GetLastSavedCombatIndex();
while i == GetLastSavedCombatIndex() do
sleep(1);
end;
if not IsHeroAlive(hero) then
SetObjectEnabled("garrison_name", nil);
Trigger(4, "garrison_name", "capture_gar");
return
end;
for i = 1, 7 do
if a[i*2] then
AddObjectCreatures("garrison_name", a[i*2-1], a[i*2]);
end;
end;
DenyGarrisonCreaturesTakeAway("garrison_name", 1);
end;
Here, you only need to replace "garrison_name" with the script name of your garrison. In the script, it should be written in quotes, and in the editor (in the Name field in the object's properties) - without quotes.
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
yes, the garrison
no, the point is not that it becomes mine
but that the entire army that I defeated is reborn
but now under my command
naturally, it cannot be taken back
plus, it doubles in size
you give your "gates" a name.
for example, vorota
vorotaF is a function that will be executed when an object is captured
then you declare a trigger
Trigger(OBJECT_CAPTURE_TRIGGER, "vorota", "vorotaF");
then you write the function itself
vorotaF(nPrevOwnerID, nNewOwnerID, sHeroName, sObjectID)
nPrevOwnerID - player number - the former owner
nNewOwnerID - the current owner
sHeroName - the name of the hero who captured the gates
sObjectID - the name of your gates (vorota)
these parameters are passed to the function after the garrison's owner changes. If it doesn't matter who captured the garrison, you can leave the parentheses empty.
to add creatures to the garrison, use the command
AddObjectCreatures( sObjectName, nGreatureID, nCount );
where sObjectName is the name of the gates (specified in quotes!!!)
nGreatureID is the creature ID (there is a document with all IDs in the editor's documentation)
nCount is the number of creatures to be added.
Trigger(OBJECT_CAPTURE_TRIGGER, "vorota", nil ); - resetting the trigger, also in the function body!!!
and don't forget to put end at the end;
that's all. If it is important which player and hero captures, specify all parameters in the function's parentheses and write a conditional statement in the function body if ....... end;
Пробуждение зла
Нашествие из Преисподней
Смена эпох
Скачать все кампании одним архивом: Яндекс.Диск Google.Диск
You can download the set of 3 Campaigns (English version) here
Одиночные сценарии Heroes V 3.1:
Незваные гости
Красный кристалл
Синий кристалл
Закат тьмы
Мультиплеерные карты для Heroes V 3.1:
Легендарная война
Сердце вулкана
Передел мира
gar="garrison name"
gar_army={}
for i = 0, 6 do
local t, n = GetObjectArmySlotCreature(gar, i)
gar_army={t, n}
end
Trigger(5, gar, 'capture_gar')
function capture_gar(oldowner, newowner, hero, gar)
for i = 0, 6 do
if gar_army[1] ~= 0 then
AddObjectCreatures(gar, gar_army[1], gar_army[2]*2)
end
end
DenyGarrisonCreaturesTakeAway(gar, 1)
Trigger(5, gar, nil)
end
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
I opened the map in the editor.
I found the garrison.
I opened the properties with the spacebar.
I clicked "Edit Script".
I pasted the text.
I clicked "OK".
what did I do wrong? I opened the map in the editor. I found a garrison. I opened its properties by pressing the spacebar. I clicked "Edit script". I pasted the text. I clicked "OK".
Пробуждение зла
Нашествие из Преисподней
Смена эпох
Скачать все кампании одним архивом: Яндекс.Диск Google.Диск
You can download the set of 3 Campaigns (English version) here
Одиночные сценарии Heroes V 3.1:
Незваные гости
Красный кристалл
Синий кристалл
Закат тьмы
Мультиплеерные карты для Heroes V 3.1:
Легендарная война
Сердце вулкана
Передел мира
how do I name a garrison?
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
It turns out you need to click
in the field to the right of the word "name".
You can also click on "name" to highlight it and then press the spacebar.
It worked!