How do YOU customise CBP?

NULL often breaks (as 'null' defined in the DLL doesn't behave the same when 'defined' as null in the XML. Best to just do:

Code:
DELETE Buildings
WHERE Type='BUILDING_ORDER';
and then just copy/paste the XML sans-promotion.

G

I originally had it just removing the promo but then I thought about the NULL problem and how those records are found by the code. My time with Communitas taught a bit about Lua not liking NULL records.
However since the rest of the TrainedFreePromotion column would also be NULL, since no initial values were assigned on creation, I thought I'd just make it like those.
 
I'm still fighting with Scouts that don't gain XP from revealing tiles after 47 XP. I modified
Code:
INSERT INTO Defines (
Name, Value)
SELECT 'BALANCE_SCOUT_XP_MAXIMUM', '[B]210[/B]';
...in \MODS\(1) Community Patch\Core Files\Core Values\CoreDefines.sql and I cleared cache and moduserdata and started a new game, but nothing changed. Do I need modify something more?

More than likely another mod is overwriting it. I'd suggest using this code in a mod:
Spoiler :
Code:
UPDATE Defines
SET Value = '210'
WHERE Name = 'BALANCE_SCOUT_XP_MAXIMUM';

Make the mod depend on CP and reference ExCE (and any other mods that may change this value). Not only will this help your changes overrule your other mods, but it also means you won't have to change back it every time Gazebo and/or JFD update their mods.

And back to the topic - someone posted here an idea with boosting XP from military buildings...but it doesn't work :( Any idea how to fix it?

It sounds like you're updating buildings from another mod (which seems to add "_UP" to each building). You'll need to make sure that your code is running only after that mod has already added it's buildings (with either a reference or a dependency) otherwise your updates will be overwritten.

Also, unless you want a building to add different values of EXP to land, sea and air, there isn't a need to update each value independently. Code like this would be simpler.

Spoiler :
Code:
UPDATE Building_DomainFreeExperiences
SET Experience = '50'
WHERE BuildingType = 'BUILDING_BARRACKS_UP';

UPDATE Building_DomainFreeExperiences
SET Experience = '70'
WHERE BuildingType = 'BUILDING_ARMORY_UP';

UPDATE Building_DomainFreeExperiences
SET Experience = '100'
WHERE BuildingType = 'BUILDING_MILITARY_ACADEMY_UP';

Faster border expansion work very well and I enjoy it, now workers have more job to do :)

Ah, glad to help! Also, thank you for leading me into taking a closer look at (1) Community Patch\Core Files\Core Values\CoreDefines.sql, because that's where that blasted ideology value I was looking for was hiding! :goodjob:

This file does only the border related stuff (and nerfs Tribute & God of the Expanse for balance reasons). It doesn't do anything else.
 

Attachments

