1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[PYTHONCOMP] Random Unit Names

Discussion in 'Civ4 - Mod Components' started by TheLopez, Feb 27, 2006.

  1. TheLopez

    TheLopez Deity

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Random Unit Names Mod
    By: TheLopez

    Last Updated 06/09/06

    Version: v0.5.2
    Patch Compatibility: v1.52, 1.61
    MP Compatible: ?
    Download Mod v0.5.2


    Description:

    This mod will give any unit created in the game a unique name. The current
    version of this mod can generate over well to many names to count. There are
    two ways to use this mod. The first is to just call the getRandomName method
    which will return just that, a random name. The second and new way to use this
    mod is to use the getRandomCivilizationName passing in the civilization type ID
    number. This mod should NOT be used as a stand-alone mod. You should just use
    the RandomNameUtils.py file instead. The other files are just used to show
    how the RandomNameUtils.py can be used.

    Installation Instructions:

    1) Unzip this into the "civ4_install_folder\Mods\" folder.
    2) Open the CivilizationIV.ini configuration file
    3) Change the Mod line to read: Mod = Mods\Random Unit Names
    4) Load the game.
    5) Then play as normal.


    -----Version Information-----

    -----v0.5.x------

    - Tweaked the Japan names so they don't always produce really long names

    - Added random name generation support for all of the original civilizations
    included in the original game. If someone wants to add other names they will
    have to do it themselves :p.


    Spoiler :

    -----v0.4------

    - Forked off the mercenaries mod random name generation code

    - Stripped the mercenary specific code from the mod


    -----===Credits & Thanks===-----

    - Exavier
    [TAB]Composite Mod - readme.txt format
     
  2. Crayton

    Crayton King

    Joined:
    Jul 18, 2004
    Messages:
    698
    Location:
    FLORIDA
    Wow, these look very Celtic :). I'm looking forward to the diversification for each civilization. I'd help, but the internet abounds in resources. Great job getting this to work. I especially enjoy the first AND last name components. I doubt it taxes the system much at all with the giant list of names, but I'm sure each civilizations' lists will be rich with half as much. Congrats.
     
  3. spincrus

    spincrus sol invictus...

    Joined:
    Dec 6, 2001
    Messages:
    1,079
    Location:
    Turkey, Austria, USA
    I won't download this mod component, as I'm waiting for the mercenary mod to be released :D

    Come on already, I'm getting veeery veeery impatient! :bounce:
     
  4. TheLopez

    TheLopez Deity

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Spincrus,

    It is getting very, very close ... would you like to see some new screen shots of the pre-release version?
     
  5. spincrus

    spincrus sol invictus...

    Joined:
    Dec 6, 2001
    Messages:
    1,079
    Location:
    Turkey, Austria, USA
    :bounce: Yes yes yes yes yes! :clap:
     
  6. CurtSibling

    CurtSibling ENEMY ACE™ SLeague Staff Supporter

    Joined:
    Aug 31, 2001
    Messages:
    28,826
    Gender:
    Male
    Location:
    Innsmouth
  7. WaxonWaxov

    WaxonWaxov Warlord

    Joined:
    Oct 26, 2005
    Messages:
    229
    Location:
    Charlotte, North Carolina
    Personally, I would like a mod that numbers units by type,

    For example, the first archer you build would be named "1st Militia"

    Militia would be city defense units.
    Infantry would be walking attack units (Swordsman, etc)
    Cavalry would be mounted units.

    etc etc.

    So the idea is early in the game you create a Horse Archer which gets named "5th Cavalry"
    Eventually, that unit could upgrade into a gunship, but would have the historical name "5th Cavalry"

    Just like the Scottish Black Watch used to use muskets, now they use Armoured Personnel Carriers.

    Hey Lopez, give me insight as to how you did this one and maybe I'll do my idea myself.
     
  8. TheLopez

    TheLopez Deity

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Hmmm..... well that is a very interesting idea. When I put out the random unit names mod I just ripped out the code from my Merc. Mod and made it available since someone had requested it. I am planning to extend it by making the random names a bit more specific depending on the civilization for the unit. Though I could introduce an option to do the type of naming that you are asking for as well. Let me mull this over and I'll see what I can do after I release my Merc. mod.


    Well, you can download the mod and see for yourself how I did it.
     
  9. WaxonWaxov

    WaxonWaxov Warlord

    Joined:
    Oct 26, 2005
    Messages:
    229
    Location:
    Charlotte, North Carolina
    The unique units for Each Civ should retain their type in the name.

    Navy Seals would be "Seal Team One", etc.

    Also, Ships should get names, like in the original mod here, but they should be civ specific. Like HMS, USS, etc.

    I did look at the mod and it seems pretty straight forward, but I'm python stupid.
     
  10. SK138

    SK138 Warlord

    Joined:
    Dec 16, 2002
    Messages:
    230
    Location:
    Hilliard, OH
    What if you named the ships after city names for the civ?
     
  11. Barak

    Barak Emperor

    Joined:
    May 1, 2003
    Messages:
    1,513
    Location:
    Chicago
    This may sound like a ignorant question, but does this mod work separately or is it integrated into the regular Civ game. Meaning would I play it as a mod, or just when I start a regular game. If regular, does it work with other mods?
     
  12. TheLopez

    TheLopez Deity

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    @Barak - It can work when starting a regular game if you drop the files into the customassets folder.

    @SK138 - Hmmm.... that is an interesting idea, maybe after some of the great people that have joined your civ as well?
     
  13. WaxonWaxov

    WaxonWaxov Warlord

    Joined:
    Oct 26, 2005
    Messages:
    229
    Location:
    Charlotte, North Carolina
    Isn't that completely random? I don't think a record is kept somewhere....
     
  14. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    It's done linearly through the ones listed in the xml file. Whenever a great leader is born it would trigger something in python, and backtracking you will be able to work out which civ has which great person....

    Or you could just grab the name when the trigger happened.

    In other words - a record could be made!
     
  15. SK138

    SK138 Warlord

    Joined:
    Dec 16, 2002
    Messages:
    230
    Location:
    Hilliard, OH
    I think I might try to do WaxonWaxov's idea with 1st Calvary or 3rd Infantry and stuff like that but I need some help. I was looking at your code for the RandomNames and I understand most of it but how do I find what unit was actually completed. Once I have that, how do I make the names count up, like 1st Calvary, 2nd Calvary, ..., Nth Calvary?
     
  16. TheLopez

    TheLopez Deity

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Well I ripped out the code that actually saves the names. The person who originally asked for the mod didn't require that the names be saved like in the Mercenaries Mod.
     
  17. WaxonWaxov

    WaxonWaxov Warlord

    Joined:
    Oct 26, 2005
    Messages:
    229
    Location:
    Charlotte, North Carolina
    Explorers/Scouts should have names like Christopher Columbus, Ponce DeLeon, etc.
     
  18. Rathelon

    Rathelon Prince

    Joined:
    Mar 10, 2006
    Messages:
    423
    Location:
    Portland, OR
    This is a really good mod, but being a former military man myself, I also would love to see this adapted to give the units military designations.

    Using your 'first', 'middle', and 'last' name format would work. The fist name could be a numeral designation, the middle name would be the unit type (infantry, cavalry, armor, etc), and the last name would be variable depending on the unit type as well (division, regiment, battalion, brigade, squadron, airwing, fleet, team, etc).

    Perhaps even to make it simpler, (so you wouldnt have to have a script to recognize the unit type being created) the 'middle' name could just be left as a long list of random names (perhaps civ-specific). So you would end up generating things like 7th Yoritomi Regiment (Japan), 29th Sun Yi Division (China), 512th Strecken Brigade (Germany), etc.
     
  19. TheLopez

    TheLopez Deity

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    All very good ideas, I am planning to update this mod after I complete my current mod: Sniper mod.

    Thanks for all the great ideas.
     
  20. Rathelon

    Rathelon Prince

    Joined:
    Mar 10, 2006
    Messages:
    423
    Location:
    Portland, OR
    I'm new to these forums, but I've done some modding in the past for Freelancer so I'd like to give it a shot. If you dont mind, I'd like to use your script and just alter the lists it generates from, but I have a question that perhaps you could help me with.

    I would prefer it only named certain units upon creation, i.e. combat units only - not settlers, workers, scouts, explorers, and spies. Would that entail altering your script, and if so, maybe you could tell me which part to look at?

    Also, I noticed in your script that you only generate the middle name if the first and last are less than 14. Is there a limit to the number of characters in the name, and if so, what is the limit?
     

Share This Page