python: how to end the Social War?

primordial stew

Emperor
Joined
Sep 1, 2005
Messages
1,219
Location
a puddle
This is for RFRE, which is a historical mod for Warlords.

The Social War breaks out in 91BC (?) because the cities in Italy are demanding Roman citizenship. The civ of "Italia" is spawned [game.createNewPlayer] and it takes over a bunch of cities [pAssimPlayer.acquireCity] in Italy, converts garrison units, and gets some random amount of Roman classes of units. I got most of that working. Now the more complicated part, how to end the war???

It can either be ended by conquering all of Italia's cities (probably difficult due to the number that flipped), or by building Lex Agraria. Lex Agraia is the reforms that opened up citizenship to peoples living in Italy, and this ended the war. The Romans took back some of the cities during the 3 year war.

Some mechanism must be created to allow Lex Agraria to be built (it could also be auto-built in python) after a min of 3 turns of war. The normal tech tree can't do a good enough job of hitting that mark. However, could a special tech be made researchable at this time? It would have beakers targeted at 3 turns, and would only enable the wonder BUILDING_LEX_AGRARIA. It would have to be enabled with the code that spawns Italia so the player can't just research it before the crisis erupts.

The list of cities is known, barring them being razed (eg by Hannibal's army when it invades Italy in 209BC).. a counter will run to make sure the Romans have conquered.. 2 of them. With the conquests and having built Lex Agraria the civ of Italia will have all it's assets converted to the iRomanID thus ending the war.

Is this overly complex?? What is a better way to do it?
 
You can make python do it behind-the-scenes (hide the building from the build list and then bring it back) but I suggest you give the player a notice when it has happened.

Can't remember where that was done from though...
 
So long as some cities have been taken back, building Lex Agraria will end the war (ie convert Italia's cities+units back to Roman), so this will be obvious to the player.

But what about the method to achieve this whole thing? I know people have written oodles and oodles of python, so is there a simpler way to simulate this?
 
Ah well. The problem with python is that it's completely invisible to the AI or player. So you'll a) need to make some incentive for the AI to build it, unless Rome is the only playable civ, in which case you need to give the player a notice of what it does.

Basically, you need this in the eventmanager.py:
on building built:
_ if building = lex agraria:
__ convert cities
__ convert units
__ peace
__ etc whatever you need to do.

Now, as for making it unbuildable, the easiest way would be to make it require a tech that can't be researched, but is given to the player by python.
 
Luckily this is only playable as the Roman. AIAutoplay is enabled, but I don't plan on spending the time necessary to try to get the AI to behave well enough. It's just there for testing, and maybe during the Pax Romana?


Ahhh... good, hiding things isn't something I know how to do, but I do know how to give techs. So 2 new techs for this:
1. tech_agrarian_troubles (given free in 91BC, is a prereq for tech_Agrarian_reforms, cost is -1)
2. tech_agrarian_reforms (gives free Lex Agraria? or maybe just allows)


Here is the handy link for the full explanation of this event:
http://en.wikipedia.org/wiki/Social_War_(91–88_BC)
 
Back
Top Bottom