Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to Gerter
User Avatar
2 years ago
Auto-translated
Gerter

Naturally, the upgrade progress, spells, and artifacts from the deceased hero will also need to be transferred to the hero from the reserve (of course, if this is logically necessary). Buildings, such as mines, have the type AdvMapBuilding, so they cannot be created.

Could it be possible to make the artifacts remain at the location of the character's "death"? Unfortunately, the skeleton is labeled as AdvMapBuilding, meaning it's impossible to spawn it at the hero's place of death to represent their corpse (and store their artifacts – the experience and spells themselves, as immaterial objects, are transferred with the hero). Can an object with the "treasure" tag (a chest) be spawned? So that, for example, a chest could store the character's artifacts (and they could be picked up). Another option that comes to mind is to take a static object (for example, some kind of purple crystal) and configure it with special properties (so that when a hero touches it, they get their items back) – but this is only if it works and doesn't involve too much hassle...

In any case, I'm currently working on creating the map – I'll get to writing the scripts later (hopefully, I'll at least implement the main ideas). I downloaded some localization files from an archive, but when I try to install them, it just shows a series of question marks, then the file closes, and I don't find any new files in the game folder where the installation path is specified. But in any case, I have English-language tutorials in the game folder, plus I've watched various videos online. For now, that's enough to get started (in any case, I still need to create the map).

P.S.: While messing around with tiles and objects, a strange dent appeared on the map (in the shape of an inverted prism). It cannot be removed by any terraforming, such as plateaus or any other method. Even if I create a hill, this dent remains in the hill. It cannot be removed by repainting or anything else. Has anyone encountered this?
User Avatar
2 years ago
Auto-translated
You can create artifacts using the CreateArtefact function. You can create a chest using CreateTreasure (although this function is not listed in the standard in-game list), attach a touch trigger to it, and distribute artifacts through the function of that trigger.
In reply to Gerter
User Avatar
2 years ago
Auto-translated
Gerter
You can create artifacts using the CreateArtefact function. You can create a chest using CreateTreasure (but this function is not listed in the standard in-game list), attach a touch trigger to it, and award artifacts through the function of that trigger.

And these hidden functions, like CreateTreasure, are they only missing from the official manuals, or from fan-made ones as well? I couldn't find it in Novik's guide. Where can I find documentation for such functions that weren't included in the manuals, in the game files or somewhere else?
In reply to IchGViji
User Avatar
2 years ago
Auto-translated
IchGViji, it's available in the script editor. Press Ctrl+Space, type "Create," and you'll see a list of possible "Create" commands.
In reply to Азгалор
User Avatar
2 years ago
Auto-translated
Azgalor
IchGViji, it's available in the script editor. Press Ctrl+Space, type Create, and you'll see a list of possible Create commands.

Thanks, I'll try it.
User Avatar
2 years ago
Auto-translated
Hello. I have a question regarding implementation, and there are several aspects to it. Is it possible to do it this way, and if so, what would be the most logical approach (i.e., if there are multiple options, which would require the least amount of work)? ----- 1) Respawning of Creatures/Resources and Rewards (artifacts/chests on the map). This should be a reusable function to update those Creatures and Rewards that have been collected/destroyed. In our case, once per in-game month. 2) Returning Heroes "Home." To avoid conflicts with the location reset, Heroes return to their "home" at the end of the month. The base on this map is impregnable. However, using a regular "portal to the city" probably won't work, because if the player has multiple heroes, they won't be able to move to the same city. The game seems to have "Regions" (areas for scripts), but I haven't worked with them yet. 3) Appearance or modification of objects on the map in a specific month, followed by an update from point "1." (I have more questions about the implementation here). 4) Quests - this is a broader topic. First, I still haven't figured out how to set them up, for example, in that "hut." 4-1) Is it possible to implement a Quest Randomizer (i.e., so that only one of the possible Quests is generated and offered)? 4-2) Updating/Resetting Quests. So that the same Object/Hut can offer quests again once a month (while if the old one is not completed, it fails, and a new one is created from point "4-1"). 4-3) Different types of quests. Regular, one-time quests that can only be completed by one player once during that month. And Reusable quests - simpler quests, such as "bring N resources/creatures," which can be completed an unlimited number of times until the Quest is updated. 4-4) All of this should work in Multiplayer, and the Quests should be the same for all players. In the case of one-time quests, they will fail if another player has already completed them. 5) About scripts in battles. First, is it possible to set up the battlefield itself and how it will look in a battle with a specific enemy or in a specific location? Second, how many interactive events can be added to this type of battle? (I think that the appearance of new enemies or the casting of existing Spells is far from the limit?) ---- --- -- *Thank you in advance to everyone who reads this and shares useful information! *The list may be supplemented later, but that will be later.
In reply to Azmadon
User Avatar
2 years ago
Auto-translated

Ismail,
1. Yes, it's possible. There's a ready-made creature spawner in the 3rd mission of the campaign for Freya in the Hammers of Fate expansion, called CreateRebels(). You can use it and modify it to suit your needs. I've already done this; together with Khottabych, we created a creature spawner that places creatures at specific points with random selection, and if those points are unoccupied. So, I think you can do something similar to respawn creatures, artifacts, and resources. However, the developers have already implemented a random generator for spawning creatures, which works like a "week of creatures," although, in my opinion, it's better to use a "custom" spawner for more flexible settings.

