Resource Generator (Lua component)

Yes it is still compatible with G&K, also BNW. I added a check for Natural Wonders to the script with the help of whoward69 to the copy I use in my resource mod(to make it compatible with some mods that remove Impassable for some Natural Wonders). I will attach it.
 
Yes it is still compatible with G&K, also BNW. I added a check for Natural Wonders to the script with the help of whoward69 to the copy I use in my resource mod(to make it compatible with some mods that remove Impassable for some Natural Wonders). I will attach it.

:goodjob:

Will include it into CCTP.
 
This mod comp. is super useful, so thanks a ton for uploading it.

I would like to use it in a mod where I plan to replace the game-default resource system with all new resources. I am struggling in this with the fact that the default resources are hard-coded into AssignStartingPlots.lua. I have seen (here and elsewhere in the forum) remarks about needing to remove those pieces from that file, but I haven't seen details on how. The file is fairly complicated and I don't want to just start deleting chunks of it without knowing what I'm doing.

Does someone already have a modified AssignStartingPlots.lua that simply does not add any resources at all? Ideally I'd like it to be BNW-compatible, but a version of the file like that for any version of the game would at least give me a place to start.

Thanks in advance!
 
I'm getting
Spoiler :
Runtime Error: Assets\DLC\Expansion2\Gameplay\Lua\AssignStartingPlots.lua:3505: attempt to perform arithmetic on field '?' (a nil value)
stack traceback:
Assets\DLC\Expansion2\Gameplay\Lua\AssignStartingPlots.lua:3505: in function 'AttemptToPlaceBonusResourceAtPlot'
Assets\DLC\Expansion2\Gameplay\Lua\AssignStartingPlots.lua:4333: in function 'NormalizeStartLocation'
Assets\DLC\Expansion2\Gameplay\Lua\AssignStartingPlots.lua:4579: in function 'BalanceAndAssign'
Assets\Maps\Continents.lua:315: in function 'StartPlotSystem'
Assets\DLC\Expansion2\Gameplay\Lua\MapGenerator.lua:815: in function <Assets\DLC\Expansion2\Gameplay\Lua\MapGenerator.lua:779>
=[C]: ?


and

Spoiler :
Runtime Error: C:\Users\JS_KANG\Documents\My Games\Sid Meier's Civilization 5\MODS\Mods\Caesar Mod (v 1)\LUA\Resources\ResGenerator.lua:339: attempt to concatenate local 'N' (a nil value)
[3295.718] Runtime Error: Error loading C:\Users\JS_KANG\Documents\My Games\Sid Meier's Civilization 5\MODS\Mods\Caesar Mod (v 1)\LUA/Resources/AddNewResource.lua.



and

I don't know
Code:
[3295.609] AddNewResource: Warning: cache not shared.
What does this mean
 
Code:
 Runtime Error: C:\Users\JS_KANG\Documents\My Games\Sid Meier's Civilization 5\MODS\Mods\Caesar Mod (v 1)\LUA\Resources\ResGenerator.lua:339: attempt to concatenate local 'N' (a nil value)
[3295.718] Runtime Error: Error loading C:\Users\JS_KANG\Documents\My Games\Sid Meier's Civilization 5\MODS\Mods\Caesar Mod (v 1)\LUA/Resources/AddNewResource.lua.

This issue arises due to assumptions made in the table structure for distributing strategics that don't have an entry in Resource_QuantityTypes.

Easily solved by changing this
Code:
N = Strategic_Distribution[i];   -- if strategic then get quantity to place

to this
Code:
N = Strategic_Distribution[i] or 1;   -- if strategic then get quantity to place
 
Nice mod. Works for me, but I get this warning.....

[2697851.104] AddNewResource: Warning: cache not shared.

No idea what this means... something to do with SaveUtils.lua, which I don't understand.

Anyone know? Can I ignore it?

Thanks.
 
Did everything according to instruction. Luxury does not appear in my game.
 
Thanks Deep Blue for the code and workaround suggestions!

A simple solution to the resource map-location allocation problem occurred to me. This extremely oversimplified approach might work perfectly for some, but not others.

If (and this is a big if) a mod has the same number of resources desired as the original, the resource allocation logic could be tricked by the names of the references to the details of the resources.

Supposing I wanted a zinc resource instead of Iron. I could simply replace all XML details referred to as "Iron" with the details of my zinc resource (including the in-game and Civilopedia text of "zinc" for this Iron resource slot). I would have "zinc" details behind RESOURCE_IRON and TXT_RESOURCE_IRON_DESCRIPTION type references. The allocation logic would then probably distribute my zinc resource in exactly the same manner Iron is currently placed onto the map.

