Hex Conquer (Borders Only)

I am not that concerned over this however, just curious if anyone reading here has any good ideas to keep the oceans' role as a barrier to tile capture, and somewhat distinct from how things work on land etc. What if naval tile captures were limited to coast only, and not ocean
Part of why water tile capture should be a thing is for claiming access to a channel that you would otherwise be unable to get through in peacetime. Restricting ocean tiles from being capturable hurts this goal.
On the other hand, can embarked units enter the ocean if you own the territory?
 
This is completely untested as I have not yet installed civ 5 nor VP, but I made some notepad edits to my previous v4 in attempt to achieve the distinction between land/water conquering, as discussed in recent posts.

@Rekk or others, please let me know if you get a chance to test and your results, ideally with firetuner open and noting any errors. I will try to test on my end asap, though I'm not sure when this will be.

Assuming this works, one thought for possible future refinement: should amphibious promotion allow land unit to conquer water tiles?
 

Attachments

This is completely untested as I have not yet installed civ 5 nor VP, but I made some notepad edits to my previous v4 in attempt to achieve the distinction between land/water conquering, as discussed in recent posts.

@Rekk or others, please let me know if you get a chance to test and your results, ideally with firetuner open and noting any errors. I will try to test on my end asap, though I'm not sure when this will be.

Assuming this works, one thought for possible future refinement: should amphibious promotion allow land unit to conquer water tiles?

This mod works very well, i love the additions you made, big problem however is whenever there is a city adjacent to a city that was razed, the other city would become invisible:
upload_2022-6-5_9-15-48.png
 
strange, i've never seen this myself. I've got a game going right now with v4, have had a few cities razed around me but everything's working as expected. Only dif between v4 and v5 should be naval units capturing water tiles. Is it possible there is some other mod affecting razed cities?
yeah sorry, I have tested all of my mods individually now, its not your mod thats making that happen!
 
Ok, found out it was a combination of extending the city working distance to 5 tiles and this mod which causes cities near razed cities to disappear. Do you know any way to fix this?
 
