How can I find the starting positions for major Civs in a WorldBuilder map?

General Tso

Panzer General
Joined
Oct 12, 2007
Messages
1,548
Location
U. S. of A.
I would like to add resources and units to games started with a WorldBuilder maps but I'm having problems finding a place to "hook" my code. I want the resources and units to appear before the first player's turn starts and be relative to their starting position. I need the ability to add them after the player's starting positions have been defined but but before the first player's turn starts. I have no problem doing this with map scripts (I use MapGenerator.lua) but I can't find anything that works with WorldBuilder maps. Hooking from CaclulateNumResourcesToAdd in WorldBuilderRandomItems almost works but unfortunately the start positions do not seem to be defined at that point. Does anybody have any ideas on how I could get this done?
 
Code that executes when a Lua file is loaded (ie code not within a function) effectively executes after the map has been generated and the starting unit(s) placed but before the player sees the load screen dialog (the one with the DoM speech in it) - effectively it's an OnGameStart() event.

You just need to make sure you don't run the code again when the player loads a saved game - but that's easy to achieve with a flag in Modding.OpenSaveData()

See my "Maps - Rotate Start Position" mod MapsRotateStartPosition.lua file for further details
 
Thank you. I'll definitely check that out. Where do I find MapsRotateStartPosition.lua? The only thing I could find is Maps - Rotate Start Position (v 7).civ5mod.
 
Thank you. I'll definitely check that out. Where do I find MapsRotateStartPosition.lua? The only thing I could find is Maps - Rotate Start Position (v 7).civ5mod.

Download that, unzip it and it's in the LUA sub-directory of the mod
 
Thanks. It never occurred to me that civ5mod files where zipable.
 
Thanks. It never occurred to me that civ5mod files where zipable.

You'll need WinRar or 7zip, standard MS-Windows or things like WinZip don't seem to work (at least not the versions I have)
 
I used 7zip - that's my favorite decompression program. It hasn't failed me yet.
 
Back
Top Bottom