2. Create zones near the cities, each with 8 cells (or however many hero units a player can have), and cover them with triggers, such as Player_1_save_zone, Player_2_save_zone, etc. Block the triggers for all players except those for whom they are intended. Record the coordinates of all 8 cells from each trigger in a table or use if/elseif statements. In the same script that I mentioned in the first answer, in the same function, there is code that checks if the desired cell is occupied (look for mentions of badpos). You can use it to check which cell to place the heroes on if one of them is already occupied (otherwise, the heroes might stack on top of each other, which is not good), or you can choose to spawn in a random point within the trigger area, also setting the condition that the point should not already be occupied. Then, as usual, write a function that will teleport them to these points, checking if the points are occupied. We'll also immediately set a condition that the function will only work if a certain day has arrived, and then at the bottom of the script, we'll add a NewDayTrigger, which will try to run the function daily. If you want, you can add a random selection of available coordinates, but in your case, I think this is an unnecessary headache; just have them teleport to the points in the list.

3. As far as I remember, buildings and buffs cannot be teleported, so it's easier to use SetObjectEnabled to false on the desired objects until a certain time, triggering a message when touched, such as "We are closed until next month. All the worst to you, may your legions be overwhelmed by 1 peasant!", and then when the time comes, switch it to true, and the building will work as usual. And so on.

4.
1) Yes, of course. You can do this using if/elseif statements based on conditions, or by using random selection, but then it's better to name the quests the same, just numbering them, for example, quest1, quest2, etc. Then, count how many quests there are, randomly select one of them (setting the condition that the quest should not already be given or something like that), and that's it.
2) In the quests, set the CanUncomplete string to true, and you can reissue them as many times as you want. However, failed quests cannot be reissued, so if you need to reissue a quest but allow it to fail, it's better to just hide it, displaying a message with the sound of a failed quest that the quest has failed.
3) Well, yes. This can be done; it's a basic part of quests. In point 2), I've already given a hint about the possibility of issuing quests repeatedly as many times as you want, as long as they are not failed.
4) I don't know if this will work in Multiplayer; I don't use Multiplayer and don't know what works and how there. But again, failed quests cannot be reissued, so a possible way to bypass this system, I suggested in the previously mentioned point 2).

5. Everything you see in custom maps with combat scripts is the maximum that can be achieved there. Combat scripts are a rather limited part of the game; there isn't much room for creativity. Controlling creatures, heroes, making them play animations, casting spells, playing or winning, spawning creatures from one side or another, and displaying messages – these are all the things that can be done in a combat script.

In reply to Азгалор
User Avatar
2 years ago
Auto-translated
Azgalor

 


Thank you for the detailed response, we will test it!
2 years ago
Auto-translated
Good morning. I added my icon using TalkBoxForPlayers(GetPlayerFilter(i), Icons.."Podkreplenie128x128.(Texture).xdb#xpointer(/Texture)"

, but it doesn't display; it just shows up as white. I can't figure out why. At first, I thought I had the file path wrong, but that wasn't the issue. Then I thought maybe the file format (xdb) needs to be specified differently when adding an icon like this, compared to adding an icon with data, like sorrow. I tried just using xdb and xdb#xpointer, but neither worked. I also checked the xdb file settings, and they are correct. What could be the problem?
Attachments 2
2 files attached • Total size: 21.3 KB
User Avatar
2 years ago
Auto-translated
Hello! If we disregard the possibility of a corrupted Icon.xdb file, it seems you still have an incorrect path to the texture. Could you please provide the output of `print(Icons.."Podkreplenie.(Texture).xdb#xpointer(/Texture)")` and try specifying an absolute path?
In reply to }{0TT@6bI4
2 years ago
Auto-translated
}{0TT@6bI4
Hello! If we rule out the possibility of a corrupted Icon.xdb file, then you still have an incorrect path to the texture. Can you write what print(Icons.."Podkreplenie.(Texture).xdb#xpointer(/Texture)") outputs and try specifying an absolute path?

Did I understand correctly that you meant my icon file is corrupted, and not something else?
I don't know how much this proves that the file is not corrupted, but after I rewrote the path a couple of times, I tried placing the file as a character icon. As a 128x128 icon, it works. Regarding the path, I tried simply writing the full path, but it didn't work: "Maps/Multiplayer/JoyPatriot/Portret/Icons/Podkreplenie128x128.(Texture).xdb#xpointer(/Texture)"

And this is how the path is defined in Icons = GetMapDataPath()..'Portret/Icons/';

print(Icons.."Podkreplenie.(Texture).xdb#xpointer(/Texture)") -- thumbnail = "Maps/Multiplayer/JoyPatriot/Portret/Icons/Podkreplenie128x128.(Texture).xdb#xpointer(/Texture)"

Attachments 1
1 file attached • Total size: 4.7 KB
User Avatar
2 years ago
Auto-translated

Have you tried using a slash at the beginning? "/Maps/Multiplayer/..."

If that doesn't help either, I would appreciate it if you could send me the map in a private message so I can take a look.

In reply to }{0TT@6bI4
2 years ago
Auto-translated
}{0TT@6bI4

Did you try adding a slash at the beginning? "/Maps/Multiplayer/..."

If that doesn't help either, I'd appreciate it if you sent me the map in a private message so I can take a look.

You are right, it worked. I didn't even think of that... why does this path require an extra slash?
In reply to Shiroyasha2910
User Avatar
2 years ago
Auto-translated
Shiroyasha2910
You are right, it worked. I didn't even think about it... why does this specific path require an extra slash?

It's 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()

User Avatar
2 years ago
Auto-translated
Without a slash, a relative path is used; with a slash, an absolute path is used.

Statistics

Welcome our newest member: recijeb