• 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 would use a spreadsheet such as Calc or Excel to do this rather than create a C++ app. Both these apps have built in functions to generate random numbers.
 
I don't know that they have to generate numbers between two values, i will make this for me because i want to gain some C++ experience i have idea and this is not hard, when i finish i will upload to forum, more harder is to merge codes from two or more modes or write some new C++ mod component for game, that is some more realistic experience that this what i want to do.
 
I don't know that they have to generate numbers between two values, i will make this for me because i want to gain some C++ experience i have idea and this is not hard, when i finish i will upload to forum, more harder is to merge codes from two or more modes or write some new C++ mod component for game, that is some more realistic experience that this what i want to do.

I've looked at the issue as well. Particularly in C2C it's a problem because we STILL have leader tags that should be defined but aren't. (They aren't obvious is part of the issue...)

I decided that we could use an Archetype system where you define blocks of these tags then mix and match those blocks on leaders to make them easier to create. Due to some determinations as to how we'd go about that going above my skill level to implement I'm still waiting for that structure to be established (though I'm thinking it probably won't be done anytime soon so I may have to go back to plan A to make it happen.) Other projects have superceded its necessity.

This was to eventually lead to a mechanism in the game to define any number of random leaders on demand (not into the XML but into the game anyhow.) Intended for a Units as Leaders and Expiring Leaders mod options - blended with an Adopt - A - Civ option. It's still a plan but it'll certainly be a while before implemented and I've got too much else to do at the moment to focus on it at all.

But I wanted to say I at least recognized the same need you did - the leaders have become too complex to do with any quality with ease.
 
If I were to change one of the city specialists' purpose and make it give a different yield, would it cause problems for the AI?

I want to have a specialist that works as a food importer. Such that he will produce let's say 6 food and will have a cost of -12 gold. This is to simulate the idea of buying food from elsewhere. But I don't want the AI to misinterpret it incorrectly or not use it when needed. Its mainly to serve as a way to help low food producing cities.

does the AI have defined code for each specialist? or does it do a general evaluation on what they produce, otherwise treats them similarly?


Ideally I wanna create a new specialist all together. But I hear there are some challenges with that?


uugh!! :twitch: somebody enlighten me on the subject.
 
I want to make little C++ console application for leaderheads which will random generate number between two numbers (example random number between 90 and 200) and write result in one xml file, from iWonderConstructRand to iFavoriteCivicAttitudeChangeLimit for now. Can someone help me about this code about random numbers generate how code will look, i will find something in books and on google. I will make in cmd because i don't know C# yet.
If you want a completely random number in C++, then there are plenty of guides online. Here is one: http://www.cplusplus.com/articles/EywTURfi/
If you want a number between 90 and 200, then it would be
Code:
90 + (rand() % 111)
It generates a random number between 0 and 110 and then it adds 90 to gain what you want.

Having said that I'm not quite sure why you would want to write random numbers in XML. If you want leaders to be random, then add the random number generator to the new game code. If you do this correctly, you will get new leader attributes every time you start a new game, but the numbers will stay the same for the entire game. I assume it should be possible to do without breaking multiplayer.

If you want to get a semi-random number ingame, which works in network games, then the code would be.
Code:
90 + getSorenRandNum(111, "log"))
log is a string it puts in the log every time the function is used.

EDIT replaced 130 with 110 :blush:
I was thinking of coding method and apparently didn't pay enough attention to the numbers themselves. I guess this is a reminder of how easy it is to make bugs.
 
With Specialists, I THINK it evaluates them based on their production, much like tiles.

Creating a new specialist I THINK is easy, just xml and art, the problem comes with the city screen display in that it does not do well with extra specialists.

Some mods have fixed this problem with new display code that adds extra things in better, I know Platy's UI does specialists, I can't remember if BuG has anything for new specialists, I haven't got to the point of adding my new specialists yet.

I don't know how the AI will react to a negative yield (it is a mechanic I intend to use myself) Whether negative will trump positive, or if it knows that getting six food when it needs it is worth losing 12 income... that will have to be experimetned with.

Apparently another thing that vanilla AI is not good at is properly valuing multiple specialists of the same type, from what I learnt from Karadoc(K-Mod Creator) the AI only 'sees' the income of the first specialist (or something like this), which is something he fixed in K-Mod.
 
I am playing on epic game speed (just short of marathon).

I want to increase the max draft amount of Nationhood to 5 from 4. Except when I increase it in the xml from 3 to 4...on epic speed this increases it to 6.

I tried looking in the gamespeed xml and didnt see a value for drafting...

And entering a value of 3.5 creates an error.
 
chances are this is something that would have to be fixed in the dll, as it is a 'scaling' issue for game speed I would think.

I don't know what the math is but chances are it has a multiplier that makes the 4 into a 6 for epic, and the xml won't accept a decimal..

