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

Happy Golden Age

Discussion in 'Civ4 - Mod Components' started by platyping, May 24, 2013.

  1. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Fixed, probably :D
     
  2. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Healthcare Bar



    Functions similar to Golden Age Bar (Collects nationwide excess Healthiness)
    Triggers +1 Population to All Cities when filled

    Both Bars Threshold now start at 250
    Added message display when either is filled

    Notes:
    Golden Age Bar does not grow in Golden Age or Anarchy
    Healthcare Bar does not grow in Anarchy but grows in Golden Age
    It is possible to make the bars 2 sided, (right towards 250, left towards -250 and triggers negative effects if filled to the left) but I don't really see a need

    Edit:
    Reuploaded, forgot to remove World Builder :D
    Added a isAlive() check to reduce performance taxing
     
  3. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,519
    Location:
    israel
    hey man,

    the health bar is an awesome idea.

    i think theres a pythom error in the event manger:


    this line is the problem:
    Code:
    sScript = str(iCurrent) + "HGA" + str(iThreshold) + "Split" + str(iHealthCurrent) + "HHB" + str(iHealthThreshold)
    			


    hope u can fix :)
     

    Attached Files:

  4. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,519
    Location:
    israel
    HURRAY!

    I FIGURED IT OUT BY MY SELF ! :)

    this is the fix:

    sScript = str(iHealthCurrent) + "HGA" + str(iHealthThreshold) + "Split" + str(iHealthCurrent) + "HHB" + str(iHealthThreshold)


    yey!
     
  5. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    It is not, should be happy if I remember.
    Check the starting ones
     
  6. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,519
    Location:
    israel
    well, for not i see that its working -
    u saying that instead it needs to be i happycurrent?
     
  7. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    It is working only because a variable is assigned correctly, just that it is assigned a wrong variable.
    The first 2 are meant for happiness, the latter for health.

    I thought I tested it after rename hmm
     
  8. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Knew I tested it before uploading :D
    The problem is not a wrong variable name.
    It is just that it becomes undefined during Golden Age.
    Fixed and reuploaded.
     
  9. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,519
    Location:
    israel
    great thank you my dear python king.
     
  10. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,519
    Location:
    israel
    hey platy,

    where can i make the thresh hold for the gilden age and health care higher - i want it to take much longer.

    thanks
     
  11. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Should be pretty obvious in cveventmanager.
    The codes are pretty short. Just search for 250
     
  12. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,519
    Location:
    israel
    oh ye silly me, sry to bother u.
     
  13. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    So, I merged this with LoR for a personal play session and it is working though with 1 minor glitch.

    Each turn, it resets to 0.

    Beyond that, I've noticed that the Barbarians are getting Golden Ages too.

    Any assist would be greatly appreciated.
     
  14. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    It means that the other mod has features that alter player script data as well.
    So depending how the other mod uses script data, hard to advise.
    Barb one is intentional, don't see why they should be denied.
    Although it can be deactivated easily
     
  15. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    Alright, I kinda figured that the Barbarians getting them was working as intended.

    There is a lot of python in LoR and I've only a minor ability with modding python.

    Any tips on where to start looking?

    BTW, I really like this mod comp, I wouldn't have downloaded it if I didn't (now to just get it to work with LoR).
     
  16. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Ctrl f and search for setscriptdata.
    Because using the same script data will wipe the saved data of this mod.
    Which is why it resets every turn.
     
  17. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    There are 13 hits in 4 files for "setscriptdata"

    1 is in your file.

    The other 12 are in BugData.py (1 hit), PyHelpers.py (2 hits) and SdToolKitCustom.py (9 hits)

    A copypaste from the N++ find in files search is in the spoiler. I am assuming that the conflict is in SdToolKitCustom. I'd have no clue what to do when I found the conflict though.

    Spoiler :
    Code:
    Search "setscriptdata" (13 hits in 4 files)
      F:\Games\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\LoR_Happy_Golden_Age\Assets\Python\BUG\BugData.py (1 hit)
    	Line 243: 		self.game.setScriptData(pickle.dumps(self.data))
      F:\Games\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\LoR_Happy_Golden_Age\Assets\Python\CvEventManager.py (1 hit)
    	Line 416: 			pPlayer.setScriptData(sScript)
      F:\Games\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\LoR_Happy_Golden_Age\Assets\Python\PyHelpers.py (2 hits)
    	Line 441: 	def setScriptData(self, szScriptString):
    	Line 443: 		self.city.setScriptData(szScriptString)
      F:\Games\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\LoR_Happy_Golden_Age\Assets\Python\SdToolKitCustom.py (9 hits)
    	Line 74: 	CyGameInstance.setScriptData( pickle.dumps(cyTable) )
    	Line 104: 	CyGameInstance.setScriptData( pickle.dumps(cyTable) )
    	Line 260: 	object.setScriptData(pickle.dumps(cyTable))
    	Line 271: 		object.setScriptData(pickle.dumps(cyTable))
    	Line 282: 		object.setScriptData(pickle.dumps(cyTable))
    	Line 326: 		object.setScriptData(pickle.dumps(cyTable))
    	Line 330: 		object.setScriptData(pickle.dumps(cyTable))
    	Line 346: 		object.setScriptData(pickle.dumps(cyTable))
    	Line 362: 		object.setScriptData(pickle.dumps(cyTable))
    
     
  18. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    The only ones of interest are the ones using player script data.
    City and game ones no conflict.

    Thus, the culprit is most likely the ones in the last file depending what is object
     
  19. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Generally, there is only one script data per player.
    Thus, when 2 modcomps are using the same script data, using set will overwrite the data of the other one.

    The solution to this is that the script data has to be partitioned into different sections such that first part is used for mod A and second part for mod B.

    Of course, when using getscriptdata to retrieve the saved data, the retrieved data has to be split into the different partitions to analyse the data.

    If you analyse the codes for this mod comp, you will realise it is already partitioned into 4 parts, 2 for happiness, 2 for health. Additional codes have to be done to add a new partition for the other mod

    Thus, looking at the intensity of the mod, it may be easier to ask the modder how to add in this small mod, rather than ask me how to add in that big mod :D
     
  20. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    Most all of the python in LoR is from Revolutions and BULL (IIRC) so I'll ask over there.

    Thanks for the help btw.
     

Share This Page