• Civilization 7 has been announced. For more info please check the forum here .

Trouble modding

Akulya

Chieftain
Joined
Apr 28, 2009
Messages
27
Location
in a shirt, under a hat.
Hey all,

I LOVE Wildmana, so much that I am writing my own XML module to tailor it just the way I like. Reading about the forthcoming developments for spellcasting has actually kept me awake thinking of the possibilities!

Anyway, on topic.

I have put together a set of modified XML files as "Akulyas_Mod" within the windmana normalmodules, set the MLF to load it after everything else, celebrated with some WIN, and it basically works (ie. it loads with no errors, and I see the changes I have made in the 'pedia). BUT, a few things have me scratching my head...

Now in order to maintain future compatability with Wildmana, I have written a minimum amount of XML in my module files; correct me if i'm wrong, but my understanding is that CIV loads core Wildmana mod XML, then goes through the normal modules and loads additional XML, essentially overrulling those tags which are duplicated, sequentially.

With that in mind -

1. I decided to make Basium & Hyborem Immortal. So my code (in akulyamod_civ4unitinfos.xml) looked like this

Code:
.
.
.
	<UnitInfo>
		<Class>UNITCLASS_HYBOREM</Class>		
		<Type>UNIT_HYBOREM</Type>
		<bImmortal>1</bImmortal>
        </UnitInfo>
.
.
.

but when I load a game, now I find that I can build Hyborem 'from the off', as he has lost his <PrereqCiv>CIVILIZATION_INFERNAL</PrereqCiv> tag, odd methinks as everything else looks unchanged.

Why does this happens?



2. I dislike melee units with the "March" promotion, don't ask me why. I want melee units to require an actual medic, but I think "March" synergises well with recon units, so my code (in akulyamod_civ4promotioninfos.xml) looks like this
Code:
.
.
.
        <PromotionInfo>
            <Type>PROMOTION_MARCH</Type>
            <PromotionPrereqOr1>PROMOTION_COMBAT2</PromotionPrereqOr1>
            <UnitCombats>
                <UnitCombat>
                    <UnitCombatType>UNITCOMBAT_RECON</UnitCombatType>
                    <bUnitCombat>1</bUnitCombat>
                </UnitCombat>				
                <UnitCombat>
                    <UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
                    <bUnitCombat>0</bUnitCombat>
                </UnitCombat>
            </UnitCombats>
            <PromotionPrereqAnd>PROMOTION_DRILL2</PromotionPrereqAnd>
	</PromotionInfo>
.
.
.

Note; that I have also changed the prereq's for "March", When I load it up and check the 'pedia, the prereq change has been made but the unitcombat has not. So March is still available to Melee.

Why does this happen?



3. I though I'd arrange sentry/sentry2/keen sight/perfect sight into a nice progression, with commesurate changes (since keen sight grants defensive strikes, which would be innapropriate for beasts, mounted and recon) so I have this...
Code:
.
.
.
        <PromotionInfo>
            <Type>PROMOTION_KEEN_SIGHT</Type>
            <PromotionPrereq>PROMOTION_DRILL4</PromotionPrereq>
            <UnitCombats>
                <UnitCombat>
                    <UnitCombatType>UNITCOMBAT_RECON</UnitCombatType>
                    <bUnitCombat>1</bUnitCombat>
                </UnitCombat>
                <UnitCombat>
                    <UnitCombatType>UNITCOMBAT_MOUNTED</UnitCombatType>
                    <bUnitCombat>1</bUnitCombat>
                </UnitCombat>				
                <UnitCombat>
                    <UnitCombatType>UNITCOMBAT_BEAST</UnitCombatType>
                    <bUnitCombat>1</bUnitCombat>
                </UnitCombat>								
            </UnitCombats>
            <bSeeInvisible>1</bSeeInvisible>
            <iDefensiveStrikeChance>0</iDefensiveStrikeChance>
	</PromotionInfo>
.
.
.

Here I get my unit combats, and my see invisible, but I retain defensive strikes.
Obviously I am turning things off in the wrong way. But the XML loads without an error, as I would've expected if I'd got my boolean declaration wrong.


I'm just playing in my sandbox really, but I'd really like to get this working - so any modders out there, if you can shed a little light in my direction, It would make me even more addicted to Wildmana (which can only be good, right?)
 
1)
do you use the force override tag?
what happens if you make the changes directly in the CIV4UnitInfos.xml?

also basium does have unitclass basium your changes should read:
Code:
<UnitInfo>
            <Class>UNITCLASS_BASIUM</Class>
            <Type>UNIT_BASIUM</Type>
			<bImmortal>1</bImmortal>
 </UnitInfo>
