[BTS] Canals Mod Component 1.0

Adds a new <bCanal> tag to TerrainInfos.XML

  1. topsecret

    topsecret Believer Supporter

    Joined:
    Feb 11, 2010
    Messages:
    5,763
    Gender:
    Male
    Location:
    At the Foot of the Cross
    This SDK Mod Component adds a new <bCanal> tag to the TerrainInfos file, allowing you to create land terrains that allow ships to pass through (but not stop).

    Spoiler Images :






    You must set <bCanal> to 1 and leave <bWater> at 0. This will allow land units to step on the space and water units to pass through the space.
    Effects of <bCanal> tag:
    1. Ships may pass through, but not stop on, the space.
    2. Ships may not enter the space if an enemy unit is on the space.
    3. Only roads may be built on the space; all other improvements are blocked in the DLL. (Please notify me if you want a modified version with that feature removed.)
    4. If a ship attacks across the space and withdraws into the <bCanal> space, it will be moved on the next turn.

    Changed files included.
     
    Last edited: Jul 4, 2018
  2. topsecret

    topsecret Believer Supporter

    Joined:
    Feb 11, 2010
    Messages:
    5,763
    Gender:
    Male
    Location:
    At the Foot of the Cross
  3. dghstfh

    dghstfh Chieftain

    Joined:
    Jun 23, 2018
    Messages:
    3
    Gender:
    Male
    how do I install this?
     
  4. topsecret

    topsecret Believer Supporter

    Joined:
    Feb 11, 2010
    Messages:
    5,763
    Gender:
    Male
    Location:
    At the Foot of the Cross
    Download it, unZIP it, and put the "Canals" in your Mods folder under Beyond the Sword/Mods.

    If you need more help, let me know.
    The terrain is not added automatically. It has to be added in WB.
     
  5. Leoreth

    Leoreth Vampire of the Blue Moon Moderator

    Joined:
    Aug 23, 2009
    Messages:
    35,787
    Gender:
    Male
    Location:
    Paris
    Oh, this is really cool. I've been thinking about the opposite of this (a strait terrain that land units can traverse but not stop on), so I'm curious about your implementation.
     
  6. topsecret

    topsecret Believer Supporter

    Joined:
    Feb 11, 2010
    Messages:
    5,763
    Gender:
    Male
    Location:
    At the Foot of the Cross
    Well, I am really new to DLL modding, but basically in CvUnit.cpp, under CvUnit::canMoveInto, I changed the check for water tiles. Instead of check for water tiles first, it checks to see if the tile is a <bCanal> space and if it does not have enemy units on it.

    However, it apparently takes all the ships movement except one to cross a canal. I am not sure exactly what is causing it because this isn't coded extremely elegantly. It's my first real SDK mod, so it works for now until I learn how to get it to do what I want. :)

    All the source code is in there if you want to take a look. Just search for "Canal"
     
  7. Leoreth

    Leoreth Vampire of the Blue Moon Moderator

    Joined:
    Aug 23, 2009
    Messages:
    35,787
    Gender:
    Male
    Location:
    Paris
    Alright, I was always wondering how easy it would be to make a unit be able to pass through a tile but not allow it to finish the turn there.
     
  8. topsecret

    topsecret Believer Supporter

    Joined:
    Feb 11, 2010
    Messages:
    5,763
    Gender:
    Male
    Location:
    At the Foot of the Cross
    I think it would be possible, but I don't think it would work with units that only move one. :dunno:

    Mine is sort of a "hack". It skips the check for invalid plots and tells the unit to move through anyway. The reason I made it land is because all ships move at least two in my mod.
     
  9. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    7,084
    Location:
    israel
    very innovative!
     
    topsecret likes this.
  10. P&nny

    P&nny Warlord

    Joined:
    Sep 1, 2007
    Messages:
    163
    This is a fantastic idea, I think it opens a lot of possibilities.

    I merged this in my MOD last night and it was pretty straightforward, I started adapting mapscripts to you use it as well.
    Ultimately I would like to adapt Wheel to have (an option) for spoke as Marsh (I took the graphics of the Colonization terrain). I'll post here if interested.

    One thing I notice though : when the spokes are more than 1 tile, it doesn't behave like I thought it would.
    Actually crossing the canal consume all movement point and leaves you only with 1 movement to go; I don't see anything in your code relating to this.
    This I think we could change too because it makes it impossible to cross a 2 tiles wide band of CanalLand/Ford/Marsh. The pathfinder doesn't get it and let you arrive on the second canal tile. Then beginning of the turn ejects you on a nearby tile.

    Any idea how to amend this?

    Thanks again!
     
  11. topsecret

    topsecret Believer Supporter

    Joined:
    Feb 11, 2010
    Messages:
    5,763
    Gender:
    Male
    Location:
    At the Foot of the Cross
    I don't know how to fix it yet because this is my first real component. I made a minor change in movement. I would have to look at code but I need to graduate in May before I have time. :lol:
     
  12. hrochland

    hrochland Prince

    Joined:
    Apr 9, 2006
    Messages:
    2,357
    Location:
    Czech Kingdom
    This look very very good
     
    topsecret likes this.

Share This Page