NULL often breaks (as 'null' defined in the DLL doesn't behave the same when 'defined' as null in the XML. Best to just do:

Code:
DELETE Buildings
WHERE Type='BUILDING_ORDER';
and then just copy/paste the XML sans-promotion.

G

G, I don't think that's a problem really based on how he's done his UPDATE statement. When you SET = null in SQL it's just going to basically delete the value in the database and not 'define' it as 'null'. The database is just an empty block at that point. It would basically be equivalent to stating an XML value of <TrainedFreePromotion><TrainedFreePromotion/>. If he says 'null', then he's got a problem.

/I
 
G, I don't think that's a problem really based on how he's done his UPDATE statement. When you SET = null in SQL it's just going to basically delete the value in the database and not 'define' it as 'null'. The database is just an empty block at that point. It would basically be equivalent to stating an XML value of <TrainedFreePromotion><TrainedFreePromotion/>. If he says 'null', then he's got a problem.

/I

I'm telling you what happens in the DLL when you use SQL to 'set' things as null. Guarantee you'll start seeing errors in the database.log if you do that. That's why I don't do it in the CP/CBP - the risk of a null error is pretty high, and for no gain whatsoever.

G
 
I never get errors in the Database by setting things as null (only if I mistakenly set it to 'null'), and double checked with SQLite, never a problem. In fact, I have Null set all over my mod for things like this:

------------------------------
-- Civilization_UnitClassOverrides
------------------------------
INSERT INTO Civilization_UnitClassOverrides
(CivilizationType, UnitClassType, UnitType)
VALUES ('CIVILIZATION_ZULU', 'UNITCLASS_LINE_INFANTRY', NULL);

No issues anywhere in database.
 
I never get errors in the Database by setting things as null (only if I mistakenly set it to 'null'), and double checked with SQLite, never a problem. In fact, I have Null set all over my mod for things like this:

------------------------------
-- Civilization_UnitClassOverrides
------------------------------
INSERT INTO Civilization_UnitClassOverrides
(CivilizationType, UnitClassType, UnitType)
VALUES ('CIVILIZATION_ZULU', 'UNITCLASS_LINE_INFANTRY', NULL);

No issues anywhere in database.

Glad it works for you. In many cases the bug won't show itself until loading a savegame. Many of the early minidump files that were linked/PM'd stemmed from null values passing in through my SQL changes, at which point I decided it was safer (and more stable) to just delete the table. Problems disappeared once I did that.

G
 
Glad it works for you. In many cases the bug won't show itself until loading a savegame. Many of the early minidump files that were linked/PM'd stemmed from null values passing in through my SQL changes, at which point I decided it was safer (and more stable) to just delete the table. Problems disappeared once I did that.

G

I'll keep an eye on that then. Good to know anyways. Where did you first notice the errors? In the database.log? I also notice that in your sql's you always do a set = 'x' (with the apostrophe) where x is some value.
 
I'll keep an eye on that then. Good to know anyways. Where did you first notice the errors? In the database.log? I also notice that in your sql's you always do a set = 'x' (with the apostrophe) where is x is some value.

Old habits die hard for my SQL (SQLite doesn't need the ' ', but I use it from habit). Originally noticed errors when removing policy requirements for wonders.

G
 
Something needs to be cleared up and a standard set for all to avoid any issues.
Stating the obvious for those that aren't aware: NULL <> value of nothing.

So removing the existing value and setting it to nothing still means that record exists in the table and can be referenced by Lua & the C++ in the DLL. Depending on how the code is structured that code finding an empty OR a NULL record will have very different results.

All I did was make the record for the BUILDING_ORDER the same as for all the other building types with regards to that column: TrainedFreePromotion ie. NULL.

The original Firaxis code has it like this:
Code:
<Column name="TrainedFreePromotion" type="text" reference="UnitPromotions(Type)" default="NULL"/>
Thus there should be no issue with restoring it to the original state.
 
Well this is simply academic at this point. IMHO, in this situation, it's not an issue unless you are treating null as if it were a string value. Putting it in '_' in sql will treat it similar to a string. Where the default null is just nothing at all. So I wonder if G had problems because that's how he does most of his SQL. For integers this, it seems to be okay. One has to be careful with this obviously, same with deleting rows especially ones that have ID's. G's method is the safest so long as the DLL isn't looking for some specific Type at some specific ID.
 
Alright, another question. I want to have this (and similar options) set through a mod rather than a manual change:

Code:
INSERT INTO COMMUNITY (Type, Value)
VALUES ('COMMUNITY_CORE_BALANCE_RESOURCE_REVEAL', 1);

I try this, thinking we're working with a type and a value:

Code:
UPDATE COMMUNITY
SET Value = '0'
WHERE Type = 'COMMUNITY_CORE_BALANCE_RESOURCE_REVEAL';

But it doesn't work. How do COMMUNITY and such options work?
 
Alright, another question. I want to have this (and similar options) set through a mod rather than a manual change:

Code:
INSERT INTO COMMUNITY (Type, Value)
VALUES ('COMMUNITY_CORE_BALANCE_RESOURCE_REVEAL', 1);

I try this, thinking we're working with a type and a value:

Code:
UPDATE COMMUNITY
SET Value = '0'
WHERE Type = 'COMMUNITY_CORE_BALANCE_RESOURCE_REVEAL';

But it doesn't work. How do COMMUNITY and such options work?

Should work, does for me. I check all my code in SQLSpyLite

Perhaps your mod is loading before the changes in CBP are made?
 
Thanks. Yeah I'm seeing inconsistencies with what's getting loaded and what's not. Really bizarre; everything updating the Worlds table works, but nothing else.

My mod has dependencies on all 6 CBP parts, so it should be loading last.

EDIT: Ok, got SQLiteSpy working and hooked up to the database. It's showing errors in this, which may be keeping everything below it from working:

Code:
UPDATE Worlds
SET PolicyPercent = '140'
WHERE Type = 'WORLDSIZE_HUGE';

Namely, it says that there's no such column: PolicyPercent. But there definitely is, you can see it in both the CBP handicap files as well as SQLiteSpy itself. Not sure what's going on.

EDIT2: I'm dumb. PolicyPercent is in HandicapInfos, not Worlds. The fact there's a ResearchPercent in both Worlds and HandicapInfos threw me off.

EDIT3: So that fixed everything except the COMMUNITY options. What's interesting is that through SQLiteSpy I can see the table inside the cached database, and it looks like the values are updating properly.

Spoiler :
xGLwFHF.jpg


Yet in game, Bonus Resources are still hidden and Barbarians continue to loot.
 
(...)

Ah, glad to help! Also, thank you for leading me into taking a closer look at (1) Community Patch\Core Files\Core Values\CoreDefines.sql, because that's where that blasted ideology value I was looking for was hiding! :goodjob:

This file does only the border related stuff (and nerfs Tribute & God of the Expanse for balance reasons). It doesn't do anything else.
Ok, Wario, thx again :)

And now, next thing I'm wondering about. Some things scale with era and gamespeed, right? But after you nerfed, f.e. Tribute policy to 10F, 10P will it be scaling fairly after each new era?
 
Ok, Wario, thx again :)

