Several Modding Questions

sresk

Chieftain
Joined
Sep 23, 2010
Messages
99
I've got a number of questions I'd like to see if I can get some help with, in no particular order:

1. I'm working on a mod to re-balance a number of things and I've made a .modinfo with both a .sql and .xml and for the most part I'm able to adjust the values I want however I've got this :
<GlobalParameters>
<Update>
<Where Name="SCIENCE_PERCENTAGE_YIELD_PER_POP" />
<Set Value="50"/> <!-- Original 70 -->
</Update>
</GlobalParameters>

And it's not having any impact in game each pop still generates .7 science, not the .5 science I think that the above code should change it to... any insight?

2. Does anyone know what these 3 values do in <GlobalParameters>, CULTURE_COST_FIRST_PLOT, CULTURE_COST_LATER_PLOT_EXPONENT, CULTURE_COST_LATER_PLOT_MULTIPLIER? I'd like to make border growth slightly faster but not sure what to changes those values to... and with the above problem I'm not sure I'm actually changing the values at all.

3. I'd like to add in a +gold generation from pops similar to the .7 science from SCIENCE_PERCENTAGE_YIELD_PER_POP, how do I add that?

4. Right now when you build a unit that requires iron it just checks do you have 2 (or 1) iron, is there a way to actually get a unit to consume the iron (similar to how civ 5 worked) I'd like to have a soft cap for units based on a manpower resource but units need to consume the manpower resource to make that work.

5. Right now when you build districts or buildings it gives a flat +x to the production of the resource is there a way to make it give a *5% (kind of like how ruhr valley or hanging gardens gives a percentage)?
 
1) I'm guessing the problem is in the .modinfo, are you sure it's loading the file and updating the database correctly?

2) I believe that the formula is something like:
culture_cost = CULTURE_COST_FIRST_PLOT + CULTURE_COST_LATER_PLOT_MULTIPLIER*num_tiles_already_grown^CULTURE_COST_LATER_PLOT_EXPONENT.

At least, that's what I assumed it was in my mod. Haven't tested exactly if that's how it works, but my mod is working as intended. Similar formulas were definitely used in Civ5.

3,4,5) You should have a look in the schema files to see if you can find tags with those names. If yes, you're in luck and it should be very simple to add. Otherwise it will be significantly harder. The neatest way would be to add those tags into the .dll in c++ when the SDK is released, although a work around in lua could probably be done too.

Thanks for the reply...

1. yes I know the file is loading because farther up in the file it's changing the tile yields on some terrains/features and I know that's working. That bring up a good point do I need to make a different mod file for each .xml I want to adjust in game data or can I just make one huge one that does everything I want?

2. That helps a lot!

For the rest can I load in a .lua file now by simply adding:
<Files>
<File>MyFile.lua</File>
</Files>

into the components section of .modinfo or do I need to do something else special? And for the sdk/c++ does that mean I'm going to need to wait for something like modbuddy to come out? Sorry if those are silly questions but while I've played around with mods and even a little bit of Unity5 I'm at the extreme limit of my modding and codeing ability's :)
 
Yeah I went ahead and split it out and it's cleaner for me to read so I imagine it's easier for others as well :) And yeah what ever this SCIENCE_PERCENTAGE_YIELD_PER_POP is changing it's value seems to have no impact at all and I can't figure out why.
 
Ok this SCIENCE_PERCENTAGE_YIELD_PER_POP is driving me nuts!!! If i go into the GlobalParameters.xml and manually edit the value to 50 it does exactly what I expect it to do but this bit of code:

<GameInfo>

<GlobalParameters>
<Update>
<Where Name="SCIENCE_PERCENTAGE_YIELD_PER_POP"/> <Set Value="50"/>
</Update>

</GlobalParameters>
</GameInfo>

Does nothing! and I have no idea why?!
 
Ok so this is driving me uterly bonkers it seems that order matters.

Here is a snipit:

<GameInfo>
<GlobalParameters>
<!-- Unchanged, here for reference-->

<Update>
<Where Name="CULTURE_COST_FIRST_PLOT" /> <Set Value="7" /> <!-- Original 10 -->
</Update>

