Creating a unit at the start of the game?

Thalassicus

Bytes and Nibblers
Joined
Nov 9, 2005
Messages
11,057
Location
Texas
I noticed that if I initialize a unit outside any functions (as the lua file loads), the unit graphic gets "stuck" ingame (when the unit is moved, a copy of the visual graphic is left behind). How can I properly create a unit at the start of the game?
 
use Events.SequenceGameInitComplete.Add( whateverFunctionYouUseForInitialisingUnits ) to wait for the graphic engine to be loaded (this event is called when the button "Begin your journey" appears on the DoM screen.

There is also the event LoadScreenClose that is called when you close the DoM screen.

As you've noted that the game data saving is screwed (since 1.0.1.511 ?) you'll have to use saveutils to check if it's a new game or a saved game reloaded (or use game turn 0, but that can be exploited)
 
(double post)
 
As you've noted that the game data saving is screwed (since 1.0.1.511 ?) you'll have to use saveutils to check if it's a new game or a saved game reloaded (or use game turn 0, but that can be exploited)

oups, just found UI:IsLoadedGame(), will be useful :D
 
Back
Top Bottom