How do i initialize CyGInterfaceScreen?

The_J

Say No 2 Net Validations
Administrator
Supporter
Joined
Oct 22, 2008
Messages
39,570
Location
DE/NL/FR
From the title you can see my problem: How do i initialize the CyGInterfaceScreen class?
Just CyGInterfaceScreen() gave me an exception, which said, that it needs a string (char* is a string, am i right?), and an integer value, but i can't find, what it really needs.
In the API (i've never said it, but thanks to the bug team for collecting all the information) is said, that it's not in the SDK, so the class has to be mentioned in one of the ohter python files, but i really can't find it :confused:.

So, does anybody have an idea?
I hope, somebody can help :).




Okay, why do i need that?
Hrochland has asked, if it's possible to create a wonder, which reveals a resource.
I've looked into the API, and there's no command for doing this.
I've looked today again in it, to find someting other, and found the command addBonusGraphicGFC (STRING szName, INT iBonus, INT iX, INT iY, INT iWidth, INT iHeight, WidgetType eWidgetType, INT iData1, INT iData2, FLOAT fxRotation, FLOAT fzRotation, FLOAT fScale, BOOL bShowBackground) in CyGInterfaceScreen, which i guess, let's me place the graphics on the map -> build the wonder, cycle over the whole map, and place the graphics over the real resource.
This should imho work, but i'm open for other ideas :).
 
I guess CyGInterface().addBonusGraphicGFC() does not place bonus on map, but rather on a screen panel.

The usage is like this: CyGInterfaceScreen( "LegionScreen", CvScreenEnums.LEGION_SCREEN ).

This class is only for screens, not for the map.
 
It may be easier to define a special purpose technology, which cannot be researched, but makes the resource visible. Then in onBuildingBuilt, if this wonder is built, grant the technology. Regardless of what implementation you use, the AI will not understand, but if you grant the wonder a high iAIWeight, this may help.
 
Another option would be to use the onBuildingBuilt event handler.

When the wonder is built, you use this function to pick a random plot in the BFC that doesn't already have a bonus, and add the bonus to it (possibly restricting the check by terrain or whatever). The bonus, if its a new bonus type that should only be there for cities with the building/wonder, would always be visible and never placed by a map script.

(I saw the other thread, so I think this is what he wanted. More or less.)
 
@stmartin: Thanks for the explanation :).
Sad, doesn't do, what i want.

but another question: Have you dealt with this a bit more?

@Davidlallen: Visibility of resources is defined in the BonusInfos, and there can only be one technology for one resource :(.

@GodEmperor: Would do this, if it were just for my mod, but the solution is not really good.


But somehow it has to work.
There's an event "a man named jed", which reveals oil, but i have no idea, how it's done.
I've also looked in the SDK, and there are some functions, which reveals the resources, but they are not exposed to python :(.
 
I don't think the Jed event actually adds a resource - it just reveals the existing oil resources just as if you had discovered the necessary tech.

It uses the BonusRevealed tag in the EventInfo file which does just that, according to the available info. That said, there is also an EventInfo tag BonusType with a matching iBonusChange which, together, add (for iBonusChange = 1) a bonus to or remove (with -1) a bonus from a tile. This is used by the several events including EVENT_SPICY_x. As far as I know there is no direct way to pick a plot in a city's BFC, so it'd probably take a python "can do" script. I don't know what happens for an event that should automatically be triggered if this comes back false - does it keep picking new plots and trying until it gets a true result?

Another option is to trigger an event that fires when the building is built and use a PythonCallback to place the resource. That way you don't have to use the onBuildingBuilt thing.

But it seems to me that onBuildingBuilt is the easiest.
 
I'm confused as to what exactly you want to do.

  1. Place a new resource on a tile
  2. Reveal all of the already existing locations for a resource
  3. Reveal only one of the already existing locations for a resource, or
  4. Place and reveal a single resource for an unrevealed resource?
1 is a snap.

3 and 4 are impossible AFAIK (all locations for a resource must be revealed; you can't keep some hidden without removing them from the map).

2 can be done with the tech trick. Say you want to do this for Oil. Create a new unresearchable tech to reveal the Oil, say Discover Oil. Change the tech that reveals Oil from Scientific Method to Discover Oil. Add Python to onTechAcquired that grants Discover Oil to anyone that acquires Scientific Method. Add Python to onBuildingBuilt that grants Discover Oil when that wonder is built.
 
I don't think the Jed event actually adds a resource - it just reveals the existing oil resources just as if you had discovered the necessary tech.

Yes, that's, what i want to do, but without an event...and that's the problem :(.

@The_J

I do not know how to do this in Python only. :)

:confused:
Okay, clearer question: Have you dealt with adding 3D graphics to a screen?
In the legion screen, i can "only" see 2D graphics.

I'm confused as to what exactly you want to do.

  1. Place a new resource on a tile
  2. Reveal all of the already existing locations for a resource
  3. Reveal only one of the already existing locations for a resource, or
  4. Place and reveal a single resource for an unrevealed resource?
1 is a snap.

3 and 4 are impossible AFAIK (all locations for a resource must be revealed; you can't keep some hidden without removing them from the map).

2 can be done with the tech trick. Say you want to do this for Oil. Create a new unresearchable tech to reveal the Oil, say Discover Oil. Change the tech that reveals Oil from Scientific Method to Discover Oil. Add Python to onTechAcquired that grants Discover Oil to anyone that acquires Scientific Method. Add Python to onBuildingBuilt that grants Discover Oil when that wonder is built.

I've wanted....2...or 3 or 4, what would work, but mainly 2.
The problem is, like already said, that revealing resources is not done in the TechInfos.xml, it's in the BonusInfos.xml, and the schema allows only one technology per resource :(.
 
The problem is, like already said, that revealing resources is not done in the TechInfos.xml, it's in the BonusInfos.xml, and the schema allows only one technology per resource :(.

And the solution I outlined

2 can be done with the tech trick. Say you want to do this for Oil. Create a new unresearchable tech to reveal the Oil, say Discover Oil. Change the tech that reveals Oil from Scientific Method to Discover Oil. Add Python to onTechAcquired that grants Discover Oil to anyone that acquires Scientific Method. Add Python to onBuildingBuilt that grants Discover Oil when that wonder is built.

gets around this restriction. You change the tech that reveals the resource and then grant the new unresearchable tech whenever anyone a) acquires the original tech or b) builds the wonder.
 
Each resource may be revealed by a single technology, and you can grant technologies in Python. I'm saying that in XML you must change Oil so that it is revealed by a new technology created by you called Discover Oil. You grant that new technology--and thus reveal the resource--in Python.
 
Without modding the SDK, I don't see a way to make this happen and still show in the Civilopedia that the original tech reveals the resource.
 
Whatever the Help tag ends up being (either directly or via a text definition) is probably added to the pedia text. This works for other things, like buildings and units, so it probably works for techs too. It's how Final Frontier gets the various features implemented via python to show, like the Habitation Facility's "Increases the Population Limit for the Planet it's on by 1" text.
 
Top Bottom