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

[SDK] Blocade units

Discussion in 'Civ4 - Mod Components' started by Andera412, Apr 20, 2017.

  1. Andera412

    Andera412 Chieftain

    Joined:
    Sep 30, 2014
    Messages:
    55
    Location:
    Ukraine
    Hello world! Its my first public work, so don't judge me so strickt.
    I isolated code from Evolution of war mod component. So, unit creates barriers for enemy units movement.

    Author: NeseryozniyVET
    Version: BTS 3.19
    Multiplayer: yes, checked.
    Source: yes + comments
    Download: https://forums.civfanatics.com/resources/blocade-units.26125/

    Units can't move in 45* direction to the enemy unit. It is necessary to attack (0*), to go sideway (90*), or to retreat (135* and 180*). The exceptions are if the enemies are invisible, if there is a combat-capable unit or a friendly city on the tile, or if the block passes through the river and blocking units do not have the ability to attack without penalties across the river. The switching of this mode greatly changes the strategy of the game, as now you can easily block the passage of the enemy army (the stack is surrounded only 3 stacks), and the FORTS become much more useful. The mod is not useful for animals.

    You can change mod options using GlobalDefinesAlt.xml file:
    If the Define value is 0 VET Blocade units component becomes disabled
    If the Define value is 1 units can move in 45 degrees direction to the enemy if the movement is not along the diagonal
    If the Define value is 2 units can't move in 45 degrees direction to the enemy

    V2: [ADDED] You can configure modcomp using Custom game option "Blocade units".
    V3: [ADDED] Units with "Breakthrough" promotion can't be blocaded or surrounded by enemy units.
     
    Last edited: Apr 26, 2017
  2. Andera412

    Andera412 Chieftain

    Joined:
    Sep 30, 2014
    Messages:
    55
    Location:
    Ukraine
  3. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,331
    Location:
    israel
    excellent!
    i hope the ai can use it.

    i would love to see more extractions by you.
     
  4. Andera412

    Andera412 Chieftain

    Joined:
    Sep 30, 2014
    Messages:
    55
    Location:
    Ukraine
    Thank you.
    I remember the bug from Civ2, when AI thought, there was no passage to other landmass and moved the whole army using transport, by 2 units.
    In my opinion, AI doesn't become weaker because of this modcomp. But BTS AI, even Better BTS AI don't want to defend non-city tile or fort. Superforts modcomp fixes it. However, AI doesn't use advantages of blocade now.
     
  5. Andera412

    Andera412 Chieftain

    Joined:
    Sep 30, 2014
    Messages:
    55
    Location:
    Ukraine
    I want to teach AI to do so:

    Or so:
    Blocadeunit modcomp 2.JPG
     
  6. Andera412

    Andera412 Chieftain

    Joined:
    Sep 30, 2014
    Messages:
    55
    Location:
    Ukraine
    UPDATE v3
    New promotion "Breakthrough" with icon added. Units with this promotion can't be blocaded or surrounded by enemy units. But they can perform blocade. "Breakthrough" is only available to units with LEADER promotion, because this unit can retrieve from blocade all other units in the stack. Units can receive "Breakthrough" promotion only if custom gameoption "unit blocade" enabled. AI can use it.
    Screenshots: View attachment 470065 View attachment 470066 View attachment 470067
     
  7. Andera412

    Andera412 Chieftain

    Joined:
    Sep 30, 2014
    Messages:
    55
    Location:
    Ukraine
    UPDATE v3
    New promotion "Breakthrough" with icon added. Units with this promotion can't be blocaded or surrounded by enemy units. But they can perform blocade. "Breakthrough" is only available to units with LEADER promotion, because this unit can retrieve from blocade all other units in the stack. Units can receive "Breakthrough" promotion only if custom gameoption "unit blocade" enabled. AI can use it.
    Screenshots: unitblocadepromotion1.JPG unitblocadepromotion2.JPG unitblocadepromotion3.JPG
    I have in plans merging this modcomp with Commanders v0.1 mod to allow all the units in the range of great general, promoted with "Breakthrough", pass blocades.
    I am also adding bUnblocade tag not only to Civ4Promotioninfos.xml, but to Civ4Unitinfos.xml to allow helicopters pass blocades even without promotion.
     
    Last edited: Apr 26, 2017
  8. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,331
    Location:
    israel
  9. CHINCHIN

    CHINCHIN Chieftain

    Joined:
    Jul 8, 2004
    Messages:
    55
    Location:
    Spain
    Hello,

    Congratulations on your mod, it's very interesting. I have integrated it into my mod and it works perfectly.
     
  10. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,331
    Location:
    israel
    Hi andrea412,
    i merged the sdk code, but it does not work (with kmod),
    can you try to help please?
     
  11. Andera412

    Andera412 Chieftain

    Joined:
    Sep 30, 2014
    Messages:
    55
    Location:
    Ukraine
    Certainly, i can. Can you describe a problem? Is it a compilation error or crash?
    KMOD has it's own KmodPathFinder system. That function can conflict with Blockade code.
    Can you attach a merge code? It is actual for me. I want to merge them to my mod as a far perspective. Writing AI for this modcomp in ChinChin's COMBAT REVOLUTION at the moment.

    P.S. Does somebody know how to download files from borncash.org ? I am trying to download this mod for CIV4: http://www.internetwars.ru/CivMODS/StrategicRivers/StrategicRivers.htm (button on the left)
    or http://borncash.org/load/1377000196 .
    I seem, that service is forbidden in my country... :-(
     
    Last edited: Apr 18, 2018
  12. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,331
    Location:
    israel
    hi Andrea,

    tthank you very very much,
    i will upload my merged code.
    the problem is that the code isnt working despite the ,merge which went without any errors.


    p.s
    i have strategic rivers , ill upload that also for you.
     
  13. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,331
    Location:
    israel
    Hi again,

    i save a lot of the mods created along the years on my cpu, so -
    here is the strategic rivers mod :
    http://www.mediafire.com/file/oz9jh6mqncq1gsd/StrategicRivers.zip

    here is mu Doto mod, the source files are in there. (i merged in many stuff to kmod, maybe you can use some):
    http://www.mediafire.com/file/9wolfh93rzt4ab0/DoTo-231.v4.rar

    the best way to see all the stuff i added is to compare to kmod source files 145, then, only my added mods will appear in a convenient comparison way.


    Also, i highly recommend you guys add kmod to the mod combat revolution, kmod is the best.


    i hope you can readjust it to kmods, i really wanna have blockade in my mod (and afterwards, the mod combat).
     
  14. Andera412

    Andera412 Chieftain

    Joined:
    Sep 30, 2014
    Messages:
    55
    Location:
    Ukraine
    Remerged C++ code K-MOD + Blockade. It works, no conflicts. Added source.
    Don't forget to merge xml:

    <Define><!-- Unit creates barriers for enemy units movement.
    If the Define value is 0 VET Blocade units component becomes disabled
    If the Define value is 1 units can move in 45 degrees direction to the enemy if the movement is not along the diagonal
    If the Define value is 2 units can't move in 45 degrees direction to the enemy -->
    <DefineName>BLOCADE_UNIT</DefineName>
    <iDefineIntVal>2</iDefineIntVal>
    </Define>

    in GlobalDefinesAlt.xml and

    <GameOptionInfo>
    <Type>GAMEOPTION_BLOCADE_UNIT</Type>
    <Description>TXT_KEY_GAME_OPTION_BLOCADE_UNIT</Description>
    <Help>TXT_KEY_GAME_OPTION_BLOCADE_UNIT_HELP</Help>
    <bDefault>1</bDefault>
    <bVisible>1</bVisible>
    </GameOptionInfo>
    in GameOptionInfos.xml

    Thank you for Strategic rivers!!! I begun to rebuild it )) .
     

    Attached Files:

  15. Andera412

    Andera412 Chieftain

    Joined:
    Sep 30, 2014
    Messages:
    55
    Location:
    Ukraine
     

    Attached Files:

  16. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,331
    Location:
    israel
    superb !!!
    i thank you so much!

    im happy you take on the rivers - i wanted this mod - it will be cool when you get it in yours!

    i hope in the future, ill merge more of your work along with combat rev.
     

Share This Page