Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to 32MeTpa
User Avatar
14 years ago
Auto-translated
PlayObjectAnimation does not necessarily need to be enclosed in a function.
If you simply write PlayObjectAnimation("a", "attack00", IDLE);
, the monster with the script name "a" will continuously play the attack animation, starting right from the map's launch. A function is needed so that it only starts playing the animation at a specific moment.
In reply to Олегарх
User Avatar
14 years ago
Auto-translated
Who can tell me what script is needed so that when you create any hero without a town, that hero doesn't lose after a week because they haven't captured a town for themselves? Best regards, and thank you in advance.
In reply to Рыцарь Бездны
User Avatar
14 years ago
Auto-translated
Knight of the Abyss
Can anyone tell me what script is needed so that when you create any hero without a town, this hero doesn't lose after a week because they haven't captured a town for themselves? With respect, and thank you in advance.
No script is needed. This can be disabled in the editor itself.
In the properties tree. The manual will tell you where to find it. If not, I'll be home and maybe I'll post a screenshot.
In reply to Dyrman
User Avatar
14 years ago
Auto-translated
Dyrman
No script is needed. This can be disabled directly in the editor.
In the properties tree. The manual will tell you where to find it. If not, I'll be home and maybe I'll post a screenshot.
Dear Dyrman, thank you again for your answer, and please post a screenshot, as my manual is in English, and I haven't found a Russian version yet.
User Avatar
14 years ago
Auto-translated
Here's a link to an editor in Russian. I'm not sure how many times I've posted the link; maybe I should add it to my signature? :) /files/10086/> And here's a screenshot: false - cancels the condition; you also need to specify which player the condition is being canceled for, and under certain conditions, you will have to change this parameter (it's easy to identify by its identical name - DieInWeekWithoutTowns) and further down the tree in PlayerSpecific. The most reliable thing to do is to change it everywhere at once! 0-1 for player 1, 1-2 for player 2, and so on. Note: The question and discussion can be moved to the neighboring topic, as this topic is not about scripts. Off-topic: 777 message :)
Attachments 1
1 file attached • Total size: 53.8 KB
User Avatar
14 years ago
Auto-translated
Is it possible to use scripts to limit the number of unit upgrade options available in a town to only one, instead of two?
In reply to Sanctuary
User Avatar
14 years ago
Auto-translated
Sanctuary
Is it possible to use scripts to limit the number of unit upgrades available in a town to only one, instead of two?
This can also be done through the editor. This question has already been raised on this forum; you can use the search function.
In reply to Dyrman
User Avatar
14 years ago
Auto-translated
I have another question: how do I create a quest that requires capturing a specific town within a specified time frame (e.g., 2 weeks)? If possible, please provide an example script. Thank you in advance.
In reply to Рыцарь Бездны
User Avatar
14 years ago
Auto-translated
Knight of the Abyss
I have another question: how do I create a quest to "capture a specific town within a specified time (e.g., 2 weeks)"? If possible, please provide an example of such a script. Thank you in advance.

This is also not done through scripts, but through the map properties tree. How to do this is explained in the manual, for example, in this one: http://www.heroesworld.ru/files/data/409/465/Heroes5_Manual_ru.zip
In reply to 32MeTpa
User Avatar
14 years ago
Auto-translated
32MeTpa
This is also not done through scripts, but through the map's property tree. How to do this is described in the manual, for example, in this one: http://www.heroesworld.ru/files/data/409/465/Heroes5_Manual_ru.zip
It's probably easier to do it through the editor, but it can also be done through scripts. To be able to do it through scripts, you need to at least understand the basics and do something simple. Manuals are available. There is also a journal: "Heroes' Herald"
http://www.woggrad.ru/ru/vestnik-heroes.html
Here is such a journal. In the latest issues, it describes how to create a simple quest, etc.
In reply to Dyrman
User Avatar
14 years ago
Auto-translated
Dyrman
It's probably easier to do it through the editor, but it can also be done through scripts. And to be able to do it through scripts, you need to at least understand the basics and do something simple. There are manuals available. There is also a journal: "Heroes' Herald".
http://www.woggrad.ru/ru/vestnik-heroes.html
Here is such a journal. In the latest issues, it describes how to create a simple quest, etc.
I can do simple quests myself; I wanted to try something a little more complex, but it seems it's still too early. Thanks for the advice, I'll keep it in mind.
In reply to Рыцарь Бездны
User Avatar
14 years ago
Auto-translated
Knight of the Abyss
I can handle simple tasks myself; I wanted to try something a bit more challenging, but I guess it's still too early. Thanks for the advice, I'll keep it in mind.
Well, this isn't complicated either. But, as I said before, it's easier to do through the editor. In the Manual, the link to which was provided in the previous post, it's not difficult to understand.
In short, if using scripts, since the topic allows:
- You enable the quest based on a specific event and store the day in a variable;
- On the event-trigger for a new day after a certain period, you set the quest to fail and the necessary condition you want;
- On the trigger for changing the ownership of an object, you add code to execute the quest.
Nothing complicated.
In reply to Dyrman
User Avatar
14 years ago
Auto-translated
Dyrman
Well, that's not complicated either. But, I repeat, it's easier to do through the editor. In the Manual, the link to which was provided in the previous post, it's not difficult to understand.
In short, if using scripts, since the topic allows:
- You enable a task based on a specific event and store the day in a variable;
- On the event-trigger for a new day after the specified period, you set the task to fail and the necessary condition you want;
- On the trigger for changing the ownership of an object, you set the code to execute the task.
Nothing complicated.
Thank you for your answer, and I have one more question for you. Is it possible to create a task like "kill all monsters of a specific race on the map"?
In reply to Рыцарь Бездны
User Avatar
14 years ago
Auto-translated
Knight of the Abyss
Thank you for your answer, and I have another question for you. Is it possible to create a task like "kill all monsters of a specific race on the map"?
Yes, it is possible, but it's not very simple. In short:
- We disable the weekly spawning of creatures;
- We add objects from the entire map to an array, with our conditions (in this case, all creatures of one race);
- After each battle, we create a new array for the entire map, and if there are no more creatures of a certain type left, we mark the task as completed.

Although the algorithm is very simple, implementing the above is not very easy. It's not a guarantee that it will work.
Of course, there might be an easier way, but this is what came to my mind for scripts.

a few minutes later...

Here's a simpler way:), but it's more cumbersome and not universal:
Pre-place all non-random monsters on the map, disable the weekly spawning of monsters, give monsters of a specific race names, and after each battle, check if each object exists on the map, and if none are left, the condition is met.
In reply to Dyrman
User Avatar
14 years ago
Auto-translated
Dyrman
It's possible, but it's not that simple anymore. In short:
- We disable the weekly spawn days for creatures;
- We add objects from the entire map to an array, with our conditions (in this case, all creatures of the same race);
- After each battle, we create a new array for the entire map, and if there are no creatures of a certain type left, we mark the task as completed.

Although the algorithm is very simple, implementing the above is not that easy. It's not a given that it will work.
Of course, there might be an easier way, but this is what came to my mind for scripts.

a few minutes later...

Here's a simpler option :), but it's more cumbersome and not universal:
Pre-place all non-random monsters on the map, disable the weekly monster spawn, give monsters of a certain race names, after each battle, check if each object exists on the map, and if none are left, the condition is met.
You're helping me out again. The second option works great. Now I want to make it so that when you enter a zone, a message is displayed, then the monster plays a death animation, it disappears, and another one appears in its place. (for example, a group of peasants is in front, then they die, and a group of skeletons appears in their place). Can you suggest a way to do this? (I can only get the message to display).

Statistics

Welcome our newest member: recijeb