Posts from Scripts for beginners.
Auto-translated
How to create infinite action points in a script for all 8 players
while 1 do
for player = PLAYER_1, PLAYER_8 do
if GetPlayerState(player) == PLAYER_ACTIVE then
for i, hero in GetPlayerHeroes(player) do
ChangeHeroStat(hero, STAT_MOVE_POINTS, 10000)
end
end
end
sleep()
end
Added 4 minutes later
And one more thing, how do I make it so that at the beginning of the game, there is a week of gold?
WEEK_OF_PLAGUE
WEEK_OF_IDLENESS
WEEK_OF_TREANT
WEEK_OF_TOAD
WEEK_OF_MAGIC
Change the very first entry to WEEK_OF_GOLD. Then, in the editor, set the map property RandomMoons to false. The downside is that all weeks will become non-random and will follow the sequence from the specified file.
Added after 22 hours 0 minutes
How do you make the training cost 1 coin per unit?
Hello everyone! I have a question: how do I create a local script for a specific object (garrison, mine, etc.) so that upon capturing it (once), it grants a reward (e.g., experience, creatures, resources)? Thank you!
Good afternoon. This type of question has been discussed many times in the Scripts topic. I recommend searching there, or, as a universal tip for this and 100+ other similar questions, you can take someone's map where this is already implemented and examine the script.
Пробуждение зла
Нашествие из Преисподней
Смена эпох
Скачать все кампании одним архивом: Яндекс.Диск Google.Диск
You can download the set of 3 Campaigns (English version) here
Одиночные сценарии Heroes V 3.1:
Незваные гости
Красный кристалл
Синий кристалл
Закат тьмы
Мультиплеерные карты для Heroes V 3.1:
Легендарная война
Сердце вулкана
Передел мира
function Def( heroname )
if heroname == hero then
StartCombat(hero,nil,1,CREATURE_CRYSTAL_DRAGON,6);
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "def", nil );
end;
end;
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "def", "Def" );
Since you left the last 4 parameters as nil, you can simply omit them.
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
I also recommend checking the console if the code doesn't work, as the error there is often the key to solving the problem.
There was a message that the line `function Def(heroname)` is not defined
and the line `function CREATURE_CRYSTAL_DRAGON` is not defined
Added 1 minute ago
Look at the script name of the hero in its settings (Select => Space => Settings => Script name). And replace `hero` with this name.
That is:function Def(heroname)
if heroname == hero then
StartCombat(hero,nil,1,CREATURE_CRYSTAL_DRAGON,6);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "def", nil);
end;
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "def", "Def");
Since you left the last 4 parameters as nil, you can simply not specify them.
But I need any hero, except for the heroes of the Forest Pact, to enter into combat when entering the area
preserve_heroes={"Name", "Name1", ..., "Name7"}.
Then, in the function:
function Def(heroname)
for key, name in preserve_heroes do
if name==heroname then
local PreserveHero=1
end
end
if not PreserveHero then
StartCombat(...)
end
...
end
Trigger...
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
Don't confuse the log editor and the game console. You can find instructions on how to unlock it online. I also recommend using a dedicated script editor => https://yadi.sk/d/W6cz5UBu3SGAvb. It doesn't crash and works better, plus it's more convenient. You need to create a table of script names for the Elven heroes:
preserve_heroes={"Name", "Name1", ..., "Name7"}.
Then, in the function:
function Def(heroname)
for key, name in preserve_heroes do
if name==heroname then
local PreserveHero=1
end
end
if not PreserveHero then
StartCombat(...)
end
...
end
Trigger...
Thank you!
Don't confuse the log editor with the game console. You can find instructions on how to unlock it online. I also recommend using a dedicated script editor => https://yadi.sk/d/W6cz5UBu3SGAvb. It's more stable, works better, and is more convenient. You need to create a table of script names for the elf heroes:
preserve_heroes={"Name", "Name1", ..., "Name7"}.
Then, in the function:
function Def(heroname)
for key, name in preserve_heroes do
if name==heroname then
local PreserveHero=1
end
end
if not PreserveHero then
StartCombat(...)
end
...
end
Trigger...
Good afternoon!
As a result, I got the following script:
preserve_heroes={"Elleshar", "Linaas", "Gillion", "Diraya", "Itil", "Ossir", "Nadaur"}
function Def( heroName )
for key, name in preserve_heroes do
if name == heroName then
local PreserveHero=1
end;
end;
if not PreserveHero then
StartCombat(heroName, "Metlirn",7,44,24,146,80,148,16,147,48,50,16,48,48,44,24)
end;
end;
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "def", "Def" );
It intercepts all heroes without exception...
I even tried having Ilfina ("Itil") enter the region, and a battle starts, and the console displays the message: Value was NIL when getting global with name 'PreserveHero'
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________