Skip to content
User Avatar
#1153
Auto-translated
This can be fit into 23 lines.:)
function obj()
local old = 0
while 1 do
local count = 0
for i=36,43 do
count = count + (HasArtefact("Muscip", i) or 0)
end
if count == 8 then
print("Player 1 has all artifacts")
SetObjectiveState("obj", OBJECTIVE_COMPLETED)
Win()
break
end
if count ~= old then
print("Player 1 has "..count.."/8 artifacts")
SetObjectiveProgress("obj", count)
old = count
end
sleep(5)
end
end

startThread (obj)


Added after 4 minutes
How do you iterate through the cities existing on the map if their names are not known in advance?
Will I have to iterate through all existing city names defined in the game resources to check for their presence on the map?
GetObjectNamesByType('TOWN') will return an array with the names of all cities on the map.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4

Statistics

Welcome our newest member: wayal