DLL - Various Mod Components

I've just deleted the source to force it to re-download and it's identical to the baseline copy I took of 2.13 (or .12 or .11 or whatever it was!)
 
V5 attached to this post [edit: v7 with bug fixes is further down this thread] - it's still using the .11 code base so I won't update the original post until the .21 code is released :yawn:

- City States less likely to raze captured cities (only if they are very unhappy)
- Various recon ranges (like extra sight) & Promotions
- Removal of achievement code
- Automated workers only consider X hexes around them
- Capturing a capital removes any parts already assembled in the capital from that Civ's space race victory condition
 
The log from test 2 (post #47) implies the issue is with a unit trying to upgrade, and test 4 seems to confirm that. I'm guessing that the GEM code that tries to spend money upgrading units is calling into the DLL in ways that the main code doesn't expect ... I shall investigate further.
...

This was not resolved in v5, right?

... and I should turn off GLOBAL_CS_UPGRADES, in case I want to use CivUP/GEM
PHP:
<Row Value="0" Name="GLOBAL_CS_UPGRADES"/>

Can be there any other incompatibilities (promotions etc...)?
 
I added some NULL pointer checks, which may have fixed the issue - but as I could never duplicate the proble I couldn't test it.
 
Not hard at all (in fact it's in the next version of my DLL mods - which is waiting for Firaxis to release the code for 1.0.2.21)

The rule for deciding whether or not the AI (major or CS) razes a (non-capital) city is "am I now unhappy?" If the answer is yes, the AI will always raze the city.

The problem with this for City States is that they always grow their pop such that their happiness hovers around the -1 to 2 region. For them, capturing a city, unless it is very small (pop 1 or 2) AND has a luxury they don't already have, will always make them unhappy.

The simple solution, is to change the logic for CS to test for being "very unhappy" (-10 or more) and only raze cities then. In game play terms, this means that when a CS captures a city it will almost always keep it, if it quickly captures a second it will sometimes keep it, sometimes raze it and a third in quick sucession is almost always razed. However, if the CS goes back to a period of peace and has time to build happiness buildings, when the next war comes it will probably be happy again and capture a third city. For me, this is a much better approach.

Anyone wanting to do this themselves, the code is in CvPlayerAI::AI_conquerCity() near the end, and you need to change

Code:
if ([COLOR="red"][B]IsEmpireUnhappy()[/B][/COLOR] || (GC.getMap().GetAIMapHint() & 2) || (GetPlayerTraits()->GetRazeSpeedModifier() > 0 && getNumCities() >= 3 + (GC.getGame().getGameTurn() / 100)) )

to

Code:
if ([COLOR="Red"][B](isMinorCiv() ? IsEmpireVeryUnhappy() : IsEmpireUnhappy())[/B][/COLOR] || (GC.getMap().GetAIMapHint() & 2) || (GetPlayerTraits()->GetRazeSpeedModifier() > 0 && getNumCities() >= 3 + (GC.getGame().getGameTurn() / 100)) )

W

This is great. And exactly what i've been looking for since, well, since i started playing. I don't know jack about mods though. If I attempt to change this myself, do I risk messing up my game?
 
Thanks for continued development. :goodjob:

Shame on Firaxis for not releasing up-to-date source code. :gripe:
 
This is great. And exactly what i've been looking for since, well, since i started playing. I don't know jack about mods though. If I attempt to change this myself, do I risk messing up my game?

It's in V5 which you can download from a post above. If that's the only bit of the DLL mod you want look in the CustomModOptions.xml file once the mod is installed and change the values to 0 for the other features
 
Just a question. Is it possible that you gain a hurry factor for the first building(in a city), by building a city on jungle, like when you build it on a forest?
 
Is it possible that you gain a hurry factor for the first building(in a city), by building a city on jungle, like when you build it on a forest?

It's possible (simple change to the code) but as you don't get production bonus for chopping down jungle (IIRC) I didn't add it
 
It's possible (simple change to the code) but as you don't get production bonus for chopping down jungle (IIRC) I didn't add it

Ok, thanks for the answer. That helps me a lot.
 
V6 attached (V7 with bug fixes further down thread)

This has bugged me for a long time. An enemy ship can blockade water resources up to two hexes away - even if you sit one of your own ships on top of them to protect the fishing fleet!



but not any more!



Enemy ships will still blockade up to two hexes distance (or whatever value is set in GlobalDefines.xml), but if the tile is NOT adjacent to the enemy ship AND there is an allied ship on the tile or adjacent to the tile, then that allied ship will break the blockade. Allied ships are a) your own, b) those of allied City States, or c) those of other players you have a DoF with. Ships have to be at sea (and therefore open to attacks) and not in port.