My version of this mod (iirc, its been a while since I've looked at this code) checks the razing city's owned tiles and reassigns them to another city that can work them -- in default VP the city can work a distance of 3 tiles, and cities must have 3 tiles between them minimum, ie no cities within another city's workable tiles. I imagine if you have 5 working distance and cities with less than 5 tiles between them, somehow the city tile itself is being affected. That said, I would expect a city tile is not assigned as a workable tile to an entirely separate city so this issue does not intuitively make sense to me.

Somewhat speculatively, you might eliminate this problem by adjusting minimum distance between cities to match the working distance. Much more speculatively, maybe tweak the lua in this mod to check to ensure the plot being reassigned is not itself a city ie. by adding a "if not [plotVariable]:IsCity() then .... end" to the razing function's tile reassigner. Just a guess.
 
Last edited:
I tried injecting it here in the main lua file of the mod:
if Map.PlotDistance( AssignCity:GetX(), AssignCity:GetY(), lPlot:GetX(), lPlot:GetY() ) < 4 then
print("reassigning plot belonging to nearly razed city")
if not [plotVariable]:IsCity() then
if ourCityAvailable then
lPlot:SetOwner(-1, -1, false, false)
end
lPlot:SetOwner( iAssignPlayer, AssignCity, true, true )
end
end

when i run the game is just crashes on turn 2. :(
 
okay by [plotVariable] i meant that the code update should use whatever name the lua file uses for the plot variable it is dealing with in this loop. Afaik you appear to be in the right place of the file, assuming the rest of your quote is just copy/paste. If this is the case, then the variable name appears to be "lPlot"... so your if statement should read "if not lPlot:IsCity() then..."

Once the if statement is updated with correct variable name, if its still not working right, run with firetuner and it should pinpoint the line of any lua errors in firetuner output. Assuming you've only added this one new condition as an if statement (or to an existing if statement), then there should be at worst just some minor syntax error.

However it is unusual for lua mod file, even with bad variable names, to crash the whole game -- its possible there are other issues at play here.
 
Last edited:
I fixed the code to what u said and it still crashes :( no idea how to use firetuner after trying it for a few hours.
 
just to make sure, you changed [plotVariable] to lPlot? ie lower case 'L' -- not upper case 'i'?

theres a tutorial on firetuner somewhere on these forums, you just need the console window really, to see output from mods. You'd have to enable it in a civ 5 config file, but otherwise it shouldn't be that complicated for these purposes.
 
@Tekamthi

Hey, thanks for this awesome mod!

This is literally the best game changing mod I've ever played since I first played CPP(now Vox Populi) in 2015.
Civ5 became a totally different game with VP, so much fun!
And VP became a totally different game with Hex Conquer, so much fun!

I have played 3 games with VP and Hex Conquer. Everything worked as intended.
I played a game VS 6 most aggression Civ in a Domination Only game. It was soooooo much fun.
With the smart AI from VP, and the dynamic frontline from Hex Conquer, the game is a blast. One of the best game I've ever played.

I only have 1 suggestion/question:
Is it possible to make this mod not (Borders Only)?
That is, units can conquer tiles even if its not directly bordering your borders.

I was sneaked up several times by the AIs from ocean, I was caught up with pants down. But sadly, I could always easily destroy them because the healing difference between friendly/enemy territory is so big that its just impossible for the AI to "success" in their surprised ocean attack, even if it did surprised me a lot. They heal 5HP per turn, while I can heal 20+HP easily, and have road/railroad to very easily switching injured units around.

The result is that AI spent a lot of resources and units to build up a sneaky attack, successfully landed on the enemy territory(my territory), pillaged some tiles, get out healed by weaker army(I only sent garrisons to fight them since my main army is fighting in frontline), had to retreat after losing half bulk of units. Which is such a shame because AI did a successful surprised attack, only losing to the unbalanced game mechanics. Its simply not possible for AI to "success" their sneak attack, and that lack of excitement comparing to the dynamic frontline. On the other hand, I don't think its a big problem for Human to abuse this mechanics, since there are always higher difficulties AI to play. But this is just my opinion though, YMMV.

I know I can go for the original mod, but I like the fixed you did to make it VP friendly.
Would you release a version where its not (Borders Only)?
Or would you kindly teach me how to modify the files to suit my needs?


Thanks you!
 
its been a long time since i looked at this but iirc its like one or two booleans that need to be changed -- the original was already setup with this as a toggle, but defaulted to not borders only. I will look into it. If you have any familiarity with lua you probably wouldn't find it difficult to track down, but i can't recall exactly where to look.
 
@Tekamthi

Hey, thanks for this awesome mod!

This is literally the best game changing mod I've ever played since I first played CPP(now Vox Populi) in 2015.
Civ5 became a totally different game with VP, so much fun!
And VP became a totally different game with Hex Conquer, so much fun!

I have played 3 games with VP and Hex Conquer. Everything worked as intended.
I played a game VS 6 most aggression Civ in a Domination Only game. It was soooooo much fun.
With the smart AI from VP, and the dynamic frontline from Hex Conquer, the game is a blast. One of the best game I've ever played.

I only have 1 suggestion/question:
Is it possible to make this mod not (Borders Only)?
That is, units can conquer tiles even if its not directly bordering your borders.

I was sneaked up several times by the AIs from ocean, I was caught up with pants down. But sadly, I could always easily destroy them because the healing difference between friendly/enemy territory is so big that its just impossible for the AI to "success" in their surprised ocean attack, even if it did surprised me a lot. They heal 5HP per turn, while I can heal 20+HP easily, and have road/railroad to very easily switching injured units around.

The result is that AI spent a lot of resources and units to build up a sneaky attack, successfully landed on the enemy territory(my territory), pillaged some tiles, get out healed by weaker army(I only sent garrisons to fight them since my main army is fighting in frontline), had to retreat after losing half bulk of units. Which is such a shame because AI did a successful surprised attack, only losing to the unbalanced game mechanics. Its simply not possible for AI to "success" their sneak attack, and that lack of excitement comparing to the dynamic frontline. On the other hand, I don't think its a big problem for Human to abuse this mechanics, since there are always higher difficulties AI to play. But this is just my opinion though, YMMV.

I know I can go for the original mod, but I like the fixed you did to make it VP friendly.
Would you release a version where its not (Borders Only)?
Or would you kindly teach me how to modify the files to suit my needs?


Thanks you!

It's not difficult to change it back, but just so you know there were 2 reasons it was changed to borders only in the first place:

1) Borders only restricts the number of tiles that can be flipped in a turn. Without the restriction, large amounts of territory flips very quickly.

2) Without the restriction you can own territory in the middle of nowhere that doesn't flip back when you make peace.
 
@comedian56

I looked at my v4 version of the mod just now -- if you are using that version, you need to open Conquer.lua, and find the UnitConquerPlots function around line 26, it should look like this:
Code:
function UnitConquerPlots( player, unit )
    --print(string.format("    Unit: %s (ID %d)", unit:GetName(), i));
    if not unit:IsCombatUnit() then return end -- only combat units can conquer
    if (unit:GetUnitCombatType() == GameInfoTypes.UNITCOMBAT_RECON) or (unit:GetUnitCombatType() == GameInfoTypes.UNITCOMBAT_SIEGE) then return end
    if (unit:GetDomainType() == DomainTypes.DOMAIN_SEA) or (unit:GetDomainType() == DomainTypes.DOMAIN_HOVER) then return end
    local plot = unit:GetPlot()
    if plot == nil then return end
    if plot:IsWater() then return end -- in order to conquer, the unit must be on a land plot
    ConquerCitadel( player, plot )
    ConquerPlot( player, plot, true )
    ConquerAdjacentPlots( player, plot )
end

You want to change the 'true' in the brackets after ConquerPlot, above, to 'false'. There are some slight differences in my v5 -- the concept is the same but you may need to do this change in two spots, to account for water and land plots (i havent looked back in on that one/cant remember how the structure works exactly there).

If you do this pls report back if this achieves what you are after. Call it an educated guess for now, I don't have time to test myself. Achieving your requested effect in usadefcon's version may require other steps altogether
 
@Tekamthi
Yes it works!
Just search and replace all "ConquerPlot( player, plot, true )" with "ConquerPlot( player, plot, false )" and its worked as intended.

At my first test playthrough, yeah it does has some effect like usadefcon mentioned, but I'm probably fine with that(?).
Don't know what I will feel later when I got sneaky attacked by the AI though haha.
Thanks both of you very much!
 
@Tekamthi
Yes it works!
Just search and replace all "ConquerPlot( player, plot, true )" with "ConquerPlot( player, plot, false )" and its worked as intended.

At my first test playthrough, yeah it does has some effect like usadefcon mentioned, but I'm probably fine with that(?).
Don't know what I will feel later when I got sneaky attacked by the AI though haha.
Thanks both of you very much!
I'd be cautious replacing all of these -- its worth experimenting with as you've done, and you won't "break" the mod or game this way in the sense that they won't crash, but you may end up with unintended effect. Then again, you might not, its possible there were no other "true" entries.

The mod calls ConquerPlot once for the plot a unit it is standing in, and then loops all adjacent plots and calls ConquerPlot for each of them, too. My suggestion was to mod only the line where ConquerPlot is called for the plot the unit occupies -- done this way, the adjacent evaluations would proceed as the original author intended. This is where you may see some wonky behaviour, in plots adjacent to units -- my best guess is you will get very frequent plot ownership changes -- unit may conquer adjacent plots very freely compared to original and my versions.

I just did a quick scan of the code the other day, i don't have it all in mind that clearly; you may or may not be fine having done a replace all. If you notice weird stuff, though, you'll have to be more selective. I take it you are not using using my v4 by adopting this approach; I took a look at my v5 just now, my first take (ie my v4 suggestion, adapted for v5) would be to change Conquer.lua lines 35 & 39 only.

In usadefcon's version you might wanna search for ConquerPlot line by line, and evaluate where the unit's plot is being conquered, vs where adjacent plots are being conquered; probably only wanna change the former. I'm not even sure tbh if this structure remains intact in usadefcon's, his re-writes more of the original than mine does iirc.

Pls report back your findings with this, I imagine others may be interested in accomplishing the same. Even share your version once you get it right -- I just don't have time to dig into this directly rn.
 
Last edited:
Is there a way to enable this for AI but not for the human? I love how this works, and it makes the AI wars more spicy which is excellent. I think it synergizes really well with their new road logic, I am excited to hit industrial in my game.

But it is way too strong in my hands, it is a huge buff to attacking. Any way for it to be turned off for me but stay for AIs?
 
yes, it can be done, though it likely requires some basic analysis and several small updates to the code -- how comfortable are you with lua or programming in general? iirc the structure of this mod calls its functions on maybe 3-4 GameEvent hooks. If you can identify each of these functions, and wrap their contents in "if not Players[ playerID ]:IsHuman() then ... end" statements (using the correct variable name for the active player ID), you'll achieve what you're after. Not super difficult, you don't have to understand much about how the mod works to do this, but probably requires at some general programming literacy. The important ones to look out for are probably the functions called on GameEvents.PlayerDoTurn and GameEvents.CityCapture... (my recollection of the game event names may be slightly off). There are a few others possibly as well, but if you get those two wrapped in if statement properly, i think you'll be like 95% of the way there.
 
Back
Top Bottom