Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to Jack_of_shadows
8 years ago
Auto-translated
Then everything will have to be done through scripts:(
In reply to Годрикова впадина
User Avatar
8 years ago
Auto-translated
Godric's Hollow
I just need a task that, when triggered by touching a specific castle, executes and spawns another task. Ideally, but if that's difficult to implement, then just place a hero near the castle and create a task that triggers when the hero touches it.

Added 2 minutes later
And the task should be "OBDJECTIVE_KIND_HERO_MUST_SURVIVE" (the hero must survive).
Don't use standard objectives; they're clunky and don't work as intended. I create all quests using OBJECTIVE_KIND_MANUAL, which means the quest is fully scripted. I'll write a complete script tomorrow showing how it should be done.
In reply to inQizitOr
8 years ago
Auto-translated
Thank you, I hope I’ll figure it out.
In reply to Годрикова впадина
User Avatar
8 years ago
Auto-translated
Godric's Hollow
Thank you, I hope I'll figure it out.
Let's start with something simpler.
First, let's take an array of names:
Town1 - the town that, when touched, should trigger the script.
Objective_1 - the objective that should be completed.

We'll write a trigger for the town - this is the only way.
TRIGGER(OBJECT_TOUCH_TRIGGER, 'Town1', 'TownF') - here, we specified the object's name and gave the function a name (you can name it anything).

Now, let's write the function itself.

function TownF()
TRIGGER(OBJECT_TOUCH_TRIGGER, 'Town1', nil)
sleep(5)
SetObjectiveState('Objective_1', OBJECTIVE_COMPLETED)
sleep(10)
SetObjectiveState('Objective_2', OBJECTIVE_ACTIVE)
end;

Added 11 hours and 2 minutes ago
User01322342
Hello everyone, I have a couple of questions:
1) How do I change a hero's specialization?
2) How do I remove the player turn panel?
3) There's a quest to defeat demons. This quest is executed through a script. The essence of the quest is to defeat two groups of demons, i.e., one demon will be located in one place, and another demon in another place. After the demons are defeated, the task will be updated: you need to return for a reward. How can I create such a quest?
Return where? To the seer's hut or to a creature on the map? Then, two different scripts.
And the script with the demons will be something like this:
First, we introduce a constant:
deamons = 0;

Now, we attach triggers to the demons (if you have heroes, use their script names; if they are creatures, use the names you gave them).
TRIGGER(OBJECT_TOUCH_TRIGGER, 'Grol', 'CheckF')
TRIGGER(OBJECT_TOUCH_TRIGGER, 'Nimus', 'CheckF')

We write a function that checks if the demons are still on the map, and if not, it adds one to our constant.
function CheckF()
sleep(5)
If IsObjectExists('Grol', false)
then
deamons = deamons + 1;
sleep(5)
If IsObjectExists('Nimus', false)
then
deamons = deamons + 1;
sleep(5)
If deamons = 2
then
Set_Objective_State('Objective_1', OBJECTIVE_COMPLETED)
sleep(5)
end;

BUT! This script isn't easy, and I can't guarantee its functionality until I test it in the game
In reply to Jack_of_shadows
User Avatar
8 years ago
Auto-translated
Probably the most convenient event is the battle result trigger: ``` Trigger(COMBAT_RESULTS_TRIGGER, 'CombatResult'); function CombatResult(id) if the quest is active and both demons do not exist, update the quest end ``` Also, don't forget about non-standard options, for example, when issuing a quest, check if the player has already killed them. Thank you :) And if it's not too much trouble, what exactly should be in the id where function CombatResult is located? I searched in the manual, but I didn't find anything about how Trigger(COMBAT_RESULTS_TRIGGER) works (maybe I didn't search well). Are there any other manuals? Half of the functions I found on this site are not in the documents in the game folder. Added 1 minute ago Thank you ;)
User Avatar
8 years ago
Auto-translated
I searched the manual for how Trigger(COMBAT_RESULTS_TRIGGER) works, but I couldn't find anything about this function.
You must have opened the wrong manual. Here are the ones you should be looking at:
HOMM5_A2_Script_Functions.pdf
HOMM5_A2_IDs_for_Scripts.pdf
A2 indicates that it's the second expansion, i.e., "Tribes of the East." It added a lot of functions.
What exactly should be in the ID where the function CombatResult is located?
This is the battle identifier; you can use it to request various battle statistics from the game – who participated, who died.
In reply to Jack_of_shadows
8 years ago
Auto-translated
What is the difference between the regular editor and the advanced editor? And how do I enable it?
In reply to Ment
8 years ago
Auto-translated
Thanks for that, but the question remains the same – what is the difference between the regular and extended versions?

Added 1 minute ago
I was just reading a thread about videos, and it mentions an extended editor, which I found interesting.
User Avatar
8 years ago
Auto-translated
An expanded panel appears in the lower left corner, displaying resources. Plus, the menu at the top of the screen changes – some nice options appear, such as connecting resource maps, and so on.
In reply to Ment
8 years ago
Auto-translated
Understood, thank you.
User Avatar
8 years ago
Auto-translated
I was making a map, and I had this kind of question:
Is it impossible to build bridges?

I tried two methods:
1. Using CreateStatic
2. Placing them with a pre-set orientation in the location where they should be, then moving them to a reserve area (corner of the map), and using the SetObjectPosition function to place them when needed.

Neither method allows the bridge to be used; it's just an object that the hero passes through. [QUOTE]
Does anyone know how to implement bridge creation?
In reply to KioM
8 years ago
Auto-translated
What is wrong with the script? `SetObjectOwner('CHELA1',PLAYER_5);`. CHELA1 is the name I assigned; the script's purpose is to make the hero neutral and have him simply stand in one place.
User Avatar
8 years ago
Auto-translated
Heroes are not addressed in this way. The hero's scripted name is set by the game; you can view it in the corresponding field. Although, even then, I'm not sure if it will work. But there was something like that in the game regarding changing the owner of heroes, in the original campaigns...
In reply to Ment
8 years ago
Auto-translated
I've already tried two different options, both with a custom name and with the in-game name, but there's no difference.

Added 1 minute ago
This was also present in the original campaigns and in the Unicorn Empire campaign, in the 4th mission.

Added 5 minutes ago
Do you need a trigger for this?

Statistics

Welcome our newest member: recijeb