Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
Auto-translated
Yes, everything is done as described, thank you for the answers. In multiplayer, delays were necessary, and they had to be placed after the required script functions. Unlike single-player, the delay had to be increased by another 1, and the order of resetting triggers and calling functions had to be changed. This allowed the cross-trigger functions to work in multiplayer (in single-player, everything worked well, albeit with some errors). Testing will show how stable this is. Play through the campaign? ))
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
User Avatar
Auto-translated
Help, please. I need an object to move when any hero enters a region. I wrote this:

function lightF(heroname)
SetObjectPosition("light",87,85,-1);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER,"light1","lightF");

where "light" is the script name of the object, "light1" is the region, and "lightF" is the function itself. What's wrong with my function? Please help. Thank you in advance.

Added after 40 seconds
There's a tab before setobject.
User Avatar
Auto-translated
What is a movable object? Only a movable object, a hero, or a neutral creature can be moved.

Added 2 minutes later
The Tab key is not needed; I don't know what that was for.

You also need to add a function to remove the action; otherwise, the script will always trigger whenever you enter the region.
Карты для героев 5

"Плата за любовь"
"Путь некроманта"
"Темные грани"
"Рок Гримхейма"
In reply to AstralLein
User Avatar
Auto-translated
Thank you. I didn't know about the movable objects. But the problem still isn't solved. Let me explain in more detail. I need the hero to stand in a region when approaching a wall in the Dungeon, and the following things should happen: an effect (light) appears on the wall, the region that the hero couldn't walk on is removed, and a secret passage through the wall is opened. How can I script all of this?
Regarding underground walls. You can walk through them if you place a bridge from the Grass folder and bury it using the z-coordinate. It won't be visible, and it will be like an invisible passage.
User Avatar
Auto-translated
an effect (light) appeared on the wall
indeed, for this, it is better to play the effect of some spell. Look in the manual and other maps for the word effect.
a region was deleted, through which the hero could not walk
there was some function that allowed you to block/unblock the passage of a region. Search for the word block.
In reply to Jack_of_shadows
User Avatar
Auto-translated
Thank you, AstralLein and Jack of Shadows, for your help. I have another question. How can I prevent a specific region from revealing the fog of war when a hero approaches it? I need it to remain hidden initially, and then, during a function, it should be able to reveal itself.
In reply to AstralLein
User Avatar
Auto-translated
So, is there nothing else besides SetWarfogBehaviour?
User Avatar
Auto-translated
Hello. Please, wise people, if you know the answer, let me know! :) As you remember, in Lords of the North, the Red Knights used this script to transform their units into red ones: function transformTroops( heroName ) sleep(3); print("function transformTroops for hero ", heroName ," has started..."); while IsHeroAlive ( heroName ) == true do for i=1,14 do creaturesCount = GetHeroCreatures( heroName, i ); if creaturesCount > 0 then RemoveHeroCreatures( heroName, i, 10000); n = i; if mod(i,2) ~= 0 then n = i + 1; end; AddHeroCreatures( heroName, 105 + (n/2), creaturesCount ); end; end; sleep(2); end; print("Hero ", heroName, " is dead. Function transformTroops terminated"); end; I need help with the following: How can I make the function work in reverse, transforming units from red to white? I've tried several times, but it doesn't work. Instead of 1, 14, I put 106, 112, and instead of 105, I put 1... It removes the red units, but spawns completely random units for the hero. Thank you for your help (if any). :)
In reply to Азгалор
User Avatar
Auto-translated
Azgalor
Hello. Please, wise people, if you know the answer, help me! :)
As you remember, in Lords of the North, the red knights converted their units to red using this script:

function transformTroops( heroName )
sleep(3);
print("function transformTroops for hero ", heroName ," has started...");
while IsHeroAlive ( heroName ) == true do
for i=1,14 do
creaturesCount = GetHeroCreatures( heroName, i );
if creaturesCount > 0 then
RemoveHeroCreatures( heroName, i, 10000);
n = i;
if mod(i,2) ~= 0 then n = i + 1; end;
AddHeroCreatures( heroName, 105 + (n/2), creaturesCount );
end;
end;
sleep(2);
end;
print("Hero ", heroName, " is dead. Function transformTroops terminated");
end;


I need help with the following: How can I make the function work in reverse, converting from red to white? I've tried many times, but it doesn't work. Instead of 1,14, I put 106, 112, and instead of 105, I put 1... It removes the red ones, but it spawns completely random units for the hero.

Thank you for your help (if any). :)
It should work approximately like this:
function transformTroops(hero)
while IsHeroAlive(hero) do
sleep(2)
for i=106,112 do
local n = GetHeroCreatures(hero, i)
if n > 0 then
RemoveHeroCreatures(hero, i, n)
AddHeroCreatures(hero, (i-105)*2, n)
end
end
end
end
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
Auto-translated
Is there a command that would make a non-clickable object (stone, tree, bridge, etc.) appear or move to specified coordinates? For example: a hero touches an obelisk, and a part of the bridge appears. The hero must find all the obelisks and, by touching them, the bridge would fully appear, and the passage would be opened.
In reply to ThomasKiller
User Avatar
Auto-translated
ThomasKiller
Is there a command that would make a non-clickable object (stone, tree, bridge, etc.) appear or move to specified coordinates? For example: a hero touches an obelisk, and a part of the bridge appears. The hero must find all the obelisks and, by touching them, the bridge would fully appear, and the passage would be opened.
SetObjectPosition.
Just set IsRemovable to true in the object's properties.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
Auto-translated
Thank you. I thought it was only for RemoveObject.

Statistics