[WIP]Secondary Unique Trait

Divine Yuri

Never Closes Chrome
Joined
Oct 28, 2014
Messages
89
Location
Brrrr, USA
9JGkBkq.png

Download
(WIP) Number of Traits to go : 42
Direct Download | Steamworkshop(when out of WIP)
Note that while this is WIP not all Civilizations have a Secondary Trait.​

So in my works of breaking pre-assumptions about what can't be done. I've decided to make a mod that is about adding a Secondary Trait in Civilization 5. Now as I'm not the person to ask if you needed 43 Unique Traits this is being released right now as a work in progress so I can possibly get some help with filling these in. Mostly I've done exactly 2 (at time of Post) Traits which one isn't even a Unique. So right now 42 Unique Secondary Traits are set to my "Generic" Trait, "Tax Nationalization". Which is just a increase of +10% :c5gold: Gold in all cities. All done traits are listed in the next post.

What I need help with :
(This is the reason it's being released as a WIP)
Ideas for Secondary Traits. I know about some Posts that discuss this, but don't think taking any ideas from that is great. I'm just looking for something simple. To help just give me a name, and ability. Don't be shy on the work required for it. I'm not looking to make these Secondary Uniques boring. I'm willing to put in the lua required for an idea that I find interesting. Also if you can think of something better for a civilization feel free to contribute. Definitely if credit is only to me.

How it's done :
I fix the problems that use to occur in a custom DLL. Also a custom UI is included in the mod that will display all Traits up to four (This doesn't matter with this mod at this time, but if I expand it the same UI will work.).


Problems :
The problems that use to be displayed here have been addressed, and fixed. I'll remove this if non popup before the Common release schedule. Where the technical part of the mod is done, and all that needs to be added are the traits.

For Modders :
Spoiler :


Name : (2nd Trait) Secondary Unique Trait
ID : 211d1d49-02bb-477b-b969-103f24dd9146

You can have any # of extra traits. The base civilizations will only have 2 with the release of this, but a additional one can always be added.

Code:
INSERT INTO Leader_Traits
		(LeaderType, TraitType)
SELECT		LeaderType,	('TRAIT_YOUR_TRAIT')
FROM Leader_Traits WHERE LeaderType = 'LEADER_YOUR_LEADER'
AND EXISTS ( SELECT Type FROM Traits WHERE Type = 'TRAIT_DY_AMERICAN_SECOND' );
Also some lua stuff :

I'll be including the "RandomUtils.lua"(probably going to just be the name of my utils for now on.) in the mod. In it I have a function that is an easy replace for CivID. Mostly just need to change your CivID to something like this:
Code:
include("RandomUtils");
local CivID = GameInfoTypes.CIVILIZATION_YOUR_CIVILIZATION;
if ( GetCivilizationByTrait ~= nil ) then
	CivID = GetCivilizationByTrait( "TRAIT_YOUR_TRAIT" ) end

--Just a note: GetCivilizationByUnique is the actual name of the function, and Trait is just a reference to that. So it includes any unique not just traits.
Which will make the CivID based on the Trait if either this or my randomizer is active, but act like a normal CivID if not.

Which if CivID's initial value is set to nil can be used for any extra traits for an easy "Is this mod active" as nil is counted as false when referenced as a boolean, and while it's included in the randomizer it'll still come out as nil if no civilization has it. So the extra Trait above can be counted this way.

The only problem is CombatBonusImprovement. This is the only column with a problem that cannot be fixed. If you use this it'll just be the last non-zero value. So it's highly un-recommended for this.

[/CODE]




Mod Support :

Civilization Trait Merge List :
Ab idea for better compatibility for Modded civs is to make the mod combine two Traits of similar Civilizations by the same Modder. I first need permission from the modder, and a change of their CivilizationID. I have a explanation of RandomUtils in the for Modders section which will allow a easier transition to Trait based CivilizationID.
Spoiler :

Democrat America (Author : Divine Yuri):
  • Bernie Sander's America (Unreleased, should be the day before Iowa)
  • Hillary Clinton's America (Unreleased, should be the day before Iowa)
Republican America (Author : Divine Yuri) :
  • Ted Cruz's America (Unreleased, should be the day before South Carolina/Nevada)
  • Trump's America (Unreleased, should be the day before South Carolina/Nevada)
 
All The Traits :
Spoiler :
This is where I'll be putting all the traits as they are made.
Removed the icons as I hit the 32 limit I didn't know existed .-.

America
We The People
Start with Liberty Unlocked. Cities founded near a unclaimed resource gain +1 Happiness.
State : Released
Idea : Divine Yuri
Code : Divine Yuri
Lua : YesActually I think most of these will be, but I'll be adding them into the Trait.
Meaning : We The People is the starting words of the American Constitution. Which states the rights of the people as the main foundation of The United States. Through protection in the law (if there was some kind of "Court" mechanic I'd change that, but have to leave with something that involves Happiness.)

Arabia
Hajj
Gain additional Faith, and Tourism from every foreign city that follows your religion.
State : Idea
Idea : Divine Yuri
Code : Divine Yuri

Austria
Alles Erdreich Ist Osterreich Untertan
When war is declared gain influence with every friendly or allied city-state.
State : Idea
Idea : Divine Yuri
Code : Divine Yuri
Name Translation : All earthly realms are subject to Austria.
Meaning : Motto of the Austrian Empire.

Byzantium
Iconoclast
The destruction of Faith and buildings gives a instant Faith boost.
State : Idea
Idea : Divine Yuri
Code : Divine Yuri
AI : If computer the buildings are just planned to be destroyed once in a while. This doesn't happen to buildings with Great Work slots.
Meaning : The Iconclast is one of the major points in the great schism as the Roman Patriarch didn't believe in the practice. Iconclast means the destruction of Religious Symbols, and was practiced by the Byzantines during certain times in history.

China
Hundred Schools of Thought
China's First Golden age produces five Random Great People over the course of the Golden Age, and China is rewarded a free Social Policy. This effect only ever occurs once.
State : Idea
Idea : Divine Yuri
Code : Divine Yuri

Egypt
Fathers of Civil Engineering
When Egypt builds a wonder 10% of allProduction towards the wonder is returned to Egypt as Science.
State : Idea
Idea : Divine Yuri
Code : Divine Yuri

Ethiopia
Negusa Negast
(Something something about the monarch).
State : Idea
Idea : Divine Yuri
Code : Divine Yuri
Meaning : Negus is a title meaning royal in Ethiopian Semitic languages.

France
Ancien Régime
+2 Culture per turn from Cities before discovering Steam Power.
State : Need to fix the way Traits are added first.
Idea : Fraxis
Code : Fraxis
Status : Might be changed if I think of something else. Just taking a easy way out with France. :p

Germany
Frier Beruf
+1 :c5production: Production from all specialists. Gain points towards Great Engineers whenever Germany builds Armored Units.
State : idea
Idea : KlassikKiller (Reddit)
Code : Divine Yuri

Greece
The Great
Upon the Discovery of Bronze Working gain a Great General named Alexander. This Great General gives +20% Combat strength to all units within three tiles. Cannot build citadels, but if destroyed is returned to the capital in five turns.
State : Idea
Idea : Divine Yuri
Code : Divine Yuri
Effect : The distance effect is when :
On top +30%
One tile +25%
2 Tiles +20%
3 Tiles +15%


Huns
Horde
Cannot find their first city until they conquer another Civilization or City-State's city. There newly captured city is renamed to Attila's Court. They start with extra military units, and at war with every other civilization.
State : Idea
Idea : Divine Yuri
Code : Divine Yuri

Iroquois
False Face Society
The Percentage of Food produced by a city is increased by the faith generated, and number of forest or jungle tiles workable by the City.
State : Idea
Idea : ghettogoatsauce (Reddit)
Code : Divine Yuri

Japan
Shogunate
After the declaration of war melee units spawn near Great Generals. Gain a culture boost when a favorable peace treaty is signed.
State : Idea
Idea : KlassikKiller (Reddit), and Divine Yuri
Code : Divine Yuri
Meaning : The Japanese shogunate was a Hereditary Military Dictatorship during Feudal Japan. The Shogunate at times held higher power than the Emperor until it was abolished during the Meiji Restoration.

Korea
Hangul
After discovering Writing gain additional Great Writer points in all cities. Great Works of Art from Korea give +5% Science.
State : Idea
Idea : Divine Yuri
Code : Divine Yuri
Meaning : The Korean writing system Hangul is one of the easiest if not the easiest writing system in the world, and was created by one man. Who also happens to be the Civilization's leader. Most people in the west (including me for a while) think it's was much like Chinese, or Japanese needing a ton of memorization but actually has less characters than even English. Which makes it very easy to learn which helped Sejong's education reforms based on Confucian values of Education.

Mongols
Protectors of the Silk Road
Cities connected to the Capital give additional Gold based on their distance from the Capital.
State : Idea
Idea : Divine Yuri
Code : Divine Yuri
Distance = | Capital(x) - City(x) | + | Capital(y) - City(y) |
Meaning : Other than the tyranny the Mongol Brought. After the conquered the lands they were known to protect the ancient Trade Routes between East, and West. The most significant of course was the Silk Road which spanned the Empire the Mongols created. They say you could walk the entire road with a gold plate on your head, and never fear being robbed because of their protection.


Ottoman
Devsirme
Upon a new era gain additional Goldan Age Points, and Melee Troops for all cities that don't follow the same religion as your capital.
State : Idea
Idea : Divine Yuri
Code : Divine Yuri

Portugal
Cape of Good Hope
The discovery of the Southern or northern most tip of a continent other than their Capital's continent doubles the distance of Trade Routes by Portugal. +2 Gold from Trade Routes to cities on other Continents.
State : Idea
Idea : KlassikKiller (Reddit), and Divine Yuri
Code : Divine Yuri

Rome
Imperial Allegiance
Rome can use Gold to hire nearby Barbarians to fight alongside Rome. These barbarian troops are cheaper, and can move after purchase.
State : Idea
Idea : Divine Yuri
Code : Divine Yuri
Meaning : Rome close to it's fall was known to hire the local Tribes men to fight along side them.

Songhai
Scholars of Timbuktu
Building Science buildings give points toward Golden Ages. During Golden Ages all Great Person Points are doubled.
State : Idea
Idea : Divine Yuri
Code : Divine Yuri

Spain
Treaty of Tordesillas
All founded cities on a continent other than the one Spain was founded on give a Gold Bonus.
State : Idea
Idea : Ranal___Ape (Reddit)
Code : Divine Yuri

Sweden
Lion of the North
Sweden gains an additional +4% Combat Strength vs Civilizations who are denounced or at war with civilizations Sweden has a declaration of Friendship with.
State : Idea
Idea : Divine Yuri
Code : Divine Yuri

Zulu
Isandlwana
When fighting a Civilization more advanced than Zulu gain an additional +40% Combat strength from flanking.
State : Idea
Idea : Divine Yuri
Code : Divine Yuri

 
So in my nightmare of breaking preassumptions about what somebody's preassumptions about what can't be done. Chapter X: Traits cannot be done.

So you found this description thingy an issue, which is clearly a cosmetic one. Ok. Game is coded to display only one trait, but your solution is to hardcode it even more to display only 2 traits. Later somebody else will code it to 3 traits. Well, what about coding it for infinite amount of traits.
Funny thing, I am pretty sure that one leader can have multiple Traits assigned so adding 'SecondaryTraitType' tag is redundant. All you need is to iterate through Traits.

Now, the GameSetup stuff, SelectCivilization.lua, two approaches. You can resize the leader box, which would probably look great in selection mode, but once you are back to GameSetup screen... You will probably have to make a scroll for a text. Anyway, FireTuner is a free thing, I am not gonna theorycraft on something you can simply check.

Anywhere you edit Lua, the sql stuff is redundant. That's why your approach is a bit incorrect.

Later, there is a DoM and civilopedia, but you can also change TXT with lua upon gameinit and I am sure it will be all in about 100 lines of code (including civ selection thing...). Check reference. What is more, I think it may be also an easier tool for Randomized Unique Components and Traits (without a need for any support, aka superior for my needs ~ will check it on my own one day).

Tl;dr Rethink your approach. Database coding should be last on the task queue. Start with editing setup screen.

Anyway, congratulations for a next additional traits project. Good luck.
 
Funny thing, I am pretty sure that one leader can have multiple Traits assigned ...

They can ... but ... the code that merges traits is horribly broken for certain tables

Not Used - in BNW
  • Trait_FreePromotions
Broken - uses highest value, not additive
  • Trait_ExtraYieldThresholds
Broken - uses last non-NULL value
  • CombatBonusImprovement (column)
Broken - uses last value, even if 0
  • Trait_YieldChanges
  • Trait_YieldModifiers
  • Trait_YieldChangesNaturalWonder
  • Trait_YieldChangesPerTradePartner
  • Trait_YieldChangesIncomingTradeRoute
  • Trait_YieldChangesStrategicResources
  • Trait_Terrains
  • Trait_ResourceQuantityModifiers
  • Trait_NoTrain
Broken - uses last value, only if greater than 0
  • Trait_FreeResourceFirstXCities

The broken yield bonus tables pretty much makes the game core functionality useless IMHO
 
Good to know.

As I was corrected, instead adding new rows in Leader Traits table (my minimalistic invalid solution), creating a new table in database should allow more than 1 extra secondary trait (especially that "Trait" seems like just a TXT in this case anyway) safely. My bad.
 
You could still use the Traits table and all the associated Trait_Xyz tables, just don't use a TRAIT_ABC value assigned to a leader and then write some horribly complex SQL and/or Lua to merge the traits ... but it would probably be simpler (and quicked) to just fix the DLL!
 
Tl;dr Rethink your approach. Database coding should be last on the task queue. Start with editing setup screen.
Yeah that's where I think my first priority should be. I've actually almost got what I had in my mind done. It's mostly the idea of removing the Description of the trait from the selection entirely, and making it a tooltip instead :
mjKkD2p.png

Still trying to figure out the tooltip, but it's generally looking how I think it should.

You could still use the Traits table and all the associated Trait_Xyz tables, just don't use a TRAIT_ABC value assigned to a leader and then write some horribly complex SQL and/or Lua to merge the traits ... but it would probably be simpler (and quicked) to just fix the DLL!
Yeah probably going to do that in the end. The doing it in SQL was more me thinking I knew it was possible that way, but just fixing the DLL is my best bet.
 
This looks really cool, but I do request that you check how it will interact with JFD's TAL.
 
This looks really cool, but I do request that you check how it will interact with JFD's TAL.

Don't really need to check I know it won't work they replace the same files. I'm gonna make a Alternate version for that, and Advanced User Interface. Though with TAL I feel bad about how many files (2/3rds) it replaces though. might just do some alterations to the Alternate leaders version to make it designed to fail without that other 1/3rd. Which would probably clear my conscience :rolleyes:.

But, anyways got the Tooltip to work.
aaQY6jI.png

Going to do a little more editing to the distance of everything. Might decrease the distance of each Trait from each other to allow more room for other Traits, and either:
  • Add in something to make it so if the mod isn't active the traits will show normally.
  • Expand the information shown like with mod information (like Cultural Diversity, or Civ4 Traits in Civ5).
    This is a approximation of how that'll look (at least my base) :
    c20EiCN.png

    Though if I go this far the UI almost becomes a new mod in itself. (the Byzantine Ideas are me taking a mod I have planned called "National Ideas in Civilization 5" into account so you can ignore that for now. :p ).
    Edit : So got the type off the wiki, and it's classical in game when adding Cultural Diversity.
 
Ok, the National Ideas in Civ V idea made me squeal a little bit :P

I quite like how the UI is designed. I'd willingly switch over from TAL if/when you get it to that point :)
 
Sorry Modjesty don't put me in the gulag plz :cry:

I would probably ask, but Yuri hasn't released the UI yet so that'd be a challenge :lol:

Edit: Also is there any more EUIV mechanics y'all are wanting to implement :mischief:
 
Quick Update (Yuri. You should know you can't make "Quick" updates...) :

I've got the Custom Leader Select Screen pretty much done. Still haven't done the edits to the Game Setup Screen, don't know why but calling the Description the same way for the Western bonus isn't coming up with anything need to call something different for Western Bonus as the amount is based on game speed, and switching the way the Second Trait is handled.

But, generally looks how I want it to. Now just need to do what I said above.

LvUHrMu.jpg


Text areas that aren't on the normal select screen are all working with Tooltips.
Just because I thought it made it look better. I made it so the Leader's name while on the selection screen doesn't display the Icons. It only replaces the icons from the displayed text, and not the Leader's name itself. So this is only a thing in the selection screen.

Well just giving how it looks now, and there probably won't be any big changes to that. Just need to do some more technical things. So here's the tool tips working :
Spoiler :
Secondary Trait :
JpHQ0y3.jpg

Cultural Diversity :
lhPQEB4.jpg

Civ 4 Traits in Civ 5 :
Jn2WrCW.jpg


You know, instead of comitting treason you could ask me to support the mod :p

That's true :p
Biggest problem right now is I'm not 100% done with the "base" part yet.

Sorry Modjesty don't put me in the gulag plz :cry:

I would probably ask, but Yuri hasn't released the UI yet so that'd be a challenge :lol:

Edit: Also is there any more EUIV mechanics y'all are wanting to implement :mischief:

Not really personally. Actually feel like Civ6 will come out before I actually get done with National Ideas. :lol:
Mostly from the naming/history part. Which becomes something like this entire mod times six, but then again most of them are going to be something boring simple like +10% Cavalry Combat Strength (though is that really different from EU4?).
 
Quick Update (Yuri. You should know you can't make "Quick" updates...) :

I've got the Custom Leader Select Screen pretty much done. Still haven't done the edits to the Game Setup Screen, don't know why but calling the Description the same way for the Western bonus isn't coming up with anything need to call something different for Western Bonus as the amount is based on game speed, and switching the way the Second Trait is handled.

But, generally looks how I want it to. Now just need to do what I said above.

LvUHrMu.jpg


Text areas that aren't on the normal select screen are all working with Tooltips.
Just because I thought it made it look better. I made it so the Leader's name while on the selection screen doesn't display the Icons. It only replaces the icons from the displayed text, and not the Leader's name itself. So this is only a thing in the selection screen.

Well just giving how it looks now, and there probably won't be any big changes to that. Just need to do some more technical things. So here's the tool tips working :
Spoiler :
Secondary Trait :
JpHQ0y3.jpg

Cultural Diversity :
lhPQEB4.jpg

Civ 4 Traits in Civ 5 :
Jn2WrCW.jpg




That's true :p
Biggest problem right now is I'm not 100% done with the "base" part yet.



Not really personally. Actually feel like Civ6 will come out before I actually get done with National Ideas. :lol:
Mostly from the naming/history part. Which becomes something like this entire mod times six, but then again most of them are going to be something boring simple like +10% Cavalry Combat Strength (though is that really different from EU4?).
holy sh*t this is a good ideal,well done you:goodjob: & wheres englands Secondary Unique Trait?
Greece
The Great
Upon the Discovery of Bronze Working gain a Great General named Alexander. This Great General gives +20% Combat strength to all units within three tiles. Cannot build citadels, but if destroyed is returned to the capital in five turns.
may i suggest if the great general dies,your civ goes intro 5 turns of anarchy,i think it was like that in civilization 4's alexanders conquest scenario
 
holy sh*t this is a good ideal,well done you:goodjob: & wheres englands Secondary Unique Trait?

may i suggest if the great general dies,your civ goes intro 5 turns of anarchy,i think it was like that in civilization 4's alexanders conquest scenario

Haven't thought of one for England yet so there isn't one. Have had a few people give me some ideas on England on the reddit post, but mostly getting what I think are kinda boring simple want these to be more than "+1 Yield on X" which I want to save for National Ideas. There's only about 22 there yet.

Greece like a lot of them in that post are probably going to be replaced. I like a few, but not all of them. Mostly did about 18 in a day just spit balling ideas, and plan to change them as better ideas come to me.
 
Actually feel like Civ6 will come out before I actually get done with National Ideas.

To be fair, Civ V wasn't exactly the cream of the crop on release :p
 
Alright so I'm going to give a confident answer to how the Traits are going to be handled.

I've fixed (Taking a educated guess) most of the DLL, and the only problem seemed to usually be a lack of addition, or some other choice that felt weird to me.

Kinda didn't touch the DLL fearing the fact I have never touched C++ before (technically, but I have C/Java experience so it was fairly easy to understand) until today, and found (most of) the problems to be the easiest fix in the world, and wish I just went for the DLL first. :rolleyes:

If you want to know the changes I've listed how I fixed (most of) the broken tables whoward said don't work below:

Spoiler :

Edit: There might be a couple needing of some tweaking. I realized trait->GetFreeResourceXCities((ResourceTypes)iResourceLoop) or FreeResourceXCities isn't a integer value. it's an object. Which might be true for a couple more here.

Broken - uses highest value, not additive
  • Trait_ExtraYieldThresholds
This one did two things. It first would check if this new value was higher than the previous, and then it would only make equal. Which makes little sense to me, but probably made sense at the time when they wrote it. I do that too (*cough* My 1000 lines of SQL code *cough*).:rolleyes: So here's the fix (Bold/Underline = change, //commented out):
Code:
//if(trait->GetExtraYieldThreshold(iYield) > m_iExtraYieldThreshold[iYield])
				//{
m_iExtraYieldThreshold[iYield] [B][U]+[/U][/B]= trait->GetExtraYieldThreshold(iYield);
				//}

Broken - uses last non-NULL value
CombatBonusImprovement (column)
The biggest problem with this one as I write the post is exactly what it does. It's a (String? Object? Improvement?) value so I can't just add. Also without knowing much about the context of it's use makes it difficult to change. Plus it's a single referenced value in the trait.

Broken - uses last value, even if 0
  • Trait_YieldChanges
  • Trait_YieldModifiers
  • Trait_YieldChangesNaturalWonder
  • Trait_YieldChangesPerTradePartner
  • Trait_YieldChangesIncomingTradeRoute
  • Trait_YieldChangesStrategicResources
  • Trait_ResourceQuantityModifiers
Only problem with these in the DLL is that they are set to the last value. So the fix looked something like this (bold/Underline = my addition):
Code:
m_iYieldRateModifier[iYield] [B][U]+[/U][/B]= trait->GetYieldModifier(iYield);

  • Trait_Terrains
The fix was like above, but it seemed to be in a weird spot. I'm not sure how likely the fix is to work as I haven't really realized how everything falls together. Mostly noticed that one function has certain working values adding( x += y; ), but the ones that don't work are changed to every value after the first( x = y; ).

  • Trait_NoTrain
Feel like the problem with this one was the fact that it would choose the last trait. So say you add one to Venice (I'm guessing a lot in this post) he'll then have the settler because it's set to false in the second trait. So the fix right now as it seems to be a boolean. Is to make it not equal the last value, but equal true as long as at least one trait that changed it is true :
Code:
//Mostly just change NoTrain to a boolean expression that takes itself into consideration. 
m_abNoTrain[iUnitClass] = [B][U]m_abNoTrain[iUnitClass] || [/U][/B]trait->NoTrain((UnitClassTypes)iUnitClass);

Broken - uses last value, only if greater than 0
  • Trait_FreeResourceFirstXCities
So turns out this is an object. So I've changed the way it's handled. It seems to be based on a value in the object known as miResourceQuantity. I've changed it to a if statement that changes that value. I'm not sure exactly if it's initialized, or not by this part of the code. So I made sure that if it isn't it is by the first non-zero value. The code looks something like this:
Compiling the old code came out with an error. Haven't done too much with C++ so wasn't sure if I could just put a opposite boolean expression, but it seems like it is already identified as that object.
Code:
[S]FreeResourceXCities temp = trait->GetFreeResourceXCities((ResourceTypes)iResourceLoop);
if ( !m_aFreeResourceXCities[iResourceLoop] ) {
	m_aFreeResourceXCities[iResourceLoop] = temp;
}else {
	m_aFreeResourceXCities[iResourceLoop].miResourceQuanity += temp.miResourceQuanity;
}[/S]
FreeResourceXCities temp = trait->GetFreeResourceXCities((ResourceTypes)iResourceLoop);
m_aFreeResourceXCities[iResourceLoop].m_iResourceQuantity += temp.m_iResourceQuantity;
So I'm guaranteeing that the "SecondaryTrait" Column is being deleted from Leader_Traits, and now it'll work as if you just add another trait.
Code:
INSERT INTO Leader_Traits
	(LeaderType,		TraitType)
VALUES	('LEADER_MARIA',	'TRAIT_DY_AUSTRIAN_SECOND');


So for modders :
Support explanation :
Spoiler :
You can have any # of extra traits. The base civilizations will only have 2 with the release of this, but a additional one can always be added.

The code I just made while writing this (probably could think of something better, but w/e it works.) Is this :
Code:
INSERT INTO Leader_Traits
		(LeaderType, TraitType)
SELECT		LeaderType,	('TRAIT_YOUR_TRAIT')
FROM Leader_Traits WHERE LeaderType = 'LEADER_YOUR_LEADER'
AND EXISTS ( SELECT Type FROM Traits WHERE Type = 'TRAIT_DY_AMERICAN_SECOND' );
Also some lua stuff :

I'll be including the "RandomUtils.lua"(probably going to just be the name of my utils for now on.) in the mod. In it I have a function that is an easy replace for CivID. Mostly just need to change your CivID to something like this:
Code:
include("RandomUtils");
local CivID = GameInfoTypes.CIVILIZATION_YOUR_CIVILIZATION;
if ( GetCivilizationByTrait ~= nil ) then
	CivID = GetCivilizationByTrait( "TRAIT_YOUR_TRAIT" ) end

--Just a note: GetCivilizationByUnique is the actual name of the function, and Trait is just a reference to that. So it includes any unique not just traits.
Which will make the CivID based on the Trait if either this or my randomizer is active, but act like a normal CivID if not.

Which if CivID's initial value is set to nil can be used for any extra traits for an easy "Is this mod active" as nil is counted as false when referenced as a boolean, and while it's included in the randomizer it'll still come out as nil if no civilization has it. So the extra Trait above can be counted this way.

Though I have one more thing to say about modding. If you have two mods of the same civilization with alternate leaders message me the similar ones, and I'll work with you to make them merge the trait if both mods are active. It's a simple way to make support without the need to make another trait entirely. If you are worried about the lua read the stuff under spoiler about "RandomUtils.lua" which will help you make a quick change to a Trait based Trait, and not a CivilizationID based one.

This is my last update post without anything more substantial. When I make my next update the updates are going to be coming in pretty fast as I just start writing the traits in Lua. Don't mind the above post. I have a different place I'm keeping the ideas I have, and a lot of those are actually out of date. I'm going to change it to only include the done Traits when I get to that point.
 
CombatBonusImprovement is used alongside NearbyImprovementCombatBonus and NearbyImprovementBonusRange to give a combat bonus for units within a certain number of tiles from a certain type of tile improvement. It's used for Polynesia's +10%-within-two-tiles-of-a-Moai thing.
 
CombatBonusImprovement is used alongside NearbyImprovementCombatBonus and NearbyImprovementBonusRange to give a combat bonus for units within a certain number of tiles from a certain type of tile improvement. It's used for Polynesia's +10%-within-two-tiles-of-a-Moai thing.

Ohh alright. Still seems to be problematic.

The problem is the game is calling CombatBonusImprovement with no parameters. So unlike say YieldModifier where it requires the YieldID to return the modifier:
Code:
//This was simplified.
CombatBonusImprovement()
YieldModifier(int YieldID)

So probably the best way I can handle it is just to choose the final one that isn't null (or 0), and go with that.

Edit:
If a civilization gets two traits with that it'll add the NearbyImprovementCombatBonus, and NearbyImprovementBonusRange of both traits (this was already happening before my edits.).
 
Back
Top Bottom