So you would have to change the multiplier for epic in the .dll I bet, which may well have much further reaching consequences than you would want..
 
@ Lib.Spi't

good, cause I'm building my mod on top of K-mod. Thanks. Yeah I think the AI evaluates the "total" yield benefits as well. Hopefully it can see and consider the negative gold as well and can use it properly.
 
If I were to add the line: <iHealth>1</iHealth> to the "farm improvement", will it cause farms to give health? the same way a forest gives health? I wanna give the farm a health point (as an experiment).


will this work?


Also, is it possible to make resources' benefits like health and happiness only citywide? so they wouldn't be nation wide. Is it possible to do it easily, with a flip of a switch... or not really?
 
If I were to add the line: <iHealth>1</iHealth> to the "farm improvement", will it cause farms to give health? the same way a forest gives health? I wanna give the farm a health point (as an experiment).


will this work?

Try it and find out.

Also, is it possible to make resources' benefits like health and happiness only citywide? so they wouldn't be nation wide. Is it possible to do it easily, with a flip of a switch... or not really?

The only way to do this (in regular BtS anyway) that I can think of is to remove the health/happy from the resources and add buildings that give them if you have the resource, just like the granary already gives +1 health for corn, rice, and wheat and the forge gives +1 happy for gems, silver, and gold. If you want the health or happy for the resource you build the associated building in the city. You can still get it in every city with access to the resource, it just takes some production and time.

This might mess up how the AI values resources a bit, but not completely ruin the evaluation.
 
Also, is it possible to make resources' benefits like health and happiness only citywide? so they wouldn't be nation wide. Is it possible to do it easily, with a flip of a switch... or not really?

The only way to do this (in regular BtS anyway) that I can think of is to remove the health/happy from the resources and add buildings that give them if you have the resource, just like the granary already gives +1 health for corn, rice, and wheat and the forge gives +1 happy for gems, silver, and gold. If you want the health or happy for the resource you build the associated building in the city. You can still get it in every city with access to the resource, it just takes some production and time.

This might mess up how the AI values resources a bit, but not completely ruin the evaluation.

^Someone tried to make a mod that made resources local, or something like that, and you got a set number that could be distributed between cities, sort of like in CiV, but I can't remember:
A: If it got finished
B: Who even was working on it
 
So... I'm a complete newbie modder. I was just looking for a way to change Asoka's traits to Philisophical/Industrious and change the Indian Unique Building to a Library that allows 3 Scientists instead of 2. I was able to change Asoka's traits easily, but then the Library wasn't as easy. All I did was change the "Building Class" of the Indian Mausoleum from Jail to Library, left the "Type" as INDIAN_MAUSOLEUM, and pasted over the rest with the normal Library XML stuff. I changed the specialist count from 2 to 3 scientists. The 3 Specialist Library showed up in the Civopedia as India's unique building, but when I built a Library in-game, it just built a normal library. I don't know what to try next. Here are the changes in XML for the Building Info thing I made.

