Quick Modding Questions Thread

you use the artstyle xml file.

it allows you to make artstyle entries for different units. So in the civilizationinfo xml you will find an artstyle tag, with something like ARTSTYLE_EUROPE

And in the artstyle xml file you can set specific units to use a different set of art files under each artstyle entry, so you can set a specific warrior for each artstyle, or chariot or elephant or whatever.

both files are in the xml/civilizations folder.

Then you add in your alternate art into the unit art defines xml. (and ofcourse the actual art into the art folder as well.)

so you have an art define entry for AMERICA_WARRIOR, CHINA_WARRIOR, etc. but no entry for them in the unitinfo file.
 
Does anyone by any chance know if there is a way to make a promotion which allows a unit to move across land and sea? I know there is a bool value for it in unitinfos but is there anyway to link it to a promotion?
 
Does anyone by any chance know if there is a way to make a promotion which allows a unit to move across land and sea? I know there is a bool value for it in unitinfos but is there anyway to link it to a promotion?

I believe it would require a change in the dll if you wanted to make non-flying units have the ability to travel over both. I presume you are talking about a hovercraft type of concept rather than truly flying.

It may be possible with Python, but there could be a significant performance hit using it. Other people can comment on Python with greater authority than me, so I stand ready to be corrected :)
 
I believe it would require a change in the dll if you wanted to make non-flying units have the ability to travel over both. I presume you are talking about a hovercraft type of concept rather than truly flying.

It may be possible with Python, but there could be a significant performance hit using it. Other people can comment on Python with greater authority than me, so I stand ready to be corrected :)

Well that is unfortunate news. You wouldn't by any chance happen to know which DLL file I should I be poking around in do you? Maybe a unit related one, or promotion related.
 
chances are you would have to link quite a few, because it would need to affect promotions, and affect the state of the unit, plus load and save the data, so I imagine it would not be a simple implementation, if you just wanted to make all units travel on land and water, it might be just a line or two to fiddle with, but making it interchangeable, and relate to a promotion would probably be harder.

I was able to use a bit of code to make one promotion have a str. impact against another promotion, a few lines that somebody had written, but I imagine terrain would be more complex...
 
If it is just less than 5 units which may acquire the promotion, then a crude method is to have a dummy version of each of them, where the original can only move on land or sea, while the dummy can move on both.

Then upon promotion, just replace the original with the dummy with all stats copied over.
 
Its a nearly a whole civ worth of units. But I see your point. It would probably be easier to just to have unique units that can move through both. I do thank you for the feedback. On that topic would anyone by any chance know if there is a way to make certain Terrain, that would otherwise not be, settle able by a specific civ?
 
Add some codes to cannotFoundCity in CvGameUtils

If Terrain == x and Civ == Y: return True
 
I tried this and it didn't appear to do anything.

Code:
	def cannotFoundCity(self,argsList):
		iPlayer, iPlotX, iPlotY = argsList
		if CyMap().plot(iPlotX, iPlotY).TerrainType == gc.getInfoTypeForString("TERRAIN_COAST") and iPlayer == 1: return True
		return False

I also tried it without the check for the player and it still didn't work.
 
It should be ones of those functions which need to be enabled via the xml file first.
Anyway, it is getTerrainType, and it is not a good idea to compare iPlayer to an integer directly, unless it is a scenario.
 
.TerrainType == gc.getInfoTypeForString("TERRAIN_COAST") and iPlayer == 1
What are you trying to do? This would make the boolean true if the plot is water up against the coastline and only if the player is the 2nd player. (Human player is usually 0 by index.)

This also wouldn't influence any other human players in a game (say you have multiplay taking place.) A better check might be isHuman(). But if you're looking to specify land coastal plots this won't do it - there's another way to refer to this but I can't recall it off the top of my head...
 
Tried this, a slightly edited bit of code from FTTW.

Code:
	def cannotFoundCity(self,argsList):
		iPlayer, iPlotX, iPlotY = argsList
		pPlayer = gc.getPlayer(iPlayer)
		pPlot = gc.getMap().plot(iPlotX, iPlotY)
		if pPlayer.getCivilizationType() == gc.getInfoTypeForString("CIVILIZATION_CRABPEOPLE"):
			if pPlot.getTerrainType() == gc.getInfoTypeForString("TERRAIN_COAST"):
				return False
		return False