and
Code:
<UnitInfo>
            <Class>UNITCLASS_HYBOREM</Class>
            <Type>UNIT_HYBOREM</Type>
			<bImmortal>1</bImmortal>
 </UnitInfo>


2) just delete the lines:
Code:
<UnitCombat>
                    <UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
                    <bUnitCombat>0</bUnitCombat>
                </UnitCombat>
if nothing changes check for other modular promotionsinfos files that may interfere

3)
again use forceoveride, or try to change the core files first to see if it works, then make it modular.

edit: the tag is: bForceOverwrite

edit 2: if you still have problems you may upload your files
 
Wow, your reply was so quick you caught my errors before I could clean them up!

I have not been using a force override tag - and it sounds as if I should.
What is the syntax? or is it in an .ini?
 
what do you mean by .ini?

just add the line

<bForceOverwrite>1</ bForceOverwrite>
to the changes you make, for example:
Code:
<UnitInfo>
            <Class>UNITCLASS_HYBOREM</Class>
            <Type>UNIT_HYBOREM</Type>
			<bImmortal>1</bImmortal>
<bForceOverwrite>1</bForceOverwrite>
 </UnitInfo>

as far as i know modular xml without this tag only adds to existing files, for example if you want to add an additional unitcombat you are good to go, but if you want to block out stuff you need to use this tag
 
Tesb, thank you so much.

an .ini is an initialization file used to set (important, usually global) parameters, CivilizationIV.ini is somewhere on your hard disk, probably in my documents/my games/Civ4... take a look and have a play.

Regarding <bForceOverwrite>1</ bForceOverwrite>,

would the correct usage be

Code:
        <PromotionInfo>
            <Type>PROMOTION_MARCH</Type>
            <PromotionPrereqOr1>PROMOTION_COMBAT2</PromotionPrereqOr1>
            <UnitCombats>
                <UnitCombat>
                    <UnitCombatType>UNITCOMBAT_RECON</UnitCombatType>
                    <bUnitCombat>1</bUnitCombat>
                </UnitCombat>				
              <bForceOverwrite>1</ bForceOverwrite>
              <UnitCombat>
                    <UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
                    <bUnitCombat>0</bUnitCombat>
                </UnitCombat>
              <bForceOverwrite>0</ bForceOverwrite>    
            </UnitCombats>
            <PromotionPrereqAnd>PROMOTION_DRILL2</PromotionPrereqAnd>
	</PromotionInfo>

As I don't want to necessarily force overwrite on the whole XML, as this would require remerging with each new patch of Wildmana!
 
try this:

Code:
<PromotionInfo>
            <Type>PROMOTION_MARCH</Type>
            <Description>TXT_KEY_PROMOTION_MARCH</Description>
<bForceOverwrite>1</bForceOverwrite>
            <Sound>AS2D_IF_LEVELUP</Sound>
            <PromotionPrereqOr1>PROMOTION_COMBAT3</PromotionPrereqOr1>
            <PromotionPrereqOr2>PROMOTION_MEDIC1</PromotionPrereqOr2>
            <bAlwaysHeal>1</bAlwaysHeal>
            <iEnemyHealChange>10</iEnemyHealChange>
            <iNeutralHealChange>10</iNeutralHealChange>
            <iFriendlyHealChange>10</iFriendlyHealChange>
            <UnitCombats>
                <UnitCombat>
                    <UnitCombatType>UNITCOMBAT_BEAST</UnitCombatType>
                    <bUnitCombat>1</bUnitCombat>
                </UnitCombat>
                <UnitCombat>
                    <UnitCombatType>UNITCOMBAT_DISCIPLE</UnitCombatType>
                    <bUnitCombat>1</bUnitCombat>
                </UnitCombat>
                <UnitCombat>
                    <UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
                    <bUnitCombat>0</bUnitCombat>
                </UnitCombat>
            </UnitCombats>
            <Button>,Art/Interface/Buttons/Promotions/March.dds,Art/Interface/Buttons/Promotions_Atlas.dds,2,4</Button>
        	<iPowerModifier>30</iPowerModifier>
		</PromotionInfo>

if this does not work try

Code:
<PromotionInfo>
            <Type>PROMOTION_MARCH</Type>
            <Description>TXT_KEY_PROMOTION_MARCH</Description>
