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

The Modding Q&A Thread

Discussion in 'Rhye's and Fall Modmods' started by Leoreth, Apr 2, 2011.

  1. Linkman226

    Linkman226 #anarchy

    Joined:
    Sep 14, 2007
    Messages:
    2,493
    Yes, this is in the DLL... can't remember where specifically
     
  2. LuKo

    LuKo The Royal Guard

    Joined:
    Aug 28, 2006
    Messages:
    1,501
    Location:
    Poland
    Thanks, I will check it tommorow (if I finally reach home after a month). I thought it was held by Python so you saved me some time :)
     
  3. LuKo

    LuKo The Royal Guard

    Joined:
    Aug 28, 2006
    Messages:
    1,501
    Location:
    Poland
    I've got some Python code preventing buildings from being built:
    Code:
    	def cannotConstruct(self,argsList):
    		pCity = argsList[0]
    		eBuilding = argsList[1]
    		bContinue = argsList[2]
    		bTestVisible = argsList[3]
    		bIgnoreCost = argsList[4]
    		
    		# player can't build an arcology if they have shielding or advanced shielding
    		if eBuilding == gc.getInfoTypeForString("BUILDING_ARCOLOGY"):
    			if pCity.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_ARCOLOGY_SHIELDING")) or pCity.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_DEFLECTOR_SHIELDING")):
    				return True
    How can I prevent library from being built during Medieval Age or later if city owner has no Printing Press?

    [EDIT]: Ok, I've got it:
    Code:
    		if eBuilding == gc.getInfoTypeForString("BUILDING_LIBRARY"):
    			if ((gc.getPlayer(pCity.getOwner()).getCurrentEra() >= con.iMedieval) and not (gc.getTeam(gc.getPlayer(pCity.getOwner()).getTeam()).isHasTech(con.iPrintingPress))):
    				return True
     
  4. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    LuKo, it would go something like this:
    Code:
            if ( eBuilding == gc.getInfoTypeForString("BUILDING_LIBRARY")
                 and gc.getGame().getCurrentEra() >= gc.getInfoTypeForString("ERA_MEDIEVAL") ):
                    return not gc.getTeam(gc.getPlayer(pCity.getOwner()).getTeam()).isHasTech(gc.getInfoTypeForString("TECH_PRINTING_PRESS")
    You need to double-check all API methods and XML tags, since I never did. There could easily be a typo in there somewhere, but I'm sure you can manage it. ;)

    edit: Note that there is difference between the game era and the player's current technological era. Use whatever makes most sense in this context.
     
  5. LuKo

    LuKo The Royal Guard

    Joined:
    Aug 28, 2006
    Messages:
    1,501
    Location:
    Poland
    My version already works but thanks anyway as probably game era makes more sense here :)
     
  6. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    I was actually unsure about Consts being available in the CvGameUtils module, but didn't bother to check. If its working, I guess it is. (Otherwise you may have just imported it yourself.)
     
  7. civ-addicted

    civ-addicted King

    Joined:
    Aug 8, 2009
    Messages:
    852
    Location:
    The City of the Lion
    Are there any kind of hidden modifiers that determine how much stability a civ must lose before collapsing? I got the feeling that civs like Turkey or Russia are a lot harder to collapse than China for example.
     
  8. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    It works like this: At some interval of turns, a script looks up all players in turn, from Egypt all the way to America. The first one with less than -40 stability will collapse - the rest are saved, regardless of stability, this time around.

    So you would be right; The earlier Civs are more likely to collapse than the later ones.
     
  9. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,860
    Gender:
    Male
    Location:
    Leblanc
    I thought a lot if it would be worthwhile to change that ... putting all civs in a list and sorting by stability should be easy.

    On the other hand, maybe it's for the better that older civs die earlier.
     
  10. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    I also modded this feature. Heavily. :D
     
  11. Linkman226

    Linkman226 #anarchy

    Joined:
    Sep 14, 2007
    Messages:
    2,493
    Not with your second rebirths as different civs. Italy is screwed then
     
  12. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Yeah, but it could be argued that this is also by design: That the "second coming" Civs should be more fickle.
     
  13. Linkman226

    Linkman226 #anarchy

    Joined:
    Sep 14, 2007
    Messages:
    2,493
    Not five-hundred years after birth. And Leoreth already made newly reborn civs less stable than civs that spawn normally.
     
  14. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,860
    Gender:
    Male
    Location:
    Leblanc
    Cool, could you elaborate a little? The collapse system struck me as a little weird sometimes, with unstable civs surviving for too long etc.
     
  15. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Oh, I revamped all of the Rise'n'Fall features, including secessions and different types of AI collapses. The main idea was to keep some 20 odd players in-game at all times, so collapses will be more frequent the higher the number of active players. And the rebirth happens long before Nationalism, but becomes more commonplace the more players that gain the Tech. Again; The less active players, the more likely are the dead ones to re-surface. It, mostly, worked like a charm! :D

    Stuff like that. But today I know a huge amount more programming than I did some 18 months ago, so I would probably end up revamping the entire mod if I ever revisited this. It would probably make more sense to make my own mod from the ground-up. If I only had the time. :lol:

    Here's looking forward to retirement! :king:
     
  16. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,860
    Gender:
    Male
    Location:
    Leblanc
    I hope it's only temporary retirement :)
     
  17. Linkman226

    Linkman226 #anarchy

    Joined:
    Sep 14, 2007
    Messages:
    2,493
    :agree:

    Wouldn't want to lose Baldyr
     
  18. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    :lol: No, no... In the immediate future I will be (technically) home-less and (hopefully) working pretty much around-the-clock. So I'll only get back when I... land, somewhere and can pick up programming again.

    With "retirement" I meant the far, distant future, when I ain't bothered with the daily grind no-more. Boat-drinks! :king:
     
  19. hoplitejoe

    hoplitejoe Top fun-poster

    Joined:
    Mar 22, 2010
    Messages:
    5,467
    How could I make it so congress was always on?
     
  20. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Always? Like from the first game turn?

    You could do this on the command prompt of the built-in Python console. If you can manage to open it, that is. (Not everyone can.)

    edit: In \Assets\Python\StoredData.py you change this line:
    Code:
                                        'bCongressEnabled': False,
    into:
    Code:
                                        'bCongressEnabled': True,
     

Share This Page