• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Brewhaus

Recruit
5 Badges
Mar 20, 2024
6
8
  • Crusader Kings II
  • Magicka
  • Cities: Skylines
  • Age of Wonders: Planetfall
  • Crusader Kings III
I'm just getting into modding and I see function/method calls around the files and I'd be really interested in seeing what all the possible calls are.

I parsed the .gui, .txt, and .yml files and got a list of about 10,000 methods but I don't know how to call them. Do they take parameters, what do they return? Is this all of them?
For example, I see references to Holding.GetIncome so I want to know what (if any) parameters it takes and what other methods the Holding object has. I found the following for Holding:

Holding.CanConstructAnyBuilding
Holding.GetConstructionBuilding.GetNameNoTooltip
Holding.GetConstructionProgress
Holding.GetCurrentGarrisonSize
Holding.GetHolder.IsAtWar
Holding.GetIncome
Holding.GetLeviesTooltip
Holding.GetMaxLevySize
Holding.GetNameNoTooltip
Holding.GetProvince
Holding.GetProvince.GetNameNoTooltip
Holding.GetProvince.GetRaidLoot
Holding.GetProvince.GetRaidLootTooltip
Holding.GetProvince.GetSupplyLimitDescFor
Holding.GetProvince.GetSupplyLimitFor
Holding.GetProvince.GetTerrain
Holding.GetProvince.GetTerrain.GetNameNoTooltip
Holding.GetProvince.GetTitle
Holding.GetProvince.GetTitle.GetDeJureLiege.GetHolder.Custom
Holding.GetProvince.GetTitle.GetDeJureLiege.GetHolder.GetUIName
Holding.GetProvince.GetTitle.GetHolder.GetUIName
Holding.GetProvince.GetTitle.GetLessee.GetUIName
Holding.GetProvince.GetTitle.GetName
Holding.GetProvince.GetTitle.IsLeasedOut
Holding.GetProvince.IsRealmCapital
Holding.GetProvince.IsRecentlyLooted
Holding.GetTaxTooltip
Holding.GetTooltip
Holding.GetType.GetConceptName
Holding.GetType.GetName
Holding.GetUnraisedLevyRatioPercent
Holding.IsConstructionInProgress
Holding.IsEmpty
Holding.IsHoldingOrNonCapitalHoldingHovered
Holding.IsLowControl
Holding.IsSelected
Holding.IsValidForLesseeOrHolder
Holding.LevyAndTaxIsAffectedByFixableSituation
Holding.OnMouseEnter
Holding.OnMouseLeave

I assume Holding.GetProvince is returning a Province object that then has it's own methods.
 
I don't know anything about programming, so forgive me if I am unhelpful, but you can find most of these on the wiki here (and it says there at the top if you type DumpDataTypes into the console it will give you all the most up to date data in C:\Users\YourName\Documents\Paradox Interactive\Crusader Kings III\logs). Your list is probably more complete than the Wiki, but it should still be a pretty thorough breakdown of most things and what they return. Basically, though, yeah, it's just a way of scoping into different bits of data. As far as I know, GetIncome doesn't really take any parameters, it just gives a number (C_FixedPoint, though you can round it off by adding |V0 or |V1, or |Vn, where n is the number of decimals you want it to round to, e.g., GetIncome|V1).

With these data types, though, you can chain things together the same way you can scopes in the script. You have to start by determining the scope, which if you're localizing for something that's not the gui, you'll probably most often do in script by save_scope_as (e.g., primary_spouse = { save_scope_as = spouse }, then you can call it in your localization by linking it to that scope, like spouse.GetTitledFirstName. With Holding, you'd want to find a way to access the scope of the holding you want the information about, and then you can scope into it to get information about it or its features. For example assume you set a scope up to choose an important province, you could find out more information that is related to it with, important_province.GetHolding.GetHolder.GetPrimarySpouse.GetFather.GetCulture.GetName will return the holding's province's controller's primary spouse's father's culture's name. You can just keep chaining things together until you get it to access whatever bit of information you want.

Stuff like Holding is, I think generally (maybe always?), something that is related to the GUI, where the GUI sets the datatype, and then the localization retrieves the relevant information based on the datatype that's being used. You can see it in HOLDING_TT_TITLE, which is localized with [Holding.GetProvince.GetTitle.GetName]. This gets used in the gui to retrieve the name of each holding's title. The triggered stuff like Holding.IsEmpty doesn't, to my knowledge, get used in localization, but they get used in the GUI. So if you want something to show up, you can use it to toggle visibility based on whether or not a holding is empty, like visible = "[Holding.IsEmpty]". There, if the holding is empty, show something on the GUI, like text, or an image, or a button. I think theoretically you could use it in localization, but that's over my head, and I don't know what you would do with it.

Anyway, I hope that helps a little bit. Most of what I've learned has just been poking through the localization and gui files, seeing how they're used and duplicating it, so my information may not be the most accurate, but the Wiki should give you the return types of most things if you want to explore it a bit.
 
  • 2Like
  • 1
Reactions:
Thank you for the detailed response. Much appreciated. I was going to try to put the tax amount and levy amount with 100 control in parenthesis but it looks like that won't be possible.
 
  • 2Like
Reactions:
Thank you for the detailed response. Much appreciated. I was going to try to put the tax amount and levy amount with 100 control in parenthesis but it looks like that won't be possible.
Can you write out an example of what you mean? It might be doable if you write it out using multiple datatypes.
 
