AssignStartingPlots defaults for VP

Settings?

Low Seas, otherwise standard. My mod just changes the formula for where land spawns and grows the total size of the map (for more water), doesn't do anything else.
 
Can you try mine with Oval? If it fails, please upload Lua.log here.
 
Here you have all the changes agreed, except for the extra trees around capitals. @azum4roll, do you want to try?
Replace the file in MODS/(6x) Community Balance Overhaul -Compatibility files/LUA.


Edit. I've modified how major deposit works. Now if it is set to be 4 horses, it will produce randomly 2, 3 or 4 horses per deposit.

Edit 2. Forgot to reduce stones on hills. Fixed!

I'm testing this at the moment, and I noticed an odd visual bug. The marsh feature has the appearance of tundra lol.

Spoiler :
20200909161345_1.jpg
Spoiler :
20200909161350_1.jpg

Edit: I'm noticing some other things, but unsure if it's from this or something else (I also just installed the 9/8 hotfix and am using the Really Advanced Setup mod at the moment). The colouration of the terrain features looks a little different to usual. Also, there are no ancient ruins turning up so far (although I don't have the 'no ancient ruins' box ticked in the map settings).
 
Last edited:
Marsh looking like tundra means the code hasn't been properly executed (some error occurred). You can check Lua.log for details.

Alternatively, try my version ;)
 
Marsh looking like tundra means the code hasn't been properly executed (some error occurred). You can check Lua.log for details.

Alternatively, try my version ;)
I downloaded and tried it, also got the marsh like tundra. Perhaps I didn't follow the instructions correctly? What needs to be done?
 
I downloaded and tried it, also got the marsh like tundra. Perhaps I didn't follow the instructions correctly? What needs to be done?
Extract directly into the 6a folder (it's correct if it asks you whether to replace), then preferably delete cache and restart the game. I tested on Continents, so if some other map doesn't work please upload the Lua.log here.
 
I'm testing this at the moment, and I noticed an odd visual bug. The marsh feature has the appearance of tundra lol.


Edit: I'm noticing some other things, but unsure if it's from this or something else (I also just installed the 9/8 hotfix and am using the Really Advanced Setup mod at the moment). The colouration of the terrain features looks a little different to usual. Also, there are no ancient ruins turning up so far (although I don't have the 'no ancient ruins' box ticked in the map settings).
I think this is related to texture sets. Every large continent is set to a set of textures: asian, african, american, ... I noticed that one of these textures misses some sprites.
 
How/where do I delete the cache? :)
Documents\My Games\Sid Meier's Civilization 5\cache

Delete the whole folder.

EDIT: I tested my script with Oval. Nothing wrong.
 
Last edited:
I tried deleting the cache, reinstalled VP first to be sure I hadn't messed anything up by accident and then replaced the starting plots doc. Playing without other mods in case I was getting a conflict there. Still getting strange results unfortunately, tu.

Spoiler :
20200911142043_1.jpg

Will give azum's version a try.

Edit: I notice this version has two files: the starting plots file and the feature generator. Should the first one have had two files in as well, or do they change different things?
 
FeatureGenerator was modified to make each jungle plot have 25% chance to be grassland.

I know why the @tu_79 script doesn't work. math.round isn't a thing in Lua.
 
So far so good with yours, azum :). Stone and bison at very reasonable levels, some bison next to one capital which is nice. Horses seem good. No cold-climate bananas so far lol. No issues with capitals.

Spoiler :
20200911212636_1.jpg

I did see two minor sources of iron adjacent to one another, and ideally I'd prefer them not quite that close. Also, I didn't see any grassland jungle unfortunately?

Spoiler :
20200911201900_1.jpg

Personally I would prefer luxury resources not to be directly adjacent as well but I'm not too fussed about that. One thing I would like to request if it's possible is more atolls. I found one I could work in one of my cities this game, and that doesn't happen very often. IMO a couple more lakes would be interesting a well ^^.
 
FeatureGenerator was modified to make each jungle plot have 25% chance to be grassland.

I know why the @tu_79 script doesn't work. math.round isn't a thing in Lua.
Holy shirt!
The text editor offered me the function so I was sure it would work.

Plus, it did generate a fine map for me.

A thing I was wondering if that the script may fail in some corner cases but the game will proceed equally. Is there a way to prevent the game from starting in case the map script don't reach the end?

