Turning off stability

Yes, it's called learning Python and using it. :p

If you're an experienced Python programmer, it's as simple as what Úmarth said, plus a few tweaks. If you have never written Python code...good luck...


Actually, now that I think of it, I had an idea to make a BTS mod that puts Rhye's stability and Unique Powers into the normal game, but I don't have the time for it so I never started.

If anyone is good at Python and can do this, i would be extremely thankful

*begs* :cry:

EDIT: And if possible, keeping the spawn dates? ( not location only date)
 
If anyone is good at Python and can do this, i would be extremely thankful

*begs* :cry:

EDIT: And if possible, keeping the spawn dates? ( not location only date)

Hmmm. I think I will give this a go. I too would like to add stability to my custom mod.

Here goes!
Spocko
 
I just heard from Rhye (thanks Rhye!!) and it seems that this could be done "using stability.py, storeddata.py and some pieces of rfceventhandler.py" - and there is no need to touch the SDK.

I suspect this touches CvMainInterface.py as well, to show the stability icon in the scoreboard.

I'll keep you posted on my progress!
Spocko
 
I just heard from Rhye (thanks Rhye!!) and it seems that this could be done "using stability.py, storeddata.py and some pieces of rfceventhandler.py" - and there is no need to touch the SDK.

I suspect this touches CvMainInterface.py as well, to show the stability icon in the scoreboard.

I'll keep you posted on my progress!
Spocko

great I will be waiting :goodjob:
 
and to add an idea, i dont know if its possible or not but on a terra map specificy those civs that should start in america start on the other continent?
to have more realistic
 
and to add an idea, i dont know if its possible or not but on a terra map specificy those civs that should start in america start on the other continent?
to have more realistic

Well, my first goal will be to isolate the code/files that are needed as a mod for standalone Stability. Since most of my modding has been with respect to REMOVING all linkages to Earth history (I call the Eiffel Tower the "Tower of Iron Lattice", renamed all my Civs and Leaders, adopted the Gods of Old religions, etc.), I'm not motivated to do much of anything with a Terra file or associated script (sorry!! :blush: ).

Nevertheless, as I work through this, if I encounter the places where the mod specifies Civ starting locations, I'll share what I find.

Spocko
 
I just heard from Rhye (thanks Rhye!!) and it seems that this could be done "using stability.py, storeddata.py and some pieces of rfceventhandler.py" - and there is no need to touch the SDK.

I suspect this touches CvMainInterface.py as well, to show the stability icon in the scoreboard.

I'll keep you posted on my progress!
Spocko

Well, I'm making progress on this, or so it seems. I've also incorporated the various XML files and CvMainInterface files, etc. and everything looks like it is running OK (as evidenced only by my stability icon changing on occasion), except I keep getting error messages in PythonErr.log, such as:

Code:
Traceback (most recent call last):

  File "CvEventInterface", line 23, in onEvent

  File "CvEventManager", line 199, in handleEvent

  File "CvEventManager", line 390, in onBeginPlayerTurn

  File "Stability", line 372, in updateBaseStability

AttributeError: 'NoneType' object has no attribute 'getTeam'
ERR: Python function onEvent failed, module CvEventInterface

This is only an example of the several messages that complain "AttributeError: 'NoneType' object has no attribute '{whatever}'"

I think these errors happen because of the way I've set up the eventmanager to call out to Stability.py - but I don't know how to tell whether or not this is the case.

Since my Python coding skills are limited to an ability to discern in general what the code is doing and to successfully fuse about 15 mod components together to form my own Mod, I know just enough Python to get into trouble. I don't know enough about these fancy EventHandlers that seem to replace the CvEventManager.py. So, to keep my code simple, I've kept the CvEventManager intact as the normal event manager, making calls out to other Python files when needed. I don't even know how to explain this...

So here's how I forked the RFC files from the BtS Mod as a standalone Stability Mod, using the BtS original CvEventManager instead of the several RFC Event handler/manager files:

In CvEventManager:
Code:
# StabilityMod
import StoredData
import Consts as con 
import Stability

...

# StabilityMod
storedData = StoredData.StoredData()
stability = Stability.Stability()

# globals
###################################################
class CvEventManager:
	def __init__(self):

...

	def onGameStart(self, argsList):
		'Called at the start of the game'
...
		# StabilityMod
		storedData.setupScriptData()
		stability.setup()

and then, for example:

	def onBeginGameTurn(self, argsList):
		'Called at the beginning of the end of each turn'
		iGameTurn = argsList[0]
		CvTopCivs.CvTopCivs().turnChecker(iGameTurn)

		# StabilityMod
		stability.checkTurn(iGameTurn)

For you Python gurus, is this enough to tell whether the stored data is being invoked, whether I'm calling out the Stability.py correctly?

Ask me questions and I'll happily give more details.
Thanks guys,
Spocko
 
I don't remember the exact procedure, but I think you should take a look at CvRFCEventManager.py and entrypoints\CvEventInterface.py too

Thanks, Rhye.

Actually your message suggests a better way to describe my problem - my goal has been to not reassign my normal eventmanager - to keep it as CvEventManager. Keeping this file as my normal eventmanager will help me when I roll this mod component into my homebrew fusion mod, which retains the CvEventManager as its normal event manager. I tried to use Dr Elmer Jiggle's approach toward swapping out the event manager and gave up a few years ago, since I could not understand the approach well enough to fuse other mods to my own. Keeping CvEventManager as my normal event manager has allowed me to make all kinds of glorious changes to my homebrew mod.

I've pulled from CvRFCeventManager each call that pertains to Stability (including StoredData.py) and put those commands into my CvEventManager. These commands include the import statements and various calls to the Stability.py file.

So, I guess my question is: is my syntax shown in my previous post correct given that the task is to pull from CvRFCeventManager any and all statements that pertain to Stability and put them into CvEventManager?

Dr Elmer Jiggle provided a nice description of how to change a "normal" mod to one that uses his style of event manager, but I have found no documentation on how to convert a Jiggle-style mod back to the original CvEventManager format.

Does this help frame the context of my question?
Thanks for your attention!
Spocko
 
another note:

AttributeError: 'NoneType' object has no attribute 'getTeam'

usually happens when there isn't a team set in that slot, that is when the number of civs set in the SDK mismatches with python.
Then you should edit stability.py and storeddata.py and revert the arrays and the global variables to 18 civs
 
another note:

AttributeError: 'NoneType' object has no attribute 'getTeam'

usually happens when there isn't a team set in that slot, that is when the number of civs set in the SDK mismatches with python.
Then you should edit stability.py and storeddata.py and revert the arrays and the global variables to 18 civs

Excellent! Perhaps my syntax in CvEventManager is correct after all. I'll have a go at this later today.

Thanks Rhye!!
Spocko
 
Excellent! Perhaps my syntax in CvEventManager is correct after all. I'll have a go at this later today.

Thanks Rhye!!
Spocko

Breakthrough! Now I'm getting only one error message that pertains to an array somewhere that I missed in my cleanup.

Code:
Traceback (most recent call last):

  File "CvEventInterface", line 23, in onEvent

  File "CvEventManager", line 199, in handleEvent

  File "CvEventManager", line 375, in onBeginGameTurn

  File "Stability", line 190, in checkTurn

  File "Stability", line 139, in setOwnedPlotsLastTurn

IndexError: list assignment index out of range
ERR: Python function onEvent failed, module CvEventInterface

I'll clean this out and then look to streamlining Const.py and StoredData.py so that they pertain exclusively to Stability (and not plagues, historic replay, etc.).

Thanks Rhye! :goodjob:
Spocko
 
Back
Top Bottom