Skip to content

Posts from Current questions and answers regarding the map editor. Auto-translated

5.0 (12 ratings)
User Avatar
#4505
Auto-translated
How can you make the quest update notification visible to the player without them having to use the "go to quests and see what has changed" method?
You could show a pop-up message like "Quest [quest name] has been updated" or something more detailed.
No, all animations are there. A complete set, plus three types of dialogue, and much more.
Well, I actually checked my editor, and I only saw 2 animations specifically for the hero Alaric, so I don't know, maybe it depends on the game version.
By the way, take a look at the script itself.
If you need criticism, I would:
- avoid "magic" numbers (4 instead of the resource name).
- move repeating string constants into variables, so that if you need to change them, you only need to change them in one place (if the player is always number 1 and has only one main hero)
player_id = PLAYER_1;
player_hero = 'Markel2';
- replace the ugly resource allocation construct with a function
function SetRes(res, num)
local curr_num = GetPlayerResource(player_id, res);
SetPlayerResource(player_id, res, curr_num + num, player_hero);
end
- if you plan to have many effects, move their unwieldy names into a separate table, here is a snippet from "Path of the Hero" (there are actually many more effects there):
-- list of effects for PlayVisualEffect
effects_table =
{
['Haste'] = 'Spells/Haste', -- breeze
['StoneSkin'] = 'Spells/StoneSkin', -- stone wall around
['Bless'] = 'Spells/Bless', -- light from the sky
['DeflectArrows'] = 'Spells/DeflectArrows', -- something like a shield on the side
['Dispel'] = 'Spells/Dispel', -- magical fog ending in an explosion
['Dispel_fail'] = 'Spells/Dispel_fail', -- magical fog without an explosion
};

function GetEffectName(id)
return '/Effects/_(Effect)/'..effects_table[id]..'.xdb#xpointer(/Effect)'
end

PlayVisualEffect(GetEffectName('Dispel'), ...);
User Avatar
#4507
Auto-translated
All of this is to reduce the likelihood of errors due to inattention; repeating long, complex lines that are difficult to visually process, such as
SetPlayerResource(1, SULFUR, GetPlayerResource(1, SULFUR)-50)
will ultimately most likely lead to typos like
SetPlayerResource(1, SULFUR, GetPlayerResource(2, SULFUR)-50)
or
SetPlayerResource(1, SULFUR, GetPlayerResource(1, GOLD)-50)
which will not be very obvious and will surface later on.
User Avatar
#4508
Auto-translated
It happens. As long as everything is okay. IDs get mixed up, that's a fact, but I prefer to copy the lines and only change the parameters.

Added 7 minutes later
We could try that, but right now I'm worried about something else. We have a task, the goal is to kill a specific player. How can we implement this through a script?

Added 1 minute later
How to check the next day is clear, but if it's immediately upon the death of the last hero or the capture of a city, it's just a normal death.
Карты для героев 5

"Плата за любовь"
"Путь некроманта"
"Темные грани"
"Рок Гримхейма"
User Avatar
#4509
Auto-translated
Also, the same as the next day, but only checking the condition in a separate thread (startThread).
In reply to AstralLein
User Avatar
#4511
Auto-translated
AstralLein
We have a script command that forces Alaric to play the casting animation once. But nothing happens in the game; this command doesn't work, but the script continues without any problems. There are no errors in the console, and the same command works perfectly with neutral creatures.

Question: is it possible to force a hero to play an animation using a script?
PlayObjectAnimation doesn't work on heroes, but it also doesn't cause any errors. So, it's not possible to animate a hero using scripts on the map.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#4512
Auto-translated
But it seems you managed to animate it. Doesn't Varrens cast a spell when dispelling the barrier of the Book of Changes in the second mission of the campaign? How?

Added 1 minute ago
If so, I played the campaign a long time ago.
Карты для героев 5

"Плата за любовь"
"Путь некроманта"
"Темные грани"
"Рок Гримхейма"
In reply to AstralLein
User Avatar
#4513
Auto-translated
AstralLein
But it seems you managed to animate it. Doesn't Varrens cast a spell when dispelling the barrier of the Book of Changes in the second mission of the campaign? How?

Added after 1 minute
If I remember correctly, I played the campaign a long time ago.
In the second mission in "Hall of Elements," the animation didn't play on the heroes; only the visual and sound effects were displayed.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#4515
Auto-translated
Please tell me how to make a specific hero neutral (not belonging to any player) and have it stay in place. And is this even possible?
User Avatar
#4516
Auto-translated
It can be done with a script. If there is an unused player on the map, the script needs to assign the hero the color of that player. Otherwise, it's impossible.

For example, on the map, all players are present except for the red one. We assign the hero to any of the seven available players. Then, using a script, we make him red. Since there is no red player, the game will make the hero neutral, but you can't directly make him neutral. It will result in an error.
Карты для героев 5

"Плата за любовь"
"Путь некроманта"
"Темные грани"
"Рок Гримхейма"
User Avatar
#4517
Auto-translated
Thank you very much! And if it's not too much trouble, could you write this script for me? I'm not very good with scripts:confused:
User Avatar
#4518
Auto-translated
The team itself in this case.

SetObjectOwner (hero, 1)

Where hero is the hero; if it's a script name, it should be in quotes, and 1 is the red player.

Added 4 minutes later
How to write the script itself (create a file for it), see elsewhere; I can't do it right away, I need the map itself.

A complete example for the hero Rolf:

SetObjectOwner ("Rolf", 2)

2 is the blue player.
Карты для героев 5

"Плата за любовь"
"Путь некроманта"
"Темные грани"
"Рок Гримхейма"
User Avatar
#4519
Auto-translated
The question isn't exactly about the editor. I'm trying to create my own creature based on the Zealot – I've changed the characteristics, changed the name, and haven't touched anything else, but every time I try to launch the game, it doesn't open. What could be causing this, and how can I fix it?
...И справедливость я несу
На острие меча.


Кампания "Искупление" - 15%



О кампании

"Искупление" - это мой амбициозный проект. Давняя мечта. С детства играя в героев, я восхищался персонажами и ландшафтами, сюжетом и стилем оригинальной трилогии, я мечтал привнести что-то свое в эту игру,  и наконец, более-менее освоив нелегкий труд картостроителя, взялся за воплощение мечты. Кампания расскажет о будущем выживших рыцарей Кровавой Стали, о пути, который они избрали, и о том, куда этот путь их приведет. К слову, мне нужен тестер-оценщик. Если хочешь принять участие в создании и есть определенный опыт, то - добро пожаловать!