S3rgeus
Emperor
So I've added a new feature in XML and have gotten started on implementing the lua to distribute it across the map. I've been working on a simple InGameUIAddin approach to placing it on the map, rather than integrating it full-whack into AssignStartingPlots.lua. (Consequently, is this approach doomed to failure? I'm sure there are others who know more about feature distribution than me.) I don't need the new feature to be distributed in any pattern or frequency across the map, I just need large concentrations of it at the top and bottom. (Assuming the map Wraps in the x-direction.) So I've been taking cues from how the ice feature is placed in assignstartingplots.lua, and that's been helpful, but I've run into a few problems:
My file activates and places the feature at the end of the player's first turn (turns out the GameEvent PreGameStart also doesn't fire. If anyone knows of an event I can hang my function onto that fires before the game starts, that would be great.) and the feature doesn't show up graphically on the map. (I've used the marsh art define tag just so I have something to see.) I'm thinking this is because the map is already 'drawn', so there aren't any aesthetic changes after the game starts. Is there some kind of 'refresh' function that tells the game to reload the textures on the hexes?
My other problem is, obviously, not all map types have geography that is in any way similar, so a single distribution setting doesn't work too great. But, using the ice feature as a template again, I only see ice placed by a single algorithm in the assignstartingplots.lua, not in each map type's individual lua file, yet ice seems quite different on the different map types. Are there adjustments made for map type or world size that I'm missing?
As an aside, is there an easier way to iterate over the map than looping through all of the hexes starting at 0,0 all the way to mapwidth,mapheight?
There were other things I wanted to ask, but I can't remember everything that went wrong all at once.
EDIT: I want to be able to keep track of how many hexes of the new feature have been put down on the map, but over the course of the entire game rather than just while it's distributing it. Is it possible to declare a global variable that will be accessible at any time? (later turns) Or, more simply, what would be the best way to preserve a counting integer over the course of the game?
My file activates and places the feature at the end of the player's first turn (turns out the GameEvent PreGameStart also doesn't fire. If anyone knows of an event I can hang my function onto that fires before the game starts, that would be great.) and the feature doesn't show up graphically on the map. (I've used the marsh art define tag just so I have something to see.) I'm thinking this is because the map is already 'drawn', so there aren't any aesthetic changes after the game starts. Is there some kind of 'refresh' function that tells the game to reload the textures on the hexes?
My other problem is, obviously, not all map types have geography that is in any way similar, so a single distribution setting doesn't work too great. But, using the ice feature as a template again, I only see ice placed by a single algorithm in the assignstartingplots.lua, not in each map type's individual lua file, yet ice seems quite different on the different map types. Are there adjustments made for map type or world size that I'm missing?
As an aside, is there an easier way to iterate over the map than looping through all of the hexes starting at 0,0 all the way to mapwidth,mapheight?
There were other things I wanted to ask, but I can't remember everything that went wrong all at once.

EDIT: I want to be able to keep track of how many hexes of the new feature have been put down on the map, but over the course of the entire game rather than just while it's distributing it. Is it possible to declare a global variable that will be accessible at any time? (later turns) Or, more simply, what would be the best way to preserve a counting integer over the course of the game?