[Vanilla] Grouping Types and Traits?

Dreamzilla

Chieftain
Joined
Mar 25, 2018
Messages
6
Hi!

Disclaimer: Before you start calling me a noob. I am entirely new to modding, and also not all that familair with coding and so on. I know how to read XML and SQL though. Anyway, I am a noob. ;)

Now here is the thing. The fact that Unique Improvements (UI) get removed upon city capture bothers me big time. So I decided to try some modding. I have to say not enirely unsuccessful, but now I get at a break point and so I am crying out for help!

I have been fiddling about with Australia. I found out that UIs are defiend by a civ Trait so I removed TraitType in the following line:

Code:
<Row ImprovementType="IMPROVEMENT_OUTBACK_STATION" Name="LOC_IMPROVEMENT_OUTBACK_STATION_NAME" Description="LOC_IMPROVEMENT_OUTBACK_STATION_DESCRIPTION" Icon="ICON_IMPROVEMENT_OUTBACK_STATION" PlunderType="PLUNDER_HEAL" PlunderAmount="100" Buildable="True" PrereqCivic="CIVIC_GUILDS" Housing="1" TilesRequired="2" TraitType="TRAIT_CIVILIZATION_IMPROVEMENT_OUTBACK_STATION"/>

This worked, the imrpovement is not removed anymore. How ever, I want that only Australia is able to build the outback station. Then I found:

Code:
    <Improvement_ValidBuildUnits>
        <!--Unique Improvements -->
        <Row ImprovementType="IMPROVEMENT_OUTBACK_STATION" UnitType="UNIT_BUILDER"/>
    </Improvement_ValidBuildUnits>

I figured if I give Australia a unique builder, I would solve the issue. So I inserted

Code:
UnitType="UNIT_BUILDER_AUSTRALIA"

And of course I added this unique unit to australia. Guess what? It worked!!!

The only downside is that my unique builder can not build other improvements than the outback station.


I figured, what if I could group all unique builders in one group called UNIT_BUILDER and then attach to the group the traits involving building normal improvements, and to each individual builder I would attach the unique improvement.

Would this work?
If yes, how?

If no, what else could I do?



Thank you!!!
 
So, what you want is for any civ to be able to keep unique improvements when they invade other civs, but not have the ability to build it themselves?

IMO this is going to get really tricky because there are so many references to the Builder unique unit that hard coded to that unit. All the various "earn a free Builder when you..." "receive extra Builder charges..." etc is tied to that specific unit. Cloning all of that would be very tricky.

You might be able to attach a Modifier like the one used by Liang the governor for Fisheries and City Parks that allows certain improvements to be built in that city. But that would also mean Builders could build additional Outback Stations or whatever. It would not be a lightweight endeavor... basically you would need a trigger of some kind that indicates "this is the kind of city that can keep this improvement type" (could be a trigger based on an improvement of type X within 3 tiles for example.) A Modifier would then be applied permanently to the city that allows that improvement type forevermore to be built there.

Would it actually work? No idea.
 
I actually made a mod like this a couple of days ago. Doing it with lua is much more simple. I will upload it soon.
 
Thank you gggbbb, great to be able to see the code of your mod, it helps a lot!

I have a great idea for a different aproach. Let's see how far I could carry it. Basically, I would like to attach unique improvements to a builder as a promotion. I see a lot of cool posibilities for gameplay improvement this way. ;)
I guess I could create a custom modifier that allows such promotions in Lua, and then use XML/SQL to create the actual promotion and another Lua script to grant the promotion automatically to the builder accordingly.

(it's not only that I want to solve the problem with the removal but I also would love to learn a bit of the basics of modding ;))
 
Basically, I would like to attach unique improvements to a builder as a promotion. I see a lot of cool posibilities for gameplay improvement this way. ;)


I don't quite understand how that would work. An in the Builder unit itself would get a promotion?

My Combined Tweaks mod contains a few examples of allowing civs to build improvements they normally cannot. The new modifier MODIFIER_CITY_ADJUST_ALLOWED_IMPROVEMENT introduced in Rise and Fall that the governor Liang uses to allow the player to build Fisheries and City Parks.

In Quo's Combined Tweaks I allow the American civ to build unique improvements by attaching modifiers to the Film Studio, as seen below:


Code:
INSERT INTO Modifiers
    (ModifierId,             ModifierType,                 RunOnce,     Permanent,     OwnerRequirementSetId,     SubjectRequirementSetId)
VALUES    ('QUO_AMERICA_ENABLE_FAKE_SPHINX',     'MODIFIER_CITY_ADJUST_ALLOWED_IMPROVEMENT',     0,         0,         NULL,             NULL),
    ('QUO_AMERICA_ENABLE_FAKE_MISSION',     'MODIFIER_CITY_ADJUST_ALLOWED_IMPROVEMENT',     0,         0,         NULL,             NULL) ,
    ('QUO_AMERICA_ENABLE_FAKE_CHATEAU',     'MODIFIER_CITY_ADJUST_ALLOWED_IMPROVEMENT',     0,         0,         NULL,             NULL) ,
    ('QUO_AMERICA_ENABLE_FAKE_GREAT_WALL',     'MODIFIER_CITY_ADJUST_ALLOWED_IMPROVEMENT',     0,         0,         NULL,             NULL) ,
    ('QUO_AMERICA_ENABLE_FAKE_STEPWELL',     'MODIFIER_CITY_ADJUST_ALLOWED_IMPROVEMENT',     0,         0,         NULL,             NULL) ,
    ('QUO_AMERICA_ENABLE_FAKE_ZIGGURAT',     'MODIFIER_CITY_ADJUST_ALLOWED_IMPROVEMENT',     0,         0,         NULL,             NULL) ,
    ('QUO_AMERICA_ENABLE_FAKE_KURGAN',     'MODIFIER_CITY_ADJUST_ALLOWED_IMPROVEMENT',     0,         0,         NULL,             NULL) ,
    ('QUO_AMERICA_ENABLE_FAKE_COLOSSAL_HEAD', 'MODIFIER_CITY_ADJUST_ALLOWED_IMPROVEMENT',     0,         0,         NULL,             NULL) ;