The downside, is that no true Iron resource would be allocated. Perhaps I could put the details for the Iron resource in what the Lua allocation logic refers to as "Uranium" or a "strategic" resource. I could change all the XML details for Uranium references to match the original XML definitions of Iron. I would be placing the iron details behind the RESOURCE_URANIUM style references. I would not mind at all if Uranium was not available as a resource. In the XML, I could even mod all Uranium dependent items (units, buildings, etc.) to no longer be dependent on Uranium if I wish. The reason I wouldn't start by replacing URANIUM references with my new "zinc" definitions would be that URANIUM might have aspects I prefer to be applied to the old Iron definitions. It would just seem easier in some cases by playing musical chairs in rearranging the resource definitions.

This is a very limited approach. But it might work for those who wish to add a new resource, and are willing to remove, eliminate, or ignore an existing "vanilla" resource from the same class (bonus, luxury, strategic).

This approach might be very appropriate for a mod I am currently working on. My goal was to start each of 12 civilizations with a unique luxury resource requiring the plantation improvement within each capital city. Since there are only 9 plantation improved luxury resources in BNW, this was not possible (only 8 in G&K prior to cocoa). I think I will try to simply trick the game in the way I suggested by plugging in my additional new plantation improved luxury resource details into the slots currently used for coastal (fishing boat improved) luxury resources. I will change the XML details such that previous fishing boat improved resources become plantation improved. Of course I would need to switch up the terrain booleans.

Crossing my fingers. Will probably post about the success or failure of this hair-brained approach afterward.

I haven't seen anything in code or XML files to indicate that the reference name of a resource has anything at all to do with resource map allocation logic. However, the behavior I am observing is that only the original vanilla resources are ever allocated on any map automatically generated with my mod. This happens either without modding any allocation logic, or alternatively attempting to use your approach. In other words, all of my newly created resources are totally being ignored in the resource map-location allocation process.

With my typical approach to things in life, I was having so much fun creating a few new resources that I went a little overboard and ended up creating 37 new resources altogether. LOL That is far too many for a balanced game on even the largest map. But at least I'm not stuck with the standard boring ones I've seen a thousand times before. At least, I mean, I am only stuck with the in-game 3D animated graphical representations of the vanilla resources (until I learn how to mod 3D graphics).

I was not successful in following your suggested approach. I probably set things up incorrectly or didn't follow instructions perfectly. Or maybe 37 new resources were even too much for your approach. Or maybe something has changed with BNW which is preventing my mods to work with your approach. I'm not too worried, because my original plan for a mod adding 37 new resources was to only use maps where I explicitly designate resource locations by creating a map in World Builder. Probably not worth my time to debug what I might have done wrong attempting to follow your approach.

By the way, last night, I was about ready to dive into the 3D animated graphics modding world. But it occurred to me at the last minute that much of my learning curve might be completely obsoleted with the release of Civilization 6. I am sure I would gain much generally applicable experience (within the gaming industry) by learning how to mod things in the Civilization 5 manner. I just don't have the slightest clue about how much of the acquired knowledge would become a total waste relative to Civilization 6.

I would appreciate if you (or anybody else) could provide some insight about your best guess regarding how much of my Civ 5 graphics learning curve might help in Civilization 6 3D animated graphics mods. You seem to be fairly proficient, experienced, and knowledgeable on the topic even if you have absolutely no inside information about Civ 6 yet. I am a software developer and reasonably adept at learning such things. I am not too inept at artistic matters in general either (I use Gimp often). I already understand many of the theoretical concepts of animated 3D graphics.

Thanks again.
 
I wish I would have started my resource mod project by first looking at the AssignStartingPlots.lua. Much very helpful information included in that file, leading to a well documented system of map building. Thanks Bob Thomas and others involved!

I think my next efforts will be forked:
a) make minor tweaks to the AssignStartingPlots.lua which make better use of my resource mod.
b) Replace the AssignStartingPlots.lua with a much more simplified algorithm.

I see value in both paths of the fork at this time.

The current map generation system seems wonderful in creating reasonable, meaningful, varied maps with relationships interacting appropriately between civilization starting points, city states, terrain, and resource locations. I have never complained about an automatically generated map due to this useful algorithm.

However, as documented in the code, the algorithm was designed for only default vanilla terrains and resources.

I would like to attempt to create a much more random (and perhaps less cohesive) approach to map generation which would much better accommodate complete freedom in terrain and resource modding.

At least, that is my vision at the moment.

Reality will probably dictate I might never get past simple tweaks to the provided AssignStartingPlots.lua, code which better accommodate my specific resource mod.
 
Top Bottom