Quick Modding Questions Thread

I would set it back to AI worker sea, just incase it thinks it can only impove land tiles (no wait you said it works..), the other thing to try would be to increase the AIValue number, I think it is that, there is power and value I think... if you increase it's value setting the AI may be more likely to build it, it is one of the things to experiment with anyway, the other thing is the computer may not think the sacrifice is worth it for the reward, but I don't know.. the other things to try may be removing sacrificing, or changing the cost of the boat..
 
I have one problem with python, i am describe all in my rar file and put all files, just read 'OPIS.txt' file.
 

Attachments

  • python_problem.rar
    381.6 KB · Views: 36
About AI_chooseProduction in python:

Is it called for every AI city every turn?
If so, is there difference between placing the pushing code there or in cityDoTurn?
Will the AI always complete the order until the end?
 
@ Horatius: AI_chooseProduction in python is called from CvCityAI::AI_chooseProduction() in the dll and yes, looks like it is every turn for every city. Since it is integrated in the dll process for the AI to choose a production, it makes sense to leave the code there and not in onCityDoTurn, no?

Will the AI always complete the order until the end?: bof :lol:

Just one note for K-mod users: karadoc installed a callback there and blocked it (like in several other places) so by default, in K-mod, it is not handled by python.
 
Well, looking at the codes will give you some answers.

1) There are still some codes before the python, so there are of course some situations which will take priority before the python is checked. Anarchy is an obvious one.

2) onCityDoTurn on the other hand can be used for more things rather than just affecting the AI choice of production.

3) Nope, A.I can still change orders
 
Spoiler :

Code:
if (isProduction())
	{
		if (getProduction() > 0)
		{

			if ((getProductionUnitAI() == UNITAI_SETTLE) && kPlayer.AI_isFinancialTrouble())
			{
				
			}
			//if we are killing our growth to train this, then finish it.
			else if (!bDanger && isFoodProduction())
			{
				if ((area()->getAreaAIType(getTeam()) != AREAAI_DEFENSIVE))
				{
					return;
				}
			}
			// if less than 3 turns left, keep building current item
			else if (getProductionTurnsLeft() <= 3)
			{
				return;
			}
			
			
			// if building a combat unit, and we have no defenders, keep building it
			eProductionUnit = getProductionUnit();
			if (eProductionUnit != NO_UNIT)
			{
				if (plot()->getNumDefenders(getOwnerINLINE()) == 0)
				{
					if (GC.getUnitInfo(eProductionUnit).getCombat() > 0)
					{
						return;
					}
				}
			}
			
			// if we are building a wonder, do not cancel, keep building it (if no danger)
			BuildingTypes eProductionBuilding = getProductionBuilding();
			if (!bDanger && eProductionBuilding != NO_BUILDING && 
				isLimitedWonderClass((BuildingClassTypes) GC.getBuildingInfo(eProductionBuilding).getBuildingClassType()))
			{
				return;
			}
		}

		clearOrderQueue();
	}
	
	if (GET_PLAYER(getOwner()).isAnarchy())
	{
		return;
	}

Anything in that whole chunk will kick in before the python call, and prevent the python from activating.
 
Thanks guys. The reason I asked was because Dune Wars DLL does block AI_chooseProduction in python. Because of that I just slapped in the pushing code in onCityDoTurn provisionally. I'm not sure if its efficient and ok like that or if I should unblock AI_chooseProduction in C++ then.

After dozens of games in AI autoplay I noticed that the AI never changes the pushed order from onCityDoTurn, but I did read that in AI_chooseProduction the AI could sometimes change it.
 
Anything in that whole chunk will kick in before the python call, and prevent the python from activating.

isProduction() checks to see if the city has any builds queued. getProduction() > 0 checks to see if the currently queued build has any hammers into it. You can look at the comments in that section of code to see the specifics of what that section is checking for. None of those sub-sections change what is currently being built.
 
Well, assuming that the python does not merely return True all the times, there should be some if else conditions.

A simple scenario will be if it is wartime, build a special project at the capital.
Thus, during war, the python will kick in and start building it.

If peace is achieved before the project is finished, the capital may start looking for other things to build instead of finishing the project, because the python is no longer true, especially if the project only provides python benefits which has no meaning to AI.

If it starts building a wonder and then war is declared again, the python will be ignored, because now one of the conditions before the python is true.
 
Slightly off topic question, but this might be the best place to ask it. If I were to mod the game to use more than 18 players, would it be possible to host it on pitboss and still have more than 18 players? If not, is there a way that any one here knows how to get it to work?

Thanks in advance.
 
Is there any simple-ish way to change the color of the Main Interface from blue to something else? I've seen it done many times, but just how it's done is eluding me.
 
Hi, I was wondering if there's a simple guide around that could help me edit an existing model's skin/texture?

In the Fall From heaven 2 mod there is a civilization that has custom models for all of their national units, except a few. I was wondering if there is a way I could take one of the existing skins from one of the national units, modify the texture a bit, then stick it on the unit that kept the default skin. (It bothers me because the unit with the default skin clash immensively with the overall style of the civilization)

Thanks!
 
Hi, I was wondering if there's a simple guide around that could help me edit an existing model's skin/texture?

In the Fall From heaven 2 mod there is a civilization that has custom models for all of their national units, except a few. I was wondering if there is a way I could take one of the existing skins from one of the national units, modify the texture a bit, then stick it on the unit that kept the default skin. (It bothers me because the unit with the default skin clash immensively with the overall style of the civilization)

Thanks!

Download GIMP and gimp dds plugin for your gimp version.

Find your file texture right click open with choose GIMP, change what you want.

after that

FILE -> OVERWRITE

or FILE -> EXPORT.


If you want to change name of your .dds texture and put it on your units, you must download some program like NIFSKOPE or BLENDER etc and change name texture inside one of this program.
 
Download GIMP and gimp dds plugin for your gimp version.

Find your file texture right click open with choose GIMP, change what you want.

after that

FILE -> OVERWRITE

or FILE -> EXPORT.


If you want to change name of your .dds texture and put it on your units, you must download some program like NIFSKOPE or BLENDER etc and change name texture inside one of this program.

Here's a skinning tutorial. If you know your way around GIMP, you can change things a lot.

Thanks guys! I'll give it a try :)

Although, if I just overwrite the file (In this case it's the Immortal skin that I want to modify and use on the Berserker unit), won't this change the default berserker skin into the Immortal skin I use? I want it to just change for the Amurite Civ.
 
Totally different question--but does anyone by chance know what the ART_DEF_BONUS_VICTORY_*various colors* tags are in CIV4ArtDefines_Bonus?

They are from Rise of Rome, a Firaxis mod for Warlords.

If you have your own mod, you can safely delete them.
 
Thanks guys! I'll give it a try :)

Although, if I just overwrite the file (In this case it's the Immortal skin that I want to modify and use on the Berserker unit), won't this change the default berserker skin into the Immortal skin I use? I want it to just change for the Amurite Civ.

No. If you edit immortal and want use them on Berserker you have two solutions:

1) Copy your changed texture inside berserker and open it with some 3D artist program like Nifskope or Blender and change texture name inside program, rename to your edited texture, as i see you don't know to do that, this is not solution for you, not yet, but this is real solution.

2) Copy your changed texture inside your berserker folder and rename your texture in berserker texture i think berserker.dds, not sure, ofc this can cause other problem, weapons from your berserker will get another texture, axe will have some different crazy color, i don't advice this solution.
 
Top Bottom