Skip to content
User Avatar
#2769
Auto-translated
OrnsteinDragonslayer
function Turma ()
         while (1) do
         if b == 0 and w == 0 then
            MessageBox("/Maps/SingleMissions/rework (4)/turmaLOCK.txt");
         end
         if b == 1 and w == 1 and var == 1 then
            MessageBox("/Maps/SingleMissions/rework (4)/turmaUNLOCK.txt");
            SetObjectiveState("suppDruid", OBJECTIVE_COMPLETE);
            RemoveObject("druid");
            RemoveObject("elf1");
            RemoveObject("elf2");
            RemoveObject("elf3");
            RemoveObject("elf4");
            RemoveObject("elf5");
            RemoveObject("elf6");
            RemoveObject("elf7");
            RemoveObject("elf8");
            MessageBox("/Maps/SingleMissions/rework (4)/unicorn.txt");
            OpenCircleFog(198, 64, 0, 2, PLAYER_1)
            MoveCamera(198, 64, 0, 30, 1.3, 1, 1, 1, 1);
            sleep(5)
            PlayObjectAnimation("unicorn", "happy", ONESHOT_STILL);
            sleep(15)
            RemoveObject("unicorn");
         end
         if b == 1 and w == 1 and a == 1 then
            MessageBox("/Maps/SingleMissions/rework (4)/turmaDEAD.txt")
         end
Trigger(OBJECT_TOUCH_TRIGGER, "turma");
break
end
end;

Trigger(OBJECT_TOUCH_TRIGGER, "turma", "Turma" );

The question is about complexity. There is an object called "Turma". When touched, a specific message should appear, depending on the conditions specified in the script. My problem is that when touched for the first time, everything is okay (the first condition, when b and w == 0), but when b == 1, w == 1, var == 1, it gives an error. Also, when b == 1, w == 1, a == 1.
Here is the error

The conditions that set the coefficients:
function QochComplete ()
         while (1) do
             sleep(2);
             if (Exists('white') == nil) then
                SetObjectiveState("Qo-ch", OBJECTIVE_COMPLETED);
             w = 1
             break
             end
         end
end

startThread(QochComplete)

function QobComplete ()
         while (1) do
               sleep (2)
               if (Exists('black') == nil) then
                  SetObjectiveState("Qo-b", OBJECTIVE_COMPLETED);
               b = 1
               break
               end
         end
end

startThread(QobComplete)
         
GetHeroName is a function that caused the error - it's from the combat script, so the error should be looked for in the combat script.
Regarding the script itself: it's not clear why there is a loop; the trigger is written incorrectly - there is no function name or nil.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

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