Clarification on eventGameInit / rules.js

For AI and campaign script related discussions and questions
Post Reply
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Clarification on eventGameInit / rules.js

Post by aubergine »

rules.js applies the baseType setting, during eventGameInit()

If a game is loaded, does eventGameInit() get called again?

If it does, how come there isn't a mass deletion of player-built structures due to the baseType setting being re-applied?
Last edited by aubergine on 02 Dec 2012, 20:23, edited 1 time in total.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: @Per: Clarification on eventGameInit / rules.js

Post by Per »

eventGameInit() is only run on initial game startup, and not on game load.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: @Per: Clarification on eventGameInit / rules.js

Post by aubergine »

Ah, that's interesting. Is the same true for eventStartLevel()?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: @Per: Clarification on eventGameInit / rules.js

Post by aubergine »

Also, if I setTimer() or queue() in eventGameInit() is there a possibility that those will get triggered before eventStartLevel() or do timed/queued function calls get held until after eventStartLevel()?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: @Per: Clarification on eventGameInit / rules.js

Post by Per »

eventStartLevel() is also not called on load.

Timers will not trigger between the two.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: @Per: Clarification on eventGameInit / rules.js

Post by aubergine »

Ah, most awesome! :)

*goes off to code an eventGameLoaded() add-on*
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Post Reply