Introducing: PyScenario - easy-to-use scenario event scripting for RFC

Vikings reached the Renaissance, because Nidaros renamed to Trondheim (which is a default rename code present in citynamemanager.py) correctly.
This is interesting. Looking at Rhye's code (CityNameManager) I can see that there are three conditions for the rename to fire: 1. Viking receive any Tech, 2. the Viking are in the Renaissance era, and 3. the Viking own a city called "Nidaros".

The PyScenario Condition Trigger(11).tech(eEra=3) is also checked whenever the Vikings receive any Tech, but it is the Era that the Tech belongs to that determines whether or not the Action(s) will be fired. This is probably why Nidaros became Trondheim and Birka didn't become Stockholm.

Without testing it myself (yet) I would guess that the Trigger had already fired before Birka was founded/spawned (because the Vikings somehow received a Renaissance Tech). But then again - it should fire each time the Conditions are met... (I'll have to revisit the actual code.)

I also had a trigger for Russian renames when they hit the industrial era which didn't fire (I was Russia so I definitely know I was in industrial era ;)). I will email you the scenario.
I'd say its the same issue as with the Vikings. Could it be that trading Techs don't count as "Tech Acquired" according to the game?

Thank you for testing and I will be doing some debugging of my own using your script as soon as I get the time. Hopefully tomorrow night. :king:
 
Regarding the city naming issues, I believe I found the bug and I commented on it in the beta-test thread.
 
I'm in the mid 18th century now and time between turns seems to be increasing very fast. Shouldn't lag affect less as time goes on, as triggers get discarded?
 
I'm in the mid 18th century now and time between turns seems to be increasing very fast. Shouldn't lag affect less as time goes on, as triggers get discarded?
I replied in the beta-testing thread. Lets try to keep the testing issues in there, because otherwise this thread will be cluttered down with bug reports and such. :p
 
I'm happy to report that I've tracked down the source for any lag and that it has been successfully taken care of! :goodjob: As I said in the testing thread: expect the next update to be free of any lag issues. :king:
 
is it possible to make all cottage/hamlet/villages give +1:food: and towns give +2:food: only in Asia? Because I want to mimic large population in Asia.
 
is it possible to make all cottage/hamlet/villages give +1:food: and towns give +2:food: only in Asia? Because I want to mimic large population in Asia.
This would fall beyond the scope of PyScenario, but practically anything is possible - if you know how to code it yourself.

You could probably add :food: to any city with CivIV Python, so what you wanna do is find a way to loop through all the cities in that area (or just all Indian and Chinese cities, period?) and lookup whether or not they are working any of the improvements you mentioned. And if they are, add food accordingly.

The trick, of course, is to make your code as efficient as possible so you're not adding to the lag... :p

Another idea could be to simply add :food: to all cities of select Civs on every turn. This will make their cities grow and also make them not starve before the shortage gets out of hand totally.

What about increasing the :food: output of Rice? If that resource is only found in the desired areas this would have an effect on population change. You can change this easily in the XML.
 
I also wanted it to apply food to other civs in that area, so Britain's Indian cities would get extra food too,

could I make a building called "Slums" that would be added to all Asian (and now that I think about it South America too) every 10 turns and check on city trade/found/conquest?

would this slow the game down too much?
 
I also wanted it to apply food to other civs in that area, so Britain's Indian cities would get extra food too,
Yes, of course. Then it would simply be a matter of finding all cities inside a defined area. Not too hard to do.

could I make a building called "Slums" that would be added to all Asian (and now that I think about it South America too) every 10 turns and check on city trade/found/conquest?
Do you mean like a UP? That cities in some areas get a free building? What would that building do? (If you simply wanna add food that part can be done in the XML.)

would this slow the game down too much?
It would depend, I guess. Testing would be required.

If you're interested in testing PyScenario I could probably make some methods for you to test out. Like a food() method for adding food to a target city. And by defining a map area (like Asia) you could use a PyScenario script to add food to all cities inside this area. On every turn, on every other turn, at a random interval, or whatever you like.

And if you manage to add a building to RFC (not as easy as it would seem, by the way), it would be easy to add that building in any city with PyScenario (it would involve using the buildings() method)...
 
is it possible to make all cottage/hamlet/villages give +1:food: and towns give +2:food: only in Asia? Because I want to mimic large population in Asia.

Yes, of course. Then it would simply be a matter of finding all cities inside a defined area. Not too hard to do.


Do you mean like a UP? That cities in some areas get a free building? What would that building do? (If you simply wanna add food that part can be done in the XML.)


It would depend, I guess. Testing would be required.

If you're interested in testing PyScenario I could probably make some methods for you to test out. Like a food() method for adding food to a target city. And by defining a map area (like Asia) you could use a PyScenario script to add food to all cities inside this area. On every turn, on every other turn, at a random interval, or whatever you like.

And if you manage to add a building to RFC (not as easy as it would seem, by the way), it would be easy to add that building in any city with PyScenario (it would involve using the buildings() method)...

Slums: all cottage/hamlet/villages give +1:food: and towns give +2:food:

Slums would be added to all cities in the pre-defined ares (I want them to be Brazil, India, SE Asia and China, but wouldn't be that hard?), I want this to be done through town line because pillaging towns=razing slums
 
Slums: all cottage/hamlet/villages give +1:food: and towns give +2:food:

Slums would be added to all cities in the pre-defined ares (I want them to be Brazil, India, SE Asia and China, but wouldn't be that hard?), I want this to be done through town line because pillaging towns=razing slums
Ok, start by figuring out how to add the Slums building, then. I can't help you with that one, since I'm yet to add a completely new building to RFC myself. Where to get the graphics? (Or would it exist in name only? Like the Triumph Arch national wonder.)

To get the desired effect - Cottages>Towns give extra :food: - there would be two paths you can take. (And I don't think you can achieve this through editing the XML entries for the improvements.)

The easier would probably be a Python mod that checks all cities and grants the :food: every turn if the Slums building is present and if the improvements in question are there and are worked. This would not be reflected in the city screen - at all - though, but the :food: would just magically appear in between turns. Very confusing for the human player, I'm sure... :rolleyes:

The more advanced method would involve C++ code and I wouldn't even know where to start, I'm afraid. But it might be possible to override the XML settings for the improvements (extra :food: output) and make the actual improvements yield more :food: - only in cities with the Slums building.

Only a small part of this could be achieved by utilizing the PyScenario application, why I guess you probably should start a new thread for this project...
 
what about the building getting +1 food per cottage/hamlet/village? and +2 per town? not built into the improvements
 
what about the building getting +1 food per cottage/hamlet/village? and +2 per town? not built into the improvements
Yeah, as I said - it should be possible to add some Python code that checks cities and grants :food: based on the presence of a specific building in cities what are working certain improvements. I can help you with this part - whether you wanna add some code into the Event Handler directly - or whether I build in support for this in PyScenario.

But you could still start by adding the building itself to the mod. (The easiest way would be to simply replace a building or wonder that you don't consider essential to the mod. But then there is the issue with the graphics... Someone ought to be able to help you though.)
 
It does not need graphics and needs to be spy-proof
 
Is there somewhere I can get a copy of the map with the coordinates displayed (not necessarily each individual tile, just the axes)? I can't imagine all you modders count tiles every time you want to change a plot. This would really help me to start playing around with the event scripter. Thanks!
 
Nevermind about the tile coordinates; I should finish reading the instructions before posting questions eh?
 
Is there somewhere I can get a copy of the map with the coordinates displayed (not necessarily each individual tile, just the axes)? I can't imagine all you modders count tiles every time you want to change a plot. This would really help me to start playing around with the event scripter. Thanks!

When I'm messing with the plots I have Civ in windowed mode, go into world builder and use the sign tool on the British dye (easiest to remember location of) and go in each direction labeling every five tiles or so
 
Tiles begin at (1,1) in the top left corner of the map.

To find out which tiles are where, enable cheat mode in Civ4.ini - there are numerous guides on how to do this.

Once that is done, simply hover over any tile and hold the shift key - in the bottom left of the screen, the game will inform you which tile you are looking at.
 
In the name of not adding to the confusion (but thanks for trying to help! :goodjob:), here's what the tutorial says:
3.7 Finding tile coordinates

It might not be obvious how to find the coordinates for map tiles. Note that you need to enable cheat mode in \My Documents\My Games\Sid Meier's Civilization 4\CivilizationIV.ini:
Code:
CheatCode = chipotle
Every scenario maker should enable this, because then you get access to the full range of options in the World Builder. Also, you can reveal the entire map (and also access all cities) with the shortkey ctrl + Z. Among other things.

Now, with cheat mode enabled, you can hover any tile while pressing the shift key. The coordinates are shown in the tile info bar (bottom left).
I believe that the map tiles are actually numbered from bottom left (0,0) to upper right (123,67).
 
A major update can be downloaded from the beta-testing thread. :goodjob:

PyScenario should now be lag free - or as lag free it can get while still saving Triggers along with the rest of the game session. (At least this will no longer effect autoplay...)

See the change log for details. (Killerkebab: You could try out the new stability() method if you like. :king:)
 
Top Bottom