I'm just documenting eventStartLevel() and was wondering if this event also gets called after loadLevel()? I don't really know anything about, or understand, the loadLevel() function so I'm a bit stumped trying to work out these two API features.
As eventStartLevel() seems to be the preferred trigger point (at least for AI scripts) to initialise scripts and timers, etc., it would be useful to know if it's only ever called once per game (when game is started new or loaded from save game) or whether it might get called more than once in the same "game session".
Also, any info on loadLevel() much appreciated as I'll be documenting that soon too
eventStartLevel() -- is it also called after loadLevel()?
eventStartLevel() -- is it also called after loadLevel()?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: eventStartLevel() -- is it also called after loadLevel()
I don't really know that much about what goes on behind loadLevel() yet.
eventStartLevel() should only be triggered once per game. It is not called when a game is loaded (which should be completely transparent to scripts for now).
eventStartLevel() should only be triggered once per game. It is not called when a game is loaded (which should be completely transparent to scripts for now).
Re: eventStartLevel() -- is it also called after loadLevel()
Sorry to necro this old topic, but I was wondering if any more is known now about eventStartLevel() in the context of a new level being loaded in a campaign?
Specifically, it has become customary for scripters to use eventStartLevel() to define a number of timers and/or queued function calls.
In a campaign, the player starts a new mission thus firing eventStartLevel() which in turn starts timers running. If then loadLevel() is used, and eventStartLevel() is fired once more after that level loads, what happens to the timers that were set in the previous triggering of eventStartLevel()? If they are still running, and eventStartLevel() gets called again due to a level being loaded, would this mean that there could be multiple timers running for the same function thus doubling the number of times a function is being run (because now it has 2 timers hitting it)?
Specifically, it has become customary for scripters to use eventStartLevel() to define a number of timers and/or queued function calls.
In a campaign, the player starts a new mission thus firing eventStartLevel() which in turn starts timers running. If then loadLevel() is used, and eventStartLevel() is fired once more after that level loads, what happens to the timers that were set in the previous triggering of eventStartLevel()? If they are still running, and eventStartLevel() gets called again due to a level being loaded, would this mean that there could be multiple timers running for the same function thus doubling the number of times a function is being run (because now it has 2 timers hitting it)?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
- milo christiansen
- Regular
- Posts: 749
- Joined: 02 Jun 2009, 21:23
- Location: Perrinton Michigan
Re: eventStartLevel() -- is it also called after loadLevel()
I always used EVENTGAMEINIT in WZScript. (I think it has some underscores in its name but IDK) Any reason this won't work now?
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual
- Demigod Game Ganual
Re: eventStartLevel() -- is it also called after loadLevel()
There is eventGameInit in the JS API, which is called once at the start of a new game.
Most JS scripts are using eventGameInit() to do some code initialisation, and then eventStartLevel() to set a bunch of timers / queued function calls.
eventGameInit() from my understanding is the point at which you can start querying the map and game objects (but not issue any commands / research / production). Then it's only after eventStartLevel() that you can start doing things like research, etc.
Most JS scripts are using eventGameInit() to do some code initialisation, and then eventStartLevel() to set a bunch of timers / queued function calls.
eventGameInit() from my understanding is the point at which you can start querying the map and game objects (but not issue any commands / research / production). Then it's only after eventStartLevel() that you can start doing things like research, etc.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO