Mod-Modders Guide to Fall Further

What all does your spell do? Maybe the issue is in there. And the PythonOnRemove happens before the promotion is actually removed so you can prevent that from happening, so that could be your issue here.

The spell that actually caused the issue is lost in the mists of time, but this is a current current version.
Code:
<SpellInfo>			<!-- Become Wood Golem -->
    <Type>SPELL_BECOME_WOOD_GOLEM</Type>
    <Description>TXT_KEY_SPELL_BECOME_WOOD_GOLEM</Description>
    <Civilopedia>TXT_KEY_SPELL_BECOME_WOOD_GOLEM_PEDIA</Civilopedia>
    <TechPrereq>TECH_NEVER</TechPrereq>
    <bDisplayWhenDisabled>0</bDisplayWhenDisabled>
    <ConvertUnitType>UNIT_WOOD_GOLEM</ConvertUnitType>
    <AddPromotionType1>PROMOTION_CLEAR_WORKSHOP_CONTRACT</AddPromotionType1>
    <bBuffCasterOnly>1</bBuffCasterOnly>
    <PyRequirement>False</PyRequirement>
    <bGraphicalOnly>1</bGraphicalOnly>
    <Button>Art/Interface/Buttons/Units/Wood Golem.dds</Button>
</SpellInfo>

And again the code in PythonOnRemove was pCaster.cast(gc.getInfoTypeForString('SPELL_BECOME _WOOD_GOLEM'))


The PROMOTION_CLEAR_WORKSHOP_CONTRACT excludes and replaces a bunch of other promotions, including the one being removed. So that could be the problem. If I feel curious, I will do some tests.
 
Hey all,

I am currently trying to implement a Commander/Minion promotion couple and I have a big issue with "Commander Promotion"

I have the following chain:

A commands B
There are 3 promotions, P1, P2 and P3. P3 is stackable
A has P1 free promotion
P1 gives Minions promotion P2
P2 gives Commander promotion P3

So I have:
A(P1), B() becomes A(P1),B(P2) becomes A(P1,2xP3),B(P2) !
I should have at the end A(P1,P3), but I have 2xP3...

When adding C as minion of A, I have:
A(P1),B(),C() becomes A(P1),B(P2),C(P2) becomes A(P1,4xP3),B(P2),C(P2)

Of course as a result if B and C quit A, I have A(P1,2xP3) as only one P3 is removed when the minon quits.

Any thought ?

To test more I did the following:

A commands B
There are 4 promotions, P1, P2, P3 and P4. P4 is stackable
A has P1 free promotion
P1 gives Minions promotion P2
P3 is autoaquire with only condition to have P2
P3 gives Commander promotion P4

I still have:
A(P1),B() becomes A(P1),b5P2) becomes A(P1),B(P2,P3) becomes A(P1,2xP4),B(P2,P3) !

So it seems only a problem with stackable commander promotion.
 
Do you have the latest patch? There were quite a few little bugs with stackables early on, but I thought they were all sorted out now. What you describe is almost the exact format for the Bannor's extra XP trickle-up effect, which last I heard is working properly (finally)
 
Spoiler :
Hey all,

I am currently trying to implement a Commander/Minion promotion couple and I have a big issue with "Commander Promotion"

I have the following chain:

A commands B
There are 3 promotions, P1, P2 and P3. P3 is stackable
A has P1 free promotion
P1 gives Minions promotion P2
P2 gives Commander promotion P3

So I have:
A(P1), B() becomes A(P1),B(P2) becomes A(P1,2xP3),B(P2) !
I should have at the end A(P1,P3), but I have 2xP3...

When adding C as minion of A, I have:
A(P1),B(),C() becomes A(P1),B(P2),C(P2) becomes A(P1,4xP3),B(P2),C(P2)

Of course as a result if B and C quit A, I have A(P1,2xP3) as only one P3 is removed when the minon quits.

Any thought ?

To test more I did the following:

A commands B
There are 4 promotions, P1, P2, P3 and P4. P4 is stackable
A has P1 free promotion
P1 gives Minions promotion P2
P3 is autoaquire with only condition to have P2
P3 gives Commander promotion P4

I still have:
A(P1),B() becomes A(P1),b5P2) becomes A(P1),B(P2,P3) becomes A(P1,2xP4),B(P2,P3) !

So it seems only a problem with stackable commander promotion.

I had the same problem in patch B. I avoided it by having P2 randomly apply P3 with 100% chance. That meant that P3 was permanent, but in my case that was okay.

I'm very interested in knowing if that has been fixed in patch C.
 
Do you have the latest patch? There were quite a few little bugs with stackables early on, but I thought they were all sorted out now. What you describe is almost the exact format for the Bannor's extra XP trickle-up effect, which last I heard is working properly (finally)

Well, I have patch C. Or so I think.
I could check but I distributed the Dagda's Tear modmodmod with patch C and the problem occur in this setup.

I'll try to simplify to see with only 1 promo granting commander stackable to see if this is working when so simple or not.
 
I am modding a unit to require both a Library and a Mage's Guild.

I couldn't find any nested tags for units to allow requiring multiple buildings, so I thought I would try a bit of a hack and use both PrereqBuilding and PrereqBuildingClass.

