Quick Modding Questions Thread

No, it does not happen more than once, but it then complains about FEATURE_FALLOUT and CIVILIZATION_BARBARIAN. Then the mod crashes for no given reason.
 
I tried debugging, setting a breaktrap at getInfoTypeForString, triggering only when szType == "TERRAIN_GRASS". It didn't break.

szType is of type char*, which is a pointer to a character, or in this case - an array of characters. In C++ you can't simply compare this to another string of type char*, because it compares addresses.
There are wrapper classes for strings (STL's std::string which is also used in the DLL) for them you can do that. (But I think it still won't work in the breakpoint condition, since only simple conditions work there which do not require calling a function, and the special '==' is an overloaded operator which is actually a function).

well I got the debugger running (thanks once again to asaf's tutorial) but my poor excuse for a computer freezes at the breakpoint. (yes I know I need a new computer and I will get one soon I promise) I tried it with civ in fullscreen and windowed. I'm wondering if I put the breakpoint in exactly the right spot, since I don't know much about C++.

If you run on fullscreen, and have one monitor (it could work well if you have 2) then Civ stops running when the breakpoint is hit so it can't clear up the screen for you to properly see the VS window, so it is better to run in window mode where the OS controls this.

Everything freezes? you can't even move the mouse cursor?

I was putting the breakpoint on the line beginning with "int" after the elapsed turns and advanced start line. If there is a better place please let me know.

This place is good.

If anyone could find it in their heart to degug it for six turns with a breakpoint at one of those lines I'd be forever in their debt.

Forever? :mischief:

I ran it until turn 9. It didn't reproduce. The only religion founded was Buddhism on turn 9 which makes sense :dunno:
 
No, it does not happen more than once, but it then complains about FEATURE_FALLOUT and CIVILIZATION_BARBARIAN. Then the mod crashes for no given reason.

Any dll modifications?
Else i'd guess that some XML is completely screwed, probably due to the encoding.
But i have no real idea :dunno:.
 
Yes, dll modifications. I have been nosing around, and I think the problem is in Python. I already found the grass problem and fixed it. I decided to reinstate the barbarian civ for now to make things easier. Do you have any idea where fallout might be mentioned?
 
I guess I meant I'd be forever in your debt if you fixed it. ok I was misinterpreting what was going on it wasn't frozen, however after clicking through (f10) what seemed like a thousand lines of code I came to this message:

No symbols are loaded for any call stack frame. The source code cannot be displayed. with 2 options: "ok" or "show disassembly"

clicking ok just left me at the same line of code and repeated the message. clicking show disassembly left me clicking through a bunch of addresses but just looping through 5 or six of them all in a group.

if I keep clicking will it eventually go back to the game? will it tell me when something happens in the game?

how could it not recur when you ran it? what could be different?

I also got this message at the start:

Assert Failed

File: CvPlayer.cpp
Line: 5134
Expression: GC.getCivilizationInfo(getCivilizationType()).getCivilizationUnits(eUnitClass) == eUnit
Message:

----------------------------------------------------------
 
I also got this message at the start:

Assert Failed

File: CvPlayer.cpp
Line: 5134
Expression: GC.getCivilizationInfo(getCivilizationType()).getCivilizationUnits(eUnitClass) == eUnit
Message:

----------------------------------------------------------

This would indicate that somebody has a unit they they can not normally build, either the default unit for a unit class for which they have a UU or somebody else's UU. Like, for example: the Inca have a regular warrior instead of their Quechua UU for the warrior (or somebody else has a Quechua).

This can happen if you are assigning some starting units in Python without checking each time to see if the player getting it has a UU of that type and giving them that instead.

It can also happen if you have units in a Worldbuilder file and forgot to give somebody their UU, or gave someone somebody else's UU.

Not exactly relevant here, but it can also happen later in the game if there is something that allows a player to build another civ's UU (like if a city that you took from another civ still builds that civ's UU).
 
I have discovered the exact conditions under which the extra religion founding takes place:

if the already founded religions have founding techs assigned to them in the xml, then any civ with any of those techs, starting with the weakest, will get a religion on turn 6. if the already founded religions have no tech prereqs in the xml, then any civ, even one with no techs, will get a religion.

since this seems to be there to help the AI I thought it might also be dependent on difficulty level but I checked "Settler" and the effect still occurred.