It still didn't want to work. I also tried it without the check for which civilization it was and it still did not work.

What are you trying to do?
Make settlers for a certain team build cities in the Coast/Ocean Terrain
 
there are a few other things that need turning on if you want to be able to make a city on water.

In the pythoncallbackdefines file.

<Define>
<DefineName>USE_CANNOT_FOUND_CITY_CALLBACK</DefineName>
<iDefineIntVal>1</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_CAN_FOUND_CITIES_ON_WATER_CALLBACK</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>

both need to be set to 1, helpfully they are at the top of the file.

You also need to change the canfoundcitiesonwater (or something like that I am having trouble finding it... I did this once before..) you need to change it from false to true, or if you want it to just be for certain civs, then you will have to do some other bits as well.. Don't ask me about that! :D

If it is still not working after that, you are better off making a new thread and linking to it here, that way you can lay out what you want to happen, and people can help you work through making it happen.

In the beginning it took me forever to get this concept working, and took lots of back and forth.

My Original Conversation around this
 
Cities on water, hm i think that is not good idea, i am not try that, but i don't know how AI will use and how will react, how AI will capture these cities ? I think that water tiles is not included in calculating area of civilization (maybe all terrains, water or land, which have this <bFound>1</bFound> are included), you don't get domination percents (Domination Victory) for water cities.
My philosophy, if AI can't used that, it is not interesting, and i don't want to include that in mod.
 
Code:
	def cannotFoundCity(self,argsList):
		iPlayer, iPlotX, iPlotY = argsList
		pPlayer = gc.getPlayer(iPlayer)
		pPlot = gc.getMap().plot(iPlotX, iPlotY)
		if pPlayer.getCivilizationType() == gc.getInfoTypeForString("CIVILIZATION_CRABPEOPLE"):
			if pPlot.getTerrainType() == gc.getInfoTypeForString("TERRAIN_COAST"):
				return False
		return False

It still didn't want to work. I also tried it without the check for which civilization it was and it still did not work.
This is saying false either way - that would be problematic for ya.


Make settlers for a certain team build cities in the Coast/Ocean Terrain
Do they have units that can? Is the dll fixed up to allow this (normally not allowed to plant cities on water tiles.)
 
Cities on water, Planetfall mod, blue player is AI.

Look for source code in Planetfall. And you can look in source code in Rise from Erebus, that mod have promotion which allow units to walk on water terrains.

And i think that you must teach AI to build cities on water (Planetfall should have that code, because AI player have city on water terrain).

selfbiased01_xHx.jpg
 
Finally got it working.

I had to edit Assets/XML/PythonCallbackDefines.xml
changing these iDefineIntVals to 1
Code:
	<Define>
		<DefineName>USE_CANNOT_FOUND_CITY_CALLBACK</DefineName>
		<iDefineIntVal>1</iDefineIntVal>
	</Define>
	<Define>
		<DefineName>USE_CAN_FOUND_CITIES_ON_WATER_CALLBACK</DefineName>
		<iDefineIntVal>1</iDefineIntVal>
	</Define>

As well as CvGameUtils.py
making the following changes:
Code:
	def cannotFoundCity(self,argsList):
		iPlayer, iPlotX, iPlotY = argsList
		pPlayer = gc.getPlayer(iPlayer)
		pPlot = gc.getMap().plot(iPlotX, iPlotY)
		if pPlayer.getCivilizationType() != gc.getInfoTypeForString("CIVILIZATION_CRABPEOPLE"):
			if pPlot.getTerrainType() == gc.getInfoTypeForString("TERRAIN_COAST") or pPlot.getTerrainType() == gc.getInfoTypeForString("TERRAIN_OCEAN"):
				return True
		return False

Code:
	def canFoundCitiesOnWater(self,argsList):
		iX, iY= argsList	
		return True

There appears to have been a python switch to allow settling water all along :lol: I just had to disallow everyone except the one civ from doing so.

Thank you, everyone for the help. I would not have figured this out on my own.
 
Back
Top Bottom