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

Quick Modding Questions Thread

Discussion in 'Civ4 - Creation & Customization' started by kiwitt, Jan 27, 2010.

  1. Oblivionyx

    Oblivionyx Warlord

    Joined:
    Sep 10, 2018
    Messages:
    170
    Gender:
    Male
    I'm trying to change Byzantine Empire to Roman Empire, but I'm not sure what file to change. Can anyone tell me?

    I tried the XML file that controls the in-game civ names. It's not it, since it only changed the description...

    Spoiler :
     
    Last edited: Apr 15, 2019
  2. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,323
    Gender:
    Male
    Location:
    Canberra, Australia
    Did you change the _ADJECTIVE text? There are three texts that are used when naming a civilization. In the Civilizations.XML file you would see the three for the Byzantines
    Code:
                <Type>CIVILIZATION_BYZANTIUM</Type>
                <Description>TXT_KEY_CIV_BYZANTIUM_DESC</Description>
                <ShortDescription>TXT_KEY_CIV_BYZANTIUM_SHORT_DESC</ShortDescription>
                <Adjective>TXT_KEY_CIV_BYZANTIUM_ADJECTIVE</Adjective>
    
     
    Oblivionyx likes this.
  3. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,128
    Gender:
    Male
    Location:
    Leblanc
    You could also take a look into the scenario file, maybe a different text key is set there.
     
    Oblivionyx likes this.
  4. Oblivionyx

    Oblivionyx Warlord

    Joined:
    Sep 10, 2018
    Messages:
    170
    Gender:
    Male
    Thank you, I fixed it now.
     
  5. njadric

    njadric Chieftain

    Joined:
    Jun 24, 2015
    Messages:
    2
    Can someone please help?
    I am trying to get population of all players in game and I am using CyPlayer getTotalPopulation () but it always returns -1. I've tried other options such as
    getAveragePopulation () and long getRealPopulation (), but they all return -1.

    I am trying to calculate GDP per capita by getting GNP (Gold) and dividing with Population for each civilization as a part of my project to expand current Demographics.

    I should add that I am beginner in Civ IV modding and don't have strong developer background so any help is welcome.
     
  6. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,128
    Gender:
    Male
    Location:
    Leblanc
    Can you show the code in context? You can use [ code ] [/ code ] tags to display it in a readable way.
     
  7. njadric

    njadric Chieftain

    Joined:
    Jun 24, 2015
    Messages:
    2
    Hi Leoreth and sorry for late reply.


    I am using this only in the game console for now. First I declare variable:

    Code:
    player = CyPlayer()
    Then i declare population like this:

    Code:
    pop = player.getTotalPopulation()
    And then I try to print pop like this:

    Code:
    print pop
    As result I get -1

    I have tried some other options for population, but can;t remember now which ones. They all return -1.
     
    Leoreth likes this.
  8. devolution

    devolution Warlord

    Joined:
    Oct 7, 2016
    Messages:
    257
    Gender:
    Male
    Location:
    Stavanger, Norway
    @njadric

    You have to reference an actual player instead of just constructing a CyPlayer() object that does not refer to any player. Try using getActivePlayer() and call its getTotalPopulation() method instead for instance.
     
    Last edited: May 1, 2019
    Leoreth likes this.
  9. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    3,352
    Location:
    In a constant brainstorm...
    No Random Events option:
    IIRC I read somewhere that it is possible to make an event always launch, even when No Random Events are ON.
    Is that true? How can it be done?
     
  10. blovdubb

    blovdubb Chieftain

    Joined:
    Feb 4, 2006
    Messages:
    71
    Location:
    Charlotte,NC
    Is there a mod or way to have REGICIDE in BTS?
     
  11. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,488
    Location:
    israel
    yes.
    platyping created such a mod.
     
  12. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,128
    Gender:
    Male
    Location:
    Leblanc
    I just set BtS up on a new laptop with Windows 10, using the Steam version. In my previous setup with Windows 7 and the CD install, I could double click the scenario files in my mod to quickly launch into the scenario with the mod already loaded. After installing the mod again now, the scenario files were not associated with any application, and after choosing the BtS exe to run them with they would just launch into base BtS without a mod.

    Is this common? I feel like I'm missing something but I'm not sure if it's due to Win10 or the Steam installation.
     
  13. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,128
    Gender:
    Male
    Location:
    Leblanc
    I have the same problems with saves created from the mod. Opening them loads base BtS, which then fails to parse them.
     
  14. blovdubb

    blovdubb Chieftain

    Joined:
    Feb 4, 2006
    Messages:
    71
    Location:
    Charlotte,NC
    can buildings be used to produce units every so many turns (or random turns) by buildings like in civ3
     
  15. devolution

    devolution Warlord

    Joined:
    Oct 7, 2016
    Messages:
    257
    Gender:
    Male
    Location:
    Stavanger, Norway
    Last edited: May 23, 2019
  16. blovdubb

    blovdubb Chieftain

    Joined:
    Feb 4, 2006
    Messages:
    71
    Location:
    Charlotte,NC
    I read that entire thread the other day, didnt see anything about it but i mostly looking for posts about the regicide victory. Ill have a look.
     
  17. devolution

    devolution Warlord

    Joined:
    Oct 7, 2016
    Messages:
    257
    Gender:
    Male
    Location:
    Stavanger, Norway
    @blovdubb : Look in the C2C and\or ROM:AND2 sources as well, I think they have implemented unit spawning wonders.

    Anyways, you could code it up roughly like this:
    In the onBeginPlayerTurn callback, every n turns: check every city for the wonder\building being present in any of the player's city. If it is, spawn the unit you want there.
     
    Last edited: May 23, 2019
  18. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,488
    Location:
    israel
    Platy do have such a wonder.
    I don't remember which one.
     
  19. devolution

    devolution Warlord

    Joined:
    Oct 7, 2016
    Messages:
    257
    Gender:
    Male
    Location:
    Stavanger, Norway
    I now remember where I saw that code, check out the King Richard's crusade wonder from the BTS Extra Mod: https://forums.civfanatics.com/threads/bts-extra-add-on-02-nostalgia.314381/#post-7881303. It spawns a crusader unit every n turns if the wonder has been built.

    The code is here: Assets\Python\CvEventManager.py, lines 416-479

    Spoiler Unit spawning code :

    ## Crusade Start ##
    pPlayer = gc.getPlayer(iPlayer)
    b_Crusade = gc.getInfoTypeForString("BUILDING_CRUSADE")
    obsoleteTech = gc.getBuildingInfo(b_Crusade).getObsoleteTech()
    if ( gc.getTeam(pPlayer.getTeam()).isHasTech(obsoleteTech) == false or obsoleteTech == -1 ):
    for iCity in range(pPlayer.getNumCities()):
    ppCity = pPlayer.getCity(iCity)
    if ppCity.getNumActiveBuilding(b_Crusade) == true:
    iX = ppCity.getX()
    iY = ppCity.getY()
    u_crusader = gc.getInfoTypeForString( 'UNIT_CRUSADER' )
    estiEnd = CyGame().getEstimateEndTurn()
    if ( estiEnd >= 1000 ):
    if ( iGameTurn % 12 ) == 0:
    for i in range(1):
    pNewUnit = pPlayer.initUnit( u_crusader, iX, iY, UnitAITypes.UNITAI_ATTACK_CITY, DirectionTypes.NO_DIRECTION )
    elif ( estiEnd >= 700 ):
    if ( iGameTurn % 8 ) == 0:
    for i in range(1):
    pNewUnit = pPlayer.initUnit( u_crusader, iX, iY, UnitAITypes.UNITAI_ATTACK_CITY, DirectionTypes.NO_DIRECTION )
    elif ( estiEnd >= 500 ):
    if ( iGameTurn % 6 ) == 0:
    for i in range(1):
    pNewUnit = pPlayer.initUnit( u_crusader, iX, iY, UnitAITypes.UNITAI_ATTACK_CITY, DirectionTypes.NO_DIRECTION )
    elif ( estiEnd >= 300 ):
    if ( iGameTurn % 4 ) == 0:
    for i in range(1):
    pNewUnit = pPlayer.initUnit( u_crusader, iX, iY, UnitAITypes.UNITAI_ATTACK_CITY, DirectionTypes.NO_DIRECTION )
    else:
    if ( iGameTurn % 4 ) == 0:
    for i in range(1):
    pNewUnit = pPlayer.initUnit( u_crusader, iX, iY, UnitAITypes.UNITAI_ATTACK_CITY, DirectionTypes.NO_DIRECTION )
    basechance = 12
    estiEnd = CyGame().getEstimateEndTurn()
    if ( estiEnd >= 1000 ):
    basechance = basechance
    elif ( estiEnd >= 700 ):
    basechance = 6
    elif ( estiEnd >= 500 ):
    basechance = 4
    elif ( estiEnd >= 300 ):
    basechance = 2
    else:
    basechance = 1
    chance = CyGame().getSorenRandNum(basechance, "free state religion spread chance")
    if ( chance == 0 ):
    lppCityUber5 = []
    for iiCity in range(pPlayer.getNumCities()):
    ppCity = pPlayer.getCity(iiCity)
    if ( not ppCity.isHasReligion(pPlayer.getStateReligion()) ):
    lppCityUber5.append(ppCity)
    if ( len(lppCityUber5) != 0 ):
    chance = CyGame().getSorenRandNum(len(lppCityUber5), "which city")
    ppCity = lppCityUber5[chance]
    ppCity.setHasReligion(pPlayer.getStateReligion(), true, true, true)
    ## Crusade End ##

     
  20. Inthegrave

    Inthegrave Chieftain

    Joined:
    May 28, 2019
    Messages:
    28
    Gender:
    Male
    Does game speed or difficulty affect leader ContactDelays? Or is it always the same as set in the CIV4LeaderHeadInfos regardless of speed or difficulty?
     

Share This Page