Why don't you suggest your own version? It would be interesting to see.
But overall, this isn't particularly important for map scripts.
...
I've sketched out the code in general terms (3-in-1). I haven't tested it.
-- Squad names in the map editor
squadList = {
"squad01", "squad02", -- ... "squad99"
}
function connect()
Trigger(NEW_DAY_TRIGGER, "onDateUpdate")
Trigger(COMBAT_RESULTS_TRIGGER, "onCombatFinish")
for i, squad in squadList do
setSquadDisabled(squad)
Trigger(OBJECT_TOUCH_TRIGGER, squad, "onObjectTouch")
end
end
function setSquadDisabled(squad)
SetObjectEnabled(squad, nil)
-- SetDisabledObjectMode(squad, DISABLED_INTERACT) -- changes the cursor
-- SetMonsterSelectionType(squad, 0) -- removes the skirt
end
-- If it's not critical to wait for the next day (due to the plot or design)
function onDateUpdate()
-- ...
check()
end
-- Here, you can additionally find out the hero's name,
-- the number of creatures, the battle result, etc.
-- The essence of the method is additional extended capabilities.
function onCombatFinish(index)
-- local heroWinner = GetSavedCombatArmyHero(index, 1)
-- local heroLooser = GetSavedCombatArmyHero(index, 0)
check()
end
-- Here, you will additionally have to find out the stacks and their number for the object,
-- or completely rely on the script, excluding the editor settings.
-- The essence of the method is to launch a controlled check after the battle.
function onObjectTouch(hero, object)
StartCombat(hero, nil, ..., "check", ...) -- ??? A lot of different parameters, maybe I'm wrong
end
function check()
local count = getSquadCount()
if count == length(squadList) then
-- All squads are killed -> actions ...
else
-- Obviously, all ProgreesFile's should be specified in the editor
-- in a quantity equal to the number of squads in the squadList
SetObjectiveProgress(<имя задания в редакторе>, count)
end
end
function getSquadCount()
local count = 0
for i, squad in squadList do
if IsObjectExists(squad) then
count = count + 1
end
end
return count
end
startThread(connect)