Skip to content
User Avatar
#3801
Auto-translated

Hi! So, I previously asked about creating a counter for killed creatures, and I have this script:

function Duncan_Revenge( combatIndex )
if GetSavedCombatArmyHero( combatIndex, 1 ) == "Duncan" then
if GetSavedCombatArmyCreaturesCount( combatIndex, 0, 112 ) >= 1 then
n_stacks = GetSavedCombatArmyCreaturesCount( combatIndex, 0 );
for i = 0,(n_stacks-1) do
local revenge_target, count, died = GetSavedCombatArmyCreatureInfo( combatIndex, 0, i );
if revenge_target == 112 and died >= 1 then
enemieskilledcounter = enemieskilledcounter + died;
ShowFlyingSign({GetMapDataPath().."Duncan_Counter.txt"; showcounter=enemieskilledcounter}, "Duncan", 1, 10)
end
end
end
end
end

The script works, but it's annoying that the message with the number of killed creatures is displayed multiple times. I understand that this is due to multiple stacks. Is it possible to modify the script so that the message is displayed only once, showing the total number of killed creatures?