Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
Auto-translated
32MeTpa, you can initiate a battle directly with a hero from the reserve using StartCombat, without first calling DeployReserveHero. And if you need the hero to appear on the map, you can use MakeHeroInteractWithObject instead of StartCombat.
In reply to Jack_of_shadows
User Avatar
Auto-translated
Jack_of_shadows
32MeTpa, you can initiate a battle directly with a hero from the reserve using StartCombat, without first calling DeployReserveHero. And if you need the hero to appear on the map, then instead of StartCombat, you can call MakeHeroInteractWithObject.
Yes, that's exactly what I need – for the hero to appear before the battle. Is there a way to start a battle on the desired arena without using StartCombat?
User Avatar
Auto-translated
32MeTpa, probably not. You could try this dirty hack: place one hero on the map, disable its AI, and when interacting with it, trigger a battle with another hero from the reserve using StartCombat. This is if the battle with a hero in the reserve works as expected, preserving the player's flag.
In reply to 32MeTpa
User Avatar
Auto-translated
32MeTpa
Is there a way to start a battle on a specific arena without using StartCombat?
Through SiegeTown(hero, city, arena).

Added 8 minutes later
The second option is to use the console command arena_override, which forces the game to conduct all non-siege battles exclusively on the specified arena.
To enable:
consoleCmd('arena_override path_to_arena')
To return to normal arenas, which depend on the type of terrain:
consoleCmd('arena_override 0')
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
Auto-translated
Thank you, I will try.
Auto-translated
Hello. I'm creating a map for multiplayer, and the idea is that after 2-2.5 months, the player's hero will be teleported to a portal leading to the center of the map, where a battle with the other players will take place. The problem is that I need to finish the map in the next few days, and I don't know anything about scripting. I'm asking for help. Is there a script that can create this scenario?
In reply to Sarcastrophe.
Auto-translated
Sarcastrophe.
Hello. I'm creating a map for multiplayer, and the idea is that after 2-2.5 months, the player's hero is transported to a portal leading to the center of the map, where a battle with the other players will take place. The problem is that the map needs to be finished in the next few days, and I don't know anything about scripting :с. I'm asking for help. Is there a script that can create this scenario?
Something similar exists in Heroes 5 - the first mission for Agrael (Dark Elf campaign), where after 4 weeks, the player has to face opponents in an arena in the center of the dungeon, which is also accessed through a portal. Try looking at the script for that map.
In reply to Sarcastrophe.
Auto-translated
Sarcastrophe.
Hello. I'm creating a map for multiplayer, and the idea is that after 2-2.5 months, the player's hero will be teleported to a portal leading to the center of the map, where a battle with the other players will take place. The problem is that the map needs to be finished in the next few days, and I don't know anything about scripting :с. I'm asking for help. Is there a script that can create this scenario?
How many players are on the map?
Auto-translated
sergejez, there are 6 players on the map.
Dimas82, yes, I know, the idea came from there. The problem is that campaign maps, apparently, cannot be unpacked, unlike regular standard maps. They use some other file packing format...
User Avatar
Auto-translated
Is there a script that would allow different creatures to be generated in a town when buildings are constructed? For example, when you build peasant huts, wolves appear instead of peasants.
Auto-translated
Could you please tell me how to make creatures on the map attack and die, just like in the 3rd mission for Goth or the 1st mission for Frida?

Added after 12 hours and 26 minutes
How do I create an attack animation for creatures on the map in the editor?

Added after 6 hours and 22 minutes
How can I make it so that, for example, peasants turn into demons in the map editor?
User Avatar
Auto-translated
How to create an animation for creature attacks on the map, in the editor?
PlayObjectAnimation('SCRIPTED_NAME_OF_THE_CREATURE', 'ANIMATION_NAME', TYPE);
for example:
PlayObjectAnimation('npc_1', 'attack00', ONESHOT);
There are animations for attacks and deaths, but not for all creatures. To find out which specific animations a creature has, place it on the map, select it, click in the property tree on Shared, and in the creature's parameter table, one of the first rows will contain the word Animation; click on it, and it will be clear from there.
How to make it in the map editor so that, for example, peasants turn into demons?
Remove the peasants, place the demons in the same spot. You can play some effect on top of that. The following functions will be useful:
RemoveObject('SCRIPTED_NAME_OF_THE_CREATURE');
CreateMonster('NEW_SCRIPTED_NAME_OF_THE_CREATURE', IDENTIFIER, QUANTITY, COORDINATES, ...);
PlayVisualEffect('EFFECT_NAME', ...)
There are many examples of how to use these functions on many maps.
Auto-translated
Could you please tell me why the dialogue scene isn't loading? dir=GetMapDataPath() StartDialogScene(dir.."/dialogi/dialog1/DialogScenes/dialog/dialog/DialogScene.xdb#xpointer(/DialogScene)");
User Avatar
Auto-translated
Cirillo, I'm not sure, but it's possible that GetMapDataPath() returns the name with a slash at the end, so the subsequent path should start directly with the name of the subdirectory, without the first slash. And also double-check the rest of the path, remembering that GetMapDataPath() points to the Maps/SingleMissions/MAP_NAME/ directory.

Statistics

Welcome our newest member: Emil