Skip to content
User Avatar
#488
Auto-translated
SoloMidDazzle

And what about the hero's name? Would 'heroname' be suitable for awarding a hero who has captured a creep?

If 'heroname' is not defined as a variable in the script, the game will interpret it as the script name of a hero and produce an error, as no such name exists. Therefore, there are two options:

1) Instead of 'heroname', enter the script name of a specific hero in quotes, for example, Duncan, like this - 'Duncan', but then other heroes, besides Duncan, will not be able to receive the reward for fulfilling the same conditions.

2) Instead of 'heroname', enter a variable that will designate the hero who has fulfilled the condition. Then, regardless of the script name, this hero will receive the reward if he has fulfilled the condition.

The second option is a bit more complex, and I already anticipate the next question... "Where can I get a variable?"

Having only a small fragment of code, it is difficult to say whether this variable was defined in this script or not. However, if you say that this script awarded artifacts and spells to the hero, then it most likely should be there. I assume that the commands TeachHeroSpell and GiveArtefact were used. If so, then either the script name of the hero or a variable should be specified in the argument of these commands.

If it was implemented in another way, then you can define the variable yourself; I think this structure will make it clear how to do it...
------------------
function function_name(hero)
playerHero = hero
...
...

...
Now you can use the playerHero variable for the command that will give 10 vampires (ID 35) to any slot:

AddHeroCreatures(playerHero,35,10, -1)
...
...
end;
-------------------------
Модификации для Heroes V 3.1:

[Модификация]Phoenix Vision - Комплексное модифицирование визуального аспекта игры.
[Модификация]UNIT-Баланс существ + визуальные изменения.
[Модификация]NewTransformUndead-Таблица поднятия нежити.

[Модификация]VisualFix-Устрание визуальных багов.

Карты для Heroes V 3.1:

[Карта][1x1]The Last Stand - Дуэльная карта финальных битв


Группа VK:
https://vk.com/club176978884