Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
9 years ago
Auto-translated
What script should I write to get complete information about the enemy creatures killed in battle, including their type and quantity?
User Avatar
9 years ago
Auto-translated
Spectral, a trigger is attached to COMBAT_RESULTS_TRIGGER, then refer to the documentation for:
GetSavedCombatArmyHero()
GetSavedCombatArmyCreaturesCount()
GetSavedCombatArmyCreatureInfo()

Example:
COMBAT_WINNER = 1;
COMBAT_LOSER = 0;

Trigger(COMBAT_RESULTS_TRIGGER, 'CombatResult');

function CombatResult(id)

local n_stacks, creature, count, died;

-- analysis of the losing side
n_stacks = GetSavedCombatArmyCreaturesCount(id, COMBAT_LOSER);
for i = 0,(n_stacks-1) do
creature, count, died = GetSavedCombatArmyCreatureInfo(id, COMBAT_LOSER, i);
end

-- analysis of the winning side
n_stacks = GetSavedCombatArmyCreaturesCount(id, COMBAT_WINNER);
for i = 0,(n_stacks-1) do
creature, count, died = GetSavedCombatArmyCreatureInfo(id, COMBAT_WINNER, i);
end

end
In reply to Jack_of_shadows
User Avatar
9 years ago
Auto-translated
Jack_of_shadows

n_stacks = GetSavedCombatArmyCreaturesCount(id, COMBAT_LOSER);
for i = 0,(n_stacks-1) do
creature, count, died = GetSavedCombatArmyCreatureInfo(id, COMBAT_LOSER, i);
end

Why does the loop start with i = 0 instead of i = 1?
User Avatar
9 years ago
Auto-translated
I have a question. Is it possible to open gates using scripts, similar to what was done in the "Exile" map?
User Avatar
9 years ago
Auto-translated
Why does i start from 0 instead of 1?
The developers of Heroes weren't always consistent, so there are several functions that require the index to start from 0.
Is it possible to open gates from an Arena Object using scripts, similar to what was seen in the Exiled map?
This topic was discussed in one of the threads here just a week ago.
In reply to Jack_of_shadows
9 years ago
Auto-translated
Is there a script that, when a hero moves, activates a light effect on objects within a certain radius around him, and deactivates it when he moves away?
User Avatar
9 years ago
Auto-translated
Hello everyone! I'm new to the site and a beginner in mapmaking. Actually, I'm not a mapmaker at all; I don't know anything about scripts, but let's get to the point. I've made a map, and what script do I need so that when my hero enters a specific region, he stops, and it counts as a victory?
P.S. - What script do I need so that the enemy hero just stands still?
In reply to Grimrock
User Avatar
9 years ago
Auto-translated
Grimrock
Hello everyone! I'm new to the site and a beginner mapmaker. Actually, I'm not a mapmaker at all, I don't know anything about scripts, but let's get to the point. I made a map, and what script do I need so that when my hero enters a specific region, he stops and the victory is recorded?
P.S. - What script do I need so that the enemy hero just stands still?
1.
function win(hero)
if hero == "scripted hero name" then
Win()
end
end

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "region", "win")
2. EnableHeroAI("scripted hero name", nil)
User Avatar
9 years ago
Auto-translated
Red Heaven Hero, thank you very much! :) You've expanded my knowledge of scripts :) Here's another question: How can I disable the quest to find a town for 7 days? (Since it's impossible to obtain a town in the mission).
In reply to Grimrock
User Avatar
9 years ago
Auto-translated


Here's another question: How can I disable the quest to find a town for 7 days? (Since it's impossible to obtain a town in the mission).[/QUOTE]
The question is not very clear.
In reply to Grimrock
User Avatar
9 years ago
Auto-translated
Grimrock
Added 12 minutes ago
[/U]Here's another question: How do I disable the quest to find a town within 7 days? (Since it's impossible to obtain a town in the mission).
Open the map tree. There, open the settings for the corresponding PLAYER.
There should be a parameter called City_in_a_week.
User Avatar
9 years ago
Auto-translated
How can I make it so that when attacking an enemy hero standing near a town, the battle starts inside the castle?
In reply to Квант
User Avatar
9 years ago
Auto-translated
Quant
Open the map tree. There, open the settings for the corresponding PLAYER.
There should be a parameter called City_per_week.
That's strange. I checked, but I can't find that parameter? Maybe you know what it's called in English?

Added 3 minutes ago
Ah, I found it and configured it. Huge thanks to Quant :3

Added 55 minutes ago
Another question, not very important, but I really want to know:D How do I upload the "Please Wait, Loading" image? This is the one that appears when the mission is loading.
User Avatar
9 years ago
Auto-translated
How do I load the "Please Wait, Loading" image? The one that appears during mission loading.
Create a text file named PWLpict.xdb



REGULAR
CONVERT_TRANSPARENT
CLAMP
TF_DXT1
1024
768
0
1
0
-1088146910
true
true
false
true
false
In this file, you can see the name of the file in dds format, and its parameters (TF_DXT1, width, and height).

Create a dds image.

Put these files into an archive with the map, where there are many files.

Then, open map.xdb in Notepad.
Find the line
and replace it with
User Avatar
9 years ago
Auto-translated
Thank you. I'll try.

Added 18 minutes later
Regarding the previous question: Is the archive with the game its root directory, or is it some other folder?

Statistics

Welcome our newest member: recijeb