Is there an "init" or "start" function that the game calls?
Posted: Tue Oct 28, 2014 5:26 am
I am still new to how scripting in this game works. The question I have is whether there is a starting script that runs where I can add any up-front settings for the game. It seems all scripts must be tied to a connector, which means they are basically triggered. I want one that executes one time when the game starts.
I do see a script called init.lua. It does seem to execute when the map loads into the editor. I know this only because if I type syntax errors the map won't load. However, any global variables I set or anything else I do in there doesn't seem to be accessible inside the script entities you define in the map. I guess they don't seem to be global even though I do declare them outside any function in init.lua.
I do see a script called init.lua. It does seem to execute when the map loads into the editor. I know this only because if I type syntax errors the map won't load. However, any global variables I set or anything else I do in there doesn't seem to be accessible inside the script entities you define in the map. I guess they don't seem to be global even though I do declare them outside any function in init.lua.