Quick Modding Questions Thread

I downloaded Conflict on Chiron and it turned out to contain an empty folder called CvGameCoreDLL. Either way I have the xml files, which was what I was looking for. I assume you are talking about IMPROVEMENT_BUNKER. Looking in vanilla DLL source, I found this in CvCity::init()
PHP:
CyArgsList argsList;
argsList.add(iX);
argsList.add(iY);
long lResult=0;
gDLL->getPythonIFace()->callFunction(PYGameModule, "citiesDestroyFeatures", argsList.makeFunctionArgs(), &lResult);

if (lResult == 1)
{
	if (pPlot->getFeatureType() != NO_FEATURE)
	{
		pPlot->setFeatureType(NO_FEATURE);
	}
}

pPlot->setImprovementType(NO_IMPROVEMENT);
It should call citiesDestroyFeatures in python, then depending on the return value destroy the feature. After that it should destroy the improvement.

Based on what I can see here, it should work. Next step would be to compile a debug DLL, set a breakpoint at the last line and step through the code to see how/why it fails to do as expected. Naturally doing that would require access to the DLL source code.

My bunker works so: A Worker build a improvement Bunker, after this improvement is finished, a pythoncode delate this improvement and set a unit Bunker with Domain Immobile . Because a Unit can do an active Action - linke Range Combat an Defending...and so on...


I solved the problem with a little Python code under def onCityBuilt...
But it would be nice to solve the problem via sdk.
I will have look into my sdk files.


Thats what i Have in my CvCity.cpp


PHP:
CyArgsList argsList;
	argsList.add(iX);
	argsList.add(iY);
	long lResult=0;
	gDLL->getPythonIFace()->callFunction(PYGameModule, "citiesDestroyFeatures", argsList.makeFunctionArgs(), &lResult);

	if (lResult == 1)
	{
		if (pPlot->getFeatureType() != NO_FEATURE)
		{
			pPlot->setFeatureType(NO_FEATURE);
		}
	}

	if (pPlot->getImprovementType() != NO_IMPROVEMENT) // 
	{
		if (!GC.getImprovementInfo(pPlot->getImprovementType()).isPermanent())
		{
			pPlot->setImprovementType(NO_IMPROVEMENT);
		}
	}
	//pPlot->setImprovementType(NO_IMPROVEMENT);
	//pPlot->updateCityRoute(false);
 
PHP:
	//pPlot->setImprovementType(NO_IMPROVEMENT);
	//pPlot->updateCityRoute(false);
The first line replace the current improvement with NO_IMPROVEMENT. In other words it will remove IMPROVEMENT_BUNKER if it's present. The next line handles something with routes on the plot, which I assume you want to do as well. The question now is why are those two lines commented out?
 
My mod have Better BTS AI, i want to force AI to build more Air units (Jet Fighters, Stealth Bombers, Guided Missiles). For now i just increased <iAIWeight>100</iAIWeight>. How will AI more respect and more build this units (Because, some big empires with 17 cities have only 4 jet fighters and 3 stealth bombers and 0 guided missile, that is terrible, and i with 21 cities have 44 jet fighters and 11 stealth bombers and several guided missiles for example) ?
 
It includes all wonders:

PHP:
bool isLimitedWonderClass(BuildingClassTypes eBuildingClass)
{
	return (isWorldWonderClass(eBuildingClass) || isTeamWonderClass(eBuildingClass) || isNationalWonderClass(eBuildingClass));
}
 
I have some unexpected problem and me is really need help.
My city icons are became crazy, trading icon is became power, and icon for defense (tower icon) is disappeared, its only show city defense. Why and how? I just add new bonuses and add new terrains and add my two new map scripts and all works, instead of this icons, please see images.

IMAGES:
Spoiler :

Trading icon:

LsnNOIg.jpg


No icon for defense (tower):

mFA1EG2.jpg

 
I have some unexpected problem and me is really need help.
My city icons are became crazy, trading icon is became power, and icon for defense (tower icon) is disappeared, its only show city defense. Why and how? I just add new bonuses and add new terrains and add my two new map scripts and all works, instead of this icons, please see images.

IMAGES:
Spoiler :

Trading icon:

LsnNOIg.jpg


No icon for defense (tower):

mFA1EG2.jpg


