Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to Ment
8 years ago
Auto-translated
Okay, I understand, I'll keep that in mind, thanks for the tip.
User Avatar
8 years ago
Auto-translated
How do I remove the castle affiliation skirt from under a unit? It says "monster "sword1" is not disabled," even though it actually is disabled.
User Avatar
8 years ago
Auto-translated
inQizitOr, if your code has the following commands in sequence:
disable monster;
remove skirt;
then insert a pause between them:
sleep(1);
All commands that affect objects on the map are executed in a different thread than your script, so the "disable monster" command actually only places itself in a task list and will only be executed when it's that thread's turn, and the most reliable way to do this is to pause the current thread, which sleep() does.
In reply to Jack_of_shadows
User Avatar
8 years ago
Auto-translated
Jack_of_shadows
inQizitOr, if your code has the following commands in sequence:
disable monster;
remove skirt;
then insert a pause between them:
sleep(1);
All commands that affect objects on the map are executed in a different thread than your script, so the "disable monster" command actually only places itself in a task list and will only be executed when it's that thread's turn, and the surest way to do this is to pause the current thread, which sleep() does.
Thank you.
User Avatar
8 years ago
Auto-translated
Added 1 hour and 43 minutes later
Another problem: I made a message box, but it seems like it only works with Unicode format, but in the game, it says the file is empty. I copied the .txt file from the map archive, renamed it, entered the text, and put it back. It doesn't work. What's wrong?
User Avatar
8 years ago
Auto-translated
I created a message box, but everything needs to be in Unicode format, and the game says the file is empty. I copied the .txt file from the map archive, renamed it, entered the text, and put it back. It doesn't work. What's wrong?
What if you create a message with a link to a file that already exists in the map, so you don't have to add anything new? Does that work? Also, it's possible that the path to the file with the error is written incorrectly.
In reply to Jack_of_shadows
User Avatar
8 years ago
Auto-translated
Jack_of_shadows
What if you create a message with a link to a file that already exists in the map, so that it doesn't interfere with anything else? Would that work? Also, it's possible that the file path is misspelled.
The path seems to be correct, as I copied it from the archiver. Substituting a file from the map didn't help – it still says that the text is empty.
User Avatar
8 years ago
Auto-translated
inQizitOr, I'm almost certain that the path is incorrect. Compare your code with other maps; the message box is used in almost every single-player map.
User Avatar
8 years ago
Auto-translated
because I copied it from an archiving program
The slashes might be incorrect.
/ instead of \, or vice versa.
This is the most obvious thing.
User Avatar
8 years ago
Auto-translated
Hello everyone, I have a couple of questions: 1) How do I change a hero's specialization? 2) How do I remove the turn order 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 demon squads, 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 will need to return for the reward. How can I create a quest like this?
User Avatar
8 years ago
Auto-translated
1) How to change a hero's specialization
A straightforward solution is to place the hero on the map, click on "shared" in the properties tree, and there will be many hero parameters that can be changed, including specialization. As far as I remember, this will turn your map into a mod. You can also create your own hero and customize it as you like; this solution will not affect other maps.
2) How to remove the player turn bar
If the computer does not have any active heroes or castles, you can remove the turn bar using the function with the self-explanatory name DoNotGiveTurnToPlayerAIIfNoTownsAndActiveHeroes().
There is a quest to defeat the demons.
You can give the demons names (and if they are heroes, they already have names by default, but there are some specific features for heroes), and check for their presence on the map using the IsObjectExists() function based on some event. The most convenient event is probably 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, check when issuing the quest whether the player has already killed them.
In reply to John_Lock
8 years ago
Auto-translated
Am I correct in understanding that this command in the objectives: OBJECTIVE_KIND_STAY_WITH_HEROES means meeting a hero, or is it something else? Because I tested it, and it doesn't register as completed when I come into contact with an ally.
User Avatar
8 years ago
Auto-translated
Godric's Hollow, the term "stay" translates to "remain," so it seems more like a quest to prevent a specific hero from being lost.
In reply to Jack_of_shadows
8 years ago
Auto-translated
I just need a task where, upon touching one castle, the task is completed, and another one appears. Ideally, but if it's difficult to implement, then just place a hero near the castle and make the task trigger upon touching him.

Added 2 minutes later
And the task is to stay alive: OBJECTIVE_KIND_HERO_MUST_SURVIVE.
User Avatar
8 years ago
Auto-translated
Godric's Hollow, I don't know how to do it with standard objects, but there are ready-made triggers for this in the scripts: OBJECT_CAPTURE_TRIGGER and OBJECT_TOUCH_TRIGGER.

Statistics

Welcome our newest member: recijeb