Hex Conquer (Borders Only)

Hi, my 3.1.1 game crashes on an AI's turn with this mod (removing it fixes the crash). Here is a zip with the mods I used (there were a few others, but this is the minimal amount required to load the game properly + Hex Conquer) and attached are the save and the logs. The crash occurs at the start of the Inuit turn and is probably related to Magdeburg being razed. I tried reassigning some of the likely problematic tiles or making them empty, but it didn't work (I didn't test every possible combination though). If it helps, Inuvik was previously captured by Prussia and liberated by Assyria.
Spoiler Mod list screenshot :
Screenshot (347).png
 

Attachments

  • Logs.zip
    8.4 MB · Views: 12
  • Gandhi_0293 AD-1365.Civ5Save
    2.7 MB · Views: 10
Hi, my 3.1.1 game crashes on an AI's turn with this mod (removing it fixes the crash). Here is a zip with the mods I used (there were a few others, but this is the minimal amount required to load the game properly + Hex Conquer) and attached are the save and the logs. The crash occurs at the start of the Inuit turn and is probably related to Magdeburg being razed. I tried reassigning some of the likely problematic tiles or making them empty, but it didn't work (I didn't test every possible combination though). If it helps, Inuvik was previously captured by Prussia and liberated by Assyria.
Spoiler Mod list screenshot :

Thanks for reporting -- unfortunately I won't have time to go through logs and trouble-shoot for a while, but a little more info might help me get a better idea of whats happening without waiting for an elusive free weekend to try loading all this up. I would expect something in the firetuner lua console output -- any errors there? The razing function activates on a player turn end, not its start, and only actually does anything when the razing city belonging to the player ending its turn is down to 1 pop. Situation here is a little unclear.

Can you confirm who is doing the razing, the player who's turn appears to be starting when the crash occurs, and player who's turn just ended, the city pop. on the crash turn, are any of the inuit unique improvements in the razing city radius, whether you get any lua error in firetuner console output? Also, have you or any of these mods changed city working radius?
 
Thanks for reporting -- unfortunately I won't have time to go through logs and trouble-shoot for a while, but a little more info might help me get a better idea of whats happening without waiting for an elusive free weekend to try loading all this up. I would expect something in the firetuner lua console output -- any errors there? The razing function activates on a player turn end, not its start, and only actually does anything when the razing city belonging to the player ending its turn is down to 1 pop. Situation here is a little unclear.

Can you confirm who is doing the razing, the player who's turn appears to be starting when the crash occurs, and player who's turn just ended, the city pop. on the crash turn, are any of the inuit unique improvements in the razing city radius, whether you get any lua error in firetuner console output? Also, have you or any of these mods changed city working radius?
Thanks for the quick response! The working radius of all relevant cities should be 3 - none of my mods change it (as far as I know), Prussia and Brazil did pick Tradition, but their capitals are far enough away (I guess Rio de Janeiro could work the other two city tiles, but their yields suggest this isn't the case). I'm not actually sure if the crash occurs at the end of Brazil's turn or at the start of the Inuit one. I assumed it was the latter since Brazil is at peace and the razing of Magdeburg will only be finished 2 turns from now, while the Inuit have a border with Prussia. As it turns out, they don't actually have any units near that border, so maybe Brazil is at fault after all. Anyway, here are a few screenshots in chronological order (I made some extra ones from earlier turns in case the border dynamics will tell you anything):
Spoiler Turn 263 - Prussia is at peace with the Inuit and the war with Assyria hasn't seen any city captures yet :
Screenshot (351).png

Spoiler Turn 284 - the Inuit have entered the war and Magdeburg is about to fall :
Screenshot (350).png

Spoiler Turn 285 - Assyria has captured Magdeburg and started razing it :
Screenshot (349).png

Spoiler Turn 293 - imminent crash, Assyria and Prussia at peace :
Screenshot (348).png

Spoiler Turn 293 - the other Inuit frontline; no tiles seem capturable by them or from them though :
Screenshot (354).png

Spoiler Turn 293 - Brazil just in case :
Screenshot (352).png

Spoiler FireTuner :
Screenshot (353).png
 
thanks for all the detail -- i'm not sure off the top here whats going wrong, but it does look like its happening either during or shortly after the razing check. As described previously, the razing check is just a loop through all that ending-turn player's cities, testing for whether each city is in razing status, and whether its pop = 1. When it identifies such a circumstance, it then does other stuff including a print statement -- but thats not happening here, and theres no lua errors anyway. So really all thats happening is a loop through all player cities with the two boolean checks that appear to execute properly, not sure what I can even investigate with this.

Its possible the firetuner output is a bit of red herring, eg the razing check completes successfully, and then whatever is queued up next somehow interferes and causes the crash. This razing check is the last thing the mod does at turnend, but its possible that the original mod code for turn-start checking plot conquers by military units is the next lua action, not sure, depends on mod load order and what other mods might be doing at turn end/start etc. If indeed you can confirm the game proceeds to next turn without this mod loaded (ie it wasn't just a one off fluke), then we can safely conclude there's something that needs fixing here. I am unsure if its my razing function or the original mod code.

Here's what i'd suggest as next step: open up the main.lua in the version of the mod you are loading in notepad++ or w/e text editor you prefer, and comment out my entire razing function. Its the last function in this file (that is not already commented out) ie you want to wrap the entire function itself as well as the GameEvents hook statement that follows in --[[ and ]]. Let me know if you're able to figure out what I'm talking about here, and whether this change has any effect on the crash.

Also, I'm not super familiar with all the other mods you have loaded -- nothing there suggests there should be a problem, but I wonder, do any of these confer unique abilities or yields or w/e in connection to tile ownership changes or razing cities?
 
Last edited:
thanks for all the detail -- i'm not sure off the top here whats going wrong, but it does look like its happening either during or shortly after the razing check. As described previously, the razing check is just a loop through all that ending-turn player's cities, testing for whether each city is in razing status, and whether its pop = 1. When it identifies such a circumstance, it then does other stuff including a print statement -- but thats not happening here, and theres no lua errors anyway. So really all thats happening is a loop through all player cities with the two boolean checks that appear to execute properly, not sure what I can even investigate with this.

Its possible the firetuner output is a bit of red herring, eg the razing check completes successfully, and then whatever is queued up next somehow interferes and causes the crash. This razing check is the last thing the mod does at turnend, but its possible that the original mod code for turn-start checking plot conquers by military units is the next lua action, not sure, depends on mod load order and what other mods might be doing at turn end/start etc. If indeed you can confirm the game proceeds to next turn without this mod loaded (ie it wasn't just a one off fluke), then we can safely conclude there's something that needs fixing here. I am unsure if its my razing function or the original mod code.

Here's what i'd suggest as next step: open up the main.lua in the version of the mod you are loading in notepad++ or w/e text editor you prefer, and comment out my entire razing function. Its the last function in this file (that is not already commented out) ie you want to wrap the entire function itself as well as the GameEvents hook statement that follows in --[[ and ]]. Let me know if you're able to figure out what I'm talking about here, and whether this change has any effect on the crash.

Also, I'm not super familiar with all the other mods you have loaded -- nothing there suggests there should be a problem, but I wonder, do any of these confer unique abilities or yields or w/e in connection to tile ownership changes or razing cities?
I commented out the razing function (by the way, Notepad++ has a comment shortcut - ctrl+Q) and the crash disappeared. I even enabled it again next turn (the one when Magdeburg would finish razing) and the game still proceeded, although it didn't reassign any of the last 7 tiles, even though 3 of them were in range of existing cities. It's strange that it happens when it does (at the end of Brazil's turn) when the only city being razed belongs to Assyria, whose turn is earlier, so presumably it worked fine for them.

About the other mods, Enlightenment era doesn't seem to do anything with razing cities, nor does New Beliefs (or if it does, those beliefs weren't picked) or any of the custom civs present in the game (or UUs from militaristic CS). As for tile ownership changes, are there even any other triggers than border expansion? Brazil's Gold Rush from Community Events fires on this turn, but on earlier tries it fired on a different turn and the crash was still there, so that one's not related, and all other major events from that mod have global notifications, so I know that they aren't firing for any relevant civ. The rest of the mods only affect the UI.
 
thanks for the shortcut, i've been doing it the slow way all this time. I'll take a look at revising that function, thanks for helping narrow down the issue. My code is certainly on the clunky side -- I wrote this somewhat quickly, while playing (still took my amateur coding skills several hours, mind you) to get the desired functionality, possible I overlooked something, and this kind of feedback is exactly what i was hoping for from community.

Looking at my function again for first time in a while, it assigns a player object to a variable but does not check if that variable == nil before trying to find that player's cities. I would expect a lua error and not a crash though, if player variable was in fact nil. Also I'm not sure how a nil player could ever end its turn to trigger this function, so I'm not sure this matters, but thats all that jumps off the screen at me for now. Its a little messy with nested if's maybe, but i'm not inclined to restructure it; messy code shouldn't give this crash necessarily.

Any chance there was an eliminated player in your game that used to have its turn between these two?

I'm going to post the code of my razing check function here, maybe we'll get some additional knowledgeable eyes to help pinpoint whats off. From described issue and lua output screenshot above, only the first 6 lines of this function appear to be executing when the problem occurs:
Spoiler :

Code:
function HexCREndTurn(iPlayer)
    print ("Hex CR razing check started")
    local pPlayer = Players[iPlayer]
    for city in pPlayer:Cities() do
        local pCity = city
        local pPlot = pCity:Plot()
        if pCity ~= nil and (pCity:IsRazing()) and (pCity:GetPopulation() == 1) then
            print ("Hex CR: city being razed has reached one pop")
            local pCityOwner = Players[pCity:GetOwner()]
            local pOwnerTeam = Teams[pCityOwner:GetTeam()]
            local iCityOriginalOwner = pCity:GetOriginalOwner()
            for i = 0, pCity:GetNumCityPlots()-1, 1 do
                local lPlot = pCity:GetCityIndexPlot(i)
                local ourCityAvailable = false
                local teamAvailable = false
                local allyAvailable = false
                local friendAvailable = false
                local noWarAvailable = false
                local dPactAvailable = false
                if (lPlot ~= nil) and ( (lPlot:GetOwner()) == (pCity:GetOwner()) ) then
                    local CityCandidates = {}
                    for pID = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
                        local nearCity, dist = getNearestCityWithException( pID, lPlot, pCity)
                        if (nearCity ~= nil) and (dist < 4) then
                            local us = (Players[pID] == pCityOwner)
                            local sameteam = (not us) and (Teams[Players[pID]:GetTeam()] == pOwnerTeam)
                            local friends = (not us) and (pCityOwner:IsDoF(pID))
                            local allies = (not us) and (pCityOwner:IsAllies(pID))
                            local war = (not us) and (pOwnerTeam:IsAtWar(Players[pID]:GetTeam()))
                            local dpact = (not us) and (pOwnerTeam:IsDefensivePact(Players[pID]:GetTeam()))
               
                            if us then
                                ourCityAvailable = true
                            end
                            if sameteam then
                                teamAvailable = true
                            end
                            if friends then
                                friendAvailable = true
                            end
                            if allies then
                                allyAvailable = true
                            end
                            if not war then
                                noWarAvailable = true
                            end
                            if dpact then
                                dPactAvailable = true
                            end
                            table.insert(CityCandidates, {iPlayer = pID, bUs = us, bTeam = sameteam, bFriends = friends, bAllies = allies, bWar = war, bDpact = dpact, cNearCity = nearCity})
                   
                        end
                    end
                    if #CityCandidates > 0 then
                        if ourCityAvailable then
                            for i = 1, #CityCandidates, 1 do
                                if CityCandidates[i] ~= nil then
                                    local lUs = CityCandidates[i].bUs
                                    if not lUs then
                                        table.remove(CityCandidates, i)
                                        i = i - 1
                                    end
                                end
                            end
                        elseif teamAvailable then
                            for i = 1, #CityCandidates, 1 do
                                if CityCandidates[i] ~= nil then
                                    local lTeam = CityCandidates[i].bTeam
                                    if not lTeam then
                                        table.remove(CityCandidates, i)
                                        i = i - 1
                                    end
                                end
                            end
                        elseif dPactAvailable then
                            for i = 1, #CityCandidates, 1 do
                                if CityCandidates[i] ~= nil then
                                    local lDpact = CityCandidates[i].bDpact
                                    if not lDpact then
                                        table.remove(CityCandidates, i)
                                        i = i - 1
                                    end
                                end
                            end
                        elseif allyAvailable then
                            for i = 1, #CityCandidates, 1 do
                                if CityCandidates[i] ~= nil then
                                    local lAlly = CityCandidates[i].bAllies
                                    if not lAlly then
                                        table.remove(CityCandidates, i)
                                        i = i - 1
                                    end
                                end
                            end
                        elseif friendAvailable then
                            for i = 1, #CityCandidates, 1 do
                                if CityCandidates[i] ~= nil then
                                    local lFriend = CityCandidates[i].bFriends
                                    if not lFriend then
                                        table.remove(CityCandidates, i)
                                        i = i - 1
                                    end
                                end
                            end
                        elseif noWarAvailable then
                            for i = 1, #CityCandidates, 1 do
                                if CityCandidates[i] ~= nil then
                                    local lNoWar = not CityCandidates[i].bWar
                                    if not lNoWar then
                                        table.remove(CityCandidates, i)
                                        i = i - 1
                                    end
                                end
                            end
                        end
                        local randPlayer = math.random(#CityCandidates)
                        local iAssignPlayer = CityCandidates[randPlayer].iPlayer
                        local AssignCity = CityCandidates[randPlayer].cNearCity
                        if AssignCity == nil then return end -- city not found?
                        if Map.PlotDistance( AssignCity:GetX(), AssignCity:GetY(), lPlot:GetX(), lPlot:GetY() ) < 4 then
                            print("reassigning plot belonging to nearly razed city")
                            if ourCityAvailable then
                                lPlot:SetOwner(-1, -1, false, false)
                            end
                            lPlot:SetOwner( iAssignPlayer, AssignCity, true, true )
                        end
                    end
                end
            end
        end
    end
end

GameEvents.PlayerEndTurnCompleted.Add(HexCREndTurn)

For the time-being, anyone using this mod that experiences strange crash should try disabling mod for the crash turn, or commenting out the razing check function as described above. This mod is lua-only so enabling/disabling should just activate/deactivate its functionality without desyncing the savegame database.
 
Last edited:
thanks for the shortcut, i've been doing it the slow way all this time. I'll take a look at revising that function, thanks for helping narrow down the issue. My code is certainly on the clunky side -- I wrote this somewhat quickly, while playing (still took my amateur coding skills several hours, mind you) to get the desired functionality, possible I overlooked something, and this kind of feedback is exactly what i was hoping for from community.

Looking at my function again for first time in a while, it assigns a player object to a variable but does not check if that variable == nil before trying to find that player's cities. I would expect a lua error and not a crash though, if player variable was in fact nil. Also I'm not sure how a nil player could ever end its turn to trigger this function, so I'm not sure this matters, but thats all that jumps off the screen at me for now. Its a little messy with nested if's maybe, but i'm not inclined to restructure it; messy code shouldn't give this crash necessarily.

Any chance there was an eliminated player in your game that used to have its turn between these two?

I'm going to post the code of my razing check function here, maybe we'll get some additional knowledgeable eyes to help pinpoint whats off. From described issue and lua output screenshot above, only the first 6 lines of this function appear to be executing when the problem occurs:
Spoiler :

Code:
function HexCREndTurn(iPlayer)
    print ("Hex CR razing check started")
    local pPlayer = Players[iPlayer]
    for city in pPlayer:Cities() do
        local pCity = city
        local pPlot = pCity:Plot()
        if pCity ~= nil and (pCity:IsRazing()) and (pCity:GetPopulation() == 1) then
            print ("Hex CR: city being razed has reached one pop")
            local pCityOwner = Players[pCity:GetOwner()]
            local pOwnerTeam = Teams[pCityOwner:GetTeam()]
            local iCityOriginalOwner = pCity:GetOriginalOwner()
            for i = 0, pCity:GetNumCityPlots()-1, 1 do
                local lPlot = pCity:GetCityIndexPlot(i)
                local ourCityAvailable = false
                local teamAvailable = false
                local allyAvailable = false
                local friendAvailable = false
                local noWarAvailable = false
                local dPactAvailable = false
                if (lPlot ~= nil) and ( (lPlot:GetOwner()) == (pCity:GetOwner()) ) then
                    local CityCandidates = {}
                    for pID = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
                        local nearCity, dist = getNearestCityWithException( pID, lPlot, pCity)
                        if (nearCity ~= nil) and (dist < 4) then
                            local us = (Players[pID] == pCityOwner)
                            local sameteam = (not us) and (Teams[Players[pID]:GetTeam()] == pOwnerTeam)
                            local friends = (not us) and (pCityOwner:IsDoF(pID))
                            local allies = (not us) and (pCityOwner:IsAllies(pID))
                            local war = (not us) and (pOwnerTeam:IsAtWar(Players[pID]:GetTeam()))
                            local dpact = (not us) and (pOwnerTeam:IsDefensivePact(Players[pID]:GetTeam()))
              
                            if us then
                                ourCityAvailable = true
                            end
                            if sameteam then
                                teamAvailable = true
                            end
                            if friends then
                                friendAvailable = true
                            end
                            if allies then
                                allyAvailable = true
                            end
                            if not war then
                                noWarAvailable = true
                            end
                            if dpact then
                                dPactAvailable = true
                            end
                            table.insert(CityCandidates, {iPlayer = pID, bUs = us, bTeam = sameteam, bFriends = friends, bAllies = allies, bWar = war, bDpact = dpact, cNearCity = nearCity})
                  
                        end
                    end
                    if #CityCandidates > 0 then
                        if ourCityAvailable then
                            for i = 1, #CityCandidates, 1 do
                                if CityCandidates[i] ~= nil then
                                    local lUs = CityCandidates[i].bUs
                                    if not lUs then
                                        table.remove(CityCandidates, i)
                                        i = i - 1
                                    end
                                end
                            end
                        elseif teamAvailable then
                            for i = 1, #CityCandidates, 1 do
                                if CityCandidates[i] ~= nil then
                                    local lTeam = CityCandidates[i].bTeam
                                    if not lTeam then
                                        table.remove(CityCandidates, i)
                                        i = i - 1
                                    end
                                end
                            end
                        elseif dPactAvailable then
                            for i = 1, #CityCandidates, 1 do
                                if CityCandidates[i] ~= nil then
                                    local lDpact = CityCandidates[i].bDpact
                                    if not lDpact then
                                        table.remove(CityCandidates, i)
                                        i = i - 1
                                    end
                                end
                            end
                        elseif allyAvailable then
                            for i = 1, #CityCandidates, 1 do
                                if CityCandidates[i] ~= nil then
                                    local lAlly = CityCandidates[i].bAllies
                                    if not lAlly then
                                        table.remove(CityCandidates, i)
                                        i = i - 1
                                    end
                                end
                            end
                        elseif friendAvailable then
                            for i = 1, #CityCandidates, 1 do
                                if CityCandidates[i] ~= nil then
                                    local lFriend = CityCandidates[i].bFriends
                                    if not lFriend then
                                        table.remove(CityCandidates, i)
                                        i = i - 1
                                    end
                                end
                            end
                        elseif noWarAvailable then
                            for i = 1, #CityCandidates, 1 do
                                if CityCandidates[i] ~= nil then
                                    local lNoWar = not CityCandidates[i].bWar
                                    if not lNoWar then
                                        table.remove(CityCandidates, i)
                                        i = i - 1
                                    end
                                end
                            end
                        end
                        local randPlayer = math.random(#CityCandidates)
                        local iAssignPlayer = CityCandidates[randPlayer].iPlayer
                        local AssignCity = CityCandidates[randPlayer].cNearCity
                        if AssignCity == nil then return end -- city not found?
                        if Map.PlotDistance( AssignCity:GetX(), AssignCity:GetY(), lPlot:GetX(), lPlot:GetY() ) < 4 then
                            print("reassigning plot belonging to nearly razed city")
                            if ourCityAvailable then
                                lPlot:SetOwner(-1, -1, false, false)
                            end
                            lPlot:SetOwner( iAssignPlayer, AssignCity, true, true )
                        end
                    end
                end
            end
        end
    end
end

GameEvents.PlayerEndTurnCompleted.Add(HexCREndTurn)

For the time-being, anyone using this mod that experiences strange crash should try disabling mod for the crash turn, or commenting out the razing check function as described above. This mod is lua-only so enabling/disabling should just activate/deactivate its functionality without desyncing the savegame database.
No player was eliminated and actually I think the problem is not in the razing function. I got an idea and reloaded that turn and looked at Magdeburg after Assyria's turn and the tiles were reassigned correctly. I then added a print before the last end of the function and it did show in the console. So the crash probably happens at the start of the Inuit turn after all and is presumably caused by the one tile that Inuvik just got from Magdeburg. They must be allergic to maize or something...
Spoiler Magdeburg with tiles reassigned :
image.png
 
interesting... not everything is making sense to me here -- its possible that some of the reloading you've done somehow used cached version of the lua, thus giving false indicator about where exactly the problem lies as you tried making changes to the mod lua -- but if your added print statement showed up in firetuner console, we can likely rule this out.

I have noticed a little wonkiness with the original mod code, when its reassigning tiles on peace deals etc.; never noticed crashes necessarily, but I'm leaning towards something on that side -- my razing check may not be elegant but it is pretty simple, really, there's too little opportunity for anything to go wrong there.

If you notice any more specifics of the in-game "symptoms", and we are able to identify the precise situation that borks this mod, I am likely familiar enough with both the original code and my additions to make some quick fixes and workarounds -- on the other hand I'll struggle to find enough time to load up mods, rigorously test, and sift through logs myself to pinpoint the exact mechanism anytime soon, though I likely will load up a game with most of your mods on my next (slow) playthrough to see if this sheds any light. Thanks again for all the info.
 
A recent patch made it so you cannot shift tile ownership between puppets and annexed cities that are bordering each other. this creates HUGE problems for this mod because when you take city that is bordering you and you dont want to annex it, that city usually ends up with no tile to work as a puppet due to all tiles shifting ownership to a city from which your armies came from.
This mod should revert the change that made it impossible to steal tiles from puppets to a city that is bordering it.
 
The version that I’m using now only flips tiles if they are equal distance or closer to a friendly city versus an enemy city. Therefore it’s not as extreme as the original version of the mod.

I can attach it if you’re interested.
 
The version that I’m using now only flips tiles if they are equal distance or closer to a friendly city versus an enemy city. Therefore it’s not as extreme as the original version of the mod.

I can attach it if you’re interested.
This is a good idea -- the original could be exploited slightly by creating long snaking arms of captured territory away from any other land holdings, as human this could be fun but probably to advantageous over AI, who rarely if ever accomplish anything similar

that city usually ends up with no tile to work as a puppet due to all tiles shifting ownership to a city from which your armies came from.
This mod should revert the change that made it impossible to steal tiles from puppets to a city that is bordering it.
Are you sure it assigns to the unit's home city? Could be correct, but I was under the impression that maybe it doesn't assign a city at all, just player ownership. Sounds like it will have to handle city ownership more intelligently in any case -- this may be a headache to sort out, but I speculate may also fix some of the rare circumstances where crashes are occurring
 
Last edited:
Are you sure it assigns to the unit's home city? Could be correct, but I was under the impression that maybe it doesn't assign a city at all, just player ownership.
city ownership is assigned in this case. a player can shift tile ownership from one city to another if they are bordering each other and if they can work the tiles. This is no longer the case with puppets. Before the change in a recent patch i could just shift tile ownership between my annexed city and puppet that is bordering it and fix the tile ownership mess mu units created when i first invaded the city.

Example: I settled a city near a city state and bought all the tiles nearby so they are bordering each other. then i invade the city state from that city and as my units get closer to the city tile itself, all of the tiles that were once under the ownership of the city state are now under my city. In this case it doesn't matter what is the distance or if my city can work the tiles or not. Now i decided to puppet a city state and it has no tiles to work except one ring that is around city tile because this mod doesn't allow those tile to flip.

A a simple solution would be to allow player to once again flip tile ownership between all cities including puppets which is currently not possible due to recent patch
 
A a simple solution would be to allow player to once again flip tile ownership between all cities including puppets which is currently not possible due to recent patch
this sounds simple but it may or may not be accessible to modders -- ideally the devs built this restriction so that it can be turned on or off via CustomModOption, but is it implemented this way? If not I'm not sure where to start... anyway will need more info about whether this functionality can be reverted simply, if any devs are browsing through here.

Alternatively, what can be manipulated via the mod is to make sure plots get appropriately assigned, albeit with potentially significant system resource cost (if we had to find nearest cities this could add to turn time) -- however it sounds like in your case of neighboring cities, there would be no perfect logic. I think we'll really have to investigate how to revert the worked tile stuff, and request such an option if none is available....

@usadefcon1 is your latest version a continuation of your previous? have you incorporated my razing check at all? i think the razing stuff is necessary to carry forward if we develop this further. I am too time poor right now to do anything with this, but can at least advise on CF here or discord. If all we need is a new copy of my v4/v5 but with CustomModOption flag enabled, I can do that, just not much else.

edit: recent congress proposal parallel to this concern. Not clear why it failed, no sponsor i guess. Sounds like there's no switch that can be flipped, probably will have to request one
 
Last edited:
The version that I’m using now only flips tiles if they are equal distance or closer to a friendly city versus an enemy city. Therefore it’s not as extreme as the original version of the mod.

I can attach it if you’re interested.
Here is the attached file for anyone interested.

Tiles only flip if:
1) They are equal or closer to a friendly city vs enemy city.
2) There is a friendly Land Unit adjacent to the tile.
3) There is no enemy Land Unit adjacent to the tile.
4) The friendly and enemy borders are touching.
 

Attachments

  • Hex Conquer (Battle Lines 1.7).zip
    6 KB · Views: 27
Here is the attached file for anyone interested.

Tiles only flip if:
1) They are equal or closer to a friendly city vs enemy city.
2) There is a friendly Land Unit adjacent to the tile.
3) There is no enemy Land Unit adjacent to the tile.
4) The friendly and enemy borders are touching.
Hi, is this performance heavy ?
 
