SerialEvents fire not only when the features are created, but when they're revealed

Joined
Mar 6, 2003
Messages
775
As the title says, they're fired whenever a feature is first drawn on the active player's map; that doesn't necessarily mean when the feature is created, it could be when a tile is revealed and already has that feature on it. In FireTuner, click on Reveal/Refresh map and its obvious.

The Wiki doesn't note this.

I added the text for SerialEventImprovementCreated and SerialEventImprovementDestroyed, which I tested out.

http://wiki.2kgames.com/civ5/index.php/Lua_Game_Objects/Events#SerialEventImprovementCreated
http://wiki.2kgames.com/civ5/index.php/Lua_Game_Objects/Events#SerialEventImprovementDestroyed

SerialEventImprovementCreated fires twice in the course of creating an improvement, once when it draws the tile for a partially-made improvement, which begins when the Worker does the build action, and once for the fully complete improvement.

Both methods have two more arguments, which seem to always be the same value as eachother, and also seem correspond to the Continent art type. Oceans show as 0 , and building an improvement on a different land mass will give you a different number, while building it on the same land mass will give you the same number
 
Hmm important point, I didn't know that. So I guess we have to take care when the player goes exploring. Did you check what happens to CityCreated and the like?
 
Hmm important point, I didn't know that. So I guess we have to take care when the player goes exploring. Did you check what happens to CityCreated and the like?

No I didn't, but my guess is its the same thing.

I'm going to look at some of the other types of events to see if there are any that aren't related to the player map. All you really need to do is be able to hook the functions on the game objects , so like every time Plot.SetImprovementType is called.

I'm also experimenting with GameEventFactory to see if I can create game events
 
some good practices when using the events is to use a flag (= 1 or 0) variable to make sure you don't run whatever the event unlocks twice ( or more ). like citycreate iirc fires a few time, and so do many other things. but with a simple check for your specific application, it won't really matter how many times the civ5 engine fires these events because you're already taking care of handling the civ5 bugs at your script level
 
In general, the events under the Events namespace are UI-focussed. The events under GameEvents are actual underlying-data changes. At least, that seems to be the general thread. We really need at least as much docs on GameEvents as we were given for Events; if we have the event names, we can at least work out what the parameters are and how the return is used.
 
Back
Top Bottom