[MODCOMP] Multiple Professions per Building

Androrc the Orc

Emperor
Joined
Apr 19, 2004
Messages
1,621
Location
Vienna, Austria
Here is a quite simple modcomp, which has the intent of allowing multiple professions to use a building, sharing it's slots.

The icon next to the building will be of the yield produced by the profession higher up in the xml order; likewise, when you drop a citizen in the building, it will by default choose the profession higher up in the xml order (which isn't much of a problem, as you can choose the profession normally through the profession choice popup).

The python and SDK modifications can be found by searching for the tags #Androrc and //Androrc, respectively.

As an example, the Gunsmith profession is set to use the SpecialBuilding that the Blacksmith uses (SPECIALBUILDING_TOOLS).

UPDATE: With the help of KJ Jansson, version 1.1 improves the interface show up of Multiple Professions per Building.

UPDATE 2: Now in version 1.2, when dragging a unit in the city screen to a building that can have multiple professions, a popup appears to ask which profession the unit should have.

UPDATE 3: Fixed a bug. The change can be found by searching for "//Androrc Multiple Professions per Building 1.3" in CvCity.cpp.

UPDATE 4: Fixed another bug; the changes can be found here.

Download
http://forums.civfanatics.com/downloads.php?do=file&id=16187
 
Great mod!

Here some comments.

1. Your "Multiple Professions per Building Modcomp" is working as you described.

The general scheme is

Yield X (Ore) + Master Blacksmith ==> Yield Y (Tools)
Yield Y (Tools) + Master Gunsmith ==> Yield Z (Guns)

Both units are working in ONE BUILDING (Blacksmith House)

Here the screen:



If possible, I'd like to ask about small improvement. To be very nice if we could just "drag unit" in the building and similar popup screen gives us a choose between two professions: Master Blacksmith or Master Gunsmith. These variants will correspond to possibility produce Tools (Master Blacksmith) or Guns (Master Gunsmith).

The current method is vary tricky and I re-read your comments number of times before understand how to send Master Gunsmith in Blacksmith House to produce Guns.

2. Second comment about icons.

Now we can produce two yields (Tools and Guns) in one building (Blacksmith House).

However, Blacksmith House icon shows only one icon (Tools).

I checked out where the program takes this icon. Result on screen:



CIV4YieldInfos.xml
Code:
			<Icon>,Art/Interface/Buttons/Unit_Resource_Colonization_Atlas.dds,5,15</Icon>

Of course, I can edit this icon, but in such case all Tools icons will be changed.

Possible solution:

- The program really takes this icons from the CIV4YieldInfos.xml file.
- But all information that we see on City screen is formed by CvMainInterface.py.
- If somebody could find the place inside this Python file where the program read information about this icon AND if possible to write a DUFFERENT path to different file with new icon, the problem will be solved.

Who can help?

I could create combined icons and everybody will see that in this building two different products could be made.

 
Here the "icon" solution.

This section was edited in CvMainInterface.py:

Code:
								if (CityBuilding != -1):
									screen.show("ProductionBox" + str(iSpecialBuildingType))
									szName = "YieldOutPutIcon" + str(iYield)
								#	screen.addDDSGFC(szName, gc.getYieldInfo(iYield).getIcon(), BUILDING_GRID[iSpecialBuildingType][0] + (STACK_BAR_HEIGHT / 2), BUILDING_GRID[iSpecialBuildingType][1] + BUILDING_GRID[iSpecialBuildingType][2] - (BUILDING_GRID[iSpecialBuildingType][2] / 6) + STACK_BAR_HEIGHT, STACK_BAR_HEIGHT * 5 / 2, STACK_BAR_HEIGHT * 5 / 2, WidgetTypes.WIDGET_HELP_YIELD, iYield, -1)  #closed by KJ Jansson
									screen.addDDSGFC(szName, gc.getYieldInfo(iYield).getCombiIcon(), BUILDING_GRID[iSpecialBuildingType][0] + (STACK_BAR_HEIGHT / 2), BUILDING_GRID[iSpecialBuildingType][1] + BUILDING_GRID[iSpecialBuildingType][2] - (BUILDING_GRID[iSpecialBuildingType][2] / 6) + STACK_BAR_HEIGHT, STACK_BAR_HEIGHT * 5 / 2, STACK_BAR_HEIGHT * 5 / 2, WidgetTypes.WIDGET_HELP_YIELD, iYield, -1)

Upper line was closed, but in the second line

Code:
getIcon()

was exchanged on

Code:
getCombiIcon()

Thus, I added a new type of icons - CombiIcon, that is a combination of two or even more icons of different goods.

The corresponding changes in SDK files are marked as

// KJ Jansson addon for Multiple Professions per Building modcomp by Androrc the Orc START

and

// KJ Jansson addon for Multiple Professions per Building modcomp by Androrc the Orc END

Thus, for Cigars we have now two similar line in CIV4YieldInfos.xml:

YIELD_CIGARS

Code:
			<Icon>,Art/Interface/Buttons/Unit_Resource_Colonization_Atlas.dds,4,15</Icon>
			<CombiIcon>,Art/Interface/Buttons/Unit_Resource_Colonization_Atlas.dds,4,15</CombiIcon>

The <Icon> from the first line is used as usually, for instance on bottom line of goods.

The <CombiIcon> from the second line is used only as icon under the city building.

As you see, for Cigars both line are the same, therefore the icons for Cigars as goods (bottom line) and as icon under Tobacconist House are the same, too.

A situation is different for Tools and Guns.

For YIELD_TOOLS
Code:
			<Icon>,Art/Interface/Buttons/Unit_Resource_Colonization_Atlas.dds,5,15</Icon>			
			<CombiIcon>Art/Interface/Buttons/Combi_Icon.dds</CombiIcon>

For YIELD_MUSKETS

Code:
			<Icon>,Art/Interface/Buttons/Unit_Resource_Colonization_Atlas.dds,6,15</Icon>
			<CombiIcon>Art/Interface/Buttons/Combi_Icon.dds</CombiIcon>

<Icon> is an usual icon from Unit_Resource_Colonization_Atlas.dds,
but <CombiIcon> is a new icon where we can see both Tools and Guns.
This is a very draft icon, of course.

Thus, the problem with icon in Multiple Professions per Building modcomp is fixed.

However, there is only one small question. I show it on the screen.



As you see, the Blacksmith Master produces Tools, Gunsmith Master produces Guns. However on popup screen we see only "Tools".

Of course, it's not critical, but if we could fix icon, I guess we could correct this Python mistake, too.

If somebody know, please, don't hesitate to show a solution. Thank you in advance.

Download from here:
http://www.civforum.de/attachment.php?attachmentid=526332&d=1292448187
 
KJ, I am working on a solution to the tooltip problem. My idea is to make it so that, if there are two yields being produced in the building, instead of using WIDGET_HELP_YIELD, it would use WIDGET_HELP_TWO_YIELDS, which would show a tooltip with the description of both yields.

I have just done a similar process to make the amount produced appear for both yields, so that if 3 tools and 3 muskets are being produced, it would show up as "+3 / +3" in the production box.

I imagine this could also be used to make the combined yield icon more dynamic, by making it so that the "CombIcon" definition gets an icon for the second yield for the building, and that icon would become an overlay over the normal icon of the first yield. So, instead of having a combined icon of both yields together, Muskets' "CombIcon" would be muskets which would be put over the Tools icon, looking exactly like in the icon you made, but in a more dynamic way. What do you think? Do you have those muskets that you put over the tools icon separated, with a transparent background?

EDIT: The tooltip now displays correctly both yields! Now all that needs to be done is implement the popup for when dropping the citizen in the building. Making the CombIcon be an overlay make it better in my opinion, as well.
 
I imagine this could also be used to make the combined yield icon more dynamic, by making it so that the "CombIcon" definition gets an icon for the second yield for the building, and that icon would become an overlay over the normal icon of the first yield. So, instead of having a combined icon of both yields together, Muskets' "CombIcon" would be muskets which would be put over the Tools icon, looking exactly like in the icon you made, but in a more dynamic way. What do you think? Do you have those muskets that you put over the tools icon separated, with a transparent background?

Making the CombIcon be an overlay make it better in my opinion, as well.

Today I will make a new CombiIcon for Guns and add this icon in the section for YIELD_MUSKETS

Code:
	<Icon>,Art/Interface/Buttons/Unit_Resource_Colonization_Atlas.dds,6,15</Icon>
	<CombiIcon>Art/Interface/Buttons/[B][COLOR="Red"]Combi_Icon_Musket.dds[/COLOR][/B]</CombiIcon>

For YIELD_TOOLS I leave usual icons

Code:
	<Icon>,Art/Interface/Buttons/[COLOR="Red"]Unit_Resource_Colonization_Atlas.dds,5,15[/COLOR]</Icon>
	<CombiIcon>Art/Interface/Buttons/[B][COLOR="Red"]Unit_Resource_Colonization_Atlas.dds,5,15[/COLOR][/B]</CombiIcon>

I'm not sure could both CombiIcons overlap each other or not, but I will try...
 
By code, they can overlap, that I know for sure. The graphical result would be exactly the same as with the current CombIcon.dds you provided, but it would be dynamically generated.

I like very much the idea of dynamically generated CombiIcons, because in such case we can see what is produced in the Blacksmith House at the moment: Tools or Guns. It would be GREAT!

After about 3-4 hours I will get access to my game PC and inform you about results, plus present some screens from the game.
 
No, unfortunately the overlapping doesn't work.

I tested two variants.

1.
YIELD_TOOLS
Code:
			<Icon>,Art/Interface/Buttons/Unit_Resource_Colonization_Atlas.dds,5,15</Icon>			
			<CombiIcon>,Art/Interface/Buttons/Unit_Resource_Colonization_Atlas.dds,5,15</CombiIcon>

YIELD_MUSKETS
Code:
			<Icon>,Art/Interface/Buttons/Unit_Resource_Colonization_Atlas.dds,6,15</Icon>
			<CombiIcon>Art/Interface/Buttons/Combi_Icon_Musket.dds</CombiIcon>

Result here:



It looks, the program reads only the first CombiIcon file (Unit_Resource_Colonization_Atlas.dds,5,15) and doesn't read the second one (Combi_Icon_Musket.dds).

2.
YIELD_TOOLS
Code:
			<Icon>,Art/Interface/Buttons/Unit_Resource_Colonization_Atlas.dds,5,15</Icon>			
			<CombiIcon>Art/Interface/Buttons/Combi_Icon.dds</CombiIcon>

YIELD_MUSKETS
Code:
			<Icon>,Art/Interface/Buttons/Unit_Resource_Colonization_Atlas.dds,6,15</Icon>
			<CombiIcon>Art/Interface/Buttons/Combi_Icon_Musket.dds</CombiIcon>

Result here:



Here the program again reads only the first CombiIcon and doesn't see others lines in the file.

You can try, I attached Combi_Icon_Musket.dds.
 

Attachments

  • Combi_Icon_Musket.rar
    679 bytes · Views: 117
KJ, I tried to add a second icon on top of the first, and... it replaced the first icon. But then I tried another way and it worked :D

Here is a link to the modcomp modified:
http://dl.dropbox.com/u/1732902/Colonization/Multiple Professions per Building 1.1.rar

Great, Androrc the Orc!

Now it's working, not exactly as I thought, but with a very detailed popup screen it's absolutely unnecessary. Moreover, now CombiIcon is not so critically important. Just enough that an icon near the building exists and looks a little bit different. All important information is available on the popup screen.

Last question about "drag unit".
Could just, please, add the possibility to "drag unit" in the Building and a corresponding popup screen gives us a choose between two professions: "Master Blacksmith" or "Master Gunsmith".
 
I am doing this now, and it is going to be a bit tricky, so it may take a while. The problem is that the indoor professions are assigned per profession, instead of per building, so to make the game check for which professions are available for that building, as well as building the whole structure behind the popup, is a bit more difficult.
 
KJ, got the popup working :D

It still needs a few modifications to make it work not only for citizens being dropped on the building, but also for it to work for units being taken from ships and from the "garrison" of the city.
 
Hi, I don't really understand what is the purpose of "Multiple Professions per Building".
If i understood we will not be able to produce 100% of tools and 100% of muskets, we must do a compromise between the two resources?
I know it is not easy to do what you did, that's why I would like to know its purpose.
Ty in advance for your reply and good Christmas party at the same time ;).
 
