ПОМОГИТЕ
![Smile45](images/smilies/smile45.gif)
Есть карта, есть скрипт:
function obj()
while 1 do
local heroes = {};
local m = 0;
local h = 0;
local count = 0;
heroes = GetPlayerHeroes(PLAYER_1);
--for m, h in heroes do
h = "Muscip";
if HasArtefact(h, 36) then
count = count + 1;
end;
if HasArtefact(h, 37) then
count = count + 1;
end;
if HasArtefact(h, 38) then
count = count + 1;
end;
if HasArtefact(h, 39) then
count = count + 1;
end;
if HasArtefact(h, 40) then
count = count + 1;
end;
if HasArtefact(h, 41) then
count = count + 1;
end;
if HasArtefact(h, 42) then
count = count + 1;
end;
if HasArtefact(h, 43) then
count = count + 1;
end;
end;
local sl = GetPlayerHeroes(PLAYER_1);
local res
if count == 8 then
print("Player 1 has all artifacts");
SetObjectiveState("obj", OBJECTIVE_COMPLETED);
Win ();
break;
end;
sleep(5);
end;
end;
startThread (obj);
Немножко подкорректировал его:
function obj()
while 1 do
local heroes = {};
local o = 0;
local h = 0;
local count = 0;
heroes = GetPlayerHeroes(PLAYER_1);
--for o, h in heroes do
h = "Muscip";
if HasArtefact(h, 36) then
count = count + 1;
end;
if HasArtefact(h, 37) then
count = count + 1;
end;
if HasArtefact(h, 38) then
count = count + 1;
end;
if HasArtefact(h, 39) then
count = count + 1;
end;
if HasArtefact(h, 40) then
count = count + 1;
end;
if HasArtefact(h, 41) then
count = count + 1;
end;
if HasArtefact(h, 42) then
count = count + 1;
end;
if HasArtefact(h, 43) then
count = count + 1;
end;
end;
o = "obj"
local sl = GetPlayerHeroes(PLAYER_1);
if count == 1 then
print("Player 1 has 1/8 artifacts");
SetObjectiveProgress(o, 1);
end;
if count == 2 then
print("Player 1 has 2/8 artifacts");
SetObjectiveProgress(o, 2);
end;
if count == 3 then
print("Player 1 has 3/8 artifacts");
SetObjectiveProgress(o, 3);
end;
if count == 4 then
print("Player 1 has 4/8 artifacts");
SetObjectiveProgress(o, 4);
end;
if count == 5 then
print("Player 1 has 5/8 artifacts");
SetObjectiveProgress(o, 5);
end;
if count == 6 then
print("Player 1 has 6/8 artifacts");
SetObjectiveProgress(o, 6);
end;
if count == 7 then
print("Player 1 has 7/8 artifacts");
SetObjectiveProgress(o, 7);
end;
if count == 8 then
print("Player 1 has all artifacts");
SetObjectiveState(o, OBJECTIVE_COMPLETED);
Win ();
break;
end;
sleep(5);
end;
end;
startThread (obj);
И скрипт перестал работать. Консоль пишет что-то вроде этого:
(Script) ERROR: no loop break
... ... (не помню
![Печаль](images/smilies/frown.gif)
что то писалось про 72 строку.)
Что это значит?