Icons going awry like that happen when you exceed the number of bonuses supported by the code. A number of mods have extended the limit. Can't remember the exact number but I think it was only 130-170 in the original dll.

New question for today: is there somewhere I can set what % chance missionary has to spread a religion into a city?
Thank You!

I think that is on the unit infos in the ReligionSpreads tag. Unless that tag has been added to RoM, RoM/AND, C2C so far back I can't remember it being added.
Code:
			<ReligionSpreads>
				<ReligionSpread>
					<ReligionType>RELIGION_ANDEAN</ReligionType>
					<iReligionSpread>80</iReligionSpread>
				</ReligionSpread>
			</ReligionSpreads>
 
Icons going awry like that happen when you exceed the number of bonuses supported by the code. A number of mods have extended the limit. Can't remember the exact number but I think it was only 130-170 in the original dll.

Less than that. In unmodded BtS, 74 is the maximum because you can fill in 3 rows of resources in tga files minus the last slot = (3 * 25) - 1.
 
@Dancing Hoskuld,
@isenchine


My mod is based on Legends of Revolution dll. I have 72 bonuses in mod now.
I attach my CIV4ArtDefines_Bonus.xml

I was have similar problem with corporations and i think with religions, important thing previous <iTGAIndex> can't have high value then next, it's strict important,
this is bad:
CORP_1 <iTGAIndex>19</iTGAIndex>
CORP_2 <iTGAIndex>7</iTGAIndex>
this is bad and will cause some crazy icons for example Aluminum.Co will have Jewels icon and etc,

this is good:
CORP_1 <iTGAIndex>7</iTGAIndex>
CORP_2 <iTGAIndex>19</iTGAIndex>

this is excellent and recommended:
CORP_1 <iTGAIndex>0</iTGAIndex>
CORP_2 <iTGAIndex>1</iTGAIndex>
if you don't put <iTGAIndex> (this tag is not available in BTS i think) counting start
from 0 and increment by +1.

You can see in my CIV4ArtDefines_Bonus.xml that some bonuses have same <FontButtonIndex> and some have 25, next have 56, and next have 17 for example, maybe that cause some problem.

NOTE: All until ART_DEF_BONUS_WEAPONS in CIV4ArtDefines_Bonus.xml is same like in BTS, my new resource start from ART_DEF_BONUS_WEAPONS to end of file.
And i don't touch GameFont.tga and GameFont_75.tga in Res folder.
I hope that someone have some idea how to fix this and what cause problem it's really irritate me, I really put a lot of effort to balance, and this do not working correctly.

EDIT:
I am now remove all new resources and i again have this problem. How is this possible ? Which file is responsible for that icons (icon trading, power, city defense-tower) ?
 

Attachments

You can see in my CIV4ArtDefines_Bonus.xml that some bonuses have same <FontButtonIndex> and some have 25, next have 56, and next have 17 for example, maybe that cause some problem.
NOTE: All until ART_DEF_BONUS_WEAPONS in CIV4ArtDefines_Bonus.xml is same like in BTS, my new resource start from ART_DEF_BONUS_WEAPONS to end of file.
And i don't touch GameFont.tga and GameFont_75.tga in Res folder.
The "mess" in your ArtDefines_Bonus file is not the problem. Except perhaps that your ART_DEF_BONUS_WEAPONS has a FontButtonIndex of 75. Note also that you have 2 ART_DEF_BONUS_COTTON.

You said that you did not change the tga files. The icons power, trading, etc come from there. They are listed in CvEnums.h and are used by CvUtil.py for example.
 
Icons going awry like that happen when you exceed the number of bonuses supported by the code. A number of mods have extended the limit. Can't remember the exact number but I think it was only 130-170 in the original dll.
Less than that. In unmodded BtS, 74 is the maximum because you can fill in 3 rows of resources in tga files minus the last slot = (3 * 25) - 1.
I encountered problems with yield icons in M:C and had to dig deeper into how GameFont works. It turns out to be somewhat more simple than first meet the eye.

GameFont.tga is read into memory. Each block is assigned an ID. When a row ends, the next ID is the first on the next row meaning rows are more of a tool for human readability than for the game, though multiple blank blocks can be skipped. For this reason I recommend filling unused ones with a "free" marker, or random icons, just to be sure not to cause offset errors.