I'm getting crashes due to city razing as well - was there ever a fix for this?
It hasn't been solved, and has yet to occur in any game I've played, but here's what I know:

I took a glance at @Captain Carrot 's logs a few posts back -- there's nothing super obvious that points out exactly what is causing the crash, or at least i didn't find it... the logs show that an event is taking place for brazil, and game seems to crash at the end of their turn... From the player report a few posts back, brazil is also razing a city (the razing functions actually triggers as razing city goes from 2 to 1 pop, so we can be pretty sure its brazil). I speculate that somehow the reassignment of plots during whatever event is being processed ends up in crash. Its a rather difficult situation to reproduce, unfortunately. There were also a lot of mods in the reported game, muddying the picture somewhat.

There's probably not gonna be a quick fix for this, but you can help us narrow in on the cause. Can you upload logs? Also, answer the following questions if you can:
  • how many other mods you had loaded?
  • are events enabled?
  • Find the civ that is razing a city with 2 pop. left as the crash occurs -- its more likely the player whose turn is ending, not the one that's starting; is there anything unusual about what's happening to that civ or that city on that turn?
There is a fix of sorts, or a workaround, assuming you are experiencing the same crash as was described previously: save game before the crash occurs, open the relevant lua file in text editor, and comment out the razing function. Reload game, play through the problem turn, undo the lua change on the next turn. Imperfect but at least you can progress your save. If you are starting a new game, I speculate you could fix this crash by disabling the events system (but i recognize as well that this is no fun). Gaia on steam workshop has done her own version of this mod, I have no idea if its compatible with VP but you might try that one, she knows civ lua pretty well so may have fixed this.

