Yeah, for now you can just save it in custom assets, with the same path and the same name as in asset directory. It will have as effect to overwright the original file when you launch the game, without changing anything in the asset folder (so if you mess up, you can simply delete your file in cutom asset).
For a start, I'll add a simple code first to test out everything is ok and your file is loaded. So you can understand how python works. You first have to add :
At the begining of the file, after the other imports. Then write in onTechAcquired :
Code:
popup = PyPopup.PyPopup()
popup.setBodyString( "Hello World" )
popup.launch()
You can add that just after " # Note that iPlayer may be NULL (-1) and not a refer to a player object" for instance. Note that in python, indentation is important. You HAVE to be aligned with the previous line, with tabulations. This will add a popup saying "Hello world" everytime anyone get a tech.
Then, I don't know the ID of the civil service tech, so you can change a little bit your code to :
Code:
popup = PyPopup.PyPopup()
popup.setBodyString( "New tech : " + str(iTechType) )
popup.launch()
The str() function convert the integer iTechType to a string. With that, you can just start a game and go to world builder. There if you add civil service to yourself, it will popup the ID.
Then, you can start your real code. Replace your popup message by :
Code:
if (iTechType == the_id_you_found_for_SC):
CvUtil.spawnUnit(the_GG_ID, the_plot_you_want_to_spawn_it, iPlayer)
Note that :
- This code is not so elegant. You should avoid using hardcoded ID in the code and get them dynamically instead.
- You still have to get the ID of the GG, and the plot where you want to spawn it.
I don't remember by heart how to get them easilly in python, but hopefully, someone will passby and give you some tips on that. But with what I wrote, you should at least be able to understand how it should work.
I guess some of the function you will need are in PyHelpers.py, like "getCapitalCity" if you want to spawn the GG in the capital.