• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Quick Modding Questions Thread

I will try that now, but i don't know much about skeleton and animation.. I don't know what to do with skeleton and animation?

The skeleton is the part which moves. It has to be connected to the 3D model, else the unit will not move.
For some easier units this description might work.
 
1) flavors. Every tech has a flavor, e.g. FLAVOR_RELIGION, FLAVOR_PRODUCTION, and so on. A tech with FLAVOR_RELIGION can be researched by a prophet, one with production by an engineer, etc.

2) UnitInfos, the values
PHP:
			<iBaseTrade>500</iBaseTrade>
			<iTradeMultiplier>200</iTradeMultiplier>
 
1) flavors. Every tech has a flavor, e.g. FLAVOR_RELIGION, FLAVOR_PRODUCTION, and so on. A tech with FLAVOR_RELIGION can be researched by a prophet, one with production by an engineer, etc.

2) UnitInfos, the values
PHP:
			<iBaseTrade>500</iBaseTrade>
			<iTradeMultiplier>200</iTradeMultiplier>

hmm the #1 confuses me. according to wiki: "Flavors Modifies AI point weighting based on an assigned flavor (potential flavors include Production, Science, Growth, and Military, among others). "

plus, some flavors do not make any sense in terms of GP association, like "growth"?
And Military flavors doesn't allow it to be researched by great general for exmaple.
you sure its the right place?


PS- unless you referring to flavors data in Unit file rather than in tech file?
 
hmm the #1 confuses me. according to wiki: "Flavors Modifies AI point weighting based on an assigned flavor (potential flavors include Production, Science, Growth, and Military, among others). "

This is right :yup:.
The research by GP is additional to that.

plus, some flavors do not make any sense in terms of GP association, like "growth"?
And Military flavors doesn't allow it to be researched by great general for exmaple.
you sure its the right place?

A great general cannot research anything ^^.
For the other flavors there's just no GP assigned.
 
hi guys, i recently added a unit (knights templar) and i was wondering if i could make it civic dependable. i mean, apart from horse, iron, guilts, to require a civic (theocracy) in order to be enabled, smth like

bPreregCivic: CIVIC_THEOCRACY

Do i have to edit a python file for this, is it an easy task or should i think of smth else?
 
1) SDK => Adds a new XML tag to do that
2) Python => Use cannotTrain callback
 
thanks platyping for the reply ( :) ), but since i'm a total noob in this ( :D) , i do not know what sdk actually is. i've come across with that definition again but i haven't understand yet what it does. is it an editor app which i launch to edit the games core or a bunch of files that i have to edit?


edit: it seems that i found a tutorial here

http://forums.civfanatics.com/showthread.php?t=405444#Compile

i'm gonna follow it to the letter and post any problems/questions/ here :)
 
It means using C++ to edit stuff in CvGameCoreDLL folder, using some C++ programs and then to compile a dll file.
This tutorial may give you a hint what it is about.

SDK can open up whole new abilities as you may have seen in big mods or some mod components like new experience system for air combats, new global warming system etc, or just simple ones that add/transfer XML tags from one XML file to another.

If you have no idea what is C++ programming, then python may be easier to use...
Generally, SDK has better performance, but it is not easy when you want to merge 2 SDK mods together.
 
You don't have to add an XML entry if all you want to do is make one unit dependent on a civic you run. If you don't want to go into SDK modding, you can also achieve the same using Python callbacks. In your case, the function you want to use is cannotTrain() in Python\CvGameUtils.py.

Code:
	def cannotTrain(self,argsList):
		pCity = argsList[0]
		eUnit = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		bIgnoreUpgrades = argsList[5]
		return False
As you can see, it always returns False currently, i.e. there is no unit which you cannot train because Python says so. So you have to edit the function to return true if the unit you want to train is a knight templar (I assume the XML entry is UNIT_KNIGHT_TEMPLAR) and you don't run Theocracy:
Code:
	def cannotTrain(self,argsList):
		pCity = argsList[0]
		eUnit = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		bIgnoreUpgrades = argsList[5]

                if eUnit == gc.getInfoTypeForString("UNIT_KNIGHT_TEMPLAR"):
                        if gc.getPlayer(pCity.getOwner()).getCivics(4) != gc.getInfoTypeForString("CIVIC_THEOCRACY"):
                                return True

		return False
Quick explanation: first line checks if the unit you want to build is a Knight Templar, second line checks if the player that owns the city which wants to build it has selected Theocracy as the civic in the fifth column (religion, columns are counted starting with 0).
 
I will suggest use gc.getInfoTypeForString("CIVICOPTION_RELIGION") rather than 4 directly.
4 may not refer to religion in mods with edited civics.

Anyway, like I said, you have to activate the python callback for this to work :D
PythonCallbackDefines.XML file
Set
Code:
	<Define>
		<DefineName>USE_CANNOT_TRAIN_CALLBACK</DefineName>
		<iDefineIntVal>[COLOR="Blue"]1[/COLOR]</iDefineIntVal>
	</Define>
 
That's probably better, yes :)
 
Hey guys, could anyone share with me the code snippet for adding in new background images, on things like the civopedia and city screens (in python) also the right python files., I learnt how to do it a couple of months ago, but have managed to well and truly forget, and I know it took me ages to find it the first time around....

thanks for help.
 
...um...might be wrong right now, but neither the city screen nor the civilopedia has really a background image.
Some of the other screens have a background, e.g. the victory progress screen. That one is defined in the .py file itself, and is currently set to MAINMENU_SLIDESHOW_LOAD, which is defined in ArtDefines_Inteface.xml
 
they do have them because I have changed them :-)

the civolo image is like a stone background, and the city screen boxes all have images that can be changed, they are just like flat background colours as standard.

I had chaged them to be computer screens, I just cannot remember where or how...

I remember spending ages digging through tutorials etc. to eventually stumble on it somewhere, it may have even been looking at the code in another mod, I just cannot remember!?!?
 
The civilopedia background is defined via SCREEN_BG_OPAQUE in the same CIV4ArtDefines_Interface.xml mentioned by The_J. You can either point it at a different .dds file or replace the one with the name it uses with a different one.

The city screen parts are more complicated, although some of the parts may be defined in that same file (search for "city" and it turns up a few things that might be useful for this). Alternatively, look in Python\Screens\CvMainInterface.py and you can see various panels using definitions like "Panel_City_Left_Style". These styles are defined in Resources\Themes\Civ4\Civ4Theme_Custom.thm. In there you can see the file names for the various parts - things like "Civ4/Custom/city_panel_lr.tga". These .tga files are in Resource\Civ4\Custom. Presumably all the ones that start with "city" are the ones you would change, although there may be some that don't start with that prefix (I don't know - never messed with them).
 
Back
Top Bottom