Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to Азгалор
2 years ago
Auto-translated
Azgalor

He is needed everywhere. In all functions where you need to specify a path to a file, you need to put a slash first:

"/Effects/_(Effect)..."
"/Characters/..."
"/Sounds/_(Sound)/..."
"/DialogScenes/..."
"/Maps/SingleMissions/..."

Everywhere, except for GetMapDataPath()


I wrote before that GetMapDataPath() also causes a white screen. But if you specify the absolute path in the usual way, it works.
2 years ago
Auto-translated
Good night, is there a way to restore dark energy using scripts? Or is there nothing else besides counting it with GetPlayerNecroEnergy?
User Avatar
2 years ago
Auto-translated
Hello everyone! I have a question about the PlayObjectAnimation function. When used, the objects end up in awkward poses. This happens with Necropolis creatures. I read on the forum that this is because the animation is not linked to the creature. I would like to know how to fix this issue. Perhaps there is a way to specify the path to the animation file?
Here is an example of the code:
PlayObjectAnimation("sklep5", "death", ONESHOT_STILL)
PlayObjectAnimation("archlich", "cast", ONESHOT);
In reply to Madara_X
User Avatar
2 years ago
Auto-translated
Madara_X
Hello everyone! I have a question about the PlayObjectAnimation function. When used, the objects end up in awkward poses. This happens with Necropolis creatures. I read on the forum that this is because the animation is not linked to the creature. I would like to know how to fix this issue. Perhaps there is a way to specify the path to the animation file?
Here is an example of the code:
PlayObjectAnimation("sklep5", "death", ONESHOT_STILL)
PlayObjectAnimation("archlich", "cast", ONESHOT);
Most creatures and heroes have two types of animations: arena animations (e.g., with the "-arena" suffix) and adventure map animations (e.g., with the "-adv" suffix). If you want a creature to use arena animations on the map, you need to edit the config file in MapObjects/Race of that creature so that it uses the arena model and animations both in the arena and on the adventure map. To do this, let's take Vampires from Necropolis as an example. Open the file Vampire.(AdvMapMonsterShared).xdb in MapObjects/Necropolis. Here, we are only interested in the first two lines, Model and AnimSet. As you can see, the model is LOD and the animation is -adv, which means the creature has a low-quality model and only one animation specifically for the map - idle. You need to copy the file to your map, place it in the same path, and in the first line, remove the _LOD suffix, and in the second line, replace _LOD-adv with -arena. It should look like this between the quotes:
Model href="/_(Model)/Creatures/Necropolis/Vampire.(Model).xdb#xpointer(/Model)"
AnimSet href="/_(AnimSet)/Creatures/Necropolis/Vampire-arena.(AnimSet).xdb#xpointer(/AnimSet)"
User Avatar
2 years ago
Auto-translated
Azgalor, thank you so much! You really helped me out! I wanted to ask about StartCombat() and SiegeTown(). Am I correct in understanding that I cannot specify additional parameters, such as the enemy hero and their army, in the SiegeTown() function? I'm thinking of implementing the battle using StartCombat() and setting the siege arena. However, I can't find the file. I'm searching in the path /Arenas/CombatArena/Stronghold_arena, but I only see textures, materials, and arena objects there. So, my question is: where should I look for the arena file (what should its extension be?), and is it possible to implement SiegeTown() with additional parameters?
In reply to Madara_X
User Avatar
2 years ago
Auto-translated
Madara_X
Azgalor, thank you so much! You really helped me out! I wanted to ask about StartCombat() and SiegeTown(). Am I correct in understanding that I cannot pass additional parameters, such as the enemy hero and their army, to the SiegeTown() function? I'm thinking of implementing the battle using StartCombat() and specifying a siege arena. I just can't find the file. Is it possible to implement SiegeTown() with additional parameters?
You're welcome, I was glad to help. Regarding SiegeTown() - it only accepts 3 arguments, namely: heroName (the hero who will lay siege), townName (the town being besieged), arenaName (a custom arena for the siege. This argument can be left blank, in which case the siege will take place on the town's standard arena, i.e., grass for humans and elves, lava for demons, etc.). It is filled in like this: SiegeTown("Godric", "/Maps/Scenario/C6M5/Ur-Hekal.xdb#xpointer(/AdvMapTown)",
'/Scenes/CombatArenas/Boss_c6m5_Biara.xdb#xpointer(/AdventureFlybyScene)'). This is a snippet of code from the final mission of the original Zehir Campaign, where you need to defeat Biara and the Master. You can take a look at how it all works there; it contains scripts for the siege of the city (battles with Biara) and for battles on a custom arena (with a shield and catapult) with the Master.
Regarding using StartCombat as a siege - I looked through the files and understand that the siege through this function is only implemented for the battle with the Master, for which a special combat arena folder has been created. It is located at Arenas/CombatArena/FinalCombat. So, if you need to create a unique siege, you can see how it is implemented on that arena. However, just below, I will explain how to find links to siege maps, and you can try using them for StartCombat(), but if you just need a scripted siege, it is easier to use SiegeTown(). You can place the city itself (if it is not planned to be present with the desired opponent) somewhere outside the visible area, and during the battle, at the initial stage, simply spawn units for the opponent, or spawn them even before the battle.
Madara_X
I'm searching along the path /Arenas/CombatArena/Stronghold_arena, but I only see textures, materials, and objects of the arena. Hence the question: where should I look for the arena file (what should its extension be?)
Correct, those folders contain the arena models and their placement on it, i.e., towers, walls, and gates. In general, links to siege arenas are specified in the configuration files of the cities themselves. That is, you place (or open in the game resources and view the file directly there, but it is probably more convenient through Shared, because there is a direct path to the file) the city, go to its Shared, and you will see the Combat line, which contains a link to the city's combat arena. This link leads to a file that loads the arena map itself and the objects (towers, walls, and gates) onto it.
In reply to Азгалор
User Avatar
2 years ago
Auto-translated
Thanks, I'll try it now.
upd.
The deeper you go into the forest, the thicker the partisans... It gives a script error: "Hero is not reserved" (for an enemy hero). Although the hero is on the map, other scripts with him work. Is it even possible to start a battle with a hero on the map?
P.S. I also tried adding him to the reserve through Player Properties, but it doesn't work.
In reply to Madara_X
User Avatar
2 years ago
Auto-translated
Madara_X
Thanks, I'll try it now!
update.
The deeper you go into the forest, the thicker the partisans... It gives a script error: Hero is not reserved (for the enemy hero). Although the hero is on the map, other scripts with him work. Is it even possible to start a battle with a hero on the map?
P.S. I also tried adding him to the reserve through Player Properties, but it doesn't work.

