Skip to content

Posts from Current questions and answers regarding the map editor.

5.0 (12 ratings)
User Avatar
Auto-translated
where does ChangeResouce come from? There is SetPlayerResouce
Change|Set doesn't add resources to the player, but sets them, so it should be done like this:
function regF ()
SetAmbientLight (0, "Tu", true, 5);
delta = GetPlayerResource(1, 5);
SetPlayerResource(1, 5, delta+10);
end;
Trigger (REGION_ENTER_AND_STOP_TRIGGER, "reg", "regF");
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
In reply to KioM
User Avatar
Auto-translated
KioM
Where does ChangeResource come from? Is there a SetPlayerResource?
ChangeResource: Changes the amount of a specified resource for the player who owns the specified hero. A "floating" message appears from this hero, indicating the resource change.
playerID: Player ID
resourceKindID: Resource type ID
quantity: Amount (cannot be a negative value)
heroName: Hero name
User Avatar
Auto-translated
antonag07 is right, it is clearly stated here that you should give 10 crystals. Sulfur has code 4 (or SULFUR, to avoid confusion).
 

К А
Стикеры GBF в Telegram
In reply to Олегарх
User Avatar
Auto-translated
Oligarch
ChangeResource Changes the amount of a specified resource for the player who owns the specified hero. A "flying" message appears from this hero, indicating the resource change.
playerID Player ID
resourceKindID resourceKindID Resource type ID
quantity Amount (cannot be a negative value)
heroName Hero name

Where did you get this from? I don't have these functions in the official manuals.
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
User Avatar
Auto-translated
When creating a map, I encountered the following problem:
If you give a creature resources/an artifact, you receive them after killing it. But if it joins your army, you don't get them. Is it possible to obtain the artifact/resources only AFTER the creature joins your army, without killing it (this doesn't fit the scenario)? If it's a script, could you please share the code? :smile45:
Нам нужен мир:smile15: ...Желательно весь!:smile14:
User Avatar
Auto-translated
Bulletin, `

function MonsterFunction(hero)
    Trigger(OBJECT_TOUCH_TRIGGER, 'Monster', nil);
    -- artifact
    GiveArtefact(hero, itemId);

    -- resource
    gold = GetPlayerResource(PLAYER_1, GOLD);
    SetPlayerResource(PLAYER_1, GOLD, gold+your amount);
end;

Trigger(OBJECT_TOUCH_TRIGGER, 'Monster', 'MonsterFunction');

in the monster's properties, give it a script name and set it so that it always joins.
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
User Avatar
Auto-translated
complains that the functions MonsterFunction (monster replaced with the script name of the unit footman) and ItemId are undefined.
From the error, I only understood that I need to give an ID to the artifact. All IDs are in the file from the developers, which I don't have. But I don't quite understand what to do with the monster.

function footmanFunction(hero)
Trigger(OBJECT_TOUCH_TRIGGER, 'footman', nil);
GiveArtefact(hero, itemId);
end;
Trigger(OBJECT_TOUCH_TRIGGER, 'footman', 'footmanFunction');
Нам нужен мир:smile15: ...Желательно весь!:smile14:
In reply to KioM
User Avatar
Auto-translated
KioM
where did you get this from? I don't have these functions in the official manuals.
This is from a manual by ValexAV. And crystals are just an example.

Ah, okay, it worked now.
function regF()
sulfur=GetPlayerResource(1, 4);
if sulfur>=3 then
SetPlayerResource(1, 4, sulfur-10);
end;
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "reg", "regF");

Added 57 minutes later
In the World of Enroth map, there was an object - a UFO. How do I place it on the map?
Auto-translated
You place any hero on the map, then in the properties tree, click on "Shared." A new window will open, and there you can choose the desired object from the list of heroes (it will have the word "UFO" in its name).
User Avatar
Auto-translated
Vestnik, everything was replaced correctly, only the artifact ID was used instead of itemId ;) ... oh yes, very often you also need to additionally declare parameters inside the function, like this:
function MonsterFunction(hero)
    myHero = hero; -- additionally added the hero variable
    Trigger(OBJECT_TOUCH_TRIGGER, 'Monster', nil);
    -- artifact
    GiveArtefact(myHero, 53); -- added as an example the ID of an artifact (in this case, the Tear of Ashi)

    -- resource
    gold = GetPlayerResource(PLAYER_1, GOLD);
    SetPlayerResource(PLAYER_1, GOLD, gold + your amount);
end;

Trigger(OBJECT_TOUCH_TRIGGER, 'Monster', 'MonsterFunction');
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
User Avatar
Auto-translated
I copied the code, pasted it into the monster. I changed the function name, but nothing happened. I checked the case sensitivity (C++ is just as case-sensitive, so there are no problems with that). Do comments affect the script's functionality? Can you upload a table with item IDs, because my build doesn't have either the official manual or the table.
Нам нужен мир:smile15: ...Желательно весь!:smile14:
User Avatar
Auto-translated
You don't need to put this script into a monster; instead, put it in MapScript.lua.
 

К А
Стикеры GBF в Telegram
In reply to Ment
User Avatar
Auto-translated
How to edit a message after winning?
In reply to Олегарх
Auto-translated
Oligarch
How do you edit a message after winning?

What do you mean? Do you want to edit the message after completing a mission and write something like "This is a real victory - not a defeat!" in it?
Well, what prevents you from creating a text file and writing what you think is necessary in it? You can do the same procedure for the message about losing ("This is your shameful defeat - not a victory!").

Statistics

Welcome our newest member: Emil