Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
4 years ago
Auto-translated
After creating the xdb file in the editor, you need to right-click on it and press Export. Then, a file should be generated in the bin folder within the Sounds folder.

Alternatively, look at the uid in the properties of the xdb file, copy it, then place the sound file in the bin/Sounds/ folder and rename the file – remove the .ogg extension and leave only the copied uid.
In reply to }{0TT@6bI4
4 years ago
Auto-translated
Wow, thanks a lot, Hottabych. I will definitely give it a try.
User Avatar
4 years ago
Auto-translated
Hi! So, I've started working on the combat script again. I want to create two fights with two heroes, but I'm having trouble figuring out how to optimize it. The thing is, I don't have a plan for these heroes to be real "boss" characters that the player only attacks. They're more like regular bots with a large army, running around and consuming everything on the map. I want it so that when my hero attacks them, or they attack my hero, it triggers the combat script. Right now, I'm only thinking of writing the entire combat sequence twice, once for when the player attacks and once for when they defend, but maybe there's a way to simplify this so that the game only needs to check once who attacked whom and then use a variable for the correct hero in all functions (like UnitCastGlobalSpell)?
In reply to Азгалор
User Avatar
4 years ago
Auto-translated
Azgalor
Hello! So, I've started working on the combat script again. I want to create two battles with two heroes, but I'm already struggling with how to optimize it. The thing is, I don't have a clear idea yet of these heroes being real "bosses" that the player only attacks. For now, they're more like regular bots with large armies, roaming around and consuming everything on the map. I want it so that when my hero attacks them, or they attack my hero, it triggers the combat script. Right now, I'm just thinking of writing the entire combat twice, once for when the player attacks and once for when they defend, but maybe there's a way to simplify this so that the game only needs to track who attacked whom once, and then use that hero's variable in all functions (like UnitCastGlobalSpell)?
The best optimization option is to only implement the scenario where you attack. How you do it is up to you. Overall, I haven't worked with this myself, but if you attach a trigger to your hero that activates on contact, you can "disable" the standard attack and, using this trigger, activate the interaction and MakeHeroInterractWithObject (or something like that), essentially making your hero attack the enemy. Then you'll only need one script.
I might be wrong about disabling the standard attack, but you can experiment with SetObjectEnabled and so on. There are many workarounds you can come up with. For example, you could create a loop that checks the distance between your heroes, and if the distance is 2 tiles, your hero will attack the enemy using this script... (but I wouldn't recommend this option :))
In reply to Jewily
User Avatar
4 years ago
Auto-translated
Jewily
The best optimization option is to implement it only when you initiate the attack. How you do it is up to you. In general, I haven't done this myself, but if you attach a trigger to your hero that activates on touch, you can "disable" the standard attack and, using this trigger, enable interaction and `MakeHeroInterractWithObject` (or something like that), effectively making the hero attack the enemy. Then you'll only need one script.
I might be wrong about disabling the standard attack, but you can experiment with `SetObjectEnabled` and so on. There are many workarounds you can come up with. For example, you could create a loop that checks the distance between your heroes, and if the distance is 2 tiles, your hero will attack the enemy using this script... (but I wouldn't recommend this option )
Yes, it's a pity that you can't pass heroes as arguments. Unfortunately, nothing I tried in the combat script itself worked. I tested it on the `playAnimation` function and constantly received the error "Hero "hero" doesn't exist," so I came to the conclusion that the combat script is essentially a separate script, so you can load it up a bit. Therefore, I will define the fight twice, depending on which side the heroes are on. However, thank you for your answer and recommendation
In reply to Азгалор
User Avatar
4 years ago
Auto-translated
Azgalor
Yeah, it's a pity that you can't pass heroes as arguments. Unfortunately, nothing I tried in the combat script itself worked; I tested it on the playAnimation function and constantly received the error "Hero "hero" doesn't exist," so I came to the conclusion that the combat script is essentially a separate script, so you can load it a bit. Therefore, I'll write the fight twice, depending on which side the heroes are on. However, thank you for your answer and recommendation
Theoretically, I think your question can be solved, and solved correctly. However, I haven't tried writing combat scripts myself, so I might not understand the nuances of the mechanics, so I can't help. And since Khottabych hasn't responded, it probably means it's either a hassle or it's not possiblesmile04
User Avatar
4 years ago
Auto-translated
What prevents checking the heroes of both sides in the battle start hook and saving the hero's name and faction into a variable?
4 years ago
Auto-translated
Help, kind people, especially Hottabych (if you're not on vacation). I have a question about textures: did I understand correctly that when I change them using the table in this method:
}{0TT@6bI4
It's easier to modify textures in the editor: Configure the advanced map editor and select the Texture table. When you open the editor, make sure the Resource => Close MOD button is grayed out (if not, click it). The Texture table will contain a list of all textures by folder; you can open folders and textures by double-clicking. When you open a texture, it will be fully displayed in the black space on the right. In the texture properties (if there are no properties, click View => Selection Properties Window), find SrcFile and click the three dots. Select the desired file from the Complete folder of your game. Of course, before you start, you need to create a Complete folder in the game folder and put the new texture in tga format into it. After you select the texture in SrcFile, right-click on the texture file in the properties tree => Export. That's it, the texture is done.
- the editor simply automatically does the same thing that I used to do manually, when I myself moved them around in the folders in the Data folder? And my second question: What does it mean to "put textures into a map"? How do I put them there? They are displayed for me, but I assume they should be somewhere in my map, and not in the Data folder, so that they are displayed for everyone. Should I unpack the map, create some folder there, put the textures there, and repack it?
User Avatar
4 years ago
Auto-translated
Yes, that is exactly what the editor does. To add a texture to a map, create a directory hierarchy in the map archive (if it doesn't exist) and place the texture file there.
In reply to Марта
4 years ago
Auto-translated
Sorry, but I still don't understand about the textures. Let's say I take a succubus model for a new heroine. I draw my own textures for her. How do I now specify a separate model and attach my textures to this model? I don't want all the succubi on the map to look like my succubus heroine. I didn't even understand how the texture is linked to the model – there is no indication of the texture in the (Model).xdb files. And moreover, I did not understand how to specify my own model (that is, conditionally my own, taken from the unpacked game) so that these textures are attached to it. If I specify a standard model for the hero, then the standard textures will automatically be added to this model. But if I replace the textures, they will change for all creatures with this model. I don't know if I explained myself clearly; sorry if anything is unclear. Here: /topic/14902/ there is a mod that changes the models of heroes. Apparently, I need to do something similar, in addition to the map? But how do you create h5u files at all? Or is it not necessary to do this to get a hero with a unique appearance on the map?
User Avatar
4 years ago
Auto-translated
h5u is an archive format. That is, you can take any zip file and rename it to the h5u format; it's not complicated. You have a new texture. Go to the hero file, look at the path to the .Model file. In the properties of this file, look at the paths to the materials in the materials folder. You need to create copies of the files for this model and materials. Open the mod archive and make copies of the specified files. I hope I don't need to explain how to duplicate files. Give the new copies a clear name or simply add a "2" at the end. In the map editor, for this hero, in the Character properties, enter the path to the copy of the .Model file (Model2). If the path was inserted and remains in the line, it means you entered everything correctly; click the three dots, and the properties of the model file will open. In the list of materials, enter the path to the copies of the material files. Then, for each material, click the three dots, and the material properties will open. In the Texture field, click New, enter the name of the new texture; a texture properties window will open. Set Texture Type to DXT3, ConvertType to CONVERT_ORDINARY, REGULAR, CLAP. In SrcFile, select the texture in tga format from the Complete folder of your game (if there is no folder, create it and put the texture there). Then, set NMips to 2. On the name of the texture file in the file tree (on the left in the properties window), right-click => Export. When the export is finished, click OK everywhere. Repeat the operation with the remaining materials if there are more than one.
In reply to }{0TT@6bI4
4 years ago
Auto-translated
Wow, it's quite complicated. Thank you so much, I'll give it a try. I just figured out that the model is linked to the texture through the Material, so I'll try to specify it.
4 years ago
Auto-translated

function dolmenF()
  MessageBox("/Maps/Multiplayer/JoyPatriot/Tekst/dolmens.txt");
     Trigger(OBJECT_TOUCH_TRIGGER, "dolmen1", nil);
end;

SetObjectEnabled("dolmen1", false);

Trigger(OBJECT_TOUCH_TRIGGER, "dolmen1", "dolmenF");

 

I've started learning scripts and wrote a fairly simple script, but it doesn't work. I've checked it several times; the object name is correct, and the path to the text is also correct. The object is not disabled; it's still working, and the specified text doesn't indicate what's wrong. I don't understand.

In reply to Shiroyasha2910
User Avatar
4 years ago
Auto-translated
Shiroyasha2910

function dolmenF ()
  MessageBox ("/Maps/Multiplayer/JoyPatriot/Tekst/dolmens.txt");
     Trigger(OBJECT_TOUCH_TRIGGER, "dolmen1", nil);
end;

SetObjectEnabled("dolmen1",false);

Trigger(OBJECT_TOUCH_TRIGGER, "dolmen1", "dolmenF");

 

I've started learning scripts and wrote a fairly simple script, but it doesn't work. I've checked it several times, the object name is correct, and the path to the text is also correct. The object is not disabled; it still works, and the specified text doesn't show what's wrong. I don't understand.

The text path shouldn't contain a / before Maps?

But in any case, always check what the console says.

Statistics

Welcome our newest member: recijeb