And now, next thing I'm wondering about. Some things scale with era and gamespeed, right? But after you nerfed, f.e. Tribute policy to 10F, 10P will it be scaling fairly after each new era?

I didn't adjust the scaling formulas at all, only the base values.

For example - the normal tribute policy gives 37 food & production on epic in the ancient era (technically, 37.5, but it gets rounded down). The nerfed one gives 15 food & production on epic in the ancient era.
 
Thanks. Yeah I'm seeing inconsistencies with what's getting loaded and what's not. Really bizarre; everything updating the Worlds table works, but nothing else.

My mod has dependencies on all 6 CBP parts, so it should be loading last.

EDIT: Ok, got SQLiteSpy working and hooked up to the database. It's showing errors in this, which may be keeping everything below it from working:

Code:
UPDATE Worlds
SET PolicyPercent = '140'
WHERE Type = 'WORLDSIZE_HUGE';

Namely, it says that there's no such column: PolicyPercent. But there definitely is, you can see it in both the CBP handicap files as well as SQLiteSpy itself. Not sure what's going on.

EDIT2: I'm dumb. PolicyPercent is in HandicapInfos, not Worlds. The fact there's a ResearchPercent in both Worlds and HandicapInfos threw me off.

EDIT3: So that fixed everything except the COMMUNITY options. What's interesting is that through SQLiteSpy I can see the table inside the cached database, and it looks like the values are updating properly.

Spoiler :
xGLwFHF.jpg


Yet in game, Bonus Resources are still hidden and Barbarians continue to loot.

What about a small mod with just these changes loaded, does that work?
 
I think the problem is the values from COMMUNITY don't do anything on their own. When CBP is activated it "asks" for the options in other files and then adjusts the database accordingly. My mod altering the option values afterwards won't do anything if they don't get "plugged in" to the database again.

It's clear in the Terrain\ResourceReveal.sql file in CBP that only the first pass of the option is important. Unless I can find a way to re-load that file, but I'm not sure how to do that.

EDIT: Oh...I just include that file in my mod. Why is it always such a simple solution...

Still not sure where the Barb Looting is handled though.
 
I think the problem is the values from COMMUNITY don't do anything on their own. When CBP is activated it "asks" for the options in other files and then adjusts the database accordingly. My mod altering the option values afterwards won't do anything if they don't get "plugged in" to the database again.

It's clear in the Terrain\ResourceReveal.sql file in CBP that only the first pass of the option is important. Unless I can find a way to re-load that file, but I'm not sure how to do that.

EDIT: Oh...I just include that file in my mod. Why is it always such a simple solution...

Still not sure where the Barb Looting is handled though.

Barb looting is handled in the CBP's options table deep in the folder structure. Until we're at release I have it in an obscure spot. Look at the Core Files folder, IIRC.

G
 
Is there anyway to tweak it so that barbarians don't just suicide against cities but can actually conquer them outside of the events that happen when a CS is being besieged? I want to see barbarians actually overrun cities and actually feel threatened by them.
 
Back
Top Bottom