Spoiler :
<BuildingInfo>
<BuildingClass>BUILDINGCLASS_LIBRARY</BuildingClass>
<Type>BUILDING_INDIAN_MAUSOLEUM</Type>
<SpecialBuildingType>NONE</SpecialBuildingType>
<Description>TXT_KEY_BUILDING_LIBRARY</Description>
<Civilopedia>TXT_KEY_BUILDING_LIBRARY_PEDIA</Civilopedia>
<Strategy>TXT_KEY_BUILDING_LIBRARY_STRATEGY</Strategy>
<Advisor>ADVISOR_SCIENCE</Advisor>
<ArtDefineTag>ART_DEF_BUILDING_LIBRARY</ArtDefineTag>
<MovieDefineTag>NONE</MovieDefineTag>
<HolyCity>NONE</HolyCity>
<ReligionType>NONE</ReligionType>
<StateReligion>NONE</StateReligion>
<bStateReligion>0</bStateReligion>
<PrereqReligion>NONE</PrereqReligion>
<PrereqCorporation>NONE</PrereqCorporation>
<FoundsCorporation>NONE</FoundsCorporation>
<GlobalReligionCommerce>NONE</GlobalReligionCommerce>
<GlobalCorporationCommerce>NONE</GlobalCorporationCommerce>
<VictoryPrereq>NONE</VictoryPrereq>
<FreeStartEra>ERA_MODERN</FreeStartEra>
<MaxStartEra>NONE</MaxStartEra>
<ObsoleteTech>NONE</ObsoleteTech>
<PrereqTech>TECH_WRITING</PrereqTech>
<TechTypes/>
<Bonus>NONE</Bonus>
<PrereqBonuses/>
<ProductionTraits>
<ProductionTrait>
<ProductionTraitType>TRAIT_CREATIVE</ProductionTraitType>
<iProductionTrait>100</iProductionTrait>
</ProductionTrait>
</ProductionTraits>
<HappinessTraits/>
<NoBonus>NONE</NoBonus>
<PowerBonus>NONE</PowerBonus>
<FreeBonus>NONE</FreeBonus>
<iNumFreeBonuses>0</iNumFreeBonuses>
<FreeBuilding>NONE</FreeBuilding>
<FreePromotion>NONE</FreePromotion>
<CivicOption>NONE</CivicOption>
<GreatPeopleUnitClass>NONE</GreatPeopleUnitClass>
<iGreatPeopleRateChange>0</iGreatPeopleRateChange>
<iHurryAngerModifier>0</iHurryAngerModifier>
<bBorderObstacle>0</bBorderObstacle>
<bTeamShare>0</bTeamShare>
<bWater>0</bWater>
<bRiver>0</bRiver>
<bPower>0</bPower>
<bDirtyPower>0</bDirtyPower>
<bAreaCleanPower>0</bAreaCleanPower>
<DiploVoteType>NONE</DiploVoteType>
<bForceTeamVoteEligible>0</bForceTeamVoteEligible>
<bCapital>0</bCapital>
<bGovernmentCenter>0</bGovernmentCenter>
<bGoldenAge>0</bGoldenAge>
<bAllowsNukes>0</bAllowsNukes>
<bMapCentering>0</bMapCentering>
<bNoUnhappiness>0</bNoUnhappiness>
<bNoUnhealthyPopulation>0</bNoUnhealthyPopulation>
<bBuildingOnlyHealthy>0</bBuildingOnlyHealthy>
<bNeverCapture>1</bNeverCapture>
<bNukeImmune>0</bNukeImmune>
<bPrereqReligion>0</bPrereqReligion>
<bCenterInCity>0</bCenterInCity>
<iAIWeight>0</iAIWeight>
<iCost>90</iCost>
<iHurryCostModifier>0</iHurryCostModifier>
<iAdvancedStartCost>100</iAdvancedStartCost>
<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
<iMinAreaSize>-1</iMinAreaSize>
<iConquestProb>0</iConquestProb>
<iCitiesPrereq>0</iCitiesPrereq>
<iTeamsPrereq>0</iTeamsPrereq>
<iLevelPrereq>0</iLevelPrereq>
<iMinLatitude>0</iMinLatitude>
<iMaxLatitude>90</iMaxLatitude>
<iGreatPeopleRateModifier>0</iGreatPeopleRateModifier>
<iGreatGeneralRateModifier>0</iGreatGeneralRateModifier>
<iDomesticGreatGeneralRateModifier>0</iDomesticGreatGeneralRateModifier>
<iGlobalGreatPeopleRateModifier>0</iGlobalGreatPeopleRateModifier>
<iAnarchyModifier>0</iAnarchyModifier>
<iGoldenAgeModifier>0</iGoldenAgeModifier>
<iGlobalHurryModifier>0</iGlobalHurryModifier>
<iExperience>0</iExperience>
<iGlobalExperience>0</iGlobalExperience>
<iFoodKept>0</iFoodKept>
<iAirlift>0</iAirlift>
<iAirModifier>0</iAirModifier>
<iAirUnitCapacity>0</iAirUnitCapacity>
<iNukeModifier>0</iNukeModifier>
<iNukeExplosionRand>0</iNukeExplosionRand>
<iFreeSpecialist>0</iFreeSpecialist>
<iAreaFreeSpecialist>0</iAreaFreeSpecialist>
<iGlobalFreeSpecialist>0</iGlobalFreeSpecialist>
<iMaintenanceModifier>0</iMaintenanceModifier>
<iWarWearinessModifier>0</iWarWearinessModifier>
<iGlobalWarWearinessModifier>0</iGlobalWarWearinessModifier>
<iEnemyWarWearinessModifier>0</iEnemyWarWearinessModifier>
<iHealRateChange>0</iHealRateChange>
<iHealth>0</iHealth>
<iAreaHealth>0</iAreaHealth>
<iGlobalHealth>0</iGlobalHealth>
<iHappiness>0</iHappiness>
<iAreaHappiness>0</iAreaHappiness>
<iGlobalHappiness>0</iGlobalHappiness>
<iStateReligionHappiness>0</iStateReligionHappiness>
<iWorkerSpeedModifier>0</iWorkerSpeedModifier>
<iMilitaryProductionModifier>0</iMilitaryProductionModifier>
<iSpaceProductionModifier>0</iSpaceProductionModifier>
<iGlobalSpaceProductionModifier>0</iGlobalSpaceProductionModifier>
<iTradeRoutes>0</iTradeRoutes>
<iCoastalTradeRoutes>0</iCoastalTradeRoutes>
<iGlobalTradeRoutes>0</iGlobalTradeRoutes>
<iTradeRouteModifier>0</iTradeRouteModifier>
<iForeignTradeRouteModifier>0</iForeignTradeRouteModifier>
<iGlobalPopulationChange>0</iGlobalPopulationChange>
<iFreeTechs>0</iFreeTechs>
<iDefense>0</iDefense>
<iBombardDefense>0</iBombardDefense>
<iAllCityDefense>0</iAllCityDefense>
<iEspionageDefense>0</iEspionageDefense>
<iAsset>3</iAsset>
<iPower>0</iPower>
<fVisibilityPriority>1.0</fVisibilityPriority>
<SeaPlotYieldChanges/>
<RiverPlotYieldChanges/>
<GlobalSeaPlotYieldChanges/>
<YieldChanges/>
<CommerceChanges/>
<ObsoleteSafeCommerceChanges>
<iCommerce>0</iCommerce>
<iCommerce>0</iCommerce>
<iCommerce>2</iCommerce>
</ObsoleteSafeCommerceChanges>
<CommerceChangeDoubleTimes>
<iCommerce>0</iCommerce>
<iCommerce>0</iCommerce>
<iCommerce>1000</iCommerce>
</CommerceChangeDoubleTimes>
<CommerceModifiers>
<iCommerce>0</iCommerce>
<iCommerce>25</iCommerce>
</CommerceModifiers>
<GlobalCommerceModifiers/>
<SpecialistExtraCommerces/>
<StateReligionCommerces/>
<CommerceHappinesses/>
<ReligionChanges/>
<SpecialistCounts>
<SpecialistCount>
<SpecialistType>SPECIALIST_SCIENTIST</SpecialistType>
<iSpecialistCount>3</iSpecialistCount>
</SpecialistCount>
</SpecialistCounts>
<FreeSpecialistCounts/>
<CommerceFlexibles/>
<CommerceChangeOriginalOwners/>
<ConstructSound>AS2D_BUILD_LIBRARY</ConstructSound>
<BonusHealthChanges/>
<BonusHappinessChanges/>
<BonusProductionModifiers/>
<UnitCombatFreeExperiences/>
<DomainFreeExperiences/>
<DomainProductionModifiers/>
<BuildingHappinessChanges/>
<PrereqBuildingClasses/>
<BuildingClassNeededs/>
<SpecialistYieldChanges/>
<BonusYieldModifiers/>
<ImprovementFreeSpecialists/>
<Flavors>
<Flavor>
<FlavorType>FLAVOR_SCIENCE</FlavorType>
<iFlavor>10</iFlavor>
</Flavor>
</Flavors>
<HotKey/>
<bAltDown>0</bAltDown>
<bShiftDown>0</bShiftDown>
<bCtrlDown>0</bCtrlDown>
<iHotKeyPriority>0</iHotKeyPriority>
</BuildingInfo>