Can you write out an example of what you mean? It might be doable if you write it out using multiple datatypes.
I'm not exactly sure what you mean by write out an example but here is what I'm talking about. Let's say you had 3 counties and you just won a war and gained 3 additional counties. Those counties have low control because of the war so the values you see for tax and levies are significantly reduced. You have a domain limit of 4 so you have to get rid of 2 of them. You want to know what the potential values of those fields are so you can decide which to keep. Here is an image example I mocked up...

ck3controlrates.png
 
  • 2
Reactions:
I'm not exactly sure what you mean by write out an example but here is what I'm talking about. Let's say you had 3 counties and you just won a war and gained 3 additional counties. Those counties have low control because of the war so the values you see for tax and levies are significantly reduced. You have a domain limit of 4 so you have to get rid of 2 of them. You want to know what the potential values of those fields are so you can decide which to keep. Here is an image example I mocked up...

View attachment 1098682
Oh, I'm sorry, I misunderstood what you were trying to do with arguments, this is my lack of programming knowledge in action. That might actually be doable. You can use those previously mentioned datatypes as arguments in some math. On that wiki you can find things like [Multiply_CFixedPoint()], and you can (theoretically) get it to combine values and output the result. I have tried just now to get it to work as an example, but I have not been able to. I've experimented with it before, and I've always struggled to get it to work. I don't know if you can only mod it to do math with script_values, or if it can work with any values in the game, but it's always frustrated me. There's another wiki page on GUI editing, though, and it is quite helpful.

Here is an example from the files of Multiply_CFixedPoint() being used in vanilla:

"[Multiply_CFixedPoint( Character.MakeScope().ScriptValue( 'character_chance_of_victory' ), '(CFixedPoint)100' )]"

If you can't figure it out based on what's available in vanilla, sometimes looking at other mods can be very helpful. Basically anything by UberEpicZach (The Catholic Trinity was helpful for me) is useful, but there are a lot of brilliant modders who know how to use these things properly, and looking for popular mods that change the GUI is a good way of finding new ways to do things.

So, by editing the localization of HOLDING_TAX_VALUE to read:

Code:
    HOLDING_TAX_VALUE: @gold_icon! [Holding.GetIncome|2]\n#color_gray (2.23)#!
    # \n gives you a new line, and then replace 2.23 with the math if you can get it to work.

You can get it to visually look like this:

2024-03-20 17-25-12 - .png


And then instead of the hard value I randomly put in as 2.23, change that part after the \n to do the math to calculate the difference that is applied to tax via control loss (I am truly terrible at math, so I have no idea how to get the reverse percentage of a number, but I'm sure it's possible). You can also chain those things together. Like Multiply_CFixedPoint() only takes two arguments, but one or both of those can be other arguments, I think.

And of course, though my example is very ugly, you can fix the visual ugliness of it by making the GUI fit the numbers so it's not so cramped.
 
  • 1
  • 1Like
Reactions:
Well, I can't figure out how to get the percentage the amounts are reduced. They are listed in the tooltip which I found here:

game\localization\english\holdings_l_english.yml
YAML:
 DOMAIN_LIMIT_OVERRUN_LEVY_PENALTY:0 "@warning_icon! #X Reduced by $VALUE|-%0$ due to being above [domain_limit|E]#!"
 DOMAIN_LIMIT_GRACE_PERIOD_LEVY_PENALTY:0 "@warning_icon! #X Due to being above [domain_limit|E], newly acquired holdings provide no levies#! $EXPIRES$"
 COUNTY_CONTROL_LEVY_PENALTY:0 "@warning_icon! #X Reduced by $VALUE|%0$ due to low [county_control|E]#!"
 FURTHER_COUNTY_CONTROL_LEVY_PENALTY:0 "@warning_icon! #X Further reduced by $VALUE|%0$ due to low [county_control|E]#!"
 COUNTY_CONTROL_TAX_PENALTY:0 "@warning_icon! #X Reduced by $VALUE|%0$ due to low [county_control|E]#!"
 FURTHER_COUNTY_CONTROL_TAX_PENALTY:0 "@warning_icon! #X Further reduced by $VALUE|%0$ due to low [county_control|E]#!"
 DOMAIN_LIMIT_OVERRUN_TAX_PENALTY:0 "@warning_icon! #X Reduced by $VALUE|%0$ due to being above [domain_limit|E]#!"
 DOMAIN_LIMIT_GRACE_PERIOD_TAX_PENALTY:0 "@warning_icon! #X Due to being above [domain_limit|E], newly acquired holdings provide no tax#! $EXPIRES$"

However, those entries (like DOMAIN_LIMIT_OVERRUN_LEVY_PENALTY) are not referenced anywhere else in the editable files. The only other reference appears to be in ck3.exe. So I don't think the value provided to $VALUE for those entities is exposed. Additionally, it wouldn't even work for the domain limit grace period penalties as you would be dividing by 0 since they are reduced 100%. So I am thinking this isn't doable after all.
 
  • 1
Reactions:
The only way I can see this may still be possible is if I was able to figure out the exact formula used in the GetIncome method and recreate it. This would only work if by some miracle all of the needed components of the formula were exposed for me to access which I highly doubt they are. For example, I don't see a way to get the buildings in a holding. There is a GetDuchyBuildingType and GetPrimaryBuildingType but there can certainly be more than 2 buildings in a holding. On top of that, those methods return the datatype of Building but there is no Building datatype defined in the datatypes!?!

edit: I ran the DumpDataTypes command and it does have the Building datatype. There is nothing exposed in the Building datatype that would allow me to determine how a building affects the tax and levy rates. So I think that is the final nail in the coffin on this mod idea.
 
Last edited:
  • 1
Reactions: