Greetings,
For those who saw the post title and immediately thought "break" or "return", please read below first as I explain the difficulty I am having with those functions.
In my game, I would like to have an introduction cutscene while in the main menu. This is a custom main menu that is a standalone map, and has characters moving around the map. The cutscene continuously runs via a while loop. (I.E: while map.name == "Modernintro" do) The while loop allows the cutscene to "reset". The difficulty I am having stems from the player being able to select a scenario to play during the cutscene. When this occurs, the game loads the selected scenario. However, error messages will pop up indicating that the script is still running despite the player being on a new map. The engine appears to not break from the while loop when the player selects a scenario, thus it continues to run.
I have attempted various solutions:
Putting the below in the while loop.
if map.name != "Modernintro" then
return;
end;
This only works if it is in between functions on the script, meaning it has to be repeated after every wait() or move_entity() function. (Which is not ideal, and furthermore leads to the engine crashing to desktop if I use it too much).
I have also attempted a function that has the same code snippet above in the function. However, I will still get error messages, meaning the function is only returning from the function and not the while loop.
I have attempted using another while loop with the above code. The script will not proceed past that point to perform the rest of the intro.
That's as best of a summary I can provide. To my knowledge there is no stop_script("insertscriptnamehere") function that I can use. I suppose I could attempt to make the intro without a while loop and simply execute itself again when it completes, but I think I would still have the same issue where the script still attempts to run after the player selects a scenario. Any assistance is appreciated.