Quick Modding Questions Thread

@Cyrus of Persia
Dancing Hoskuld:"Assign each civ one BUILDING_ and then make them not capture in the building infos file. " Dancing Hoskuld think that you set <bNeverCapture>1</bNeverCapture> and <iConquestProb>0</iConquestProb> in CIV4BuildingInfos.xml to this values.
@Dancing Hoskuld, if i understand @Cyrus of Persia want that every civilization can build their PYRAMID, if he add unique building for PYRAMID, and if one civ built PYRAMID all other civs can't build PYRAMID, but he don't want that, if i correct understand what he want.
 
Seriously, why not just change all world wonders to national wonders?
 
Hi Cyrus, you're back! :)

You're right that the only solution is to create as many new building types AND classes. All World Wonders.

If you just set Pyramids to National Wonder, the problem is the same: the second one would disappear after conquest.

Edit/PS: There is no limit to the number of buildings that we know. We rely on C2C to test these limits! ;)

As you can imagine, the problem is the difficulty of working with a huge file. Imagine that if you want to change one attribute of the Pyramid, you would have to change it 34 times...

Edit/PS2: no need to touch the CIV4CityLSystem. I have several buildings using the same art, not a problem.
 
The reason why national wonders disappear when captured is because the probability is set to 0.
Nothing to do with player limit.
 
I experimented that some years ago. The probability set to 0 is just an additional check.

Have a look at the function CvPlayer::acquireCity. It checks "isProductionMaxedBuildingClass" which in turn checks isBuildingClassMaxedOut.

As far as I can tell from the code, if the Building is "MaxedOut" you won't get it.

EDIT: tested it with the Hermitage and iConquestProb set to 100. You don't get a 2nd one.
 
If that is the case, if he is a dll coder, just remove that check. If he is a python coder, then just type few lines. If he must rely on XML, then no choice copy 100 times for each wonder :D
 
Thanks guys, some great input.

@Isenchina: Hey man :), Good to see ya! and... since when do you read dlls :cooool: ? I thought you didn't do C++? :D

@Platyping: I'm an amateur coder. not too experienced, but can code some. I think there would be a problem with removing the check because it will also eliminate the function of removing buildings that SHOULD be removed after conquest, such as national projects. I want national projects to stay the same. So then it would require additional coding, which might lead to even more coding... and well... remember... I'm an amateur coder.

I like the possibility of a few lines within python, but can that properly address the issue in your knowledge? or is that also equivalent to circumventing the "MaxedOut" check, because that likely won't work as I explained above.
 
P.S. @Platyping:
Seriously, why not just change all world wonders to national wonders?

Well that's exactly how I want them to be except.. Imagine if Egyptions attacked mexico and took it over... then the aztec pyramids suddenly disapeared!! WTH!! :mischief: :lol:

Many nations built pyramids, they aren't exactly different. They're all pyramids! why should only 1 nation get to build a pyramid!!

Greeks built great palaces, ...so did the persians, ...so did the romans, ....so the the babylonians..... and they all look like the parthenon.

That's why I want to give the ability to each nation to acheive whatever they want for the same benefits, ..and so I would like to work around the stupid "1 world wonder" concept which I never liked.
 
@Isenchina: Hey man :), Good to see ya! and... since when do you read dlls :cooool: ? I thought you didn't do C++? :D

I like the possibility of a few lines within python, but can that properly address the issue in your knowledge? or is that also equivalent to circumventing the "MaxedOut" check, because that likely won't work as I explained above.

I don't "do" C++, I carefully said: "As far as I can tell from the code..." ;)

As for Python, I'm a bit unsure of it. Does the conquered city keep its ID or does it get a new one? When is Python called, before or after the dll? I'm not sure when I will have time to do some testing. Maybe Platy could enlighten us... :wavey:

The actual code will also depend on whether you would want it for all National Wonders or just for a specific set of them.
 
Just add under cannotConstruct...

If it is a World Wonder, and I already built/owned (depends what you want) one:
Don't allow me to build a similar one.

Done
 
If it's a World Wonder, only one civ can finish it: not good.

If it's a National Wonder, the check on construction is done with XML but he can't capture another one: not good.

If it's a normal building, cannotConstruct can do the check that only one is built per civ and you can capture another one.

But it won't be a wonder anymore, it won't count for the score. And all Pyramids will be called... Pyramids.

Actually, I was thinking more of a check in "onCityAcquired" or even onCityAcquiredAndKept. But then you have to check whether the building was existing before and "re-construct it" with Python.
 
Who said a world wonder can only be built once? Just set the global limit to 10000 and it is still a world wonder
 
It looks like you are right: in CvGameCoreUtils:
Code:
bool isWorldWonderClass(BuildingClassTypes eBuildingClass)
{
	return (GC.getBuildingClassInfo(eBuildingClass).getMaxGlobalInstances() != -1);
It's a bit strange though...

Summary:

in BuildingClass: iMaxGlobalInstances = 34 (for example); Team & Player instances = -1

Check iConquestProb in Building type.

in XML/PythonCallbackDefines: activate USE_CANNOT_CONSTRUCT_CALLBACK (value to 1)

in Python/CvGameUtils: write a code under def cannotConstruct:
Spoiler :
Code:
	def cannotConstruct(self,argsList):
		pCity = argsList[0]
		eBuilding = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		# Cyrus of Persia: begin
		pPlayer = gc.getPlayer(pCity.plot().getOwner())
		if eBuilding == gc.getInfoTypeForString("BUILDING_PYRAMID"):
			if pPlayer.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_PYRAMID")) > 0:
				return True
		# Cyrus of Persia: end
		return False
Which means that if you capture one Pyramid before having built one yourself, you can't anymore!

Not tested and code to be reviewed depending upon your exact needs.

EDIT: Cyrus, I now remember that I already answered you in post #3353 in May 2014!
 
It is actually more complicated than that. You need to include those which are being constructed by other cities, but exclude the one currently constructed by this city. As I said, if you want to count only those you built yourself, use other codes in CyStatistics.
 
Hmm... indeed the AI will have no clue that they can't build more than one.

But in CyStatistics I only see getPlayerNumBuildingsBuilt which does not seem to be better.

A dll solution is probably easier then!
 
The difference is that you can capture a pyramid and still be able to build one yourself.
 
I see, right. I thought that you were referring to a method for checking the multiple production of a building by a single player to avoid a waste of production time in other cities that won't be the first one to build a Pyramid.

Let's wait for Cyrus' reaction but if it is to continue the discussion on the various possibilities, I suggest to Cyrus to open a new thread under the SDK/Python section (unless you choose the all-XML solution of course).
 
Not very hard. All you need to do is use CountPlusMaking rather than just Count, then reduce it by 1 if it is the city which is building.
 
CountPlusMaking: didn't know that one. :)
 
Back
Top Bottom