Randomizing the city names list

PawelS

Ancient Druid
Joined
Dec 11, 2003
Messages
2,811
Location
Poland
I found a way to do one of the things I always wanted in this game: to randomize the list of city names, so the order at which they are used when a civ is founding cities is different every time you load the mod.

I'm too lazy to create a functional modcomp with it (it's incorporated into my mod), but it's basically a piece of SQL code like this:

Code:
CREATE TABLE Civilization_CityNames1 AS SELECT * FROM Civilization_CityNames;
DELETE FROM Civilization_CityNames;
INSERT INTO Civilization_CityNames SELECT * FROM Civilization_CityNames1 ORDER BY RANDOM();
DROP TABLE Civilization_CityNames1;

(The last command is not necessary, but I think it can save a small amount of memory.)

Oddly, it gives a "syntax error" in the ModBuddy, looks like the syntax checker doesn't know the CREATE TABLE ... AS command. But it works in the game.
 
That's a very nice find! I've tried it out and works perfectly. Thanks for posting it. :)
 
I really liked this idea, but I tweaked it a bit to leave the capital names alone. You can download it [as a functional mod] from my sig if you like [or on Steam].

Code:
CREATE TABLE Civilization_CityNames_Temp AS SELECT * FROM
    (SELECT * FROM Civilization_CityNames ORDER BY rowid DESC)
    GROUP BY CivilizationType;
INSERT INTO Civilization_CityNames_Temp SELECT DISTINCT * FROM
    Civilization_CityNames WHERE NOT EXISTS
    (SELECT * FROM Civilization_CityNames_Temp WHERE
    CityName = Civilization_CityNames.CityName)
    ORDER BY RANDOM();
DELETE FROM Civilization_CityNames;
INSERT INTO Civilization_CityNames SELECT * FROM
    Civilization_CityNames_Temp ORDER BY rowid ASC;
DROP TABLE Civilization_CityNames_Temp;
 
Good idea, I reported this thread for moving there.

Moderator Action: -> Thread moved.

I'm too lazy to create a functional modcomp with it (it's incorporated into my mod), but it's basically a piece of SQL code like this:

Would still be nice if someone could do it (just so that the normal end user can use it) :).
 
Nutty's version (without randomizing capital names) is a functional mod that can be downloaded using the link in his sig.
 
While I appreciate Nutty's mod, I am really looking for one that randomizes the capital city name as well.

I really have no clue what I'm doing here.
 
If you really need it and don't know how to make a mod yourself, I can do it...
 
While I appreciate Nutty's mod, I am really looking for one that randomizes the capital city name as well.

You could just edit my mod. Replace the contents of RandomCities.sql with PawelS's version in the first post. That's it.
 
Wow, thanks Nutty that worked! I don't know what I actually did, but I can cut and paste...those directions are simple enough.

Thanks again both of you! I will be using this mod from here on out!
 
I hate necrobumping, but I was wondering if it was possible to do the same thing with color, and if we are really crazy, leaderheads, and uniques.
 
Sorry for the necro-bump, but I have a question. I'm using this excellent modcomp in Anno Domini (with the capital's name intact) and like it - but wondered if there was a way that the first three cities would retain their name before the randomness happened - then each empire would have a capital city, two well-known cities then a random selection.
 
In Nutty's solution (post #3) replace the initial CREATE TABLE statement with

Code:
CREATE TABLE Civilization_CityNames_Temp AS
SELECT * FROM Civilization_CityNames c
    WHERE rowid IN (
        SELECT rowid FROM Civilization_CityNames n
            WHERE c.CivilizationType = n.CivilizationType ORDER BY rowid ASC LIMIT 3
    );

If you want the first 5 cities (say) to be kept, just change the "LIMIT 3" bit to "LIMIT 5"
 
Thanks! In the mod, it seemed a bit odd that the second city of a major empire could be a minor city, but it's nice to have that random element in once a few cities have been founded.
 
Back
Top Bottom