1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Specialised Cities

Discussion in 'Civ6 - Unreleased Mods' started by Arlequin, May 11, 2017.

  1. Arlequin

    Arlequin Chieftain

    Joined:
    Apr 19, 2017
    Messages:
    23
    Gender:
    Male
    Location:
    France
    I recently started developing a mod with a bigger focus on city specialisation and especially specialists, based on this Thread in the Idea&suggestions section.

    I had a hard time understanding how to mod, especially the .lua part, but the mod is starting to get its shape so I decided to describe here what I done and what I have left to do, hopping that some of the solutions I found may be of some use to someone, and that I may get some advices for the problems I haven't solved yet.

    I made my mod dependant on nqmod version of cqui because I don't want to play without it, and I had to change UI lua files so I didn't want to do it on vanilla version.
    Before anything else I want to thanks everyone contributing to the civ6 modding community! I would have been stuck if not for reading your code and your posts on the forum. Special thanks to HellBlazer, notque, chaorace, Gedemon and LeeS


    Part 1: Adding Urban Policies

    I wanted to allow the player to affect "urban policies" to cities with the following properties:
    1- A urban policy is quick and easy to set-up (no production cost, 1 turn max to be set).
    2- A city can use only one urban policy.
    3- A urban policy can be used by only one city.
    4- A urban policy can be changed.
    5- Urban policies will in most case give a % yield and GPP modifier for the city, and add specialist slot.

    Ex: Technopolis: requires a library, gives +2 scientist slot, +100% science yield and +100% great scientist point in this city.

    Solution:
    1 & 5- The best solution I came up with was to add new buildings representing urban policies. That was the easy part. I looked at some existing mods to see how to add buildings with the correct modifiers (except for the GPP part that we will see in part 2). I set the base cost of the urban policies to 5, cheap enough to build it in one turn. I have yet to test if a cost of 0 is possible.

    2 & 3- I did not found how to use modifiers to prevent a city to have 2 different urban policies. Therefore I looked at the code in nqmod for national wonder and modified the productionpanel.lua file to manage the production list.

    4- FInally I had to allow to change city policies. For that I looked at how to allow removing a building. I did not found a way to add a remove/sell button to the building so I decided to use a "stop urban policy" project instead. Base cost 5, cheap again. When a project is done a lua event OnFiniishedProject is triggered, so I used it to call a function to remove the building. The code for removing was already done by nqmod again, so I just had to use it. It does the job but the building is still considered to be in the city the turn it is removed. The next turn it is however fully gone and I can build a new urban policy in this city.
    TODO: Find a way to remove the building the same turn as the project ends. I must probably use a different event, or maybe move the code to the gamescript context.

    Part 2: Make specialists grant Great Person Points.

    For the district specialists to have a real strategic value I wanted them to grant GPP again.
    1- Each Campus/CH/IZ specialist grants 0.5 Great Scientist/Merchant/Engineer point respectively.
    2- Each HS/Camp/Harbor specialist grants 1 Great Prophet/General/Admiral point respectively.
    3- Each Theatre specialist grants 0.3 Great Writer, Artist and Musician point.
    4- EC buildings have 1 specialist slots each. Those specialists yield 2 food and 0.15 GS,GM,GE and GWAM.
    5- Most urban policies grant +2 citizen slots and +100%GPP for a given district type in its city.

    Solution:
    1,2,3,5 - There is actually an sql table to affect GPP to specialists so I tried it first but I had 2 problems. The first problem is that I have to input an integer: decimal value is truncated. Also even if I used integer values, it seemed that somehow the gpp balance was not correct. So I gave up on this solution. I also did not find a modifier to apply a % boost to a specific type of specialist in a given city.
    I therefore decided to make the calculation of gpp by hand, to set the gpp balance in the game manually, and to adapt the great person panel and the workers plot tooltip accordingly. The hard part began.

    to be continued...

    It is late now so I will continue this post later. I will also try to illustrate all this with code snippets.
     
    Last edited: May 12, 2017
  2. Arlequin

    Arlequin Chieftain

    Joined:
    Apr 19, 2017
    Messages:
    23
    Gender:
    Male
    Location:
    France
    [reserved]
     
  3. Arlequin

    Arlequin Chieftain

    Joined:
    Apr 19, 2017
    Messages:
    23
    Gender:
    Male
    Location:
    France
    [reserved]
     

Share This Page