LoneGazebo / Community-Patch-DLL

Community Patch for Civilization V - Brave New World
Other
290 stars 160 forks source link

Runtime Error in map generation #8658

Closed Soren217 closed 2 years ago

Soren217 commented 2 years ago

1. Mod version, and DirectX version if reporting a graphical issue (X.Y.Z, e.g. 1.4.4, DX 10 & 11):

1.4.4

2. Mod list (if using Vox Populi only, leave blank):

Custom Advanced Setup Screen (v.5)

3. Error description:

When using the Custom Advanced Setup Screen mod with CBP, the Communitas map generator fails to place luxury resources and the log reports this:

[9514.421] Runtime Error: C:\Users\Z217\Documents\My Games\Sid Meier's Civilization 5\MODS\(6a) Vox Populi - Compatibility Files (EUI)\LUA\AssignStartingPlots.lua:8596: attempt to compare number with nil
stack traceback:
    C:\Users\Z217\Documents\My Games\Sid Meier's Civilization 5\MODS\(6a) Vox Populi - Compatibility Files (EUI)\LUA\AssignStartingPlots.lua:8596: in function 'AssignLuxuryToRegion'
    C:\Users\Z217\Documents\My Games\Sid Meier's Civilization 5\MODS\(6a) Vox Populi - Compatibility Files (EUI)\LUA\AssignStartingPlots.lua:8808: in function 'AssignLuxuryRoles'
    C:\Users\Z217\Documents\My Games\Sid Meier's Civilization 5\MODS\(1) Community Patch\Mapscripts/Communitas.lua:8183: in function 'PlaceResourcesAndCityStates'
    C:\Users\Z217\Documents\My Games\Sid Meier's Civilization 5\MODS\(1) Community Patch\Mapscripts/Communitas.lua:967: in function 'StartPlotSystem'
    Assets\DLC\Expansion2\Gameplay\Lua\MapGenerator.lua:815: in function <Assets\DLC\Expansion2\Gameplay\Lua\MapGenerator.lua:779>
    =[C]: ?
[9515.234] LoadScreen: GameInfo.PolicyBranchTypes[-1] is undefined`

It seems caused by this commit:

https://github.com/LoneGazebo/Community-Patch-DLL/commit/12d464fb35dffe29e5245900476ddf6b06d32e97

At least, commenting out this section in AssignStartingPlots.lua fixes it:

                    elseif res_ID == self.silver_ID or res_ID == self.fur_ID then
                        if (region_type == RegionTypes.REGION_TUNDRA and self.startLocationConditions[region_number][8] >= 2) or
                            (region_type == RegionTypes.REGION_DESERT and self.startLocationConditions[region_number][9] >= 2) then
                            -- enough tundra/desert to place the silver/furs at start location
                            table.insert(resource_IDs, res_ID);
                            local adjusted_weight = resource_options[2] / (1 + self.luxury_assignment_count[res_ID]);
                            table.insert(resource_weights, adjusted_weight);
                            iNumAvailableTypes = iNumAvailableTypes + 1;
                        else
                            -- debug
                            print("Luxury", res_ID, "cannot be placed in region", region_number, "due to a lack of corresponding terrain at start location.");
                        end

(Also, the reason for using this mod is just for easy hotseat setup, but it happens even if only one player is set to human.)

jayeye2011 commented 2 years ago

not gonna like this answer I think https://github.com/LoneGazebo/Community-Patch-DLL/issues/8617#issuecomment-1032155058

Soren217 commented 2 years ago

Oh, didn't think to check the closed ticket section for this, sorry.

It is strange though, I only encounter this issue with the custom advanced setup screen mod.