Skip to content

Current questions and answers regarding the map editor.

User Avatar
#5407
Auto-translated
Jack_of_shadows
Azgalor does not support this feature in quest descriptions, and besides, you invented the syntax yourself. For it to work (where it can work), it must be written exactly as in the example - in curly braces, separated by semicolons, in the form of an assignment of a name from the text file and a value. But if there are only a few quest progress steps, you can create a separate description for each: "1 out of 3 demons collected", "2 out of 3 demons collected", etc. This is described in the FAQ in my signature.
Just indent all internal code blocks relative to the outer block, for example:
function red3()
print("Checking how many creatures Vlad has collected");
if red_troops_count ~= 3 then
red_troops_count = red_troops_count + 1;
print("Vlad has collected ", red_troops_count ," demons out of 3");
sleep(1);
SetObjectiveProgress( "test_obj", red_troops_count );
else
if red_troops_count == 3 then
SetObjectiveProgress( "test_obj", red_troops_count );
print("Vlad has collected all the demons. Arrivederci Signor Giocatore!");
end;
end;
end;


And there will be no problems with the 'end' statements, everything will be visually clear.

Yes, after submitting my question, I tried to write ObjectiveProgress like a message box, and received an error that the first argument was incorrect. It's a pity that the developers didn't implement this functionality for ObjectiveProgress as well, because, for example, I need the progress to change for each creature, and there are 20-30 of them planned (I only set 3 for testing the script), and for this I will have to create 30 text files?... Well, okay, true heroes always find a workaround, as they say. 😄 For now, I'll download the FAQ from your signature and read what's in it.

Are internal code blocks relative to the outer block things like checks and sub-functions? Like if, while, SetObjectiveState? I'm a complete zero in scripting terms. 💀



Added 1 minute ago
}{0TT@6bI4
I also recommend using a script editor that kindly prompts you about missing 'end' statements and highlights which block is not closed.
I downloaded it, but haven't used it. I only read the introduction about Lua and what checks there are, etc. Thanks to it, I learned what an array is. I need to try working with it.