My Changes mod - add your own XML/SQL/LUA/UI

whoward69

DLL Minion
Joined
May 30, 2011
Messages
8,691
Location
Near Portsmouth, UK
As supplied, the mod does nothing useful, but provides all the files (correctly set up) for you to add your own changes to.

  • XML/MyXmlChanges.xml - add your own XML here to update the game database
  • SQL/MySqlChanges.sql - add your own SQL here to update the game database
  • LUA/MyLuaChanges.lua - add your own Lua code here to execute as the mod starts or on events
  • UI/MyUiAddition.xml - add your own UI additions here (also UI/MyUiAddition.lua and XML/MyUiTextStrings.xml)

Comments in each file explain their usage
 

Attachments

  • My - Changes (ModBuddy Project).zip
    15.8 KB · Views: 1,127
  • My - Changes (v 1).civ5mod
    2.2 KB · Views: 804
.civ5suo files are the "compiled" .civ5sln files, it could be deleted but it's also doing no harm there. I could also have cleaned out the build and packages sub-dirs, but what the hey ;)
 
I was having problem with getting my own mod to work (it used to work back when G&K was new), and now I seem to have an issue with SQL being run at all...

I tried this simple mod, and it showed up in the lua log, so I know it loads, but it didn't manage to add anything to defines table like the sql should do...

I've tried deleting cache, moduserdata and even whole civ folder, but same problem... nothing helpful in database log but posting anyways

Code:
[9017.762] constraint failed
[9017.762] While executing - 'INSERT INTO ArtDefine_StrategicView(StrategicViewType, TileType, Asset) VALUES(?,?,?)'
[9019.556] no such table: ContentPackage.LocalizedText
[9020.601] Validating Foreign Key Constraints...
[9020.601] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[9020.601] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[9020.601] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[9021.584] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_HITTITE_WARCHARIOT" does not exist in Units
[9021.584] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_SUMERIAN_PHALANX" does not exist in Units
[9021.584] Failed Validation.
[9021.990] 
-- SQLite Memory Statistics --
Memory Usage:
		[Cur]		[Max]
Malloc:		385896		33244128
PageCache:	4388		4982
LookAside:	0		0
Scratch:	0		1

Static Buffer Overflows:
		[TooLarge]	[NoSpace]
PageCache:	0		29696000
Scratch:	0		0

Largest Allocations:
Malloc:		131072
PageCache:	1160
Scratch:	6640

Prepared Statements:
Current:		10
------------------------------
[9068.852] no such table: ContentPackage.LocalizedText
[9070.568] no such table: ContentPackage.LocalizedText
[9084.172] Validating Foreign Key Constraints...
[9084.172] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[9084.172] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[9084.172] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[9085.139] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_HITTITE_WARCHARIOT" does not exist in Units
[9085.139] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_SUMERIAN_PHALANX" does not exist in Units
[9085.139] Failed Validation.
[9085.498] 
-- SQLite Memory Statistics --
Memory Usage:
		[Cur]		[Max]
Malloc:		451280		33244128
PageCache:	4391		4982
LookAside:	0		0
Scratch:	0		1

Static Buffer Overflows:
		[TooLarge]	[NoSpace]
PageCache:	0		29696000
Scratch:	0		0

Largest Allocations:
Malloc:		131072
PageCache:	1160
Scratch:	6640

Prepared Statements:
Current:		17
------------------------------
[9085.763] no such column: Type
[9085.763] In Query - select * from Natural_Wonder_Placement where Type = ? LIMIT 1

I've given up after fiddling for two hours trying to get something to work...
 
If you start a thread in the main C&C forum and attach your zipped built mod (ie the one in the MODS sub-folder) I'll take a look. Always easier to debug the actual mod.
 
If you start a thread in the main C&C forum and attach your zipped built mod (ie the one in the MODS sub-folder) I'll take a look. Always easier to debug the actual mod.

*points to the top of this thread* I couldn't get this one to work even, that's why I asked here, figured if not the simplest of all mods will work, it's a good place to start...

Specifically, the sql part "INSERT INTO Defines(Name, Value) VALUES ('_MY_CHANGES_SQL', '1');" doesn't seem to work. I've checked Defines table after it's loaded, and it's not added there... I verified that sqlite from firefox was using the correct db since opening last file after deleting cache gave me a file not found... so I'm certain that part is right...

