Python help: Project requires building

Ferocca

Warlord
Joined
Nov 21, 2011
Messages
179
I'm not even sure if it's a python task, but in XML it doesn't seem possible (you can only make a project require another project).
I'm trying to make a project require a certain building (a world wonder).

I know XML pretty well, but don't know any python. So I hope somebody can help me:)
If yes: is it possible to make the project switch owners if the required building is taken by conquest? or is it possible to destroy the project once the required building is taken by conquest, so that the conqueror has to ('re-')build the project on his own? and once the project requires the specific building, will the project only be buildable in the city with the required building or can you build it anywhere if you own the specific building in only one city?
 
I don't know if this is possible in python, but it's definitely possible in the SDK (it wouldn't be that difficult either, once you learned how).
 
Rebuilding the project is not possible with python, but everything else is.

and once the project requires the specific building, will the project only be buildable in the city with the required building or can you build it anywhere if you own the specific building in only one city?

Both possible. How do you want to have it?
 
Rebuilding the project is not possible with python, but everything else is.



Both possible. How do you want to have it?

Great!
I prefer the project to be buildable in the city with the required building only.
So: a project that requires a building (world wonder), that can be captured by conquest and that can only be built in the city with the required building - that's what I would like and is actually possible, you say?
 
Okay, example attached.
In this example, you can only build the Manhattan project in the city in which the Pentagon is (and you need the tech for the project).
In case someone captures the city, the conquerer will get the project.

There's one change in CvEventManager.py, and one change in CvGameUtils.py.
If you want to use it in your mod, then you have to change the refferenced wonder + project (it#s written in there, PROJECT_MANHATTAN_PROJECT and BUILDING_PENTAGON), and the conquering messages (no text included, because you'll sure change that yourself; you'll only see TXT_KEY_LOST_MANHATTAN and TXT_KEY_CONQUERED_MANHATTAN).


Problematic points:
- What should happen if the city is razed? Currently the project just stays at the owner (might be the best for the AI)
- What should happen if the conquerer doesn't have the tech for the project? Currently that's ignored, he still gets the project.

Edit: Attachement removed, see one of the following posts for a correct version.
 
Okay, example attached.
In this example, you can only build the Manhattan project in the city in which the Pentagon is (and you need the tech for the project).
In case someone captures the city, the conquerer will get the project.

There's one change in CvEventManager.py, and one change in CvGameUtils.py.
If you want to use it in your mod, then you have to change the refferenced wonder + project (it#s written in there, PROJECT_MANHATTAN_PROJECT and BUILDING_PENTAGON), and the conquering messages (no text included, because you'll sure change that yourself; you'll only see TXT_KEY_LOST_MANHATTAN and TXT_KEY_CONQUERED_MANHATTAN).


Problematic points:
- What should happen if the city is razed? Currently the project just stays at the owner (might be the best for the AI)
- What should happen if the conquerer doesn't have the tech for the project? Currently that's ignored, he still gets the project.
Okay, great, thanks! (Good idea by the way, about the Pentagon with Manhattan Project)
I will try it out as soon as possible:)
About the problematic points:
Would it be possible to destroy the project forever once the city gets razed? It would make most sense since it requires a world wonder.
Point 2: In this case it's okay if the conquerer gets a working project without having the required technology (but it would be okay too if the conquerer will only get a working project with the required technology). Does it work like that now or you don't know what would happen now?

Thanks again!
 
Point 1 has been changed, there's now another place in the CvEventManager where stuff has to be changed.

Point 2: In this case it's okay if the conquerer gets a working project without having the required technology [...]. Does it work like that now or you don't know what would happen now?

It works like that now :yup:.
 

Attachments

Point 1 has been changed, there's now another place in the CvEventManager where stuff has to be changed.



It works like that now :yup:.
Thanks! I just need a bit more help, since: it doesn't work, and I'm pretty sure it's because of BUG. (The problem is that I can just build the project when I have the required tech, I don't need to have building). BUG is truly annoying when making a change in CvGameUtils.
There is a way to make BUG acknowledge your own changes in CvGameUtils, but I don't know how to do that, I just don't understand how to do that, but in case you don't know either and want to help: Tutorial
That would actually help me with another python problem too, because I still want something that requires a change in CvGameUtils, but with BUG it's impossible for me to make it work.
(Oh, and in case you know it by heart, how do you add <Help>TXT_KEY_XXX</Help> to a project in the civilopedia? You know, that you can make your own ICON_BULLET?)
 
Please say it the next time before if you're using BUG or not.

Okay, new attachement.
There are 2 files in it, which you have to drop into the respective folders in the BUG folder.
Additionally you have to open in the BUG mod the file Assets\config\init.xml and add at the end before
PHP:
</bug>

the line:
PHP:
<load mod="ManhattanRequiresPentagon"/>

it should work then (haven't tested it).



(Oh, and in case you know it by heart, how do you add <Help>TXT_KEY_XXX</Help> to a project in the civilopedia? You know, that you can make your own ICON_BULLET?)

Sadly not possible. Help tags are there for nearly everything, but they didn't add them to the projectInfos.xml :sad:.
 

Attachments

Please say it the next time before if you're using BUG or not.

Okay, new attachement.
There are 2 files in it, which you have to drop into the respective folders in the BUG folder.
Additionally you have to open in the BUG mod the file Assets\config\init.xml and add at the end before
PHP:
</bug>

the line:
PHP:
<load mod="ManhattanRequiresPentagon"/>

it should work then (haven't tested it).





Sadly not possible. Help tags are there for nearly everything, but they didn't add them to the projectInfos.xml :sad:.
First of all, thanks!
I have found something for the project help tags:
http://forums.civfanatics.com/showthread.php?t=378673
In case you're interested. Don't know if it works though, but I'm not going to check now, of course ;) First to the point: it didn't work still. Sorry for not telling beforehand that I have BUG installed, but sometimes BUG doesn't make it hard to mod and sometimes makes it extremely hard to mod, like now apparently - so I forgot to tell, actually.
I thought that the mod's name wasn't referred to correctly: Manhattan requires Pentagon and ManhattanRequiresPentagon were used both, but changing everything to ManhattanRequiresPentagon didn't change anything:(
 
First of all, thanks!
I have found something for the project help tags:
http://forums.civfanatics.com/showthread.php?t=378673
In case you're interested. Don't know if it works though, but I'm not going to check now, of course ;)

I know about the mod component ;), but I'm not sure if you want to merge that.

First to the point: it didn't work still. Sorry for not telling beforehand that I have BUG installed, but sometimes BUG doesn't make it hard to mod and sometimes makes it extremely hard to mod, like now apparently - so I forgot to tell, actually.
I thought that the mod's name wasn't referred to correctly: Manhattan requires Pentagon and ManhattanRequiresPentagon were used both, but changing everything to ManhattanRequiresPentagon didn't change anything:(

mmhh...I'll check that later.
Remind me if I don't respond within 24 hours.
 
The problem is somewhere in BUG, and I currently can't figure it out.

I have to post a new thread in the python/SDK subforum, and hopefully someone else knows why.

Okay, I will be patient, thanks:)
 
Okay, problem has been solved now.
Attached it again, please just replace the both files :).

