Stability Cheat modmod

Baldyr

"Hit It"
Joined
Dec 5, 2009
Messages
5,530
Location
Sweden
Update: This modmod is included in the latest RFC patch, so I have removed the download.

After reading a good few thread on the main RFC forum about players not being able to cope with the stability system, and reading tons of advice given to these players, I came to a conclusion:

The only way to cheat a collapse is to change the actual Stability rating of your Civ, and that would have to be done with Python code. Nothing you can achieve in the World Builder would of course have anything but minuscule short term effect on Stability. Instead of walking these players who are willing to cheat in order to save their game through how to edit the scenario or how to go about changing the rating via the built-in Python console, I decided to try something little more hands-on:

  1. Click on the link at the bottom to download a zip-packed alternate version of the file CvRFCEventHandler.py
  2. Go to the ...\Sid Meier's Civilization 4\Beyond the Sword\Mods\Rhye's and Fall of Civilization\Assets\Python\ folder and make a copy of the original CvRFCEventHandler.py
  3. Unzip the downloaded file into that same folder so that it replaces the old file.
  4. Start up a game or load a saved game. Once in-game, press the shortkey shift + alt + q in order to enable the RFC "Cheat Mode".
  5. Now, every time the shortkey shift + alt + s is pressed, the Stability rating of the human player's Civ will go up 10 points. :eek:
The way to salvage a game doomed for collapse at a certain game turn (and it will always happen on that same turn), is to simply boost the Stability rating above -40 and the collapse is avoided. By always keeping the Stability rating above this value all future collapses can be avoided (for the human player).

In case anyone would like to add this feature to an already modified CvRFCEventHandler.py this is the code:
Spoiler :
Code:
                #Stability Cheat
                if self.rnf.getCheatMode() and theKey == int(InputTypes.KB_S) and self.eventManager.bAlt and self.eventManager.bShift:
                        print("SHIFT-ALT-S") #boosts stability by +10 for the human player
                        utils.setStability(utils.getHumanID(), utils.getStability(utils.getHumanID())+10)
It goes anywhere under the definition for the function/method onKbdEvent():
Code:
        def onKbdEvent(self, argsList):
 
Once again, you come up trumps. I won't use this because I like the stability challenge when it doesn't kick my ass - but I love the way you've gone about it :)
 
Thanks man! :goodjob:

As described elsewhere, I have been messing around a lot with the stability system myself and once I can find time to work some more on it, I might post a modified stability modmod. It features "dynamic" stability that make Civs collapse and respawn more frequently:

Spoiler :
Collapses would no longer be directly caused by instability, but rather by being in Anarchy. Any turn a Civ is in Anarchy (due to civics changes) there is a risk of collapse. This risk is greatly influenced by the actual Stability rating - but also by the number of active Civs in play. So a Civ with, say, +20 Stability would be pretty safe for a turn of Anarchy or two - unless there are less than average number of Civs in play at the moment.

This also means that the number of Civs will tend to stabilize around 20 or so (if I recall correctly). Also, Civs will respawn before Nationalism (not all though) but this is less frequent. The number of Civs with Nationalism affects the chances of any Civ to respawn though, so Nationalism will still trigger respawns galore. (They will get more and more common with time, and as a consequence so will collapses as the collapse threshold will be lowered for each respawn.)

In order to counter-weight Anarchy as the cause of collapses, a Golden Age will make a Civ safe from collapse in its duration. On the other hand, Anarchy now causes more instability than before, so a long period of Anarchy would be very risky for all but the most stable of empires! (There are also in-game messages telling you about what Civs are undergoing Anarchy and how severe the political situation is.)

This would, of course, not be for all tastes. :rolleyes: Those players who feel that they need to cheat the stability system would probably feel the need to do so constantly! But the idea is actually that you'd pretty much have to endure a Civil War or two as the human player - and also that your rivals will rise and fall more frequently. I like to view it as more "Rhye's and Fall". :king:


As I said, I may collect all of my changes for a future modmod...
 
Is there any chance you could also include a cheat code for a smaller amount of stability? Say +5 or so? Just something to give you a little boost when you need it, without being too much.
 
Is there any chance you could also include a cheat code for a smaller amount of stability? Say +5 or so? Just something to give you a little boost when you need it, without being too much.
Nah... But you could change the amount yourself to whatever you wish. Open the downloaded file and go to line #1076:
utils.setStability(utils.getHumanID(), utils.getStability(utils.getHumanID())+10)
Change the value 10 (red) to 5 or whatelse. :goodjob:
 
I have a question on enabling the cheat mode:

From the changelog of version 1.183:

Squatting enabled only in “cheat mode”. Press SHIFT+ALT+Q to enable it°°

Does that mean that whenever I open the cheat mode to give myself more stability, I enable squat mode as well?

Not that I ever want to do that of course.:D Though it's a pretty neat mod for all people who want to use it.
 
Ok, here's another "cheat mode" if you like.

Installation is the same as above but this time for the Stability.py file. What it will do is give a slight (+1) Stability boost to the human player on every 10 turns - only on Viceroy level. This will add up over time though. (Its basically equal to 3 times the default stability boost for Viceroy, which is +1 Stability every 20 turns. Because both apply at the same time.)