For some reason, it just doesn't seem to run the .sql in the above mod (and similarly with my own mod)...
 
using the correct db

C:\Users\{username}\Documents\My Games\Sid Meier's Civilization 5\cache\Civ5DebugDatabase.db
 
ok, my confusion is complete hehe... the debug database does indeed have the lines added, but the debug database isn't what is read for the mods usage is it? so if I were to add the rest of my sql stuff to this same mod, having it update debug database only won't help will it?
 
The "core" database is a pristine copy of the core xml files. When you play with mods, the core database is copied as the debug database and then the mods applied to it. The game then uses the debug database during play - confused? You, me and several thousand others!
 
Well yeah, but this must be a relatively new change right? since when I made my mod in vanilla civ5 I am pretty sure I never was opening that debug database to check the changes applied, although I can't remember checking the database manually when I updated to G&K, so might been already changed by then...

Anyways, I'll check my mod again, looking at the correct database this time, and then post as new thread if I still can't figure out why it stopped working... thanks
 
Been like that since day one IIRC, so unless you were editing the xml files directly ...
 
Must been me that at some point started checking the wrong database then... anyways, it appears my mod was working afterall, I just had forgotten some of the details so it seemed off to me when I started it up for first time in months, and checking the wrong database made gave me flawed evidence of the same hehe

Your mod is nice though, it's exactly what I'd want to find when I first started playing around with civ5 mods, since I'm mainly good at SQL so throwing in some of those is really all I need (mostly)... now it just needs a manual to help people not do stupid mistakes like I did trying to test it :p
 
now it just needs a manual to help people not do stupid mistakes like I did trying to test it :p

Feel free to write up your experiences ;)
 
I'd like a little help on a mini-modding of another mod: This mod removes the Pantheon cost increases for all civilizations,but I want to limit that to Byzantinum . I would need just simple xml support for that:

Code:
<GameData>
	<Language_en_US>
		<Update>
			<Set Text="Pantheon Cost is not Increased when other civilizations found a pantheon" />
			<Where Tag="TXT_KEY_TRAIT_EXTRA_BELIEF" />
		</Update>
		</Language_en_US>
	<Traits>
	<Leader_Traits>
		<Row>
			<LeaderType>LEADER_THEODORA</LeaderType>
			<Type>TRAIT_EXTRA_BELIEF</Type>
			<Where Name="RELIGION_GAME_FAITH_DELTA_NEXT_PANTHEON"/>
			<Set Value="0"/>
		</Row>
	</Leader_Traits>
	</Traits>
</GameData>
 
Its best to post specific questions in the main forum and not tacked onto the end of this thread - as more people will see them
 
I am just getting into modding, with a couple simple mods. This will be a huge help, so thank you!
As a brand new modder, how should I read/understand this mod? Would you be so kind as to recommend a good guide for getting started? (Preferably a brief one, I don't want to jump in with both feet just yet!)
 
@Mathew.Pederson - this mod can be downloaded and installed as is and will "work" ... it just doesn't actually do anything!

But it is a fully functioning mod, which you can then make small changes to, eg changing city distance from 3 to 2 or 4, or changing the combat strength of Warriors, safe in the knowledge that all the usual pit-falls of VFS, InGameUIAddin and OnModActivated can be ignored and you can concentrate on the XML/SQL/Lua you are trying to get working.

There are no guides on doing the very simple stuff, as its fairly easy to figure out. "I want to change the range of gattling/machine guns to 2 ... 1) I need to find where the game sets this (in an XML file) ... 2) I need to work out the XML/SQL needed to change it ... 3) I need to build a mod to put that change into ... 4) I need to add my XML/SQL to the mod". Step 3 is the hard/frustrating part that this mod is intended to alleviate.

Most guides cover how to do advanced stuff - create a civ, add a new model for a new unit, write a UI mod, etc - and all of those are in the Tutorials and References sub-forum
 
I beg your pardon, but I challenge the assertion that "its fairly easy to figure out." I see a bunch of files here, and you say I may edit them, but without some guide as to what these files are, in what layout they are read, etc I can only stick my hands in the proverbial fingerpaint and hope the result does not crash my game. Can you point me to a place where I may learn more about numbers 1 & 2 in your above example?
 
Top Bottom