Sorry, it didn't work :(

Maybe I left something out. I mean, it must be something I am doing.
So, I replaced: ManhattanRequiresPentagon.xml (in Assets/Config)
ManhattanRequiresPentagon.py (in Assets/Python/Contrib)
Furthermore, I should have CvEventManager and CvGameUtils replaced/merged that you sent me earlier, which I have done. Then, the last change I have is the change in init.xml.
So is there something I forgot to edit/replace, something I could have done wrong?
Anyway, thanks a lot again for your work!
 
So, I replaced: ManhattanRequiresPentagon.xml (in Assets/Config)
ManhattanRequiresPentagon.py (in Assets/Python/Contrib)

2* right.

Furthermore, I should have CvEventManager and CvGameUtils replaced/merged that you sent me earlier, which I have done.

Nonono, that's not necessary (and not sure if it might interfere with something).

Then, the last change I have is the change in init.xml.

Right again.

Could you please copy your init.xml over to here? (just open it and past it in a post)
 
2* right.



Nonono, that's not necessary (and not sure if it might interfere with something).



Right again.

Could you please copy your init.xml over to here? (just open it and past it in a post)
Okay, I will undo the python changes then;)
The init file is posted as you see;)
 

Attachments

mmmhh...okay...so far right.
:hmm: the problem might be the cache...-> please hold down shift during loading, and test again if it works.
Okay, now I have the init file in the right place, the python in contrib folder, and the xml file in the config folder. replaced the EventManager and GameUtils with the original files (without this mod).
Cleaned cache.
Yet, I can still build the project without finishing the building first. It still doesn't work:( I really wonder what that could be. If you need any information, of course I can provide all happily.
 
Back
Top Bottom