When I enter these tags in the unit's info:

<PrereqBuilding>BUILDING_MAGE_GUILD</PrereqBuilding>
<PrereqBuildingClass>BUILDING_LIBRARY</PrereqBuildingClass>

Then the unit is listed in the Pedia as requiring a Mage's Guild, but also a Temple of the Order?? Very strange...
 
I am modding a unit to require both a Library and a Mage's Guild.

I couldn't find any nested tags for units to allow requiring multiple buildings, so I thought I would try a bit of a hack and use both PrereqBuilding and PrereqBuildingClass.

When I enter these tags in the unit's info:

<PrereqBuilding>BUILDING_MAGE_GUILD</PrereqBuilding>
<PrereqBuildingClass>BUILDING_LIBRARY</PrereqBuildingClass>

Then the unit is listed in the Pedia as requiring a Mage's Guild, but also a Temple of the Order?? Very strange...

You're using a building index to look up a building class. The Temple of the Order buildingclass probably happens to be the same index as the building Library.

Replace BUILDING_LIBRARY with BUILDINGCLASS_LIBRARY, and it should work.
 
Alright, I have an odd issue here, not sure if you can help me or not. After merging the new DLL content from FfH, I get this error on startup:

Code:
Tag: &#8364;Ø7&#9633;_SLAVE in Info class was incorrect
Current XML file is: xml\Civilizations/CIV4LeaderRelationInfos.xml

Any chance you've seen something like this before? I'm assuming I broke the Leader Relations code somehow, but I have no idea how. :confused:

This is the only popup I get... I can start the mod, browse the pedia, and so on, but trying to start a game causes a crash.
 
You are missing a global define somewhere most probably. Use Notepad++ to search through all of your assets folder for _SLAVE (you'll get quite a few, but the right one should stand out), as well as searching in your DLL code with Codeblocks or VS
 
You could make a new prereq for promotions which is based on StrBoost of the unit, then have an AutoAcquire promo to swap unitcombat. Or you could rewrite the DLL routine which grants strength to also apply a special promotion on the 4th run (promo set by global define and changing unitcombat), or just to flat out change the unitcombat. Or you could cheat and since you know what age the unit will be when gaining the fourth boost, have an AA MinAge, CIV_ANIMAL promotion (not MustMaintain, so that the unitcombat remains beast after capture)

Just wanted to say that I got the prereq working. :goodjob: Now I'll move on to the techarray for animal units... But that can come on Monday. :p
 
Sorry for the double post, wanted this one seen. :lol:

Alright, I'd like to allow animal civ units with the bExploreRivalTerritory tag to be able to enter cultural borders. I'm thinking that it should be simple, just a check in CvUnit to make sure that tag is not on the unit before blocking it's movement...

However, I'm nowhere near my comp at the moment, and I'm still pretty shaky in the DLL. Not even completely sure I named the right file. :lol: Am I on the right track here, or no?

Edit: Got home, and I believe I already have it working... At least, it worked when I tested it. :lol:

Worried the edit may have been too easy however... Any unforeseen consequences coming from the two spots bolded?

Code:
    if (getTeam() == ANIMAL_TEAM)
    {
        if (pPlot->isCity() && atWar(pPlot->getTeam(), getTeam())[B] && !isRivalTerritoryExplore()[/B])
        {
            return false;
        }
        if (plot() != NULL)
        {
            if (!plot()->isOwned())
            {
                if (pPlot->isOwned() && atWar(pPlot->getTeam(), getTeam())[B] && !isRivalTerritoryExplore()[/B])
                {
                    return false;
                }
            }
        }
 
Yep, that's it. The rest of that aspect will be from autoacquire promotions granting said effects after a certain amount of strength gains. ;)

Of course, I'm assuming that bRivalTerritory in unitinfos and bRivalTerritoryExplore in promotioninfos use the same function? If not I'd have to add another check... Don't want to have to rely on a promotion for all possibilities, some units may have the ability naturally.
 
I was wondering if it was possible to add a line like 'import MyFile' in CvSpellInterface.py to make it import MyFile.py where I would stock the spells I added... Would it work?
(I'm not asking if it would be useful, I'm just wondering if it's possible)
 
I was wondering if it was possible to add a line like 'import MyFile' in CvSpellInterface.py to make it import MyFile.py where I would stock the spells I added... Would it work?
(I'm not asking if it would be useful, I'm just wondering if it's possible)

Yes.

You'd have to refer to your spells as "MyFile.reqReallyAwsomeSpell" in the xml.

You could also use "from MyFile import *" , and not have to preface with MyFile . But DON'T DO THAT!!! It makes debugging and reading the source much harder for the benefit of saving seven characters. I'm only pointing it out so that you can avoid it.

A third option is writing "__import__('MyFile').reqReallyAwsomeSpell" in the xml. MyFile will need to be in the python folder*, but you don't have to modify CvSpellInterface.py.

A fourth option is to use my modular python mod.

*Or possibly any subfolder of the python folder. Certainly any existing subfolder.
 
Okay, thanks for the answer :)

I'm not sure it's worth it right now... Maybe when I'll have many 'subparts' (like, one for this civ, one for this one, one for that one), but right now it doesn't seem useful.
 
Back
Top Bottom