my solution for now is to make FUTURE_TECH the founding tech of the already founded religions, but if anyone can think of a better way I'd love to hear it.
 
Thanks for reporting that :).
I'll definitely have to remember this.

Yes, dll modifications. I have been nosing around, and I think the problem is in Python. I already found the grass problem and fixed it. I decided to reinstate the barbarian civ for now to make things easier. Do you have any idea where fallout might be mentioned?

How did you find out where the other stuff was missing (...and where)?
No real idea about the fallout atm :dunno:.
 
I have discovered the exact conditions under which the extra religion founding takes place:

if the already founded religions have founding techs assigned to them in the xml, then any civ with any of those techs, starting with the weakest, will get a religion on turn 6. if the already founded religions have no tech prereqs in the xml, then any civ, even one with no techs, will get a religion.

since this seems to be there to help the AI I thought it might also be dependent on difficulty level but I checked "Settler" and the effect still occurred.

my solution for now is to make FUTURE_TECH the founding tech of the already founded religions, but if anyone can think of a better way I'd love to hear it.

In the Charlemagne mod there is also a Future Tech 2 that can never be researched since Future Tech is repeatable. I believe the religions are attached to Future Tech 2.
 
I have a few ideas, and I'm not sure how hard it would be to implement them. I suspect this is moving out of XML range into Python or worse.
1) Any ground unit (except the camel riders) ending its turn in a desert takes a small amount of damage.
2) A unit that is invisible in forest/jungle only
 
The first one is doable with Python scripting but any effective implementation would be done directly in the DLL/SDK. The second one is probably doable in C++ only. :p
 
I've got one quick (well, I hope so :P) question.

Why doesn't this promotion show up? Range I and II work, but once I have Range II, I can't select Range III.

Code:
		<PromotionInfo>
			<Type>PROMOTION_RANGE3</Type>
			<Description>TXT_KEY_PROMOTION_RANGE3</Description>
			<Sound>AS2D_IF_LEVELUP</Sound>
			<LayerAnimationPath>NONE</LayerAnimationPath>
			<PromotionPrereq>PROMOTION_RANGE2</PromotionPrereq>
			<PromotionPrereqOr1>NONE</PromotionPrereqOr1>
			<PromotionPrereqOr2>NONE</PromotionPrereqOr2>
			<TechPrereq>NONE</TechPrereq>
			<StateReligionPrereq>NONE</StateReligionPrereq>
			<bLeader>0</bLeader>
			<bBlitz>0</bBlitz>
			<bAmphib>0</bAmphib>
			<bRiver>0</bRiver>
			<bEnemyRoute>0</bEnemyRoute>
			<bAlwaysHeal>0</bAlwaysHeal>
			<bHillsDoubleMove>0</bHillsDoubleMove>
			<bImmuneToFirstStrikes>0</bImmuneToFirstStrikes>
			<iVisibilityChange>0</iVisibilityChange>
			<iMovesChange>0</iMovesChange>
			<iMoveDiscountChange>0</iMoveDiscountChange>
			<iAirRangeChange>1</iAirRangeChange>
			<iInterceptChange>10</iInterceptChange>
			<iEvasionChange>0</iEvasionChange>
			<iWithdrawalChange>0</iWithdrawalChange>
			<iCargoChange>0</iCargoChange>
			<iCollateralDamageChange>0</iCollateralDamageChange>
			<iBombardRateChange>0</iBombardRateChange>
			<iFirstStrikesChange>0</iFirstStrikesChange>
			<iChanceFirstStrikesChange>0</iChanceFirstStrikesChange>
			<iEnemyHealChange>0</iEnemyHealChange>
			<iNeutralHealChange>0</iNeutralHealChange>
			<iFriendlyHealChange>0</iFriendlyHealChange>
			<iSameTileHealChange>0</iSameTileHealChange>
			<iAdjacentTileHealChange>0</iAdjacentTileHealChange>
			<iCombatPercent>0</iCombatPercent>
			<iCityAttack>0</iCityAttack>
			<iCityDefense>0</iCityDefense>
			<iHillsAttack>0</iHillsAttack>
			<iHillsDefense>0</iHillsDefense>
			<iKamikazePercent>0</iKamikazePercent>
			<iRevoltProtection>0</iRevoltProtection>
			<iCollateralDamageProtection>0</iCollateralDamageProtection>
			<iPillageChange>0</iPillageChange>
			<iUpgradeDiscount>0</iUpgradeDiscount>
			<iExperiencePercent>0</iExperiencePercent>
			<TerrainAttacks/>
			<TerrainDefenses/>
			<FeatureAttacks/>
			<FeatureDefenses/>
			<UnitCombatMods/>
			<DomainMods/>
			<TerrainDoubleMoves/>
			<FeatureDoubleMoves/>
			<UnitCombats>
				<UnitCombat>
					<UnitCombatType>UNITCOMBAT_AIR</UnitCombatType>
					<bUnitCombat>1</bUnitCombat>
				</UnitCombat>
			</UnitCombats>
			<HotKey/>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<Button>C:\Program Files (x86)\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\RANGE3.dds</Button>
		</PromotionInfo>

