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

killerkebab is right - you don't need to define a tile twice in the same Trigger:
Code:
Trigger("Stonehenge").date(-3000).player(31).target([COLOR="Red"]51,53[/COLOR]).valid().city([COLOR="Red"]51,53[/COLOR],"Stonehenge",1).buildings(118)

Yeah, that one was kind of stupid.

Other than that, you could just add the city/wonder to the 3000 BC scenario directly. (Edit the WBS file.)

I'd prefer to make the script work with the scenario that already exists, so a new scenario wouldn't need to be made.

If you can't be bothered with it, you at the very least want it present on the first turn (before the game starts), right?
Code:
Trigger("Stonehenge")[COLOR="Red"].startup(bLateStart=False)[/COLOR].player(31).target([COLOR="Red"]51,53[/COLOR]).city([COLOR="Red"]51,53[/COLOR],"Stonehenge",1).buildings(118)

Say what? I must have missed the .startup() method in the documentation...

(I deleted the valid() Condition because there should be no reason why the tile isn't valid before the game starts.)

There's always a wee bit of randomization to the start of scenarios like these. I might end up putting the town next to a barba... oh yeah. That was stupid too.

:hammer2:

(I originally thought about making Stonehenge Independent, then realized that Independent is reserved for known minor civs like the Hittites, so I decided on barbarians instead... but I forgot to remove the .valid() method)

This is correct... It never dawned on me to check cities for religions present. I'll have to be get back to you on this. But otherwise you could also spread Christianity to the city with the same Trigger...

Nah. What I hope to eventually do is spread Christianity to a few cities (Antioch, Alexandria, Ephesus, Rome) by 100 AD, force the Roman Empire to convert to Christianity in 380 AD (if they're AI-controlled), and hope that it spreads to Constantinople in time.

Religion is something that I'd rather nudge in the right direction than micromanage.

But yeah, think about adding a .cityfaith() condition. And if I might make one more suggestion... how about a .revive() action? I'd like to create a triggered event in which, in 323 BC, if the Greeks control Babylon, Parsa, and whatever the Egyptian capital is named, they totally collapse. Then, the Greeks are revived and all Independent cities in Greece flip to them; if the Egyptians have been exterminated, they are revived and all Independent cities in Egypt flip to them; and if the Babylonians have been exterminated, they are revived and all Independent cities between Jerusalem and Parsa flip to them (Babylon was only a few km from the capital of the Seleucid Empire). This would require something like 3 or 4 triggers to do correctly, but it needs that .revive() option... unless you can revive a civ just by flipping cities to it...
 
But yeah, think about adding a .cityfaith() condition.
The main issue would be what to call it. I might make it a dual-use deal with corporations. It could also potentially be used to check for holy cities/corporate headquarters. Any name suggestions? (One word only, please.)

And if I might make one more suggestion... how about a .revive() action?
I don't fully understand what you need. If you can achieve this with the current API (several Triggers) then there would not be any need for another method.

If you have a very specific request that really isn't useful outside of your own scenario, then I can always make a custom method especially for you. (As long as the same event can't be done without it, of course.)
 
I don't think we need to check number of religions in a city (?) - just if the specified one is present. Something like:
present( eReligion=None, eCorporation=None, bCenter=False )

That way it could be used to check eReligion and/or eCorporation - and optionally if the city is the headquarters of that religion/corp. Alternatively:
present( eIndex, bReligion=True, bCenter=False )

With such a setting the method would look for religions by default, but it could also be made to look for corporations with bReligion=False.

Additionally, if no map target is defined within the Trigger, then the method could set the Target Tile to the city containing the holy city/corporate headquarters. (Perhaps bCenter should be True for that feature to be enabled? Otherwise it could set a Plot List containing all the cities with that religion/corp?)

We can basically have whatever we want. :D So voice your opinion before I actually do this.
 
Given that the in-game corporations have nothing to do with any real-world companies, I fail to see why anyone would have a use for making a trigger conditional on a certain corporation being present in a city. However, if the programming wouldn't be all that different, then go ahead.

What I definitely don't see happening is someone wanting to check a city for a certain corporation AND a certain religion simultaneously.

Also, religions and corporations are indexed separately.

Given these factors, I think .present(eIndex,bReligion=True,bCenter=False ) makes the most sense. If eIndex is set to "none", then the trigger should only fire if no religion/corporation is present in the city. If eIndex is set to "none" and bCenter is set to "true", it should only fire if the city is not the Holy City of any religion or HQ of any Corporation. Also...

if no map target is defined within the Trigger, then the method could set the Target Tile to the city containing the holy city/corporate headquarters. (Perhaps bCenter should be True for that feature to be enabled? Otherwise it could set a Plot List containing all the cities with that religion/corp?)

I hadn't even thought of that. Brilliant.

Idea: if a Target Player is specified, then the method should only look for that player's cities with that religion/corporation?
 
I don't fully understand what you need.

I need to be able to bring a dead civilization back to life. It happens on its own in unstable empires after the discovery of Nationalism, but I need to make it happen on cue.
 
If eIndex is set to "none", then the trigger should only fire if no religion/corporation is present in the city. If eIndex is set to "none" and bCenter is set to "true", it should only fire if the city is not the Holy City of any religion or HQ of any Corporation.
All good ideas. :goodjob:

Idea: if a Target Player is specified, then the method should only look for that player's cities with that religion/corporation?
This is how I would set it up by default. So we're thinking alike - which is good because this means that you pretty much understand how PyScenario works - and is supposed to work.

By the way, I'm working on a small mod-scenario that makes the Celtic civilization collapse along side with Rome and spawn as Byzantium. We'll see if I can pull it off... And if I do, then the PyScenario methods I'm using will be available to all. :king:
 
By the way, I'm working on a small mod-scenario that makes the Celtic civilization collapse along side with Rome and spawn as Byzantium. We'll see if I can pull it off... And if I do, then the PyScenario methods I'm using will be available to all. :king:
And I actually did it. :D I'll post it on the mod-mod forum tomorrow. I doubt the methods used will be part of any future PyScenario update though (so they need to be imported as custom methods then), as it turns out that the dynamic Civ names are hard coded in the DLL file. So there would be little point in changing any of the major players Civs - the name(s) would just change back automatically. But there is till some options for the minor Civs, even if that doesn't warrant a place in the API.
 
All good ideas. :goodjob:
This is how I would set it up by default. So we're thinking alike

I'm starting to get the feeling that some of the former hostility between us may have been unwarranted :D

Just so you know, I finished the pseudo-automated wonder-building part of my script yesterday. I'm going to work on AI city-founding next, followed by city-flipping and civilization collapses. This will, of course, require extensive research, both in-game (to see where cities are located) and on Wikipedia (to see when they were founded, when certain empires conquered them, etc.)
 
Just make sure to test your script in-between additions...
 
I need to be able to bring a dead civilization back to life. It happens on its own in unstable empires after the discovery of Nationalism, but I need to make it happen on cue.
Oh, I missed this post earlier. I'm actually working on this very thing right now, along with the dynamic Civ change and the requested present() method for checking for religions. :king:
 
Have I told you lately that you're awesome?
 
Have I told you lately that you're awesome?
Now you have. :D

You'll be able to test out a prototype for the present() Condition shortly. Right now a eIndex=None setting makes the Condition pass if any religion is present. But you specifically requested that such a setting would pass only if no religion is present. Would you care explain why you need this? (It will be trivial to change it any which way at this point.)

The advertised dynamic Byzantium mod-mod won't be released before the next PyScenario release (beta v2.1) because it has become dependent on my latest work on the application. It will feature code re-writes that improve functionality and usability, but also new content (methods, mostly).
 
Right now a eIndex=None setting makes the Condition pass if any religion is present. But you specifically requested that such a setting would pass only if no religion is present. Would you care explain why you need this?

I was following the clearly idiotic "none means none" logic. Is this bad? The next time a girl says "no" to me, does she really mean "any"?:p

Actually, your way is better... if you add a bAbsent setting (set to False by default) so that the condition can be used both ways.
 
I was following the clearly idiotic "none means none" logic. Is this bad? The next time a girl says "no" to me, does she really mean "any"?:p
:lol: Funny!

I guess None could also mean "all". (I guess you're familiar with n/a as in None/All - it stands for "not specified".)
Actually, your way is better... if you add a bAbsent setting (set to False by default) so that the condition can be used both ways.
I added a bPresent=True setting. The code is near illegible at this point - all some 100 lines of it - by the way. :rolleyes: It'll take awhile for me to do the testing and debugging...
 
Ok, attached is a custom module containing the promised present() Condition. It was a rather big undertaking and I'm relying on you the testers to verify that it does what it advertises. These are the settings:

present( eIndex=None, bPresent=True, bReligion=True, bCenter=False )

How to use the settings has already been discussed in this thread, but please ask if something is unclear.

To enable the Custom module you need to unpack it into the mod's Python folder. Then add these lines to your Scenario module:
Code:
from Custom import *
Trigger.present = present
 

Attachments

Back
Top Bottom