EDIT.
Also, I think it would have more variability by having the amount of the deposits be chosen randomly between max amount and half this value. Would you try this?
Code:
                            -- added by azum4roll: give some variance to strategic amounts
                            local rand = Map.Rand(10000, "ProcessResourceList - Lua") / 10000
                            quantity = math.max(1, math.floor(0.5 + quantity * (1 - 0.5 * rand)))

Edit 2.
I'm testing this formula now, and it gives horses in amounts from 2 to 5. Maybe the deposits of 2 horses come from the minor deposits, so the general generator is producing deposits from 3 to 5 units. The formula does not give proper results.:confused: Maybe
"quantity = math.max(1, math.floor(quantity * (1 - 0.5 * rand)))"
Consider also changing the max value for horses generated in tundra and desert, I'm sure it is not working as intended:
Code:
    resources_to_place = {
        {self.horse_ID, math.ceil(horse_amt * 0.7), 100, 2, 3}
    };
    self:ProcessResourceList(40 * resMultiplier, 1, self.desert_wheat_list, resources_to_place);
    self:ProcessResourceList(70 * resMultiplier, 1, self.tundra_flat_no_feature, resources_to_place);
Right now the max amount for horses is 4. Horses in tundra are Ceil(4*0.7) = 3.
I think it should be Floor(4*0.5) = 2, with a minimum of 1.
meaning: math.max(1, math.floor(horse_amt * 0.5))

EDIT 3. Here's something I don't get. Check this.
Code:
                    if self.strategicData[plotIndex] == 0 then
                        local x = (plotIndex - 1) % iW;
                        local y = (plotIndex - x - 1) / iW;
                        local res_plot = Map.GetPlot(x, y)
                        if res_plot:GetResourceType(-1) == -1 then -- Placing this strategic resource in this plot.
                            local res_addition = 0;
                            if res_range[use_this_res_index] ~= -1 then
                                res_addition = Map.Rand(res_range[use_this_res_index], "Resource Radius - Place Resource LUA");
                            end
                            local quantity = res_quantity[use_this_res_index]
                            -- added by azum4roll: give some variance to strategic amounts
                            local rand = Map.Rand(10000, "ProcessResourceList - Lua") / 10000
                            quantity = math.max(1, math.floor(quantity * (1 - 0.5 * rand)))
                            res_plot:SetResourceType(res_ID[use_this_res_index], quantity);
                            if (Game.GetResourceUsageType(res_ID[use_this_res_index]) == ResourceUsageTypes.RESOURCEUSAGE_LUXURY) then
                                self.totalLuxPlacedSoFar = self.totalLuxPlacedSoFar + 1;
                            end
                            self:PlaceResourceImpact(x, y, impact_table_number, res_min[use_this_res_index] + res_addition);
                            placed_this_res = true;
                            self.amounts_of_resources_placed[res_ID[use_this_res_index] + 1] = self.amounts_of_resources_placed[res_ID[use_this_res_index] + 1] + res_quantity[use_this_res_index];
                        end
                    end
The original code creates a resource with "res_quantity[use_this_res_index]" as the strategic amount in the deposit. It then discounts this same value from the amount of resources placed. But since you added a new variable "quantity", the amount actually placed and the amount the the script thinks it has been placed don't match, do they?
 
Last edited:
Here. I've tweaked the value each deposit can yield to be something random between 1 and the max value and also fixed the account for the total number of strategics. It's working fine for me on Continents.
The change:
Code:
                            -- added by azum4roll: give some variance to strategic amounts
                            local rand = Map.Rand(99, "ProcessResourceList - Lua") / 100
                            local quantity = res_quantity[use_this_res_index]
                            quantity = math.max(1, math.floor(1 + 0.5 * quantity * (1 + rand))) --tu_79 fix
                            res_plot:SetResourceType(res_ID[use_this_res_index], quantity);
                            if (Game.GetResourceUsageType(res_ID[use_this_res_index]) == ResourceUsageTypes.RESOURCEUSAGE_LUXURY) then
                                self.totalLuxPlacedSoFar = self.totalLuxPlacedSoFar + 1;
                            end
                            self:PlaceResourceImpact(x, y, impact_table_number, res_min[use_this_res_index] + res_addition);
                            placed_this_res = true;
                            self.amounts_of_resources_placed[res_ID[use_this_res_index] + 1] = self.amounts_of_resources_placed[res_ID[use_this_res_index] + 1] + quantity; -- tu_79 fix
 