Ultimately this project needs someone to step up as lead dev to smooth out its imperfections -- I may return to work on it eventually, but I am time poor & have a few other projects that I have some passion for on CF, this just isn't one of them. Besides the rare crash described above, it also needs to reassign plots more intelligently to puppets as they're captured.

edit: you might avoid all of this by just using @usadefcon1 version -- I'm just not sure his version handles razing at all
 
Last edited:
It hasn't been solved, and has yet to occur in any game I've played, but here's what I know:

I took a glance at @Captain Carrot 's logs a few posts back -- there's nothing super obvious that points out exactly what is causing the crash, or at least i didn't find it... the logs show that an event is taking place for brazil, and game seems to crash at the end of their turn...
This is strange, considering Brazil was never at war at any point of that game. As you can see on the screenshots, the city being razed was originally Prussian and the razing was done by Assyria. Maybe the crash occurs when reassigning some of Magdeburg's tiles to Brazil? Three of them are in working range of Sao Paolo and Salvador, as opposed to one for Inuvik and the four unreachable ones.
 
I assumed it was the latter since Brazil is at peace and the razing of Magdeburg will only be finished 2 turns from now,
Perhaps I misinterpreted this... I was under the impression Brazil AND another were razing... If it's just the other than it doesn't make sense that it was Brazil, and maybe the events that Brazil was doing are unrelated.

There's something confusing about your scenario in that crash occurs between Inuit and Brazil turn as per your description, but the city involved belongs to neither. iirc my razing check should only apply to a player on their own turn, and to that player's owned cities... And yet it seems to clearly be crashing during a raze check. It might be as simple as applying an additional conditional in the Lua to double check that whatever city is being processed by the raze function actually belongs to the relevant player... It's unclear how the raze check would even find a non-player city to begin with, it literally just loops all the current player's cities to check for razing status and pop=1

In any case there's some rare scenario during tile reassignment that CTD's the game, maybe @dailyminerals can shed some light on what was happening in there game when it occurred
 
Last edited:
Top Bottom