Mod or XML edit to stop AI building Wonders?

AstuteClass

Chieftain
Joined
Jul 17, 2009
Messages
20
Hi,

I only got into Civ V last year, and I still only play the vanilla because I'm having so much fun with it. The only change I play around with is simply turning Science research to 4x the length than normal because it's a classic trait of Civ games to advance techs way too quickly.

Anyway, I was comfortably playing Emperor, but I stepped it up to Deity last night and just got buried in wonders and tech advancement.

For a bit of fun, I was wondering if it would be possible to make it completely and utterly impossible for other civs to build wonders. I always play as England if that helps. Could I make them unique to England perhaps?
 
Since you've limited this to England, then we can make it happen with SQL alone. Lua would be the only way if you want to limit it to the player no matter the civ. [EDIT: And it wouldn't be that hard to do; I was just in a SQL mood, I guess.]
[EDIT #2: Note you could have done it with XML alone, but it would have been a lot of typing, and it wouldn't apply to modded civs and modded wonders.]

Assuming you're not a modder, I'd suggest downloading whoward69's My - Changes mod. Unzip it to your mods folder, then edit the .SQL file, and add the following:
Code:
INSERT INTO Civilization_BuildingClassOverrides
   (CivilizationType, BuildingClassType, BuildingType)
   SELECT Civilizations.Type, BuildingClasses.Type, ''
   FROM Civilizations, BuildingClasses
   WHERE Civilizations.Type != 'CIVILIZATION_ENGLAND'
   AND BuildingClasses.MaxGlobalInstances = 1;
CREATE TRIGGER DisableWondersForModCivs_Astute
   AFTER INSERT ON Civilizations
   BEGIN
      INSERT INTO Civilization_BuildingClassOverrides
         (CivilizationType, BuildingClassType, BuildingType)
         SELECT NEW.Type, BuildingClasses.Type, ''
         FROM BuildingClasses
         WHERE BuildingClasses.MaxGlobalInstances = 1;
   END;
CREATE TRIGGER DisableModWonders_Astute
   AFTER INSERT ON BuildingClasses
   BEGIN
      INSERT INTO Civilization_BuildingClassOverrides
      (CivilizationType, BuildingClassType, BuildingType)
         SELECT Civilizations.Type, NEW.Type, ''
         FROM Civilizations
         WHERE Civilizations.Type != 'CIVILIZATION_ENGLAND'
         AND NEW.MaxGlobalInstances = 1;
   END;
The 2 "CREATE TRIGGER" statements [i.e., everything after line 7] isn't necessary if you don't use modded civs and/or don't use modded wonders, respectively, but it won't hurt to leave them in.

I haven't tested it in-game, but it looks good from the database side, so it should work. If you want it to affect another civ, just change the 2 places it mentions CIVILIZATION_ENGLAND to whatever civ you like.
 
Hey Nutty.

Thanks for the reply, mate.

A lot of that flew over my head but I'm going to re-read it now.

And yeah, I pretty much use vanilla, un-modded everything. I haven't even bought the DLC because I have lots of fun with the vanilla game. Only thing I've modded really is making science take 4x as long for everyone.

So I clicked whoward69's thread link, but there are two files in his sig. Do I download both or just one of them?
 
You don't need the ModBuddy project. Just download the mod, and unzip it in C:\Users\%username%\Documents\My Games\Sid Meier's Civilization 5\MODS\ .

There's one SQL file included in the mod, called something like MySQLChanges.sql. Edit it with notepad, and add the code from my post above. Start CiV, go to the MODS menu, check the little circle next to "My - Changes," hit NEXT, and start your game. When you want to load a saved game that you started with the mod, you should go through the MODS menu again.
 
Again, thanks for all the help, Nutty.

I left the "ModBuddy" one alone, however, the second one which is just the My Changes mod, is a single file and isn't part of a collection of files zipped up.

Actually, I just tried the "ModBuddy" one because it was a zip, and found the MySQLChanges.sql in My - Changes\My - Changes\SQL, so should I use this one after all?
 
a xxx.civ5mod file is the compressed (zipped) version of a mod.

  • When placed in your ~/Documents/My Games/Sid Meier's Civilization 5/MODS folder and you start up the game, the xxxx.civ5mod file will be extracted into a usable mod.
  • Or, you can use 7z or similar program to extract it directly into its non-zip form, and then copy the resulting mod folder into your ~/Documents/My Games/Sid Meier's Civilization 5/MODS folder.

You want the one called "My - Changes (v 1).civ5mod"
 
Oh right, thanks LeeS. Sorry for being a n00b.

Edit: It wouldn't let me extract it with WinRAR so I did it in another folder and copy and pasted it, but I can't edit the above text into the SQL file because when I save it's telling me access is denied. I've changed permissions and it won't let me.

Edit 2: So I edited the SQL file in another folder, copy and pasted it into the MODS folder, and it won't show up in the Mods menu when I start the game. lol this is tricky.

Edit 3: Sorry, I deleted the entire mod file, redownloaded it, gave full permissions on the parent folder (Sid Meier's Civilization 5) and then the mod showed and I enabled it. Quit game, added Nutty's text, saved document, reloaded the game, and now it's ready for testing!

Thanks so much again, guys!
 
Oh right, thanks LeeS. Sorry for being a n00b.

Edit: It wouldn't let me extract it with WinRAR so I did it in another folder and copy and pasted it, but I can't edit the above text into the SQL file because when I save it's telling me access is denied. I've changed permissions and it won't let me.

Edit 2: So I edited the SQL file in another folder, copy and pasted it into the MODS folder, and it won't show up in the Mods menu when I start the game. lol this is tricky.

Edit 3: Sorry, I deleted the entire mod file, redownloaded it, gave full permissions on the parent folder (Sid Meier's Civilization 5) and then the mod showed and I enabled it. Quit game, added Nutty's text, saved document, reloaded the game, and now it's ready for testing!

Thanks so much again, guys!
Did you extract the REST of the mod (and replace the SQL file with your edited version)? The SQL file alone isn't enough.

The access denied is making me think you're trying to edit it while it's still zipped up...

EDIT: Congrats!
 
Oh right, thanks LeeS. Sorry for being a n00b.

Edit: It wouldn't let me extract it with WinRAR so I did it in another folder and copy and pasted it, but I can't edit the above text into the SQL file because when I save it's telling me access is denied. I've changed permissions and it won't let me.

Edit 2: So I edited the SQL file in another folder, copy and pasted it into the MODS folder, and it won't show up in the Mods menu when I start the game. lol this is tricky.

If winRAR won't recognize it, then use the method where you place the civ5mod file into the MODS folder, then start the game, go into the MODS menu, wait for a moment or two for the file to extracted to its unzipped form, then exit back out of the game. You can then open the ~\My - Changes (v 1)\SQL/MySqlChanges.sql file using Notepad or some other text editor.

If you are having "Permissions" issues this has nothing to do with the My Changes mod. It has to do with settings of your computer on your end. I have Win8.1 and have never had any troubles related to "permissions".
 
Hmmm I don't think I'm quite doing it right, gentlemen. I did everything but a far away land just built The Great Lighthouse. This is what I currently have:

http://i.imgur.com/yWkosw3.png

http://i.imgur.com/JRW7eYv.png

http://i.imgur.com/D0i7Q9S.jpg

I've probably done something simple incorrectly.

Edit: I have absolutely no idea where the Game of Thrones stuff came from.

Edit 2: And I in no way enjoy Ed Sheeran or any other pop bilge. That's a remnant from an annoying ex who asked me to get that album.
 
Yeah, it's definitely not working, guys. I re-did everything from scratch, and even enabled the Game of Thrones mod for good measure, even though I still have no idea where it's coming from.

Started a deity game, thought things were going so well... then...


http://i.imgur.com/3TCXfNg.jpg

8s1BHWP.jpg
 
Well, you could zip up what you have, and we can make sure it works.
Or if you want to attempt to figure it out yourself, you could enable logging and check the database.log and/or get a SQLite viewer and check the database:

Just use SQLite Manager for Firefox or SQLiteSpy [that's the one that whoward69 uses, Paz]

[...or SQLite Database Browser or SQLite Studio or Sqliteman or SQLiteManager or SQLite Administrator...],

...then open the %userprofile%\Documents\My Games\Sid Meier's Civilization 5\cache\Civ5DebugDatabase.db file, [you can either run your mod, and while CiV is running, check the database, or] paste your SQL into the appropriate box (the "Execute SQL" tab in SQLite Manager), and see if an error pops up; if not, take a look at the database and see if the changes were made appropriately.

Note you'll actually be making changes to the database, but when you launch CiV, it will re-populate the database. So if you're going to be trying a few things, you might want to keep a backup copy of the db file so you don't have to launch CiV to get it to reset.

Or go another way entirely, and try for a Lua solution instead (paste into the Lua files of My Changes). [Note this will disable Wonders for all but the human player in a single-player game]:
Code:
GameEvents.PlayerCanConstruct.Add(function(iPlayer, buildingTypeID)
if iPlayer ~= 0 and GameInfo.BuildingClasses[GameInfo.Buildings[buildingTypeID].BuildingClass].MaxGlobalInstances == 1 then
return false
else return true
end
end)
 
Hey Nutty.

I'll try the other methods, but for now, I'll zip what I have and you can see what's what.

I also uploaded all the XML files from my Assets/Gameplay folder even though I've only really changed one thing and that's to extend research time.

How would I edit that "Lua" info? And to test it, would I deleted everything in MODS folder in My Games/Sid Meier's Civilization V first?

Also, is it not working perhaps because I have my Civ V installed not on my main directory, but rather my second G: drive?

Edit: Sorry Nutty, I only just read your reply. I'll try the Lua now, while assuming I need to remove the MODS stuff first.
 

Attachments

This may seem like a stupid question, but when you are in the MODS menu, and after you click on the enable button for the "My Changes" mod (and the little green checkmark displays for it), do you click the "NEXT" button at the bottom of the MODS menu, or do you click on the "BACK" button ?

-------------------------------------------------------------------------------------------

Slow down a little and let us help you figure out in an organized and methodical way what it is you are misunderstanding/misapplying. I say this because
And to test it, would I deleted everything in MODS folder in My Games/Sid Meier's Civilization V first?
would pretty much never be anything we would recommend in order to test whether a mod is working properly.
 
This may seem like a stupid question, but when you are in the MODS menu, and after you click on the enable button for the "My Changes" mod (and the little green checkmark displays for it), do you click the "NEXT" button at the bottom of the MODS menu, or do you click on the "BACK" button ?

-------------------------------------------------------------------------------------------

Slow down a little and let us help you figure out in an organized and methodical way what it is you are misunderstanding/misapplying. I say this because
would pretty much never be anything we would recommend in order to test whether a mod is working properly.


I click next and then it says configuring or something and then a little box pops up saying it's active with the only way to go but "back".

I just tried the Lua edit. Everything seemed promising, then a far, far away land built The Great Lighthouse :(


This is the Lua log if you're interested
 

Attachments

You aren't seeing this?
  1. After "Configuring Data" is done. Your screen will have a slightly different color-scheme because you have Vanilla and I have BNW. Plus, I have a rather long list of mods enabled.
    Spoiler :
    G5yLopc.jpg
  2. SINGLE PLAYER highlighted.
    Spoiler :
    rr6TSlr.jpg

    Clicking SINGLE PLAYER takes you to #3:
  3. SET UP GAME highlighted. If you have a modded game already saved that uses the same list of enabled mods, you can choose LOAD GAME at this point and go into the load-game menu.
    Spoiler :
    KMBENa5.jpg

    Clicking SET UP GAME takes you to #4:
  4. MODDED GAME SET-UP menu
    Spoiler :
    e1eqECo.jpg
If you click BACK at any point in the process, then you are not using mods, and no changes from any mods will be applied, regardless of whether they are "checked" as being enabled.
 
Ahhh whaaaat?! I did not know there would be a set up game in the MOD menu lol. I thought you had to apply it then you go the standard single player route.

I'm at work at the minute, but I'll be home in around 7 hours to check that out.

I definitely got the first screen where it listed "My Changes" in that little box, and the only button there being "Back".

But I didn't know about the other stuff, like doing a single player game from that MOD menu lol.

I'll post some screens when I get back.

EDIT:

So I'm back home and feel like the dumbest person ever for missing this:

Spoiler :
e5UcPGx.jpg


... and going to the normal single player menu instead! lol

Anyway, that mod there is back with the first SQL solution. I will try it and report back!


EDIT 2:


OMFG IT WORKS!!!!!!!!! Well, at least I'm positive it does because every other nation is reaching the classical age, tonnes of wonders left to build and nobody building them, and I'm able to scoop them with ease. Already got Great Library, Oracle, and Pyramids with Great Lighthouse underway with ease on Deity whereas normally I'm always about to hit Great Library and Great Lighthouse crops up as built straight away.

This was with the first SQL edit btw. So thanks so much Nutty for making those mods and thanks to LeeS for spotting my idiocy of missing the single player button! You guys rock!!
 
Back
Top Bottom