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

[MODCOMP] Route Restricter

Discussion in 'Civ4 - Mod Components' started by Shqype, Mar 15, 2008.

  1. Shqype

    Shqype Shqyptar

    Joined:
    Nov 15, 2005
    Messages:
    2,468
    Location:
    New York + Shqypni
    Route Restricter SDK Mod Component
    For BTS 3.13, made with Bhruic's unofficial patch 1.11

    This evolved from my first modcomponent, MechRoute, but has been expanded and improved for more versatile application.

    What it does: This mod allows you restrict a unit's movement exclusively to routes. Which routes it restricts is up to you: I have added a new <PassableRouteNeededs> tag which will allow you to set which routes a unit is restricted to.



    The Mechanized Infantry has been set to be able to move on both roads and railroads:
    Spoiler :
    Code:
    <PassableRouteNeededs>
    	<PassableRouteNeeded>
    		<RouteType>ROUTE_ROAD</RouteType>
    		<bPassableRouteNeeded>1</bPassableRouteNeeded>
    	</PassableRouteNeeded>
    	<PassableRouteNeeded>
    		<RouteType>ROUTE_RAILROAD</RouteType>
    		<bPassableRouteNeeded>1</bPassableRouteNeeded>
    	</PassableRouteNeeded>
    </PassableRouteNeededs>

    The above will allow a unit to move on any plot, as long as it contains a road or railroad. (This is essentially what MechRoute did, using the <bMechanized> tag). The difference is that you don't have to change <bMechanized> for any units that you don't want to restrict their movement to routes alone, since that tag might be used for combat formations. Plus, you can actually choose which route you want to restrict a unit's movement to: roads, railroads, or both.

    As an example, I have set the catapult to move only on roads:
    Spoiler :
    Code:
    <PassableRouteNeededs>
    	<PassableRouteNeeded>
    		<RouteType>ROUTE_ROAD</RouteType>
    		<bPassableRouteNeeded>1</bPassableRouteNeeded>
    	</PassableRouteNeeded>
    </PassableRouteNeededs>

    And the artillery can only move on railroads:
    Spoiler :
    Code:
    <PassableRouteNeededs>
    	<PassableRouteNeeded>
    		<RouteType>ROUTE_RAILROAD</RouteType>
    		<bPassableRouteNeeded>1</bPassableRouteNeeded>
    	</PassableRouteNeeded>
    </PassableRouteNeededs>

    To see what I changed in the source code, just search for "Shqype," as I have commented all my additions with either "Shqype Start" and "Shqype End" for multi-line additions, or "Shqype Add" for one-line additions. The new scheme is also included, and conveniently the new tag I added is not required for the XML to load properly, so you can only apply it to the units you want to restrict movement to.

    Thanks again to Kael and Seven05 for supporting me in creating this modcomp. Please let me know what you think of it, any bugs you might encounter, and if there's a reasonable way for me to further expand and improve this modcomp. :)
     
  2. Shqype

    Shqype Shqyptar

    Joined:
    Nov 15, 2005
    Messages:
    2,468
    Location:
    New York + Shqypni
  3. NikNaks

    NikNaks Chieftain

    Joined:
    Jul 25, 2006
    Messages:
    2,972
    Location:
    England
    Nice one, Shqype! This sounds a lot more useful :)
     
  4. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,271
    Location:
    israel
    P-E-R-F-E-C-T-!-!-!

    KEEP THIS SMALL MODCOPMS COMING MAN!!!

    i want to ask for you help, and suggest a mod comp,

    see my private msg.

    kel.
     
  5. Shiggs713

    Shiggs713 Immortal

    Joined:
    Mar 11, 2007
    Messages:
    2,361
    Location:
    Indianapolis
    very nice! :thumbsup:
     
  6. Grishnash

    Grishnash Mad Scientist

    Joined:
    Sep 20, 2005
    Messages:
    446
    Location:
    Varrock :P
    That's cool! But I was thinking, could you make it that a unit would need a route to pass some terrain. Like, mounted units need a road/RR to pass forests. Or ground units need roads/RR to go over peaks?
    That would be cool. But anyways, good modcomp. :goodjob:
     
  7. Zuul

    Zuul Mod lister!

    Joined:
    Nov 13, 2005
    Messages:
    1,117
    Location:
    Sweden
    Cool update :). Good :thumbsup:
     
  8. hrochland

    hrochland Prince

    Joined:
    Apr 9, 2006
    Messages:
    2,114
    Location:
    Czech Kingdom
    really verry good idea is this... :goodjob:
     
  9. Shqype

    Shqype Shqyptar

    Joined:
    Nov 15, 2005
    Messages:
    2,468
    Location:
    New York + Shqypni
    Thanks for the support guys! :)

    Grishnash, I'll look further into it. But first I'll wait for Firaxis to release their patch, and see what they add/change.
     
  10. Gaius Octavius

    Gaius Octavius Chieftain

    Joined:
    Jul 28, 2006
    Messages:
    4,016
    Is this just basically a port of Zebra 9's zRoutes mod, or did you add new things also? Either way I'm sure it will get a lot of use. :thumbsup:
     
  11. Shqype

    Shqype Shqyptar

    Joined:
    Nov 15, 2005
    Messages:
    2,468
    Location:
    New York + Shqypni
    I didn't port Zebra 9's mod, I made this from scratch.

    I haven't used his mod, but from what I understand it allows you to set route restrictions by an .ini file. Alas, it uses python, so this is much faster and configurable by XML. :)

    And I may expand it further ;)
     
  12. Kissa

    Kissa Chieftain

    Joined:
    Aug 16, 2004
    Messages:
    156
    Location:
    Paris
    With this Mod comp., you could make a "train" Unit.
    This is the Unit that really match with this Mod comp.
     
  13. LoneTraveller

    LoneTraveller Chieftain

    Joined:
    Apr 30, 2008
    Messages:
    283
    Location:
    Montreal, Quebec
    This might sound stupid but...do I have to compile the .cpp files ?
     
  14. smeagolheart

    smeagolheart Monarch

    Joined:
    Sep 4, 2007
    Messages:
    924
    Location:
    Phoenix, AZ
    yes, have to recompile the sdk. Comes from the .cpp files, you should have a complete set in your beyond the sword directory in civgamecoredll folder. The cpp files are probably changes made you'd have to incorporate
     
  15. Nuvoloblu

    Nuvoloblu Adequator

    Joined:
    Oct 22, 2009
    Messages:
    69
    Location:
    France
    They are very intellingent thinghs ! Do you develop ? Were may I found that for my v3.17 ?
    Thanks !!!
     
  16. Ninja2

    Ninja2 Great Engineer

    Joined:
    Nov 17, 2005
    Messages:
    1,142
    Location:
    Denmarkia
    This component works with 3.13, 3.17 and 3.19.
     
  17. WilliamOfOrange

    WilliamOfOrange Chieftain

    Joined:
    Jul 17, 2003
    Messages:
    998
    Location:
    Lincolnshire, UK
    EDIT: Is it possible to limit units to routes based on promotions a unit has as not the unit itself? If so, that would make it possible to have units behave as if there were tunneling under ground.

    Great work. Thanks.
     

Share This Page