Skip to content

Posts from Current questions and answers regarding the map editor.

5.0 (12 ratings)
In reply to &T&T&Twreqnd
User Avatar
#4276
Auto-translated
&T&T&Twreqnd
I don't understand this, but it's strange that after the battle, the creature speaks a text, but without the battle, it doesn't. Can you help?

There is a solution. If you are talking about a group of creatures with a flag, I haven't checked, but if it's a single creature, it should work.
Let's get to the point.
First, give the creature a name. "Name" is the script name that will be used.
To interact with objects and creatures, you need to use
SetObjectEnabled("Name",nil); this can be written anywhere.

function DevilF()
MessageBox("/Maps/SingleMissions/Test_Skriptov/Devil.txt"); - this command displays a message. "Test_Skriptov" is your map, and "Devil" is the text file.
AddHeroCreatures("Christian", 3, 20); "Christian" is the script name of the hero. , 3 is the ID of the creatures, in my case, archers, and 20 is the quantity.
RemoveObject("Devil"); this removes the object if you want the action to be one-time.
end;

Trigger(OBJECT_TOUCH_TRIGGER, "Devil", "DevilF");

and here is the code:

function DevilF()
MessageBox("/Maps/SingleMissions/Test_Skriptov/Devil.txt");
AddHeroCreatures("Christian", 3, 20);
RemoveObject("Devil");
end;

Trigger(OBJECT_TOUCH_TRIGGER, "Devil", "DevilF");

It worked for me. I don't know if there are other ways. If you want the creature not to be removed, you can do this:

function DevilF()
Trigger(OBJECT_TOUCH_TRIGGER, "Devil", nil); this command is used so that the actions are no longer triggered
MessageBox("/Maps/SingleMissions/Test_Skriptov/Devil.txt");
AddHeroCreatures("Christian", 3, 20);
end;

Trigger(OBJECT_TOUCH_TRIGGER, "Devil", "DevilF");
Attachments 2
2 files attached • Total size: 607.3 KB
User Avatar
#4277
Auto-translated
For aesthetics, you can add PlayObjectAnimation("Devil", "happy", ONESHOT_STILL);

function DevilF
Trigger(OBJECT_TOUCH_TRIGGER, "Devil", nil);
MessageBox("/Maps/SingleMissions/Test_Skriptov/Devil.txt");
AddHeroCreatures("Christian", 3, 20);
PlayObjectAnimation("Devil", "happy", ONESHOT_STILL);
end;

Trigger(OBJECT_TOUCH_TRIGGER, "Devil", "DevilF");

Added 1 minute ago
If anything is unclear, ask, and I'll try to answer :)

Added 5 minutes ago
PlayObjectAnimation("Devil", "happy", ONESHOT); this is better

Added 27 minutes ago
Here's a tip: it's better to edit scripts in the Skripts Editor; you can also create text files there, which will simplify the process

Added 6 minutes ago
function DevilF
Trigger(OBJECT_TOUCH_TRIGGER, "Devil", nil);
MessageBox("/Maps/SingleMissions/Test_Skriptov/Devil.txt");
AddHeroCreatures("Christian", 3, 20);
PlayObjectAnimation("Devil", "happy", ONESHOT_STILL);
end;

Trigger(OBJECT_TOUCH_TRIGGER, "Devil", "DevilF");

SetObjectEnabled("Devil",nil);

Now everything is correct, it should be

Added 31 seconds ago
function DevilF
Trigger(OBJECT_TOUCH_TRIGGER, "Devil", nil);
MessageBox("/Maps/SingleMissions/Test_Skriptov/Devil.txt");
AddHeroCreatures("Christian", 3, 20);
PlayObjectAnimation("Devil", "happy", ONESHOT_STILL);
end;

Trigger(OBJECT_TOUCH_TRIGGER, "Devil", "DevilF");

SetObjectEnabled("Devil",nil);

Now everything is correct, it should be
User Avatar
#4278
Auto-translated
Thank you, I'll try now!

