Skip to content

Posts from Scripts for beginners. Auto-translated

4.5 (2 ratings)
User Avatar
#121
Auto-translated
lightName
'/path_to_file/file_name.xdb#xpointer(/AmbientLight)'
Standard lighting is located at /Lights/_(AmbientLight)/
You can place your own lighting in any location within the map archive.
In reply to Ment
User Avatar
#122
Auto-translated
Ment
That's how you get it from the resources... You need the path to the xdb file, with the addition of a pointer type, etc. Everything is analogous to the function that displays text, or the one that plays a video...
I understand, I found it... I entered it, but the script doesn't work somehow. I changed the script to SetAmbientLight - changes the lighting to a specified level on the map.
It turned out something like this:

SetAmbientLight (0, "/Lights/_(AmbientLight)/Tests/DirtArena01 (2).xdb", false#this is the sharpness of the lighting change#, 50#this is the change time, I don't quite understand what value is best here, maybe I should set it to nil?#);


Added 1 hour 16 minutes ago
Jack_of_shadows
'/path_to_file/file_name.xdb#xpointer(/AmbientLight)'
Standard lighting is located at /Lights/_(AmbientLight)/
You can put your own in an archive with the map in any location.
Okay, thanks. I already understand. I can navigate the data normally)).
Could you tell me where the models and textures for the artifact shop are located? I want to create and place recolored carts in different colors in the editor (like creating a market). I found this item in the data, but it only contains references to a path like this: models\Icons\Mercenary_Camp.tga
I don't know where to look for this models folder. The standard folder in the data (_Models) doesn't work
[url=Таверна (фулдилка) - заходите.


User Avatar
#123
Auto-translated
ggroy, I haven't checked all the options, so your method might work, but as far as I know and have used myself, the SetAmbientLight and SetCombatLight functions accept lighting names in different formats. For SetCombatLight, I mentioned above – the path in the resources. For SetAmbientLight, I haven't tested how to work with standard ones, but for your own lighting files, you need to connect it in the settings tree in the editor, assign a name, and then use that name in the function.
50#this is the change time, I don't quite understand what value is best to set here; maybe set it to nil?
nil might cause a script error; it's better to use 0. Based on my subjective assessment, I think this time is in seconds, so it's better to set it to 1-2.
Could you tell me where the models and textures for the artifact shop are located?
I haven't worked with textures, but you might need to start with the file _(Model)\Buildings\MercenaryCamp.(Model).xdb It contains the following: < Materials>
< Item href="MercenaryCamp-Merc_camp_terrain.2.(Material).xdb#xpointer(/Material)"/>
< Item href="MercenaryCamp-lambert2.4.(Material).xdb#xpointer(/Material)"/>
< Item href="/_(Material)/dev/Test/Malkovsky/CragTerrain.(Material).xdb#xpointer(/Material)"/>
< /Materials>
So, the object contains 3 textures. For the first one, the specified file contains a link to the texture itself: < Texture href="/Textures/auto-imported_______320/TESTS/Buildings/MercenaryCamp/Mercenary_camp_terrain.tga.xdb#xpointer(/Texture)"/> And that's where the image is located: Mercenary_camp.tga.dds And only after finding it did I realize that this wasn't the artifact shop, but the mercenary camp. The shop is located nearby: \Textures\auto-imported_______320\Buildings\BlackMarket\black_market.tga.dds
In reply to Jack_of_shadows
User Avatar
#124
Auto-translated
For your lighting files, you need to connect it in the settings tree within the editor, assign a name, and then use that name in the function.
Please explain how to assign a script name in the settings tree. I can't seem to figure it out.

Also, do you know of any tutorials on adding a new file to the map editor? Or at least tell me what program to use to open and edit files from the editor with the extension .(AdvMapObjectLink)?

And by the way... thank you very much for the tip about the building models. It was a great help! :smile26:
[url=Таверна (фулдилка) - заходите.


User Avatar
#125
Auto-translated
ggroy, I would recommend using the forum search by function name; a lot has already been discussed. For example, here:
/topic/at/538808/
/topic/at/966501/
Or at least tell me what to use to open and edit editor files with the extension .AdvMapObjectLink.
Any text editor will do, for example, Notepad++.
In reply to Jack_of_shadows
User Avatar
#127
Auto-translated
Jack_of_shadows
ggroy, I would recommend using the forum search by function name; a lot has already been discussed. For example:
/topic/at/538808/
/topic/at/966501/
Hooray! After many hours, I finally figured out this lighting!
Thank you, friend!
any text editor, for example, notepad++.]
No, it doesn't work with a text editor, nor does it work with Notepad, or as an archive.
You need some kind of program(( but which one? It is located in the Editor folder.

By the way, how long did it take you to create the "Path of the Hero" map? The map is simply amazing. I played through it myself and am learning scripting from it.)
If you can, tell me if there are a lot of libraries involved that scripts just won't work without?

And I also wanted to ask why the RemoveObject (nameObject) script isn't working for me.
Also, it blocks all subsequent commands within the same function block.
I specifically tested it on different types of objects; neither resources, buildings, nor landscape objects are removed.

Added after 3 hours 2 minutes
Ment
ggroy, don't ignore these characters; you don't have them. Jack does.
I initially thought it was because of them. As it turned out... they didn't play a special role.
[url=Таверна (фулдилка) - заходите.


User Avatar
#128
Auto-translated
By the way, this is in the Editor folder.
I only see *.xdb files in the Editor folder, and they are text files. In Total Commander, if pressing F3 opens something meaningful (text or an image), it means that the file can be edited. Most files in data.pak are like that.
How long did it take you to create the "Path of the Hero" map?
Almost two years, considering that I already had some experience with scripts. I learned it bit by bit over time, starting back when the map editor was first released.
I see that a lot of libraries are used, without which the scripts simply won't work?
I wrote all of this myself; it's just divided into many files. After all, a library is essentially a set of code snippets that are repeated more than once in the program's text and are therefore placed in separate functions for efficiency. (The exception is the lualib.lua library by RedHeavenHero; I used its random number generation in combat mode).
Why doesn't the RemoveObject(nameObject) script work for me?
In the editor, each object has a property called IsRemovable; it needs to be set to true to allow the object to be deleted. And I'm not sure if it's possible to delete buildings.
In reply to Jack_of_shadows
User Avatar
#129
Auto-translated
Jack_of_shadows
I only see *.xdb files in the Editor folder, and they are text files. In Total Commander, if pressing F3 opens something meaningful (text or an image), it means that the file can be edited. Most files in data.pak are like that.
No... I'm not talking about data.pak, but about the Editor folder in the game directory. I'll correct myself... the files I want to open have no format at all. I think that if I open them, I can implement one interesting idea)). Directory of those files:Heroes..\Editor\ObjectLink\MapObject\_(AdvMapObjectLink)[/I]
almost two years, considering that I already had some experience with scripts. And I learned little by little at different times, even back when the map editor was first released.

All of this was written by me, just broken down into many files. After all, a library is essentially a set of code snippets that are repeated in the program's text more than once, and for efficiency, they are placed in separate functions. (exception - the lualib.lua library by RedHeavenHero, from which I used random number generation in combat mode).
Impressive:eek: :) Why do you only have one "dove" yet... I don't know((
in the editor, each object has a property called IsRemovable, it needs to be set to true to allow deletion. And I'm not sure if it's possible to delete buildings.
THANKS A LOT. You helped me a lot. I finally managed to do it:)
[url=Таверна (фулдилка) - заходите.


User Avatar
#130
Auto-translated
Heroes..\Editor\ObjectLink\MapObject\_(AdvMapObjec tLink)

I have different folder names, but the structure is similar. They are binary files in Nival's proprietary format, so there's not much you can do about it. I think this is a topic for discussion in the Modding section.
In reply to Jack_of_shadows
User Avatar
#131
Auto-translated
Jack_of_shadows
My folder names are different, but the structure is similar. They are binary files in Nival's proprietary format, so there's not much you can do about it. I think this is a topic for discussion in the Modding section.
I was looking for similar topics... but I didn't find anything. Maybe we can create something similar, either you or me?

P.S. Ment, could you add a "Modding" section to the quick search in the Heroes 5 section? It's hard to find that section. If, of course, you have permission to modify the site...
[url=Таверна (фулдилка) - заходите.


User Avatar
#132
Auto-translated
Could you create something similar for me or for you?
I don't really use mods; I'm happy with the original game.
User Avatar
#133
Auto-translated
Guys, sorry for being off-topic. But I really need to ask something. I don't have the objects panel. Can anyone help?
User Avatar
#134
Auto-translated
I don't have the objects panel.
It's called the Tool panel; you can enable it in the menu or the top panel.