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

Is it possible to add district adjacency bonus with specific resources (or resource classes)?

Discussion in 'Mod Creation Help' started by kaspergm, Dec 2, 2017.

  1. kaspergm

    kaspergm Warlord

    Joined:
    Aug 19, 2012
    Messages:
    4,070
    I'd like to add the following district adjacency bonuses to the game, but not sure if it's possible (with simple modding):

    • Encampment: +1 production for every adjacent strategic resource.
    • Commercial Hub: +1 gold for every luxury resource
     
  2. criZp

    criZp Chieftain

    Joined:
    Jul 19, 2013
    Messages:
    802
    Location:
    Nidaros, Norway
  3. kaspergm

    kaspergm Warlord

    Joined:
    Aug 19, 2012
    Messages:
    4,070
    Yes, Hansa does it, but not on specific resource classes. Hansa adds a bonus for any adjacent resource, and as far as I can see in the code, it doesn't have a list for resources that qualifies - it just checks if plot has a resource or not.
     
  4. criZp

    criZp Chieftain

    Joined:
    Jul 19, 2013
    Messages:
    802
    Location:
    Nidaros, Norway
    pic4.jpg

    You can try to make a copy of the row with ID = Resource_Production, where you change ID to StrategicResource_Production, and also change "AdjacentResource = true" to "AdjacentResourceClass = "RESOURCECLASS_STRATEGIC"

    Alternatively, change ID to StrategicResource_Production1, and change AdjacentResource = true" to AdjacentResource = "RESOURCE_ALUMINIUM". Then make a copy of the line for each other strategic resource. Remember to also change the ID number (StrategicResource_Production2 ... 3 ... etc)
     
  5. kaspergm

    kaspergm Warlord

    Joined:
    Aug 19, 2012
    Messages:
    4,070
    Interesting, thanx, this is really helpful, this will be something I'll try to play with when I have more time. :thumbsup:
     
  6. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    5,732
    Location:
    Illinois, USA
    Code:
    "AdjacentResource" BOOLEAN NOT NULL CHECK (AdjacentResource IN (0,1)) DEFAULT 0,
    "AdjacentResourceClass" TEXT NOT NULL DEFAULT "NO_RESOURCECLASS",
    .....
    
    • "AdjacentResource" is a boolean: you cannot state anything except "true" or "false" ("1" and "0" for SQL)
    • "AdjacentResourceClass" wants the statement of a CLASS of resource, not an individual resource. It will take any text you enter, but GIGO probably applies at DLL level on the implementation of anything not understood by the game as a valid class of resource.
     
  7. sclera

    sclera Chieftain

    Joined:
    Nov 13, 2013
    Messages:
    25
    I tried to do this recently. Short answer: it's not possible. It's possible to change plot yields on a per-resource basis using modifiers, but I could not figure out a way to make specific resources give adjacency bonuses.
     

Share This Page