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

How to add and change TSL for a YnAMP map

Discussion in 'Yet (not) Another Maps Pack' started by Gedemon, Aug 12, 2017.

  1. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    7,920
    Location:
    France
    Note: for the examples in this thread I use the Giant Earth, the other names can be found in the corresponding map's threads or in the Map.xml file in the map's folder.


    If you are a modder:


    You'll need to set this in a SQL file loaded before the file setting the TSL (this is to make sure that your XML/SQL file won't fail to load if YnAMP is not loaded)
    Code:
    CREATE TABLE IF NOT EXISTS StartPosition
        (    MapName TEXT NOT NULL,
            Civilization TEXT,
            Leader TEXT,
            DisabledByCivilization TEXT,
            DisabledByLeader TEXT,
            AlternateStart INT default 0,    
            X INT default 0,
            Y INT default 0);
    Then see the XML example below to add the code in one of you file loaded after the one creating the table.


    If you are not a modder:

    See How to create custom.xml and custom.sql to make simple changes and add the code for the TSL of the civilization you want to add in the custom.xml file, like for example:
    Code:
    <GameInfo>
       <StartPosition>
          <Replace MapName="GiantEarth" Civilization="CIVILIZATION_CANADA" X="50" Y="50" />
          <Replace MapName="GiantEarth" Civilization="CIVILIZATION_MONGOLIA" X="50" Y="50" />
        </StartPosition>
    </GameInfo>
    
    of course you have to change X="50" Y="50" to the coordinate of the starting position you want to use (see How to find the X, Y values of a plot in game), and you must check what name was given to each civilization by the mods author, the CIVILIZATION_CANADA and CIVILIZATION_MONGOLIA I put here are just guess.



    Advanced rules for TSL:

    There is 2 options available in the advanced setup screen when selecting "True Start Location" for Civilization placement:
    - Use Leaders TSL when available
    - Use Alternate TSL if required and available

    And here is an exemple of use in the Map.xml with Egypt and Arabia on the Greatest Earth Map:
    Code:
            <Replace MapName="GreatestEarthMap" Civilization="CIVILIZATION_ARABIA"        X="64" Y="33" />
            <Replace MapName="GreatestEarthMap" Civilization="CIVILIZATION_ARABIA"        X="58" Y="35" Leader="LEADER_SALADIN" DisabledByCivilization="CIVILIZATION_EGYPT" />
            <Replace MapName="GreatestEarthMap" Civilization="CIVILIZATION_ARABIA"        X="64" Y="33" Leader="LEADER_SALADIN" AlternateStart="1" />
    
            <Replace MapName="GreatestEarthMap" Civilization="CIVILIZATION_EGYPT"        X="58" Y="35" DisabledByLeader="LEADER_SALADIN" />
            <Replace MapName="GreatestEarthMap" Civilization="CIVILIZATION_EGYPT"        X="60" Y="30" AlternateStart="1" />
            <Replace MapName="GreatestEarthMap" Civilization="CIVILIZATION_EGYPT"        X="57" Y="36" Leader="LEADER_CLEOPATRA" DisabledByLeader="LEADER_SALADIN" />
            <Replace MapName="GreatestEarthMap" Civilization="CIVILIZATION_EGYPT"        X="60" Y="30" Leader="LEADER_CLEOPATRA" AlternateStart="1" />
    Here is how it should work:

    - the lines containing Leader="LEADER_XXXXX" will be ignored if the Use Leaders TSL when available option is not checked.

    - the lines containing AlternateStart="1" will be ignored if the Use Alternate TSL if required and available option is not checked.

    - if the Use Leaders TSL when available option is checked, any leader that is referenced for a TSL using "Leader=" will never use a generic TSL for its Civilization. For example with the code above, Cleopatra will never spawn at (58,35) if the option is checked.

    - if the Use Alternate TSL if required and available option is checked then the lines with AlternateStart="1" will be used if the default TSL (defined by the lines without AlternateStart="1") is not available for any reason.

    - there should be only one "default" TSL for a Civilization alone or a Civilization/Leader, but you can use as many lines with AlternateStart="1"

    There can be 3 reasons to make a TSL unavailable:
    - There is another TSL already set under the minimal separation distance for cities (the placement order is defined by the Civilization order on the advanced setup screen, the human player - or host in multi - is always placed first)
    - The Civilization referenced in the tag DisabledByCivilization is in game
    - The Leader referenced in the tag DisabledByLeader is in game

    If the mod can't found a suitable alternate TSL (or if the option is not used), the default TSL will be used.


    Examples:

    1/ If Cleopatra is in game but not Saladin, her TSL will be Alexandria at 57,36 if Use Leaders TSL is checked, and Cairo at 58,35 (default TSL for Egypt) if that option is disabled

    2/ If Saladin is in game but not Cleopatra, his TSL will be Cairo at 58,35 if Use Leaders TSL is checked, and Mecca at 64,33 (default TSL for Arabia) if that option is disabled

    3/ If Cleopatra and Saladin are in game and Use Leaders TSL is checked, then Cleopatra's TSL will be Thebes at 60,30 (Alternate TSL for Cleopatra) because of the DisabledByLeader="LEADER_SALADIN" in her default TSL line, and Saladin will also use his alternate TSL at 64,33 (which is coincidentally the default TSL for Arabia, but we can set it at another position than Mecca) because Egypt is in the game (even if it was an alternate leader than Cleopatra)

    Now if we change the XML a bit to this:
    Code:
            <Replace MapName="GreatestEarthMap" Civilization="CIVILIZATION_ARABIA"        X="64" Y="33" />
            <Replace MapName="GreatestEarthMap" Civilization="CIVILIZATION_ARABIA"        X="58" Y="35" Leader="LEADER_SALADIN" />
            <Replace MapName="GreatestEarthMap" Civilization="CIVILIZATION_ARABIA"        X="64" Y="33" Leader="LEADER_SALADIN" AlternateStart="1" />
    
            <Replace MapName="GreatestEarthMap" Civilization="CIVILIZATION_EGYPT"        X="58" Y="35" DisabledByLeader="LEADER_SALADIN" />
            <Replace MapName="GreatestEarthMap" Civilization="CIVILIZATION_EGYPT"        X="60" Y="30" AlternateStart="1" />
            <Replace MapName="GreatestEarthMap" Civilization="CIVILIZATION_EGYPT"        X="57" Y="36" Leader="LEADER_CLEOPATRA" DisabledByLeader="LEADER_SALADIN" />
            <Replace MapName="GreatestEarthMap" Civilization="CIVILIZATION_EGYPT"        X="60" Y="30" Leader="LEADER_CLEOPATRA" AlternateStart="1" />
    1/ and 2/ won't change but in 3/ Saladin's TSL would be Cairo (and Cleopatra's would be Thebes)

    If we remove all DisabledByLeader and DisabledByCivilization references, then the setup screen order would define who will be in the Nile's delta in case 3/, the last selected leader would use it's alternate TSL

    If Use Leaders TSL was activated but not Use Alternate TSL, then 3/ would result in Cleopatra at Alexandria and Saladin at Cairo.
     
    Last edited: Aug 12, 2017
    Clubber Lang likes this.
  2. thecrazyscot

    thecrazyscot Spiffy

    Joined:
    Dec 27, 2012
    Messages:
    1,735
    Question regarding adding city-states: I have a mod adding multiple city-states which would all be within a few tiles of each other in a TSL situation (ancient Burmese cities). When adding TSL support, do I need to have them disable each other? If so, how would I go about disabling 3 other city-states? Just have duplicate entries like so?
    Code:
    INSERT INTO StartPosition (MapName, Civilization, DisabledByCivilization, X, Y)
        VALUES
            ('GreatestEarthMap', 'TCS_CIVILIZATION_SRI_KSETRA', 'TCS_CIVILIZATION_BEIKTHANO', 82, 38),
            ('GreatestEarthMap', 'TCS_CIVILIZATION_SRI_KSETRA', 'TCS_CIVILIZATION_HALIN', 82, 38),
            ('GreatestEarthMap', 'TCS_CIVILIZATION_SRI_KSETRA', 'TCS_CIVILIZATION_MAINGMAW', 82, 38);
     
  3. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    7,920
    Location:
    France
    Yes, let me know if it doesn't works as intended.
     

Share This Page