1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Promotions DLL

Discussion in 'Civ4 - Mod Components' started by TheLadiesOgre, Sep 2, 2009.

  1. Gooblah

    Gooblah Heh...

    Joined:
    Jun 5, 2007
    Messages:
    4,282
    if you're calling a 'get' function, you'll need something like this:

    Code:
    FAssert(getVictoryAdjacentTileHeal[B]()[/B] >= 0);
     
  2. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,429
    Location:
    DE/NL/FR
    Sad to hear both :(, wish you good luck.
     
  3. BobeBrown

    BobeBrown Warlord

    Joined:
    Oct 4, 2009
    Messages:
    255
    First - Thanks for this!

    Second - I really want to use this but i could do with a bit of guidance

    I want the promotions, ExtraDropRange and ExtraStrength. I done a search in all files of your source code and found those two ExtraDropRange and ExtraStrength to be in these files :

    CvInfos.cpp
    CvInfos.h
    CvUnit.cpp
    CvUnit.h
    CvGameTextMgr.cpp
    CvUnitAI.cpp
    CyInfoInterface1.cpp

    I then copied very carefully the code that only had ExtraDropRange and ExtraStrength to my source files. I done this on three different source codes and then compiled, Just to make sure i done it correctly.

    I then proceeded to make a xml modular promotion for Airborne which would add drop range and modular promotion for Extra Strength. I copied over the ExtraDropRange and ExtraStrength schema code from your unitschema into my own. ExtraDropRange module would not work at all. ExtraStrength module would add 2 strength but had a pink dot in the left side of the screen where the info is displayed.

    ... What am i doing wrong...How would you do it? Are those all the source files that are needed for those two promotion tags? Is there any python file i need for these two promotions?
     
  4. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    @BobeBrown

    Well, personally I've never done anything modularly so the first thing that I would recommend would be to add the <iExtraDropRange> and <iExtraStrength> to the Schema and PromotionInfos xml files for your mod. Aside from that, as long as you copy all of the entries for ExtraDropRange and ExtraStrength everything should be good (make sure to double check for missing parens as I seem to routinely forget to add them). As far as the pink dot is concerned, you did remember to add the button art right? There is no need to use python for the promotions that you want to add (it's only there for AIAutoPlay and to display CivicPrereqs for Promotions/Units in the Civilopedia).

    I'm glad that you're enjoying it, let me know if you need further assistance.
     
  5. topsecret

    topsecret Believer

    Joined:
    Feb 11, 2010
    Messages:
    5,658
    Gender:
    Male
    Location:
    At the Foot of the Cross
    Is this thread dead?
    Anyway, what bugs are known (in latest version)
     
  6. Deon

    Deon Lt. of Mordor

    Joined:
    Jan 13, 2008
    Messages:
    2,956
    Location:
    St.Petersburg, Russian Federation
    That looks awesome. Just today I thought "how to make desert to damage units?" and here's the answer! :D
     
  7. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    @Deon

    You should be made aware that AI units will linger on tiles that inflict damage. I remember trying to make it so that they would move along but it needs more work...
     
  8. CaptainMidnight

    CaptainMidnight Warlord

    Joined:
    Apr 16, 2006
    Messages:
    141
    Everything seems to be working great except I can't seem to get the promotion civics prereq to work. Anyone got this tag working?
     
  9. CaptainMidnight

    CaptainMidnight Warlord

    Joined:
    Apr 16, 2006
    Messages:
    141
    For anyone who's interested I solved the problem with the prereq tag. The promotions readpass3 is missing in CvXMLLoadUtilitySet.cpp:

    Code:
    LoadGlobalClassInfo(GC.getMPOptionInfo(), "CIV4MPOptionInfos", "GameInfo",   "Civ4MPOptionInfos/MPOptionInfos/MPOptionInfo", false);
    	LoadGlobalClassInfo(GC.getForceControlInfo(), "CIV4ForceControlInfos", "GameInfo", "Civ4ForceControlInfos/ForceControlInfos/ForceControlInfo", false);
    	
    	// Preqcivics CM Edit
    	for (int i=0; i < GC.getNumPromotionInfos(); ++i)
    	{
    		GC.getPromotionInfo((PromotionTypes)i).readPass3();
    	}
    	// Preqcivics CM Edit End
    
    	// add types to global var system
    	
    	for (int i = 0; i < GC.getNumCursorInfos(); ++i)
    The XML code in the example promotion is also incorrect. Should be:

    Code:
    <PrereqCivics>
          <PrereqCivic>CIVIC_BARTER</PrereqCivic>
        </PrereqCivics>
    Works a treat now!
     
  10. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    @CaptainMidnight

    Thanks for the fix, I've been meaning to get back to modding now that I've got a new computer, but it'll be like starting from scratch again for me

    Again, thanks :goodjob:
     
  11. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,599
    Gender:
    Male
    Location:
    MN
    Let us all know then when you get all this updated, ok, thx.
     
  12. Arian

    Arian No more ghostbusting!!

    Joined:
    May 10, 2008
    Messages:
    2,088
    Location:
    The Netherlands
    I tried to merge this modcomp but I get an error message in CvUnit.cpp, in this function:

    setHasPromotion(PromotionTypes eIndex, bool bNewValue)

    This code
    Code:
    /*****************************************************************************************************/
    /**  Author: Xienwolf (Imported by TheLadiesOgre)                                                   **/
    /**  Date: 1.10.2009                                                                                **/
    /**  ModComp: TLOTags                                                                               **/
    /**  Reason Added: Allow bAutoAcquire & bMustMaintain                                               **/
    /**  Notes: This is a direct import of code from FallFurther.                                       **/
    /*****************************************************************************************************/
    	for (iI = 0; iI < GC.getNumPromotionInfos(); iI++)
    	{
    	    if (isHasPromotion((PromotionTypes)iI) && GC.getPromotionInfo((PromotionTypes)iI).isMustMaintain() && !canAcquirePromotion((PromotionTypes)iI) && !m_pUnitInfo->getFreePromotions(iI))
            {
                setHasPromotion(((PromotionTypes)iI), false);
            }
    	    [COLOR="Red"]if (GC.getPromotionInfo((PromotionTypes)iI).isAutoAcquire() && canPromote((PromotionTypes)iI, -1))[/COLOR]
            {
                promote(((PromotionTypes)iI), -1);
            }
        }
    /*****************************************************************************************************/
    /**  TheLadiesOgre; 01.10.2009; TLOTags                                                             **/
    /*****************************************************************************************************/
    generates this error:
    error C2064: term does not evaluate to a function taking 2 arguments

    Any idea what's wrong??
     
  13. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    Try adding the blue parens
     
  14. Arian

    Arian No more ghostbusting!!

    Joined:
    May 10, 2008
    Messages:
    2,088
    Location:
    The Netherlands
    I suppose I screwed up the merging. Also this modcomp conflicts with Superspies. Both use 'canPromote'.
    Anyway it seems to work fine now, thanks for the nice modcomp :)
     
  15. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    If you're worried about conflicts, give me a few days, I was working on updating to the next version......
     
  16. CaptainMidnight

    CaptainMidnight Warlord

    Joined:
    Apr 16, 2006
    Messages:
    141
    That's great news! I have a request if you have time or the inclination. Could you incorporate the <bEffectProm> from Xienwolf Fall Further Mod? I use a lot of civic dependent promotions and it would tidy up the Civilopedia somewhat.

    I'll eventually get round to trying to do it myself but I'm tied up with other SDK concerns at the moment.
     
  17. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    Mind if I push it to the next update after this one?

    I'm trying to do something fairly comprehensive with this update, that's all I want to say on the topic....
     
  18. Arian

    Arian No more ghostbusting!!

    Joined:
    May 10, 2008
    Messages:
    2,088
    Location:
    The Netherlands
    In your update, can you include code that displays a message when a unit 'autoacquires' a promotion?
     
  19. CaptainMidnight

    CaptainMidnight Warlord

    Joined:
    Apr 16, 2006
    Messages:
    141
    @TLO No problem! Looking forward to the update.
     
  20. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    I thought that was already there.....

    That seems like a glaring omission on my part, it would make sense for it to notify you when one of your units AutoAcquires, IDK why I didn't originally include it

    @CM
    I'm hoping to get the update done in the next few days

    bEffectProm will be on top of the list for the next update
     

Share This Page