Thanks in advance!
 
Check the sum of the unit's base interception and the additional interception added by promotions. If it would be over a defined limit, then the promotion is not available to the unit. The definition of the maximum allowed interception chance is the MAX_INTERCEPTION_PROBABILITY setting in the GlobalDefines.xml file in BtS's Assets/XML folder. The setting for this is 100 in BtS.

You can either adjust the interception base + bonuses to not exceed that amount, or you can probably just raise the maximum. If i recall correctly, the interception chance has some effect on the damage done during an interception so increasing this and getting units with higher interception chances can also lead to increased damage inflicted on units being intercepted (the interception chance scales proportionately with damage too, by the way), making it more likely to shoot them down instead of just damage them.
 
It doesn't even work on an Airship or Fighter with no other promotions besides Range 1 (simply +1 range) and Range II (+1 range and +10% evasion chance), so are you sure that is the problem? Anyway, if it is, I guess I'll have to change MAX_INTERCEPTION_PROBABILITY because I've also added an Interception 3 promotion... If I set MAX_INTERCEPTION_PROBABILITY to, say, 200, would that make aircraft seriously underpowered?
 
Well, an Airship has 0 InterceptionProbability (in CIV4UnitInfos.xml), so... On the other hand, a Fighter has 100. Seeing as I haven't ever modified that tag, how could it work in normal BTS (I just checked, in normal BTS, MAX_INTERCEPTION_PROBABILITY is indeed 100)? Or am I misunderstanding something?
 
Yes, they are activated. I'll take a look at the promotions page.

Well, nothing happened. I also clicked on the promotion, and everything was fine. No errors showed up, Range II was required for Range III, and Range II required Range I. That was also shown on the promotion table in the Civlopedia. However, as you can see, these aircraft have lots of experience left, yet no promotion to choose from. Also, what's up with the strange health bar?

EDIT: I've added a new screenshot; even without any promotion those health bars are huge...
EDIT2: Well, those health bars still respond to promotions (giving aircraft my 'Draftee' promotion reduces their strength by 20%, which reduces the health bar, Cover and all those specific things do nothing, Range and anything that doesn't give +/-% to ordinary strength also does not influence the health bar, only Combat (and Fanatic, which, among other boni, also increases base strength) does). They're absurdly large though.
EDIT3: And now they're back to normal... Suddenly. I did:

Zoom in as far as I can on a city (those health bars were still huge).
Open World Builder and add 3 Mech Infantry with 999 XP.
Close World Builder.
Notice the health bars are normal again.

...?
 

Attachments

  • Utopia.jpg
    Utopia.jpg
    242.3 KB · Views: 65
  • Dystopia.jpg
    Dystopia.jpg
    232.7 KB · Views: 34
  • Dys-U-Topia.jpg
    Dys-U-Topia.jpg
    242.4 KB · Views: 66
Not much, just what you'd expect. The plane with Range 3 (in Ollantaytambo) can operate 1 tile further than the plane with no promotions (in Coruay-something or somesuch, two tiles above Ollantaytambo).

Also, is there a way to make promotions... Well, like, you can have Combat 1 or Drill 1, but not both. Because, if you have both Draftee (free upgrades, but -20% strength) and Quick Training (-20% upgrade cost), upgrading will actually cost -20%, in other words, you receive 20% of the normal upgrade cost...
 

Attachments

  • NORADNoRange.jpg
    NORADNoRange.jpg
    233.8 KB · Views: 63
  • Range3.jpg
    Range3.jpg
    236.6 KB · Views: 29
Back
Top Bottom