PyScenario: Beta version release

Regarding razing cities, this seems to always be the option of the Civ receiving a city - whether or not to keep it that is... But I'll take a look at Rhye's code to see whether or not he uses another method or something. :p
Rhye uses the same method - CyPlayer.acquireCity() - as PyScenario so any difference would be whether or not the flip occurs in war or peace.

You could try using the treaty() Action to make Civ getting the flip make peace with the Civ losing the city. Then, hopefully, the receiver wouldn't wanna raze it. Try it! :king:
 
I am (player) the receiver and (one) city gets auto-razed. Still, I don't know when in-game city gets auto-razed on conquer (when it never reached 2 pop? Is it why Melpum starts with 2 pop and starve to 1 at next turn?). Anyway, migration() would solve the rpoblem (all cities in the area gets +1pop-> flip(area)).
 
I am (player) the receiver and (one) city gets auto-razed. Still, I don't know when in-game city gets auto-razed on conquer (when it never reached 2 pop? Is it why Melpum starts with 2 pop and starve to 1 at next turn?). Anyway, migration() would solve the rpoblem (all cities in the area gets +1pop-> flip(area)).
I've continued this discussion in the main thread. Since this is more a support/request topic, not a testing/bug report topic.
 
For some reason, most of the codes don't seem to work on my computer, and I need help

first, I tested out on spawning native warriors on multiple tiles, and it worked.
Code:
Trigger(29).year(650,850).valid(None,0,1,1,0,0).target((114,48),(116,52)).units(None,None,24).flag("Emishi",1,0).promotions(20)
But other things( spawning units and cities Etc. can't remember the codes) doesn't work.
I also tested out the code on the 1st page of the tutorial (changed the turn for testing)
Code:
Trigger(2).check().turn(2).units(102,47)
but it doesn't work. I attached screenshots and save datas for turn 1 and 2

sorry for my bad english
 
For some reason, most of the codes don't seem to work on my computer, and I need help
Getting started can be a bit rough going, but mostly people seem to figure out how to get this working. :) So let see.

First of all: Have you enabled debugging and exception? (See original post.)

Secondly: Your interface is golden - do you have some other mod running with RFC?

Code:
Trigger(2).check().turn(2).units(102,47)
but it doesn't work. I attached screenshots and save datas for turn 1 and 2
Note that turn based events take place in between turns. So you should probably have attached a screenshot for turn 3 also, as the turn() Condition would fire only after turn 2.

Other than that, there is no big mystery. If you try this Trigger out by playing some other Civ than the Chinese you'd see that it works. The problem with the Chinese is that the check() Condition uses the default values (this happens automatically since you haven't entered any custom values inside the parenthesis). This is what the API entry looks like:
check( bHuman=False, bDead=False )
The first argument is bHuman and it makes the Condition check whether or not the target player (the player you define in the Trigger constructor, the first element of the Trigger) is human. The default setting is False and this will not allow for the Trigger to fire if you play as this Civ. The other valid settings are True (only allow for a human player) and None (disable check - allow both human and AI player).

The second argument prevents you from accidentally respawning dead Civs by giving them units/cities. This is the main reason why you should make a habit of using this Condition, but as you're still experimenting with this you could probably just skip and revisit it once you get the hang of things. :goodjob:

This is what your Trigger should look like if you wanna allow for the spawn both for the human and the AI player alike:
Code:
Trigger(2).check(None).turn(2).units(102,47)
Also note that you are omitting three arguments in the turn() method and two in the units() method. But this is ok since the application will then lookup the default values for these setting. At the beginning it might be useful for you to spell out all the arguments though, just so you don't overlook anything. You could even spell out the names of the arguments themselves, if this helps you:
Code:
Trigger(ePlayer=2,eCivilization=None).check(bHuman=None,bDead=False).turn(iTurn=2,iTurn2=None,iInterval=1,iModulo=0).units(iX=102,iY=47,eType=None,iNum=1)
Good luck! :goodjob:
 
OOPS!!:hammer2:
Frogot to change that. Thanks! Now it works fine!

1. Well, I couldn't find anything in the logs though. None of the stuff on python was in it. The tutorial listed the things on the ini. file, but I couldn't find the line"ShowPythonDebugMsgs = 1". maybe that's the problem.

2. no Idea. I don't have any mods on CustomAssets.

Also, are the natives considered "dead" or something? If I put "check" on it it won't work.
 
1. Well, I couldn't find anything in the logs though. None of the stuff on python was in it. The tutorial listed the things on the ini. file, but I couldn't find the line"ShowPythonDebugMsgs = 1". maybe that's the problem.
Look at PythonDbg.log - and I believe that guide is a bit outdated because I don't think I never found that exact line myself... (Or was it another line?) There should be all manner of debug data in there once you enable debugging. This is how you get PyScenario to print out debug data.

Also, are the natives considered "dead" or something? If I put "check" on it it won't work.
I actually got this result myself the other day. I don't know if its because Rhye hasn't activated the Native Civ in the 3000BC scenario (it might come to life once "Zulu" or "Native America" spawns) - or if it was just a glitch. I know that I restarted the game and somehow got the units to spawn, but you might still be right. You probably shouldn't use the bDead=False argument on the Native, then. :p

edit: Whether or not the Native are dead or alive can by the way be checked in the debug log. :D Because the status of Civs is reported there every time Rhye changes them.
 
Version beta 1.031 of PyScenario is available from the original post. See the change log for all the details.
 