Call it training wheels, or something. :p

edit: I added another Viceroy-only feature: The expansion threshold of max 32 foreign tiles is effectively tripled to 96! :eek: This should make most players new to RFC stop complaining about not being allowed to expand beyond their historical borders...

disclaimer: I haven't actually tested this one so a test pilot would be appreciated. :goodjob:
 

Attachments

  • StabilityBoost.zip
    11 KB · Views: 366
Does that mean that whenever I open the cheat mode to give myself more stability, I enable squat mode as well?
That would be yes.

More cheats could be added to the cheat mode... Come up with a shortkey and an effect and I (or someone else) might just whip up the code for it. :king:

I believe that there is already a gold and Tech cheat in there somewhere, by the way, but since I don't cheat I haven't bothered with it. :p
 
I like your ideas Baldyr, except:
- Doesn't that mean one could avoid civil war by choosing some civics and keeping them forever?
- Does that make India immune from collapse?
- Does it make civs with Cristo Redentor immune from collapse?
 
I like your ideas Baldyr, except:
- Doesn't that mean one could avoid civil war by choosing some civics and keeping them forever?
- Does that make India immune from collapse?
- Does it make civs with Cristo Redentor immune from collapse?
It was a while back that I was toying with this, but I also believe that I made secessions more commonplace - for unstable Civs. And Despotism comes with severe stability penalties, so you would wanna change civics eventually! So instead of a Civil War (collapse) you'd get a slow fragmentation (secessions). And as you well know - bad civics equal instability - so the trick is to change civics while you're in the green, even if it means a slight risk of collapse. (+20 or so is usually totally safe not counting the effect of the Anarchy turns themselves...) Because the alternative would be far worse!

But you might nonetheless be right about possible exploits. If some UPs or Wonders or the like cause balancing issues that would of course have to be dealt with accordingly. (Note however that the AI will also collapse for other reasons.)

Yeah, and I also made Anarchy last more turns by editing XML. I do however believe that newly born Civs have a grace period from collapse in order to be able to change their starting civics - even if the Anarchy will set them back in Stability. (I might end up presetting their civics however.) And for testing purposes I made every respawn be accompanied by a Golden Age - making the Civ safe from another immediate collapse. (I actually like this idea as a respawn = rebirth = renaissance = golden age.)

There are more tweaks in there than I can keep track of, so I'd have to give it some work before releasing anything at all...

edit: Looking at the code I now see that I actually made a Civ with "collapsing" stability (-40 or less) go into Anarchy periodically. So instability would still lead to collapses - but it would be because the instability made them go into Anarchy.
 
Is there any way to prevent the AI from collapsing. It is no fun when the AI typically begins to collapse when they lose a couple of cities during a war.
Perhaps one can modify the python so that the AI does not collapse so easily?
 
Sure, the mod is moddable. What you describe is a situation where an AI loses at least half of its cities, I believe. Other than that, an already unstable Civ that loses a city or two could very well be pushed over the threshold (less than -40 stability) and eventually collapse.

What exactly do you wanna do?
 
A question, would it be possible to raise stability only in specific categories? Like, say, only in Civics category?

The reason I'm asking is because I've had quite a few Anarchies during my play and now my Civics score is low due to permanent Anarchy.
 
make it so you can always give civs cities that are in their dark green spawn zone? I was Spain and I vassalized America but but I was unable to give them cities in their dark green zone, also being able to gift cities in a civs light green zone would be nice too (like gifting America cities in Canada for example)
 
A question, would it be possible to raise stability only in specific categories? Like, say, only in Civics category?
To add shortcuts to all of the categories? Like shift + alt +1 for the first category, shift + alt + 2 for the next one, and so one?

It should be possible, but I haven't tried it.
 
make it so you can always give civs cities that are in their dark green spawn zone? I was Spain and I vassalized America but but I was unable to give them cities in their dark green zone, also being able to gift cities in a civs light green zone would be nice too (like gifting America cities in Canada for example)
I think this is a very good idea, but it does sound like something that would have to be done in the SDK (in C++) so I'll pass it to someone who actually knows what they're doing... :rolleyes:
 
I run a mac and I really suck at rfc :blush: and need the stability cheat. I cant find it in anywhere in my game please help!
:confused::confused::confused::confused::confused::confused::confused::confused::confused::confused::confused::confused::confused:
 
I run a mac and I really suck at rfc :blush: and need the stability cheat. I cant find it in anywhere in my game please help!
:confused::confused::confused::confused::confused::confused::confused::confused::confused::confused::confused::confused::confused:
First enable cheat mode by pressing shift + alt + Q. Then press shift + alt + S to gain extra stability.

Assuming that you have the latest version of RFC.
 
First enable cheat mode by pressing shift + alt + Q. Then press shift + alt + S to gain extra stability.

Assuming that you have the latest version of RFC.

I've all ready tired that and nothing happened and when I look in the file the is no cheat.:confused:
It is an current update so I cant figure out why it isn't there.
:confused::confused::confused::confused:
 
Top Bottom