Power Up Mod

I can get the SDK and XML to work, but not the Python.

I can not get these functions to work:

PHP:
	def getNumUnitsNeededForBuildingPromotion(self, argsList):

[...]

	def getGoldCostForBuildingPromotion(self, argsList):

[...]

There's something wrong cause I can add all promos to the buildings and I can also add all promos to units without any experience :confused:
I get loads of Python errors :(
Gold/turn is displayed wrong.

Some screenies:
Spoiler :

First of many Python errors


This works fine


No costs are charged for promotions


All promotions added to building for free


Even after all upgrades units remain eligible for upgrade :confused:
 
I'm not familiar enough with BUG, so can someone help out here with how to incorporate changes to CvGameInterface.py and to CvGameUtils.py into BUG?

I think the BUG modders documentation should help here.
I guess my BUG version is not good enough. I've hardly tested it.
 
Assuming the mod has not changed how this stuff works in general...

When all promotions are free, it is typically because the relevant Python did not load due to errors. Any error that happens during the loading of the file will generally cause the entire file to fail to load.

The calculation for how much XP a units needs to advance a level is done in Python in the game utils file (named CvGameUtils.py is the regular name, it may be different in a BUG based mod which can load more than one). If the file fails to load due to a bug in the code, then when the DLL goes to call the getExperienceNeeded function in that file it will not find any such function to call and when that happens the returned value it gets is 0. That means that every level costs 0 xp to get, which makes it possible for any unit to get every available promotion for that unit type and still be eligible to go up a level and get more.


So the game utils file may have a bug that stops it from loading.

On the other hand...

Another possibility is that BUG may be complicating this. If BUG itself is not functioning properly (due to a bad merge or possibly even just a bad config file, for example) then it may not be loading the mod's game utils correctly, in which case the game utils file could be correct but you have no way of knowing since BUG is not loading it.

It is also possible that adding new functions to a class that BUG is trying to load as a set of game utils doesn't actually work - it may be that a function that is not one of the known names of functions that the DLL calls will fail to be added, which might case other failures (it could end the processing of the class so none after it are added either). I'm pretty sure this is the case...

Part of the comments from the start of BugGameUtils.py:
## Automatically Registering GameUtils
##
## addModuleUtils(utils, override=False)
## addClassUtils(utils, override=False)
## Adds all of the functions from <utils> as handlers and listeners. Every handler
## name must match the name of a callback
(with "Listener" appended for listeners).
## To ignore a function, begin its name with a single underscore ("_").

So adding functions to the class is not a great plan, if you are using the "load the entire class" method of getting them handled by BUG.
 
How to add unique promotions line for building.

Example I have fletchers hut (bow maker) and I want two things
1Gain xp to building only when built archery combat class unit
2 add fine bows and fine arrows promotions lines to this building
 
If you mean adding promotions that can only be added using a building (or a specific building) - I can't think of a way.
You can implement such a tag based on this mod, but you'll need to do some programming for it.
 
If I understand correctly, the SDK files are marked with what was changed but I would have to compare and contrast in order to know which of them are affected....is that correct?

But the python files have not been at all?

Does someone have a list of the SDK a python files that I would change? or the same files with the addition denoted? I am not sure I want to sift through everything only to miss the odd little piece of code here and there.
 
Upon re-reading, is this a non-BUG mod then? I do not need the Assets included on post #13 unless I want the python files that were changed to be denoted in the documentation. Correct? Those python files are for the attempted BUG-merge. Could I still use those python files or would I have to find the relevant code and C&P into my mod's python files?
 
Top Bottom