Auto-translated
Is there a function that returns an array of all equipped (currently in use) and unequipped (in the hero's inventory) artifacts?
function GetAllArtefacts(hero)
local array = {};
for artefact = 1, 96 do
if HasArtefact(hero, artefact, 1) then
array[artefact] = 2;
elseif HasArtefact(hero, artefact, 0) then
array[artefact] = 1;
else
array[artefact] = 0;
end;
end;
return array;
end;For example, this function will return an array where the index = the artifact number, and the value = 0, 1, 2, respectively: none, present, equipped.
function GetAllArtefacts(hero)
local array = {[0] = {}, [1] = {}};
for artefact = 1, 96 do
if HasArtefact(hero, artefact, 1) then
array[1][length(array[1]) + 1] = artefact;
elseif HasArtefact(hero, artefact, 0) then
array[0][length(array[0]) + 1] = artefact;
end;
end;
return array;
end;And this one will return an array where array[0] is an array of unequipped artifacts, and array[1] is an array of equipped artifacts.
However, in both cases, if there are ≥2 artifacts of the same type, both functions will say that they are equipped.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4