Resource Generator (Lua component)

So, the latest problem I am having now, is that apparently the resources reload when a save is loaded. I am not yet sure if they are simply loaded on top of the old resources, or if it is completely reshuffled, but it sounds like some reshuffling is going on.

Do you know anything about why that might be happening? And could you put a line in there that keeps it from generating on a save? :)

Wow I never thought about this :lol:

you are right the resources will be regenerated again when you load a saved game, I will fix this for sure !
 
The earliest event you can hook into at present is, I believe, the start/restart game. To only run on mapgen, I think you have to mod the mapgen or resource-scattering code.

Maybe we should agree a new AddIn name to use for immediate-after-map-gen and a standard modding a core file to address it.
 
@Decimatus

Thanks for pointing at that fatal bug, it is now fixed in the new version. Download the files again from my first post.

No problem, thanks for fixing it so quickly. :)

Seems to work in my quick little test, so I will send it to the users and see how it goes.
 
I was trying to increase the quantity of key resources that appear on the map but haven't been having much luck.

Spoiler :
-- Now multiply quantity with modifiers
iQuantity = iQuantity * option_modifier *NumCivs_modifier;

-- Increase Iron by 50%
if New_ResourceType == "RESOURCE_IRON" then
iQuantity = iQuantity * 5;
end
-- Increase Horse by 50%
if New_ResourceType == "RESOURCE_HORSE" then
iQuantity = iQuantity * 5;
end
-- Increase Coal by 50%
if New_ResourceType == "RESOURCE_COAL" then
iQuantity = iQuantity * 5;
end
-- Increase Oil by 50%
if New_ResourceType == "RESOURCE_OIL" then
iQuantity = iQuantity * 5;
end
-- Increase Aluminum by 50%
if New_ResourceType == "RESOURCE_ALUMINUM" then
iQuantity = iQuantity * 5;
end
-- Increase Uranium by 50%
if New_ResourceType == "RESOURCE_URANIUM" then
iQuantity = iQuantity * 5;
end


I used 5 just to see a visible effect on the map, but there is none. Is my formatting incorrect?
 
Yes the formatting is correct, what is the effect that you get?? you get no resources at all?

note that max quantity for any resource is limited to 320 on any map size.

Just no change whatsoever. Before I change it, 0-3 nodes of horse and iron on each continent of a dual map. After the change, 0-3 nodes per continent.
 
Just no change whatsoever. Before I change it, 0-3 nodes of horse and iron on each continent of a dual map. After the change, 0-3 nodes per continent.

That depends on defined terrains and features, even if you put 999 resource defined on Jungle and then you randomly get 1 jungle in the map , then you will get 1 resource only. if you define something common like grass you will see more resources.
 
That depends on defined terrains and features, even if you put 999 resource defined on Jungle and then you randomly get 1 jungle in the map , then you will get 1 resource only. if you define something common like grass you will see more resources.

Well both horse and iron for instance come on some pretty common terrain types, and there are plenty of empty hills, grass, and plains.

But I even multiplied all vanilla strategics by 5, without noticeable difference in anything.
 
Well both horse and iron for instance come on some pretty common terrain types, and there are plenty of empty hills, grass, and plains.

But I even multiplied all vanilla strategics by 5, without noticeable difference in anything.

I cant tell the reason for that without looking at the files. Is that only happening to Iron and horses? do other resources increase or no increase on all resources?

I will do a test from my side to see.
 
I cant tell the reason for that without looking at the files. Is that only happening to Iron and horses? do other resources increase or no increase on all resources?

I will do a test from my side to see.

I glanced at the other resources and didn't see any likely changes. I probably should have had firetuner open when I tested, because it would at least tell me if it is only placing 10% of those resources or something. I will try that out when I get home.
 
This looks like a great mod, trying to get it to work right now. I can't seem to get the resources to load on the map, all the files are imported into VFS, i added the content row, changed the name after MY_MOD_NAME in AddNewResources and added the resources to the file. Is there anything i missed? also i noticed that in the chocolate example you use ART_DEF_RESOURCE_SPICES, but in the the database this is ART_DEF_RESOURCE_SPICE.
 
Does this still function with gods and kings?
 
The world builder scatter resources function does not seem to work properly. It only scatters one of each resource. And since I want my mod to be replayable, I would like all resources to respawn at game start.

Can this mod be used on a fixed map to generate vanilla resources such as iron/sugar/wheat etc.?

It seems you need to change the amount in line:
resourceCount = math.max(1, resourceCount);

in file WorldBuilderRandomItems.lua in Expansion/Gameplay/lua

Worked like a charm to me, both in game or world builder.
 
Before I start using this for a project, is it compatible with G&K? I really love the concept, especially because I'm adding an entirely new set of strategic and luxury resources, which would make my life tremendously easier.
 
Top Bottom