Skip to content

Current questions and answers regarding the map editor.

User Avatar
#4731
Auto-translated
am-wrag
I wrote a script, a thread that checks if certain key guardians have been visited and, depending on the conditions, displays a message. It works the way I need it to, but for some reason, it completely clutters the console with warnings. Help me figure out what's wrong.
Scripts:

function StartKeyMasterObserv()
Trigger(NEW_DAY_TRIGGER, "StartKeyMasterObserv", nil );
print("Start keymaster observe thread");
startThread(CheckKeyMasterFoundThread);
end;
function CheckKeyMasterFoundThread()
GreenKeymasterMessageNotShow = true;
RedKeymasterMessageNotShow = true;
TanKeymasterMessageNotShow = true;
repeat
if HasBorderguardKey(PLAYER_1, GREEN_KEY) and GreenKeymasterMessageNotShow then
GreenKeymasterMessageNotShow = false;
MessageBox(GetMapDataPath().."KeymasterMessage/Green.txt");
end;
if HasBorderguardKey(PLAYER_1, RED_KEY) and RedKeymasterMessageNotShow then
RedKeymasterMessageNotShow = false;
MessageBox(GetMapDataPath().."KeymasterMessage/Red.txt");
end;
if HasBorderguardKey(PLAYER_1, TAN_KEY) and TanKeymasterMessageNotShow then
TanKeymasterMessageNotShow = false;
MessageBox(GetMapDataPath().."KeymasterMessage/Tan.txt");
end;
sleep(5);
until(HasAllKeymasterFound())
end;
function HasAllKeymasterFound()
if HasBorderguardKey(PLAYER_1, GREEN_KEY) and HasBorderguardKey(PLAYER_1, RED_KEY) and HasBorderguardKey(PLAYER_1, TAN_KEY) then
MessageBox(GetMapDataPath().."KeymasterMessage/All.txt");
print("Keymaster thread finish");
return true;
end;
return false;
end;
Warnings:
Replace the global variables so that they don't take the value nil, for example, with 1 and 0. And replace false everywhere with nil.

As a result, if all references to empty global variables (with a value of nil) are removed, the warnings will also disappear.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

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