What did I do wrong/What should I try? Thanks for any help!

-Chris

P.S. I was also wondering if there was a way to change the Indian civilization's cultural borders' color from pink to something else using XML. It's not a big deal, but having a pink civilization was always a little weird for me.
 
Did you change the CIV4CivilizationInfos.xml entry for India accordingly?

Code:
			<Buildings>
				<Building>
					<BuildingClassType>BUILDINGCLASS_JAIL</BuildingClassType>
					<BuildingType>BUILDING_INDIAN_MAUSOLEUM</BuildingType>
				</Building>
			</Buildings>

The JAIL should become LIBRARY.

In that same file, the color is defined as:
Code:
<DefaultPlayerColor>PLAYERCOLOR_PURPLE</DefaultPlayerColor>

Choose another one which is not used in the CIV4PlayerColorInfos.xml in the XML/Interface folder. You could also create a new one (in the CIV4ColorVals.xml file, same folder).
 
Is there a way to make the ai more likely to refuse to comply with the edicts of the apostalic palace?

I shouldve lost several wars, but I started a "stop fighting amongst brothers and sisters of the faith" vote and got out of it really easily.
 
The only way to do this (in regular BtS anyway) that I can think of is to remove the health/happy from the resources and add buildings that give them if you have the resource, just like the granary already gives +1 health for corn, rice, and wheat and the forge gives +1 happy for gems, silver, and gold. If you want the health or happy for the resource you build the associated building in the city. You can still get it in every city with access to the resource, it just takes some production and time.

This might mess up how the AI values resources a bit, but not completely ruin the evaluation.

I see. That's not ideal. I want resources to give happy benefit only to the city they are placed in. Still thanks.



A citizen (not the specialist) gives 1 unhappiness, 1 unhealthiness, and eats two food. I wanna modify these. I can see the food_consumption in globaldefines, but I can't find the are two. Where are they?
 
Back
Top Bottom