Attachments

Also, I didn't see any grassland jungle unfortunately?
You have to overwrite the modinfo file too so the game reads the new FeatureGenerator.
Is there a way to prevent the game from starting in case the map script don't reach the end?
Not that I know of, and I'd rather not CTD for a mapscript failure. It's obvious anyway with those marshes.
EDIT.
Also, I think it would have more variability by having the amount of the deposits be chosen randomly between max amount and half this value. Would you try this?
Code:
-- added by azum4roll: give some variance to strategic amounts
local rand = Map.Rand(10000, "ProcessResourceList - Lua") / 10000
quantity = math.max(1, math.floor(0.5 + quantity * (1 - 0.5 * rand)))
Edit 2.
I'm testing this formula now, and it gives horses in amounts from 2 to 5. Maybe the deposits of 2 horses come from the minor deposits, so the general generator is producing deposits from 3 to 5 units. The formula does not give proper results.:confused: Maybe
"quantity = math.max(1, math.floor(quantity * (1 - 0.5 * rand)))"
Consider also changing the max value for horses generated in tundra and desert, I'm sure it is not working as intended:
Code:
resources_to_place = {
{self.horse_ID, math.ceil(horse_amt * 0.7), 100, 2, 3}
};
self:ProcessResourceList(40 * resMultiplier, 1, self.desert_wheat_list, resources_to_place);
self:ProcessResourceList(70 * resMultiplier, 1, self.tundra_flat_no_feature, resources_to_place);
Right now the max amount for horses is 4. Horses in tundra are Ceil(4*0.7) = 3.
I think it should be Floor(4*0.5) = 2, with a minimum of 1.
meaning: math.max(1, math.floor(horse_amt * 0.5))
I intended for tundra/desert major horses to range 2-4 (normal ones are 3-5). Minor horses stay 2.

A 80%-120% variance is more natural than a 50%-100% one, don't you think?
EDIT 3. Here's something I don't get. Check this.
Code:
if self.strategicData[plotIndex] == 0 then
local x = (plotIndex - 1) % iW;
local y = (plotIndex - x - 1) / iW;
local res_plot = Map.GetPlot(x, y)
if res_plot:GetResourceType(-1) == -1 then -- Placing this strategic resource in this plot.
local res_addition = 0;
if res_range[use_this_res_index] ~= -1 then
res_addition = Map.Rand(res_range[use_this_res_index], "Resource Radius - Place Resource LUA");
end
local quantity = res_quantity[use_this_res_index]
-- added by azum4roll: give some variance to strategic amounts
local rand = Map.Rand(10000, "ProcessResourceList - Lua") / 10000
quantity = math.max(1, math.floor(quantity * (1 - 0.5 * rand)))
res_plot:SetResourceType(res_ID[use_this_res_index], quantity);
if (Game.GetResourceUsageType(res_ID[use_this_res_index]) == ResourceUsageTypes.RESOURCEUSAGE_LUXURY) then
self.totalLuxPlacedSoFar = self.totalLuxPlacedSoFar + 1;
end
self:PlaceResourceImpact(x, y, impact_table_number, res_min[use_this_res_index] + res_addition);
placed_this_res = true;
self.amounts_of_resources_placed[res_ID[use_this_res_index] + 1] = self.amounts_of_resources_placed[res_ID[use_this_res_index] + 1] + res_quantity[use_this_res_index];
end
end
The original code creates a resource with "res_quantity[use_this_res_index]" as the strategic amount in the deposit. It then discounts this same value from the amount of resources placed. But since you added a new variable "quantity", the amount actually placed and the amount the the script thinks it has been placed don't match, do they?
Oops. That only affects the logged value though. Uploaded the fix.
 

Attachments

80%-120% variance is more natural than a 50%-100% one, don't you think?
Not sure. It works better when deposit sizes are big, since you are discounting a percentage. And you are giving a 20% chance to have something bigger, 20% for something smaller, 60% for the stated max value.
As I've put this, there's a full random range between the max value and half the max value, so it's easier to find horses with stacks of 3 and 2, which gives more variety.
 
Back
Top Bottom