To work with the DeployReserveHero() function, you need to add the hero to the player's reserve and ensure that this hero is not on the map.
In reply to Азгалор
User Avatar
2 years ago
Auto-translated
Azgalor
To work with the DeployReserveHero() function, you need to add a hero to a player's reserve and ensure that this hero is not on the map.
Through experimentation, I found that I can summon a hero from the reserve for StartCombat(), but he is neutral, even if I assign him an allegiance in the editor. However, I want to initiate a battle with a specific character who is already on the map, but the function refuses to recognize him.

I've seen this script implementation in other games. Perhaps you could suggest how to extract a map from a campaign? Then I could delve into the code myself and share the solution if you're interested.
In reply to Madara_X
User Avatar
2 years ago
Auto-translated
Madara_X
Maybe you can suggest how to extract a map from a campaign?
You create a new map, open the resources of the campaign map you need, and export them to the root folder of the new map. Close the map, open it again, and your map becomes a map from the campaign.
User Avatar
2 years ago
Auto-translated
I looked at how RedHeavenHero implemented it (mission 2) – in the end, it turned out to be much simpler than I thought. There, the garrison is simply assigned a city type. No complex scripts. I'll try to implement it now.

Added 40 minutes later
It turns out that the game consistently ignores the TownType parameter. I even looked in the Shared section of the garrison; there's an interesting parameter called TerrainAlign, which also doesn't seem to have any effect...

Added 1 hour 20 minutes later
Solution for future generations: you place an Outpost (for which city modifiers work), and then replace its model through Shared with what you need.
User Avatar
2 years ago
Auto-translated
Hello! Do I understand correctly that TalkBoxForPlayers() malfunctions when trying to pass variables to it? I tried passing a variable into the dialogue text. In my case, the TBFP has only 2 answer options, but with the passed variable, the options break, and 2 more options appear: the first (third) is a copy of the dialogue text, and the second (fourth) is the variable itself. Is there no way to bypass this, right?

update: If used in the answer options, it works normally, but for some reason, if used in the dialogue text, it breaks. Strange...
User Avatar
2 years ago
Auto-translated
Azgalor, it should definitely work.
In reply to Jack_of_shadows
User Avatar
2 years ago
Auto-translated
Jack_of_shadows
Azgalor, it should definitely work.
Hmm, here's how it looks:
ClickThe first screenshot shows how the answer options should look, and the second shows how it works after adding the variable to the argument with the text of the dialogue itself.

Perhaps the problem is in the code itself? Here's what I have:

TalkBoxForPlayers(PLAYER_1, "/Characters/Heroes/Windranger/Icons/Teacher.(Texture).xdb#xpointer(/Texture)", "/TalkBoxes/InfoTeacher.txt", {"/TalkBoxes/Job_2/dialog_job_2_v2_desc.txt"; job_art=GetArtefactName(job_art)}, nil, "TalkBoxesWithTeacherJobDialog2Answers", 1, "/TalkBoxes/dialog_name.txt", nil, 0, "/TalkBoxes/Job_2/dialog_job_2_agree_" .. textvar .. ".txt", "/TalkBoxes/Job_2/dialog_job_2_refuse_" .. textvar2 .. ".txt" )
User Avatar
2 years ago
Auto-translated
Azgalor spent a long time thinking about it; in this case, it is necessary to always pass all 5 answer options. If only 2 are used, then add nil, nil, nil after them.

Statistics

Welcome our newest member: recijeb