Auto-translated
I wrote a function based on your advice:
But after destroying all the demons, nothing happens. Can you tell me where the error is?
In the startThread function, it should be written without quotes:
startThread(cherti);Perhaps that's why it's not working.
And also, is it possible to create a hidden connection between quests? I'll try to come up with a simple example:
Quest - destroy an enemy hero
Secondary quest - destroy a neutral.
When you approach the enemy hero, dialogue #1 plays, but if you have destroyed the neutrals, dialogue #2 will play.
Also, if you simply fight the enemy hero, his army will have 5 phoenixes.
But if you defeat the neutrals, it will have 250 wolves and some artifact will be found.
Is it possible to implement such things?
There are two options for the dialogue. The first is to replace the trigger on the enemy hero when the additional quest is completed, which will lead to the second dialogue.
The second is to use the GetObjectiveState function to check whether the additional quest has been completed and, depending on whether the condition has been met, provide one or the other option.
But I would recommend the second option; I had a lot of trouble with the first one.
And by the way, there is a third option - create a variable, equal to, for example, 0, and when the additional quest is completed, change its value to 1. And when you touch the enemy hero, check if the variable is equal to 1. But this is essentially the same as the second option, only it takes up an extra variable