<Update>
<Where Name="CULTURE_COST_LATER_PLOT_EXPONENT" /> <Set Value="1.2" /> <!-- Used to be 1.3 -->
</Update>

<Update>
<Where Name="CULTURE_COST_LATER_PLOT_MULTIPLIER" /> <Set Value="3" /> <!-- Used to be 6 -->
</Update>

<Update>
<Where Name="CULTURE_PERCENTAGE_YIELD_PER_POP" /> <Set Value="20" /> <!-- Used to be 30 -->
</Update>

<Update>
<Where Name="DISTRICT_POPULATION_REQUIRED_PER"/> <set Value="4" /> <!-- Original 3 -->
</Update>

<Update>
<Where Name="FORTIFY_BONUS_PER_TURN"/> <set Value="4" /> <!-- Original 3 -->
</Update>

<Update>
<Where Name="SCIENCE_PERCENTAGE_YIELD_PER_POP"/> <Set Value="50"/> <!-- Original 70 -->
</Update>
............................. con't

</GlobalParameters>
</GameInfo>

if I put
<Update>
<Where Name="SCIENCE_PERCENTAGE_YIELD_PER_POP"/> <Set Value="50"/> <!-- Original 70 -->
</Update>
at the top of the list it works if I put it anywhere else then it doesn't work and honestly I'm haveing a hard time telling if the others are working or not as in my testing I'm just jumping into a new game checking the science yield at founding the city and then jumping out so I'm not playing enough turns to check the rest of the lines.

and I know it's not mod info becasue I'm not touching that and the other files in the mod are working as expected.
 
I have been able to make various changes using a different approach, which may help you.

In the .modinfo file have something similar to the following:
Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="02086b89-1bce-4256-9cce-894db79280e9"> <!-- Make this your own unique identifier -->
   <Properties>
       <Name>Name of your mod here</Name>
       <Stability>alpha beta etc etc</Stability>
       <Teaser>Short description of your mod</Teaser>
       <Description>longer description of your mod</Description>
       <Authors>List of names of who ever put the mod together</Authors>
       <SpecialThanks>List of whoever you wish to thank</SpecialThanks>
   </Properties>
   <Files>
       <File>Rules.sql</File> <!-- The file you wish to use to update the database -->
   </Files>
   <Components>
       <UpdateDatabase id="name of mod without spaces">
           <Properties>
               <Name>Name of mod</Name>
           </Properties>
           <Items>
               <File>Rules.sql</File> <!-- The file you wish to use to update the database -->
           </Items>
       </UpdateDatabase>
   </Components>
</Mod>
To make a unique identifier, use https://www.guidgenerator.com/

Do all your SQL in the file named in your modinfo file. Inside the .sql file its a matter of simply using SQL commands to reference the various XML files and entries you wish to change. For example, you want to update a specific entry in the GlobalParameters file. Do the following...
Code:
UPDATE GlobalParameters SET Value = "50" WHERE Name = "SCIENCE_PERCENTAGE_YIELD_PER_POP";

Then simply select and activate your mod in the game. That should solve your problem. I have made roughly 20+ changes to 8 different xml files this way. I have extended the marathon game speed to be 300 turns per era, and ensure religion, faith, great people, population, unit costs, building costs, tech and civic costs etc all fall into the 300 turn per era format. Working great at the moment and each era feels like an actual era, as multiple wars are fought and decisions become even more important.

So the 2 files in your mod folder for this would be:
yourModName.modinfo
Rules.sql

I have tried importing entire files to overwrite, such as GameSpeeds.xml, but importing seems to only work for .lua files. Perhaps i am missing something, i do not know. But as yet, i have not been able to import an .xml file.

Hope that helps you out a little.
 
Huh using .sql does seem a little easier than using .xml .... I may have to try that thanks
 
What are the script possibilities? Does anyone know?
I'd like to add attrition to mountain tiles (making them passable is easy) might cause problem with the ai, but it doesn't tend to keep items on mountain tiles/avoid them unless it's a big advantage to the path
there were other things I forgot, oh yeah changing the map generator so that certain sides of mountain ranges will always come out as dry and others as wet

stuff like that
 
Back
Top Bottom