<bForceOverwrite>1</bForceOverwrite>
            <Sound>AS2D_IF_LEVELUP</Sound>
            <PromotionPrereqOr1>PROMOTION_COMBAT3</PromotionPrereqOr1>
            <PromotionPrereqOr2>PROMOTION_MEDIC1</PromotionPrereqOr2>
            <bAlwaysHeal>1</bAlwaysHeal>
            <iEnemyHealChange>10</iEnemyHealChange>
            <iNeutralHealChange>10</iNeutralHealChange>
            <iFriendlyHealChange>10</iFriendlyHealChange>
            <UnitCombats>
                <UnitCombat>
                    <UnitCombatType>UNITCOMBAT_BEAST</UnitCombatType>
                    <bUnitCombat>1</bUnitCombat>
                </UnitCombat>
                <UnitCombat>
                    <UnitCombatType>UNITCOMBAT_DISCIPLE</UnitCombatType>
                    <bUnitCombat>1</bUnitCombat>
                </UnitCombat>
            </UnitCombats>
            <Button>,Art/Interface/Buttons/Promotions/March.dds,Art/Interface/Buttons/Promotions_Atlas.dds,2,4</Button>
        	<iPowerModifier>30</iPowerModifier>
		</PromotionInfo>

edit: i have not changed the promotion prereq you might want to do that
 
Looking at the Schema, the <bForceOverwrite> can only be used at the start of a <PromotionInfo>, so the whole thing up to </PromotionInfo> pretty much has to be overwritten. It works, which is a good thing, but feels a bit heavy handed.

I have tried both approaches you suggested, and they both work.

This is a very good thing, as it means I can take a whole new approach. Set the <bForceOverwrite> on the sections I wish to change, and then just copy over the whole data from the original and mod to my hearts content. Perhaps not as elegant as envisaged, but functional; and functional ugly code, trumps elegant buggy code. Sad but true.

Cheers again Tesb, and, did I mention, that I'm looking forwards to the new spellcasting? (because I am)
 
Sorry to Double Post,

But I just got thinking, if without the <bForceOverwrite> tag xml within normalmodules is added in addition to that which as already loaded - then why do Basium and Hyborem lose their <PrereqCiv> tags?


1. If I add the <bImmortal> directly into the core XML, then I have no problems (ie. they are immortal, and only buildable by their respective civs)


2. If I add the code from my Original Post
Code:
.
.
.
	<UnitInfo>
		<Class>UNITCLASS_HYBOREM</Class>		
		<Type>UNIT_HYBOREM</Type>
		<bImmortal>1</bImmortal>
        </UnitInfo>
.
.
.
then as explained I get immortality, but lose civ specificity.


3. If I use my original code (as above) but add
Code:
<PrereqCiv>CIVILIZATION_INFERNAL</PrereqCiv>
then I get what I want, but am left confused - why do I need to add the <PrereqCiv> tag at all? Why did I lose it form the base code? Is this happening somewhere else aswell perhaps and I have not noticed?
 
When using bForceOverwrite, you MUST place the entire entry into the module. The entire unit, building, civilization, whatever. Otherwise, it will assume that all exempted tags are set to 0. It's a necessary evil, for the ease with which you can modify or add stats.

I'm not sure what's going on with Hyborem and Basium, there may be a conflict with another module.
 
Reading about the forthcoming developments for spellcasting has actually kept me awake thinking of the possibilities!

feel free to post them in the spell threads, ideas are always welcome :)
 
1. I decided to make Basium & Hyborem Immortal. So my code (in akulyamod_civ4unitinfos.xml) looked like this

Code:
.
.
.
	<UnitInfo>
		<Class>UNITCLASS_HYBOREM</Class>		
		<Type>UNIT_HYBOREM</Type>
		<bImmortal>1</bImmortal>
        </UnitInfo>
.
.
.

but when I load a game, now I find that I can build Hyborem 'from the off', as he has lost his <PrereqCiv>CIVILIZATION_INFERNAL</PrereqCiv> tag, odd methinks as everything else looks unchanged.

Why does this happens?

There is a bug in the code that loads the PrereqCiv tag modularly. Will be fixed in 9.0 Right now just add <PrereqCiv>CIVILIZATION_X</PrereqCiv> to any unit you modify which has a Prereqciv.
 
Merci Sephi,

Just out of curiosity, where is that aforementioned bug?

Also - would it ever be possible to force XML tags that appear within normal modules to overwrite existing tags (be they from core files or modules lower down the load order); on a case by case basis rather than toggle bForceOverwrite and have to redefine every tag again?

If that could be done, it would allow for a nice hierarchical information flow, to every modders benefit.
 
the bug is in the dll.

Theoretically it is possible to allow force overwriting for single tags only but I doubt anyone wants to spend that much time on it.
 
Top Bottom