Quick Modding Questions Thread

Baldyr, isn't it too heavy for the game? Wouldn't it be slowing the game to have that check everytime a unit is built?
I'd have to time it to be able to give an answer, but the unitBuilt call-up isn't near as severe as something like the canMove call-back, because the former would probably be called a couple of times a turn, while the latter would be called hundreds of times! That is why the first one is always enabled in the game, while the second one is disabled by default.

In case, here are the tags:
Give PROMOTION_ARCTIC_SURVIVALIST to UNITCLASS_WORKER if there is a building BUILDINGCLASS_HERMITAGE_RUSSIA or BUILDINGCLASS_HERMITAGE_VIKING.
Before I do this; just a quick pointer: Shouldn't the Civ specific Herminage buildings be BuildingTypes belonging to BUILDINGCLASS_HERMITAGE? Because that is - as far as I understand it - what BuildingClassTypes are for. Namely being able to diversify Civ specific building, also known as Unique Buildings, of the same class.

It can be scripted either way, but I thought we should clarify this in beforehand.

edit: It turns out that it would be a bad idea to check BuildingClassTypes, so it should be BuildingTypes, as I proposed. Try this in CvEventManager:
Code:
	def onUnitBuilt(self, argsList):
		'Unit Completed'
		city = argsList[0]
		unit = argsList[1]
		player = PyPlayer(city.getOwner())

[COLOR="Red"]		if unit.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_WORKER"):
			if ( city.isHasBuilding(gc.getInfoTypeForString("BUILDING_HERMITAGE_RUSSIA"))
		             or city.isHasBuilding(gc.getInfoTypeForString("BUILDING_HERMITAGE_VIKING")) ):
				unit.setHasPromotion(gc.getInfoTypeForString("PROMOTION_ARCTIC_SURVIVALIST"), True)[/COLOR]
 
Baldyr, it looks as if it works fine, thank you (a Viking worker was promoted, not others)!

About the code, can I repeat it for the desert promotion but for 5 or 6 civilizations (with or or or or or...) and can it start below with the same indentation as for the first "if"?

Also, I realized that I already added stuff there (The_J's Warriors of God... hé hé). I guess it's OK to leave that section below? (I did not try to build a Warrior of God though).

About the BuildingClass, it is done intentionnally like that. If the Viking would happen to invade England for exemple, and if they conquer a city, they have a probability to have a special Hermitage_England that would not then be converted automatically into a Viking Hermitage. If they have the appropriate tech, they could later build (and only in this conquered city) the English "UB" and English "Unit". I put those in parenthesis because I changed the "uniqueness" of them up to a certain extent. I don't like the vanilla way so much.

As you see, I have implemented my own rules and that is all the fun of modding!

Thank you!
 
I'd say experiment with it and come back here once you get stuck. :)
 
I think it will (not completely sure since I only glimpsed at the code), but unhealthiness issues might cause your population to decrease, so you'll have to take care of that as well.
Unhealthiness will be a problem ... I agree. But not sure about whether it will cause a decrease. (EDIT: Yes it does.)
 
Baldyr, isn't it too heavy for the game? Wouldn't it be slowing the game to have that check everytime a unit is built?

Hardship already scans the terrain surrounding the city every time a unit is built without any perceptible slowing, so checking for a building shouldn't do much to it. Glad you like the mod!
 
Hi,

quick question: is there a way to get a building to provide more than one free promotion simply by modifying the XML (i.e. no python)?

Ta.
 
You could create new buildings which provide unique promotions. e.g.

"Ranger School" produces "Woodsman 1"
"Mountaineering School" produces "Guerilla 1"

etc.
 
You could create new buildings which provide unique promotions. e.g.

"Ranger School" produces "Woodsman 1"
"Mountaineering School" produces "Guerilla 1"

etc.

I think he meant have 1 building provide 2 or more promotions, i think you can do it somehow like you can with required techs for units, since it says this for units that require more then 1 tech
<PrereqTech>TECH_FISHING</PrereqTech>
<TechTypes>
<PrereqTech>TECH_THE_WHEEL</PrereqTech>
<PrereqTech>NONE</PrereqTech>
<PrereqTech>NONE</PrereqTech>
</TechTypes>
Im sure you can do the same with promotions but im sure it will require the schema change
 
Schema changes usually means a DLL change, I thought. My way is a lot simpler to implement. He could halve the build cost for the building and create two lower cost buildings.
 
aggri1, just holler if you need help with the proper Python fix. Python is your friend. ;)
 
Schema changes usually means a DLL change, I thought. My way is a lot simpler to implement. He could halve the build cost for the building and create two lower cost buildings.

No just edit the CIV4BuildingsSchema, thats where it says what you can put in the xml, im sure theres a way you can add that in, never tried editing schemas so wouldnt know how, but thats my best guess
 
aggri1, just holler if you need help with the proper Python fix. Python is your friend. ;)

Truer words have never been spoken!

Except for:

C++ is your friend! :p

Despite my relative dearth of knowledge on c++ I still find it incredibly powerful.
 
You can change the schema and it will allow you to add extra tags to the xml. But they will do nothing. The DLL controls what the tags actually do.
 
No just edit the CIV4BuildingsSchema, thats where it says what you can put in the xml, im sure theres a way you can add that in, never tried editing schemas so wouldnt know how, but thats my best guess

You can change the schema and it will allow you to add extra tags to the xml. But they will do nothing. The DLL controls what the tags actually do.

What GE said.
The schemas are there both to let us know the correct structure of the XML files, and to help validate the XML when the game runs. It doesn't load the XML values.
 
Hi,

quick question: is there a way to get a building to provide more than one free promotion simply by modifying the XML (i.e. no python)?

Ta.

why don't you just creat a new promotion which covers everything you like? and have a fancy button? looks much cooler than a line of boring promotions!!
 
Does civ ignore the commented parts of XML files? It seems like it ought to, but I'm getting crashes since making some XML changes...
 
Commenting out lines in (some) XML files appears to be a bit buggy. :p
 
Ah, that's probably it then. I've got whole multiple-line segments commented out for later use... guess I'll paste them into a new file.
 
I changed the English names of some of the religious buildings in \Assets\XML\CIV4GameTextInfos_Objects.xml (the vanilla master files). Just the <Text><English> names, not the <Tag>.

Now, the Civilopedia and hints don't show those buildings' cultural output. You still get the cultural output, because it shows up when you hover over the cultural output breakdown in the City Screen. Any ideas as to what's causing this? It happens in both RFC and the otherwise unmodded game.

I'm running BTS 3.13 on Windows XP.
 
Back
Top Bottom