The game assigns the IDs to the info classes using setChar(). BTS does this in CvGameTextMgr.cpp with the function CvGameTextMgr::assignFontIds(). Colonization does this in the exe and then the dll can overwrite afterwards. Not sure why there is a difference, but the bts solution is the modder friendly one.

You can essentially add as many icons as you like and it will work in the text (like icons in pedia). However for some exe reason city billboards can only display the first 286 icons. This mean I sorted icons in M:C to place text only icons intentionally after the 286, making plenty of room for billboard icons and making it clear what are using the billboards and what isn't. Also it looks like colonization use way more icons than BTS since there is one for each yield and European player color, while BTS just has the religion and corporation icons instead.

I wrote new pages to the already heavily modded domestic advisor in M:C where it lists the GameFont icons and their IDs as well as the type from the info class using the ID, if any. I then added iChar as an optional xml setting. If set, this will be the ID to use in GameFont. The correct ID can then be read from the debug DA interface. I would like to port this to BTS, but since it relies heavily on M:C specific code, it would be better to start over and write something from scratch using python only and I never got around to even start doing something like that. It shouldn't be too complex. It's just a matter of making a list, loop some numbers and for each number write the int and the widechar of that int. Different "tabs" can then loop the infos using get/set char() and make a line for each, telling the int value, widechar and getType(). Do remember that each icon exist in two sizes and displaying both on the same line would be a good idea.

Warning: the bullet char is hardcoded in the game exe. Whatever you do to GameFont.tga, make sure it will keep the ID it has in vanilla.
 
@isenchine,
@Nightinggale


Thanks for answers, and thanks for double ART_DEF_BONUS_COTTON i remove one, change index of weapons from 75 to 4 for example and problem i same, how i can see, he is move all icons for 12 spaces (angry civic is red golden age, unhealthy is eaten food, trading is power), how and why i don't know i will describe my short activity, i yesterday see that problem.

Can some of this cause problems ?
1. I add several new terrains, feature and bonuses, and don't touch any tga files.
2. I add new bonuses to corporations.
3. Some corporations can have 12 resources, because i changed
<DefineName>NUM_CORPORATION_PREREQ_BONUSES</DefineName>
<iDefineIntVal>12</iDefineIntVal>
in GlobalDefines.xml

I think that is all. I will attach several files in rar and you can see, maybe someone will found this unreal and unexpected problem.
 

Attachments

How are your Corporations showing? I see that you have started a iTGAIndex as from the 8th Corporation only. Was it always like that?

I don't use this kind of tga file so it's difficult to say anything more. But obviously, it's Religions and Corporations that are read before the icons. The resources are read after them.
 
I think that is on the unit infos in the ReligionSpreads tag. Unless that tag has been added to RoM, RoM/AND, C2C so far back I can't remember it being added.
Code:
			<ReligionSpreads>
				<ReligionSpread>
					<ReligionType>RELIGION_ANDEAN</ReligionType>
					<iReligionSpread>80</iReligionSpread>
				</ReligionSpread>
			</ReligionSpreads>


Thank you! I will try to play with that ;)
 
1. I add several new terrains, feature and bonuses, and don't touch any tga files.
That's the problem. What happens is this:

CvGameTextMgr::assignFontIds() fills out the icon IDs into the info classes. It simply starts at one end and assign an ever increasing ID. It has no knowledge of the tga files and relies purely on the xml info. You increased GC.getNumBonusInfos(), which mean everything read after bonuses will have an offset error. The only thing after bonuses is symbols.

If you open GameFont.tga, you will see that symbols are read as 12 places to the right of the correct one. Trade becomes power while defense becomes empty. You added 12 bonuses, or rather, you added something, which with padding became 12.

Edit GameFont.tga+GameFont_75.tga and add the new bonuses. This should add the offset "error" to the tga reading code as well and once again they match.

Also it would seem that CvGameTextMgr::assignFontIds() informs the exe of the symbol IDs, meaning the bullet char isn't hardcoded. That's quite interesting as this is one of the major differences between bts and colo and one thing, which really annoys be with the colo exe. If it really isn't hardcoded in bts, the bullet char should be affected by the offset error as well and be fixed by adding the bonus icons.
 
Back
Top Bottom