Skip to content
User Avatar
#3716
Auto-translated
}{0TT@6bI4
You can only transfer data through SetGameVar, though.

There is a trigger for the end of the battle, which passes the battle index to the function. And using the battle index, you can get all the information about the destroyed creatures using GetSavedCombat.... It's in the tutorial and also on the forum, Jack of Shadows explained it (searching for GetSavedCombatArmy site:heroesworld.ru should give you results).
Wow, thanks! I didn't even notice this functionality in the guide before. Listen, I wanted to find out something. In the developer maps, I saw quest skeletons that save the main heroes by tracking their existence through loops (IsHeroAlive), or through their loss through a trigger (PLAYER_REMOVE_HERO_TRIGGER). So, I became curious, which of these would be less resource-intensive for the map? Which approach should be preferred for script optimization?

Added 1 hour 50 minutes ago
I don't understand how these functions work. I wrote the script:
enemieskilledcounter = 0;
SetTrigger( COMBAT_RESULTS_TRIGGER, "WR_Revenge" );

function WR_Revenge( combatIndex )
print("Function started")
if ( GetSavedCombatArmyHero( combatIndex, 1, "WR" ) == true ) and ( GetSavedCombatArmyCreaturesCount( combatIndex, 2, 112 ) == true ) then
print("Passed the checks")
local revenge_target, count, died = GetSavedCombatArmyCreatureInfo( combatIndex );
print("Passed local")
if revenge_target == 112 and died >= 1 then
print("Passed the check for the death of at least one angel")
enemieskilledcounter = enemieskilledcounter + died;
print("Hero killed ", enemieskilledcounter ," angels");
end
end
end

However, "print("Passed the checks")" is not displayed, which means the checks are not working. How should I write them then? The developers described everything vaguely in the document, i.e., not at all.

Statistics

Welcome our newest member: wayal