INSERT INTO ModifierArguments
    (ModifierId,                 Name,             Type,             Value,                 Extra,     SecondExtra)
VALUES    ('QUO_AMERICA_ENABLE_FAKE_SPHINX',     'ImprovementType',     'ARGTYPE_IDENTITY',     'IMPROVEMENT_SPHINX',        NULL,     NULL) ,
    ('QUO_AMERICA_ENABLE_FAKE_MISSION',     'ImprovementType',     'ARGTYPE_IDENTITY',     'IMPROVEMENT_MISSION',        NULL,     NULL),
    ('QUO_AMERICA_ENABLE_FAKE_CHATEAU',     'ImprovementType',     'ARGTYPE_IDENTITY',     'IMPROVEMENT_CHATEAU',        NULL,     NULL) ,
    ('QUO_AMERICA_ENABLE_FAKE_GREAT_WALL',     'ImprovementType',     'ARGTYPE_IDENTITY',     'IMPROVEMENT_GREAT_WALL',    NULL,     NULL) ,
    ('QUO_AMERICA_ENABLE_FAKE_STEPWELL',     'ImprovementType',     'ARGTYPE_IDENTITY',     'IMPROVEMENT_STEPWELL',        NULL,     NULL) ,
    ('QUO_AMERICA_ENABLE_FAKE_ZIGGURAT',     'ImprovementType',     'ARGTYPE_IDENTITY',     'IMPROVEMENT_ZIGGURAT',        NULL,     NULL) ,
    ('QUO_AMERICA_ENABLE_FAKE_KURGAN',     'ImprovementType',     'ARGTYPE_IDENTITY',     'IMPROVEMENT_KURGAN',        NULL,     NULL) ,
    ('QUO_AMERICA_ENABLE_FAKE_COLOSSAL_HEAD', 'ImprovementType',     'ARGTYPE_IDENTITY',     'IMPROVEMENT_COLOSSAL_HEAD',    NULL,     NULL) ;

INSERT INTO BuildingModifiers
    (BuildingType,                     ModifierID)
VALUES    ('BUILDING_FILM_STUDIO',            'QUO_AMERICA_ENABLE_FAKE_SPHINX') ,
    ('BUILDING_FILM_STUDIO',            'QUO_AMERICA_ENABLE_FAKE_MISSION') ,
    ('BUILDING_FILM_STUDIO',            'QUO_AMERICA_ENABLE_FAKE_CHATEAU') ,
    ('BUILDING_FILM_STUDIO',            'QUO_AMERICA_ENABLE_FAKE_GREAT_WALL') ,
    ('BUILDING_FILM_STUDIO',            'QUO_AMERICA_ENABLE_FAKE_STEPWELL') ,
    ('BUILDING_FILM_STUDIO',            'QUO_AMERICA_ENABLE_FAKE_ZIGGURAT') ,
    ('BUILDING_FILM_STUDIO',            'QUO_AMERICA_ENABLE_FAKE_KURGAN') ,
    ('BUILDING_FILM_STUDIO',            'QUO_AMERICA_ENABLE_FAKE_COLOSSAL_HEAD') ;


It's also attach the Modifier at the Leader or Civilization level rather than the City level. In Combined Tweaks for example, I have a set of "Friendship bonuses," unique bonuses you get if you declare Friendship with another civ. Some of them allow you to build a unique improvement, using the Modifier MODIFIER_PLAYER_ADJUST_VALID_IMPROVEMENT.
 
I don't quite understand how that would work. An in the Builder unit itself would get a promotion?

Yes, it would be a principal change. The ability to build a Unique improvement would not be defined by leader/civ trait, but by a certain promotion a builder has. (The builder need to be knowledgable to build a certain improvement).
That very promotion though, is defined by the leader/civ trait.

So because the leader the leader/civ are Catherine/France. All builders automatically get a 'Chatteau promotion', and because the builder has this promotion it can build a Chatteau.

This will solve the removal upon capture issue, because the improvement is not all that unique anymore.
What is even cooler is that you might want to tactically capture a builder of another civ, so that you can build a foreign unique improvement into your native city.
You also could add a new Spy action 'Steal know-how', if successfull it grants you a builder with a foreign Unique Improvement Promotion.

Citystates that grant unique improvement, grant a promotion instead as well, the promotion will not be removed after you lose suzerain. (You'll just not get the promotion on a new builder anymore, but already existing builders with the promotion keep the ability to build the unique improvement)


My Combined Tweaks mod contains a few examples of allowing civs to build improvements they normally cannot. The new modifier MODIFIER_CITY_ADJUST_ALLOWED_IMPROVEMENT introduced in Rise and Fall that the governor Liang uses to allow the player to build Fisheries and City Parks.

In Quo's Combined Tweaks I allow the American civ to build unique improvements by attaching modifiers to the Film Studio, as seen below:

Cool!! Unforunately I haven't upgraded to R&F yet. But definately worth looking into this later! :) Thanks
 
Last edited:
Back
Top Bottom