The whales at the top are not blockaded as the enemy ship is two tiles away and the allied ship is adjacent to them, but the whales at the bottom are blockaded as despite having an adjacent allied ship they are adjacent to the enemy ship.

W
 
Another Amazing update whoward! I've just downloaded v6 but since this the first time I've tried to install a DLL file, how does one go about installing them?
 
Another Amazing update whoward! I've just downloaded v6 but since this the first time I've tried to install a DLL file, how does one go about installing them?

Same as other mods.. unpack zip file to ...\Documents\My Games\Sid Meier's Civilization 5\MODS\
 
The CS razing logic should be more complex in order to represent the niceties of the real world:

Upon the conquest of the city, the game should check:
  • What is the population of the city?
  • What was the happiness before the conquest?
  • What would be the happiness change from annexing or puppeting the city?

Raze quotient goes up by 1 for every unit of net unhappiness generated by the city.
Raze quotient goes up by 2 for every nuclear attack against it in the last 5 turns.
Raze quotient goes up by 3 for every building that is normally given automatically in an advanced start during that era that is not in the city.
Raze quotient goes up by 1 per enemy unit that is within the city radius.
Raze quotient goes up by an additional 0.5 for every unit of unhappiness past the very unhappy threshold generated by the city.
Raze quotient goes down by 0.2 for every unit gain of happiness caused by puppeting vs. annexing.
Raze quotient goes down by 1 for every unit of population in the city.
Raze quotient goes down by 0.2 for every unit of :c5gold:, :c5science:, :c5culture:, :c5faith:, and :c5greatperson: produced by the city.
Raze quotient goes down by 0.5 for every unit of :c5production: produced by the city.
Raze quotient goes down by 1 per building in the city.
Raze quotient goes down by 2 per national wonder in the city.
Raze quotient goes down by 3 per wonder in the city.
Raze quotient goes down by 0.5 per unit of your most-used strategic resource, and 0.2 for all strategic resources.
Raze quotient goes down by 0.2 per specialist in the city.

If the raze quotient is greater than 2, the CS will begin razing. If less than -2, the city will be annexed. Anything in between and the CS will puppet the city. This quotient will only be calculated once right after conquest and once per turn while the city is razing (and for the first 10 turns of its being a puppet), to see if it should start or stop the razing process. After a city is fully razed, puppeted for over 10 turns, or annexed, the ability of CSs to raze a particular city should be removed, and from then on a puppet city can only be annexed or kept in its existing state.
 
The CS razing logic should be more complex in order to represent the niceties of the real world:

Feel free to take this code and use it as the basis for your own mod to implement these ideas
 
Ok, I will check this soon and let you know...

Good news and bad news - bad news (for me) is that I now have a saved game that crashes in the AI turns if every option in the DLL is "on" but proceeds if they are all "off". So the good news (for you) is that I can now reproduce this problem on my own system, so should be able to finally get to the bottom of it :scan:

Edit: The problem is in the DisassembleSpaceship() code, as it fails to take into account city states being conquered (ie losing their capitals)
 
V7 (which fixes a bug introduced in V5) attached

The bug is in the spaceship disassembly code and causes a CTD when a city state is conquered. To fix for an in-progress game, either disable the option in CustomModOptions.xml and reload the saved game

Code:
<Row Name="GLOBAL_NO_CONQUERED_SPACESHIPS" Value="[B][COLOR="Red"]0[/COLOR][/B]"/>

or over-write the v6 dll with the one from v7

EDIT: V9 further down the thread
 
Can you please tell us what happens with your Ships are able to use forts code when:

A. a Melee Ship tries to move into a hex that has an enemy unit in it.
B. a Ranged Ship tries to move into a hex that has an enemy unit in it.
C. a Melee Unit tries to move into a hex that has an enemy ship in it.
D. a Ranged Unit tries to move into a hex that has an enemy ship in it.
E. How about civilians? Can chips capture those?

Is it possible to make this an improvement that workers can build that has only the canal effects and not the fort effects? Custom Artwork?
 
Back
Top Bottom