I tried to do the following in an attempt to simulate the rise of Poland (as independents):
Code:
Trigger(28).turn(202,211,2,-1).city(66,54, "Warszawa").culture(20).religions().buildings(59,13).garrison(eType=60,iNum=4)
Trigger(28).turn(253).city(67,54, "Vilnius").culture(20).religions(1).buildings(59,13,3,5).garrison(eType=61,iNum=4)

The first trigger fired successfully (even if the coordinates were geographically incorrect). However, the game crashed after trying to fire the second trigger (Warszawa was conquered by Germany).

Is the game designed to crash when spawning a city beside a city of another civ, or does it need to be detected immediately and be skipped?
 
Spawning cities with the city() method is designed to be used in tandem with the valid() method - to prevent spawning next to existing cities. But it is actually a feature that the old city gets demolished if this does happen, so that old ones can be replaced with new ones. (It would be a question of scenario design if you want this to happen or not.) There should be no crash in any case.

You need to enable Python exceptions so that you can report the actual error message once the game "crashes". (What exactly did happen?) See the original post for a link on how to enable exceptions.

Also, do you have a savegame from the previous turn? (Perhaps a autosave?) It helps if the "crash" can be repeated.

And are you using the very latest version of PyScenario? The current version is 1.031 - you find the version number at the beginning of the PyScenario.py file:
Code:
# Test release for use with Rhye's and Fall of Civilization mod
# version Beta 1.031
 
I have the latest version. Attached is the last autosave and other files that I edited. I think something else is causing the crash, because I also edited CityNameManager.py for additional placenames, AIWars.py for predetermined AI behavior, and RiseAndFall.py for free missionaries with England and Netherlands (plus techs for Ethiopia on my customized 600AD start).

For some reason, I don't see anything in my Logs folder after I added everything I need to add.
 

Attachments

Trigger(28).turn(202,211,2,-1).city(66,54, "Warszawa").culture(20).religions().buildings(59,13).garrison(eType=60,iNum=4)

I think it is OK but I presume you thought more about sth like this:

Code:
Trigger(28).turn(202,211,[B]9[/B],-1)[B].once()[/B].city(66,54, "Warszawa").culture(20).religions().buildings(59,13).garrison(eType=60,iNum=4)
 
I copied the script from Baldyr's example script for spawning Kiev. I haven't tried it because I always start the game at 600 AD.

BTW, I fixed the line according to your suggestion, and I'll test it.

UPDATE: Made it to the 1500s without crashing the game! Thanks for the help. The game crashed on turn 290. I'll try closing my browser before starting CivIV again.
 
Code:
.owned((69,33),7).target((66,30),(70,36)).flip(None,7,0,0,1,0)

Is it possible to do like that or do I have to make 2 triggers?
Hhmm... I'll have to figure out what you are intending to do before I give an answer... :p This thing is getting somewhat advanced!

Ok, looking at the API your owned() method checks if tile (69,33) belongs to Rome. The target() method defines some map area that includes that very same tile, and finally the flip() method will give all Roman cities to the target player (which isn't included in your sample). So that would be a yes, then. But make sure to test this properly - your are the tester, after all. :D

I think it is OK but I presume you thought more about sth like this:

Code:
Trigger(28).turn(202,211,[B]9[/B],-1)[B].once()[/B].city(66,54, "Warszawa").culture(20).religions().buildings(59,13).garrison(eType=60,iNum=4)
Any Trigger including the city() method will only fire once, so the explicit once() method isn't necessary.

This isn't documented however, so there is no way that you could have known that...

What happened with the problem you had with getting exceptions and odd results with the output() custom Action? :confused: If you've found a bug we should most definitely investigate the issue further...
 
For some reason, I don't see anything in my Logs folder after I added everything I need to add.
Strange! At least the PythonDbg.log should be full of Rhye's debug stuff...

I would actually suggest that you reinstall RFC as another mod altogether, with PyScenario. Rename it Rhye's and PyScenario or whatever, but make sure to alter the WBS files to reflect this change (otherwise the mod will load the old mod instead, as the mod location is defined in the WBS). Then try the PyScenario script again.

Unfortunately I don't have time to debug your edited files, but I do appreciate that you help out with testing PyScenario! With any luck you have found a actual bug and this is what its all about.

Once you've established that it isn't PyScenario or your script that is causing your game to crash, try and transfer you other edits one file at the time. Test throughly and add another edited .py file once you're convinced that the game isn't gonna crash. With any luck you will at least be able to pinpoint what module is causing the crashes. Then it would probably be a good idea to post you altered code in the main programming forum. Someone would, hopefully, be able to help you there.
 
Just now I'm stuck with updating PyScenario XD When I'm done I tell if I find a bug.
Good luck with that. :goodjob: Just make sure you don't overwrite your Scenario module while doing it... (It might just be the PyScenario.py file that has changed, I don't remember.)
 
Good luck with that. Just make sure you don't overwrite your Scenario module while doing it... (It might just be the PyScenario.py file that has changed, I don't remember.)

The main problem was changing custom modules. But I think I managed to make it.

[EDIT]: OK, no bugreport, with the new version everything is working fine.
 
Sorry for double post, but... I go a step further:
Code:
.target((66,30),(70,36)).owned(None,7).target((66,30),(70,36)).flip(None,7,0,0,1,0)
is it a valid trigger? I want it to fire if any plot is owned by Rome to flip all Roman cities in the area.

And another question: is it possible to make an unit a mercenary simply by giving "mercenary" promotion? If it is true, what's the code of the promotion?
 
Back
Top Bottom