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. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    TLOTags v0.40 (formerly Promotions DLL v0.2)
    By: TheLadiesOgre

    Patch Compatibility: v3.19
    MP Compatible: ? (though I see no reason why not if all parties involved are using it)

    Description:
    This is a little project I've decided to do to gain more experience and familiarity with the SDK.
    Currently all this does is add some tags (for Promotions, Terrain and Units) to the game. In essence, what I hope to
    achieve with this is to allow anyone who can edit XML to be able to add most (if not all) of the phenomenal python
    functionality made available by our community members without the fear of Whitespace.

    Note: I have realized that Fall Further (and possibly FFH2 as well) uses the Heroic Strength Promotion, and so I apologize
    for having missed that despite the fact that The_J told me it was not his concept (It has also come to my attention that
    DPII's Conqueror's Delight also had an "Extra Strength" tag). I have also realized that several of the other tags here were
    previously included in one form or another in Fall Further, I'm sorry for not having noted this earlier.

    Installation Instructions:
    1) Extract the "TLOTags Folder" into you "C\User... \BeyondtheSword\Mods" folder.
    2) Start a fresh game
    3) Load the mod and enjoy.

    -----Notes for Modders-----
    I have included the changed source files and ensured that they are unmistakably commented.
    Search for "TheLadiesOgre" in the sources and "TLOTags" in the XML.
    I've added new tags in the PromotionInfos.xml, files, they are detailed in the NewTags.txt (if you are
    familiar with how XML and UnitSchemas work you can probably skip this file).
    In the included Schema.xml files I have set my added tags to minOccurs="0".
    **Note of Importance**
    In the UnitSchema.xml file I have set nearly all of the tags for PromotionInfos.xml and UnitInfos.xml
    to minOccurs="0". I have also "trimmed" the PromotionInfos.xml and UnitInfos.xml files. For those of you who are unaware
    of how a "trimmed" XML file works I have included Xienwolf's walkthrough on editing trimmed XML files from "Mod-Modders
    Guide to Fall Further" (it can be found in NewTags.txt)

    -----Version History-----
    --v0.40-- (Updated: 22.10.2009)
    >Added Celebrity (new art for this as well as for Heroic Strength and others are a WIP)
    >Added Demoralizer, Industry Espionage, Marauder, Roaming Bandit, Sneak and Thug (all with new custom button art by TLO)
    >Added More New Tags (see NewTags.txt for details)
    >Built on BBAI v0.81
    >Removed Respawn II (as it was obsoleted by <bStackEffect>)

    Spoiler Version History Continued :
    --v0.31-- (Updated: 30.09.2009)
    >Added MarineParatrooper (by GarretSidzaka)
    >Added New Custom Button Art for Advanced Airborne Combat Training, Airborne Combat Training, Airborne Combat Veteran, Field Surgeon, Field Hospital, Survivor I and Survivor II (by TheLadiesOgre)
    >Added Some Colonization Promotions for use with new tags (Bomb I/II/III became Exploding Shot I/II/III <---potential to be ridiculous, in testing I wiped a stack of 31 enemy units with 2 mobile arty in one turn)
    >Fixed Field Heal/Surgeon/Hospital Notification Bugginess (Thank you EF)
    >Fixed Respawn/Survivor Bugginess (Thank you Xienwolf, Opera and EF)

    --v0.3-- (Updated: 23.09.2009)
    >Added AI_Autoplay v2.0 and Unofficial Patch v1.20
    >Added Several New Tags (see NewTags.txt for details)
    >Added The_J's Respawn Promotion
    >Added Tsentom1's Survival Promotion
    >Added New Promotions from Gedemons version of the Air Forces Mod for 3.13 (for use with some of the new tags)
    >Split Skirmisher into two Promotions (Skirmisher and Strategic Withdrawl)
    >Tweaked AI concerning Paradrops

    --v0.2-- (Updated: 07.09.2009)
    >Added Tsentom1's Field Medic Promotion (though it is slightly altered with additional button art by Mechaerik)
    >Added Tsentom1's Skirmisher Promotion (though nerfed somewhat, no more Blitz/Skirmisher stack-wiping)
    >Altered availability of Heroic Strength I (now available with Combat II)
    >Spread out Heroic Strength into three promotions (with altered buttons courtesy of Mechaerik)

    --v0.1-- (Released: 02.09.2009)
    >Added Heroic Strength Promotion to Vanilla BTS DLL


    Spoiler Future Version Projections :
    -----Future Version Projections-----
    --v0.5--
    >Looking to focus on all things air and espionage-based
    >Will be adding faichale's take on TSheep's SuperSpies (including JDogs AI rework as well as potentially a few other tweaks, I have some ideas...)
    >Will be adding Native Promotions
    >Will be adding AirLethality from MongooseSDK3.3
    >Will be adding various promotions that haven't made it in yet (not necessarily new tags, just new promotions using the new tags)

    --v0.6--
    >Looking to focus on all things religious
    >Will be adding religious combat promotions
    >Will be adding The_J's Warriors of God
    >Will be adding Tsentom1's Malleus Maleficarum


    -----Credits and Thanks-----

    *Castor_Troy: for the French Translation

    *Cybah: for the German Translation

    *DPII: I wouldn't have known to use the switch statement without seeing it in Conqueror's Delight

    *EmperorFool: for assistance with questions

    *JDog5000, Yakk and glider1: for BBAI

    *Kael: for the PrereqCivic for Units

    *Mechaerik: for the Button Art

    *Moctezuma: for IDW

    *The_J: for the awesome "Simple" Python things

    *TheLopez: for the Readme.txt format

    *Tsentom1: for his Python Promotions

    *Xienwolf: for "An Idiot's Guide to Editing the DLL" and the FF Sources and all of the help

    ...If I've forgotten to credit you let me know and I'll rectify the situation

    Download Here

    Spoiler NewTags.txt :
    CVPromotionInfo
    <bAutoAcquire>: If a unit possesses all of the prereqs for a promotion tagged with this, the unit will automatically recieve this promotion (however, they will not recieve the promotion until they have enough experience unless the promotion is also tagged <bNoXP> (i.e. the choice is forced unless also tagged <bNoXP>))

    <bDefensiveVictoryMove>: If this is set to 1, whenever the unit wins while defending, they will gain one point of movement.*

    <bFreeDrop>: If this is set to 1, paradropping does not act as an attack or cost any movement and the unit can drop onto FoW tiles. (In addition to being available with a promotion, I have also given this to Paratroopers by default)

    <bIsMechOnly>: If this is set to 1, this promotion will only be offered to units which are <bMechanized>.

    <bIsNoMechs>: If this is set to 1, this promotion will not be offered to units which are <bMechanized>.

    <bMustMaintain>: If for any reason the prereqs for this promotion are no longer met, the unit will lose it.

    <bNoXP>: This promotion is free (so long as the prereqs are met).

    <bOffensiveVictoryMove>: If this is set to 1, whenever the unit wins while attacking, they will gain one point of movement.*

    <bOneUp>: If this is set to 1, a unit that is given this promotion will get an "extra life".

    <bPillageCulture>: If this is set to 1, the unit will pillage culture (ala IDW) whenever they pillage a tile.

    <bPillageEspionage>: If this is set to 1, the unit will recieve espionage points (vs. the owner of the tile) whenever they pillage a tile.

    <bPillageMarauder>: If this is set to 1, the unit will pillage twice (if possible) whenever they pillage a tile.

    <bPillageOnMove>: If this is set to 1, the unit will pillage (free of charge concerning attack/movement) whenever they move to a new tile that is applicable.

    <bPillageOnVictory>: If this is set to 1, the unit will recieve the profits of pillaging (though with no tile improvement loss) on a combat victory.

    <bPillageResearch>: If this is set to 1, the unit will pillage research (toward their current research tech) whenever they pillage a tile.

    <bStackEffect>: This promotion may be purchased as many times as the player sees fit.

    <iAirCombatLimitChange>: Whatever number is entered here will be applied to the units Air Combat Limit.

    <iCollateralDamageLimitChange>: Whatever number is entered here will be applied to the units Collateral Damage Limit.

    <iCollateralDamageMaxUnitsChange>: Whatever number is entered here will be applied to the units Collateral Damage Max Units Limit.

    <iCombatLimitChange>: Whatever number is entered here will be applied to the units Combat Limit (thus making it possible to kill with collateral damage if the % goes over 100%).

    <iExtraDropRange>: Whatever number is entered here will be applied to the units drop range (thus giving units previously unable to paradrop the ability to do so; Note: Animations still needed).

    <iExtraStrength>: Whatever number is entered here will be applied to the units base strength.

    <iSurvivorChance>: Whatever number is entered here will be the chance that the unit has to survive a combat loss.

    <iVictoryAdjacentHeal>: Whatever number is entered here will be the chance that the unit has to give one turn's worth of healing to all friendly units on an adjacent tile on a combat victory (offensive or defensive).

    <iVictoryHeal>: Whatever number is entered here will be the chance that the unit has to heal (one turn's worth) on a combat victory.

    <iVictoryStackHeal>: Whatever number is entered here will be the chance that the unit has to give one turn's worth of healing to all units on the same tile on a combat victory (offensive or defensive).

    <PrereqCivic>: One of these civics is required to take this promotion (multiple entries may be made).

    * I have not seen either of these give more than one point of movement per turn.

    CvTerrainInfo

    <bRequiresFlatlands>: Cloned from improvements, if this is set to 1 the terrain type will only be found on flatlands.

    <iHealthPercent>: cloned from features, the number entered here will modify a city's healthiness (similar to jungles only now it is the actual terrain instead of the feature on the terrain).

    <iTurnDamage>: cloned from features, the number entered here will be the damage that a unit takes per turn on this terrain (similar to fallout only as above)

    **All new fields added to CvTerrainInfos currently default to 0**

    CvUnitInfo
    <bFreeDrop>: As noted above, this is also a unit tag which I have set to 1 for paratroopers by default.

    <PrereqCivic>: This civic is required to train this unit.


    How to edit a Trimmed XML File by Xienwolf

    1: Use Notepad++
    2: Right click on the TAB for the file you have opened
    3: Select "Clone to Another View"
    4: Welcome to split-screen view! You now see 2 copies of the same file, who cares?!
    4.5: Make sure that you are split vertically (side-by-side) instead of Horizontally (I get the top!)
    5: In one copy, focus on what you want to change/add
    6: In the other copy, scroll down to "Test Promo" (actually, just search. As long as you include a space before/after any word, it searches very nicely to the commented name instead of the 5,000 other lines of code that use that word somehow...)
    7: Now that you have the test promotion (all fields) right next to your change/addition, you can see the precise order required for all fields, and only use the ones which matter in some way!

    8 (occasional): If your field requires sub-elements, and nothing else actually USES those subelements, open up the Schema file and pray that you understand how to read them (just encase the <> value you need subelements for in "" marks and you should get a result which lists what comes inside of it. You may have to also search for each of those for the REALLY nested entries...)


    Yes, the trimmed XML can make adding things to the file a PITA, but it makes figuring out what the file actually DOES a lot quicker/easier in the end since you don't have to scroll through 500 cases of >0< or >NONE< and pray you don't overlook the >1< which is causing you issues...
     

    Attached Files:

  2. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    30,806
    Location:
    Germany / Netherlands
    Like already said:




    Good luck with learning and compiling :D.
     
  3. xienwolf

    xienwolf Chieftain

    Joined:
    Oct 4, 2007
    Messages:
    10,589
    Location:
    Location! Location!
    Fantastic work here :) Cloning from UnitInfos to PromotionInfos is how I got my start in modding.

    Should you desire to do so, I have added a TON of functionality to Promotions in Fall Further which I am sure people in "normal" BtS would enjoy. I would discourage copying directly as it would be mildly counter-productive to your goal of being familiar with the DLL, but it may prove to be a handy reference so that you can choose a tag, code it for yourself, then compare how we did it differently (You know you are comfortable when you start noticing that I "did it wrong" in my version after you manage to code it up for yourself and see how I did it differently)
     
  4. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    Thank you for the praise, but I didn't clone anything yet (except how the AI values the promotion in CvUnitAI), I added my own new integer! I danced a jig last night I was so happy. Thank you for the pointer towards FF's promotions, I may just have to DL that and take a look.

    @The_J
    Again, thank you sir
     
  5. mechaerik

    mechaerik Tuturuu!

    Joined:
    Oct 28, 2008
    Messages:
    7,064
    Location:
    Los Angeles
    I finished the buttons.

    Has 5 buttons (the original, and ones with stars, up to 4).
     

    Attached Files:

  6. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    Thank you sir
     
  7. Cybah

    Cybah Chieftain

    Joined:
    Jun 22, 2007
    Messages:
    1,480
    Does your strength promotion only work with +1 strength? because the text

    Code:
      	<TEXT>
        		<Tag>TXT_KEY_PROMOTION_EXTRA_STRENGTH_TEXT</Tag>
        		<English>+1[ICON_STRENGTH]</English>
        		<French>+1[ICON_STRENGTH]</French>
        		<German>+1[ICON_STRENGTH]</German>
      	</TEXT>
    
    does not include a variable.
     
  8. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505

    I was unaware of the appropriate variable when the XML file was written up. Rest assured, it works with whatever number you enter be it 1 or 10,000 and the variable will be entered in the next version as well as Heroic Strength II and III (or at least my take on those potential promotions).

    Spoiler :
    yay 200! I know, I know, that is nothing compared to some other post counts still-- yay!
     
  9. Castor_Troy

    Castor_Troy Chieftain

    Joined:
    Jun 4, 2007
    Messages:
    145
    Location:
    Romania
    Wow this is great, the fact that they will be very extremely user friendly all those promotions and traits etc, really great work looking forward to your work and I will also use the .DLL for my mod, but 1 question :
    Is it possible due to the fact that you provided the source code that i rebuild it to allow more than 18 civs since i need around 22-23 for the biggest scenario? :)
     
  10. Cybah

    Cybah Chieftain

    Joined:
    Jun 22, 2007
    Messages:
    1,480
    the source files can be found in the download file.
     
  11. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    $E%#! I knew I was forgetting something, feel free to recompile, that is why I included the sources, no need to ask, just please remember to give credit. That is now another thing on my list for the next version (50 civ DLL, because yet another thing I'd like to do is merge this with RevDCM once the next version comes out)
     
  12. Castor_Troy

    Castor_Troy Chieftain

    Joined:
    Jun 4, 2007
    Messages:
    145
    Location:
    Romania
    Yes i know if u read the last part you`ll see i said "you provided" so it was a question in the type if its ok with the ideea :D .
    And dont worry i`ll credit you once i`ll release it.

    EDIT: Also i would like to know if you will put tags for all the changes that you will make even the small traits or promotions in your future release since u said you`re gonna include revDCM and i dont quind of want to include it since it wont be of much help to my mod .
     
  13. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    Don't worry, when I cross that bridge, it will be two seperate downloads, one with and one without
     
  14. mechaerik

    mechaerik Tuturuu!

    Joined:
    Oct 28, 2008
    Messages:
    7,064
    Location:
    Los Angeles
    here's the buttons you asked for.
     

    Attached Files:

  15. TheLadiesOgre

    TheLadiesOgre Aspiring Codesmith

    Joined:
    Jan 16, 2009
    Messages:
    505
    Thank you sir, the original post (and download) will both be updated within the hour.

    Edit: both updated
     
  16. Castor_Troy

    Castor_Troy Chieftain

    Joined:
    Jun 4, 2007
    Messages:
    145
    Location:
    Romania
    Great a new realease that includes more of the stuff i needed, superb work.
    But can u detail what exactly has happened with the skirmish promotion ? (since u mentioned that blitz/skirmish nerf)
     
  17. Cybah

    Cybah Chieftain

    Joined:
    Jun 22, 2007
    Messages:
    1,480
    Can I add more heroic strength promos? Or would I need to modify the SDK then for a correct text?

    edit: thanks for the variable :)
     
  18. Cybah

    Cybah Chieftain

    Joined:
    Jun 22, 2007
    Messages:
    1,480
    with blitz, skirmish and enough strength you could attack ~100 times with one unit. :D because blitz only says: you can attack again with enough movement left, blitz is NOT: you can attack twice.
     
  19. Cybah

    Cybah Chieftain

    Joined:
    Jun 22, 2007
    Messages:
    1,480
    your source files seem to be incomplete. getting this error on compiling:

    error C2660: 'CvUnit::doHeal' : function does not take 0 arguments

    edit: maybe a problem when using mongoose's weaker march effect

    edit2: yes, won't work with mongoose's march changes.
     
  20. Cybah

    Cybah Chieftain

    Joined:
    Jun 22, 2007
    Messages:
    1,480
    cannot compile a debug dll:

    1>CvUnit.cpp(10664) : error C2296: '>=' : illegal, left operand has type 'int (__thiscall CvUnit::* )(void) const'
    1>CvUnit.cpp(10664) : error C2297: '>=' : illegal, right operand has type 'int (__thiscall CvUnit::* )(void) const'
    1>NMAKE : fatal error U1077: '"C:\Programme\Microsoft Visual C++ Toolkit 2003/bin/cl.exe"' : return code '0x2'


    Code:
    void CvUnit::changeVictoryAdjacentTileHeal(int iChange)
    {
    	m_iVictoryAdjacentTileHeal += iChange;
    	FAssert(getVictoryAdjacentTileHeal >= 0);
    }
    
     

Share This Page