Happy Golden Age

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
 
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 :)
 

Attachments

  • 1errorgolden.jpg
    1errorgolden.jpg
    42.9 KB · Views: 485
It is not, should be happy if I remember.
Check the starting ones
 
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
 
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.
 
Should be pretty obvious in cveventmanager.
The codes are pretty short. Just search for 250
 
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.
 
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
 
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).
 
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.
 
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))
 
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
 
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
 
Most all of the python in LoR is from Revolutions and BULL (IIRC) so I'll ask over there.

Thanks for the help btw.
 
Top Bottom