Hi, I don't really understand what is the purpose of "Multiple Professions per Building".
If i understood we will not be able to produce 100% of tools and 100% of muskets, we must do a compromise between the two resources?
I know it is not easy to do what you did, that's why I would like to know its purpose.
Ty in advance for your reply and good Christmas party at the same time ;).

Merry Christmas for you as well :)

What it means is that the slots of the SPECIALBUILDING_TOOLS buildings will be shared between the Blacksmith and Gunsmith professions. They are just an example, however; you could, for instance, make two new professions - Cotton Weaver and Wool Weaver - share the slots of the SPECIALBUILDING_CLOTH buildings.
 
Hi Androrc,

just a little Feedback:

This ModComp is really working great for me so far. :goodjob:

I am using it for different production lines:

Cocoa and Coffee (from Cocoafruits and Coffeeberries)
Cloth and expensive Clothes
Fur-Coats and Leathergoods
Hammers and Furniture

Thanks again for this great ModComp. :bowdown:
 
I have updated the mod to version 1.3, fixing an important bug. The change can be found in CvCity.cpp by searching for "Androrc Multiple Professions per Building 1.3".

Hi Androrc,

just a little Feedback:

This ModComp is really working great for me so far. :goodjob:

I am using it for different production lines:

Cocoa and Coffee (from Cocoafruits and Coffeeberries)
Cloth and expensive Clothes
Fur-Coats and Leathergoods
Hammers and Furniture

Thanks again for this great ModComp. :bowdown:

:)
 
Top Bottom