Skip to content
#1172
Auto-translated
There's an issue with the script. Here's the map script (in its entirety):
SetRegionBlocked("Block1", true, 2);
SetRegionBlocked("Block2", true, 2);
SetObjectiveVisible("killall", nil);

function am()
	while 1 do
		local count = 0
		for i=36,43 do
			count = count + (HasArtefact("Muscip", i) or 0)
		end;
		if count < 8 then
			SetObjectiveState("obj", OBJECTIVE_ACTIVE);
		end;
		sleep(5);
	end;
end;

function killallactive()
	SetObjectiveVisible("killall", true);
	startThread (am);
end;

function winF()
	Win();
end;

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)
			QuestionBox(GetMapDataPath().."complete-game.txt", "killallactive", "winF");
			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);
For testing, I removed one of the artifacts from a hero and gave it to another hero. The objective reset to 0, and the console displayed an error: (Script) ERROR: Objective "obj" is active, so can only complete or fail it What does this mean?

Statistics

Welcome our newest member: dodoD0D0