Question about threads. I don't know much about them, but I think I need them here, so I'm asking for help.
There are several special neutral creatures. After they are destroyed, a trigger should activate (probably), and a reserve hero should appear.
How is this implemented?
Something like this:
function fun()
while (1) do
sleep(2);
if (Exists('neutral1') == nil) and (Exists('neutral2') == nil) then
fun2();
break
end;
end;
end;
startThread(fun);The function fun checks in a loop whether the objects neutral 1 and 2 exist. As soon as they disappear, the function fun2() is executed. startThread can be written immediately after loading the map, or when you need it (for example, when you receive a quest for the neutral creatures).
And a second question, not about threads: can one trigger activate multiple functions? How do I write this?
For example, will a trigger like this work - Trigger(REGION_ENTER_AND_STOP_TRIGGER , "dialog", "Dialog1", "function2", "function3", "function228"); ?
Perhaps it can be done somehow, but I would launch them in a chain:
Trigger(REGION_ENTER_AND_STOP_TRIGGER , "dialog", "Dialog1")
function Dialog1 ()
...
function2();
end;
function function2 ()
...
function3();
end;
and so on.