Added 25 minutes later
After clicking the check button, it displays an error: Function DevilF not defined, line 1.
In reply to &T&T&Twreqnd
User Avatar
#4279
Auto-translated
&T&T&Twreqnd
Thank you, I'll try it now!

Added 25 minutes later
After clicking the check button, it displays an error: Function DevilF not defined, line1

This is a bug in the map editor. You shouldn't pay attention to this error.

You can name the function whatever you want, for example:
function Heroes() or whatever is convenient. After the word function, write anything.

function "your function name" () Write the name without quotes.
User Avatar
#4280
Auto-translated
I entered this for the demon:
AddHeroCreatures("Nikolai", 3, 20);
function Heroes()
Trigger(OBJECT_TOUCH_TRIGGER, "Devil", nil);
MessageBox("/Maps/SingleMissions/Opolchenie/Devil.txt");
PlayObjectAnimation("Devil", "happy", ONESHOT_STILL);
end;
Trigger(OBJECT_TOUCH_TRIGGER, "Devil", "Heroes");
SetObjectEnabled("Devil",nil);
but when I enter the map, nothing happens; they simply join the squad.
In reply to &T&T&Twreqnd
User Avatar
#4281
Auto-translated
&T&T&Twreqnd
I entered this into the demon:
AddHeroCreatures("Nikolai", 3, 20);
function Heroes()
Trigger(OBJECT_TOUCH_TRIGGER, "Devil", nil);
MessageBox("/Maps/SingleMissions/Opolchenie/Devil.txt");
PlayObjectAnimation("Devil", "happy", ONESHOT_STILL);
end;
Trigger(OBJECT_TOUCH_TRIGGER, "Devil", "Heroes");
SetObjectEnabled("Devil",nil);
but when I enter the map, nothing happens; they just join the squad.



function Heroes()
Trigger(OBJECT_TOUCH_TRIGGER, "Devil", nil);
AddHeroCreatures("Nikolai", 3, 20);
MessageBox("/Maps/SingleMissions/Opolchenie/Devil.txt");
PlayObjectAnimation("Devil", "happy", ONESHOT_STILL);
end;
Trigger(OBJECT_TOUCH_TRIGGER, "Devil", "Heroes");
SetObjectEnabled("Devil",nil);

There are two possibilities here: either you didn't name the creature correctly, or the script name of the Hero is not what it should be. Try this.
In reply to John_Lock
User Avatar
#4282
Auto-translated
What should we name the creature?
User Avatar
#4283
Auto-translated
The message may not appear if you created a text file and placed it in the map. It is better to use SkriptsEditor, as it allows you to create text files and Lua scripts.

Added 40 seconds ago
&T&T&Twreqnd
How do I name a creature?

However you want. For example, latnik. It's up to your imagination.

Added 34 seconds ago
Name the creature and use it in the script.
In reply to John_Lock
User Avatar
#4284
Auto-translated
Where can I download the script editor?
User Avatar
#4285
Auto-translated
where Name - you enter any name you like.
Attachments 1
1 file attached • Total size: 341.1 KB
User Avatar
#4286
Auto-translated
Do you have the EWA mod installed for Heroes 5? If so, SkriptsEditor is located there.
User Avatar
#4287
Auto-translated
Did you write a script for this creature?
I might have misunderstood the conversation, but it seems pointless to write a script for a creature, meaning in the script window for this neutral unit. You need to write it in the general script.
 

К А
Стикеры GBF в Telegram
User Avatar
#4288
Auto-translated
http://hmm5.sklabs.ru Here is the link. I don't know if it's allowed to add external links here, but I'll take a chance.
In reply to John_Lock
User Avatar
#4289
Auto-translated
So, I downloaded and opened the script editor for this map, what's next?

Added 4 minutes later
Now the demon won't let me in.
User Avatar
#4290
Auto-translated
Click on the icon next to the folder. It's a text file. Name it whatever you want and write whatever you want.
Attachments 1
1 file attached • Total size: 113.3 KB

Statistics

Welcome our newest member: leyu