Skip to content

Current questions and answers regarding the map editor.

User Avatar
#5396
Auto-translated
}{0TT@6bI4
Create a new script (xdb and lua) and link it to your hero using the function SetHeroCombatScript("Hero Name", "/Path to script/ScriptName.xdb#xpointer(/Script)")

In the combat script itself:
function Start()
--We only consider the case when our hero attacks; if the "bad counter" increased when we were attacked, it would be unfair.

local EnemyCreat = GetDefenderCreatures()
flag = 1
for key, unit in EnemyCreat do
if GetCreatureType(unit)=="Bad ID" or GetCreatureType(unit)=="Bad ID 2" then --N blocks of "bad ID" checks
SetGameVar("BadCounter", GetGameVar("BadCounter")+1)
flag = nil
break
end
end
if flag then
SetGameVar("GoodCounter", GetGameVar("GoodCounter")+1)
end
end
Thank you, I'll try it. And thank you for the explanation about ~= . Regarding the gates - I understand, we'll wait. 😎