• 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.

CK2 Dev Diary #58: Modding and a bit of optimization

Good afternoon, all. I’m Magne “Meneth” Skjæran, the programmer on CK2. In the past I’ve written dev diaries about modding, optimization, and quality of life improvements, as well as last week’s dev diary talking about the life of a bug, and the one before that about what each role on the team is responsible for.

Summer is still ongoing, and most of the office is gone until the end of July, including the majority of the CK2 team. The show must still go on, so for these four weeks I’ll be writing most of the CK2 dev diaries.

Since most of the team being on vacation means that little development is happening, that means that these four dev diaries will be pretty light on info about the upcoming expansion and patch, but I hope to provide you with some interesting insights, info, and tidbits regardless.

Today, I’ll be talking about what we’re doing to make the game more moddable in 2.8. As a former modder, this is one of my favorite topics, and I’ve had the privilege to implement much of the functionality I’ll be mentioning.

I’ll also talk briefly about some optimizations we’ve made to the game to make it faster.
At the end of this diary, I’ll also share five changelog entries from the 2.8 patch chosen (mostly) at random.

Our Commitment
As I talked about in the Mods and Mod Telemetry dev diary, we consider mods and modders to be a great thing for CK2. Mods increase the longevity of the game by letting people tweak it to their liking, to explore alternate scenarios, and alternate realities. At the time of writing, just under half (48%) of all players who played yesterday were using at least one mod, up from 42% when I wrote the Mods and Mod Telemetry dev diary.
On top of that, a significant number of people at PDS are former modders.
Additionally, most things that make modders happy also makes our content designers’ work easier, or opens up new possibilities entirely.

As such, moddability has long been something we as a team have been dedicated to, and the 2.8 patch will be no exception to that.

Some Highlights
The moddability changelog (see the bottom of this post) in 2.8 will be massive, so I want to highlight a few features in particular that I think people will like:

- Most effects and triggers that take a number can now take a variable name instead, and will grab the variable from the current scope. E.G., "wealth = test_variable"

This adds a huge amount of flexibility to what can be done with variables. While before you couldn’t really use variables beyond localisation and comparisons, now you can use them in almost all numeric effects and triggers.

- Made the following console commands that before were only available to devs and beta testers available to everyone: guibounds, noai, join_society, leave_society, society_rank_up/down, society_currency, set_society_grandmaster, get_all_artifacts, activate_artifacts

Especially the first console command will be useful, which is why I mentioned it back in the Mods and Mod Telemetry dev diary.

- Targeted decisions now support having a 3rd party character or artifact

While before we had targeted decisions to allow you to select one other character that’s affected by a decision, now you can select a third. This can use all the same filters as the regular targeted decisions can, with the player selecting the target character or artifact from a list that contains the characters/artifacts that meet the decision’s third party potential. I’m looking forward to seeing what sort of stuff people will come up with based on this. It also supports a scriptable scoring system for the third party, which is used for sorting the list, and can also be referenced in script via variables.

- Now possible to store variables in the same manner as event targets; any variable starting with "local_" will work this way, meaning it'll persist as long as the event chain does, but not be accessible outside it

For any variable that’s only used for a single event chain, this means you no longer have to deal with resetting it once the chain is done.

- Uploading mods to Steam is no longer limited to 50MB

This is probably the change with the biggest immediate effect. Right now the max size of CK2 mods is significantly limited, but with 2.8 that will be a thing of the past.

- Effect and trigger scope changes now have an optional "show_scope_change" parameter. If set to "no", the scope change won't be shown in the tooltip. It'll be shown as just "effect description" rather than "scope change: effect description". This functionality isn't supported by any/random scopes.

While purely visual, this can in many cases result in much nicer looking tooltips.

- Added "conditional_tooltip"; defines when a given piece of trigger script should be displayed. Its contents are only evaluated if it is displayed

If you’ve ever had a trigger that varies based on someone’s tier, you’re likely to have wanted this. With this you can make sure only the trigger that’s relevant for the current situation is displayed, significantly reducing the size of many tooltips. In vanilla it is also useful for requirements that vary based on DLC.

- Absolutely all tooltips now support custom loc. Generally, "Root" will be the player

This means that custom loc that only depends on the viewer will now work nearly everywhere, which should make showing what you want a lot easier.

- All numerical triggers now support comparison operators (>=, <=, <, >, and ==) with a few exceptions: tier triggers, among_most_powerful_vassals. These exceptions are due to operation triggers breaking existing behavior (E.G., "tier = duke" isn't equivalent to "tier >= duke", which the comparison operators assume)

This is something I’ve wanted to do ever since we introduced comparison operators, however the sheer amount of time it’d take has prevented it until now. This should make a lot of script cleaner, as well as opening up some new possibilities. Especially when combined with variables being usable as the right-hand-side.

- Added support for "else_if" and "else". If one of these is placed after an "if" or "else_if", it will be executed if the "if"/"else_if" limit returns false. Example
Code:
    if = { limit = { something = yes } do_something = yes }
    else_if = { limit = { something_else = yes } do_something_else = yes }
    else = { do_another_thing = yes }
This is another piece of functionality that was already possible to replicate in script, but incredibly tedious. Now, those horrible checks where you want to figure out which of several alternatives to use can be condensed significantly.

- Added a fail_trigger_effect field for events. This effect is triggered if script attempts to trigger an event, but the trigger isn't fulfilled. Useful for handling things like one character in a chain dying for unrelated reasons partway through the chain

Added on the same day as I’m writing this at Matthew Clohessy’s (GoT modder who is working as a content designer on CK2 for the summer) request, this should make handling event chains that could go awry due to unrelated happenings a lot easier.

Optimization
With the highlights of our modding improvements covered, let’s talk a bit about optimization.

While the speed increase won’t be nearly as big as the improvement that came with the 2.6 patch, we’ve spent several days making the game faster. In part, this was to make up for the addition of Tibet, but we didn’t simply stop when the game was once more as fast as 2.7.1.

Overall, the game is in my tests about 8% faster than 2.7.1, though the exact improvement will vary from machine to machine.

Here’s a list of some of the things we’ve done to achieve this:
  • Ported the GUI optimization HoI4 mentioned half a year ago
  • A number of other GUI optimizations, most notably making the outliner faster
  • Moved a number of things from serial evaluation to parallel evaluation
  • Avoiding a number of unnecessary updates to province and character modifiers. For example, acquiring an artifact with no effect will no longer cause the character’s modifier to refresh
  • Making courtiers check events less often (but still having the same overall chance to get them)
  • Eliminating a number of unused variables that were being pointlessly saved
  • Making the AI check a large number of decisions less often when it had a low chance of taking them. E.G., if it had a 1% chance of taking a decision each month, it’ll now generally have a 10% chance of taking it each year instead
  • Further reductions to the number of unnecessary characters generated. For example, when the AI wants to get rid of a barony it’ll now try to find someone appropriate to give it to, and only if that fails will it generate a random character
  • Various structural changes to code to make it more performant
All in all, this should result in a small, but noticeable, improvement to game speed.

Summary
Modding and game speed is very dear to us on the CK2 team, and thus something we’ve spent some time on improving for 2.8.

Now, as promised, here’s the modding changelog for 2.8. Note that some entries that relate to features that have not yet been revealed have been removed from the list. This list is also not final; more will almost certainly be added before 2.8 is released.

Code:
- Split the defines CONTESTED_TITLE_OCCUPIED_WARSCORE_BONUS and CONTESTED_TITLE_OCCUPIED_WARSCORE_BONUS_INDEP into attacker and defender version
- Split the 'ticking_war_score_multiplier' in Casus Belli scripts into 'att_ticking_war_score_multiplier' and 'def_ticking_war_score_multiplier'
- Added a new define for the effect of Fort Level on defender morale in sieges: FORT_LEVEL_MORALE_LOSS_REDUCTION_MULT
- Fixed a number of scopes not getting localised as effects, only as triggers
- error.log will now usually tell you if you've saved a map file in the wrong format
- The game will now crash slightly earlier if the province map is the wrong size (not a multiple of 64), making the issue easier to identify
- Cultures can now have "dynasty_name_first = yes" which puts the dynasty name before the personal name
- Added a "holding_types" folder in common. This can be used to define additional triggers for building each holding type
- The scaled_wealth trigger now supports "min" and "max" just like the scaled_wealth effect
- Fixed "effect" in history not being seeded, meaning that all effects with a random component would always produce the exact same result. Now the result will be properly randomized
- Build cost and build time modifiers now apply to forts, trade posts, and hospitals too. Note that there are still no type-specific modifiers for these three holdings
- on_heresy_takeover no longer creates a dummy character for the religion scope, but instead uses an actual religion scope
- "Religion" in loc while already in a religion will just return the same religion, to ensure that any loc written based on some on-actions using characters as makeshift religion scopes continue to work. The same has been done for "Culture" in culture scopes
- Most effects and triggers that take a number can now take a variable name instead, and will grab the variable from the current scope. E.G., "wealth = test_variable"
- gain_effect now fires in all cases (except history and death) for job titles and minor titles, including when added through script
- lose_effect or retire_effect now fires in all cases (except history and death) for job titles and minor titles. Being given a new job title will fire retire_effect on the old title, and gain_effect on the new title
- Fixed resigning as a commander firing lose_effect rather than retire_effect
- Added death_effect for job titles and minor titles, which fires when a character dies while holding the job/minor title
- Made the following console commands that before were only available to devs and beta testers available to everyone: guibounds, noai, join_society, leave_society, society_rank_up/down, society_currency, set_society_grandmaster, get_all_artifacts, activate_artifacts
- Added the console command "province_religion" or ("prov_rel") to change the religion of a province. Syntax is: "province_religion <province> <religion>"
- Targeted decisions now support having a 3rd party character or artifact
- Now possible to store variables in the same manner as event targets; any variable starting with "local_" will work this way, meaning it'll persist as long as the event chain does, but not be accessible outside it
- Uploading mods to Steam is no longer limited to 50MB
- Added the following targeted decision filters: court_including_me, home_court_including_me, dynasty_including_me, all_including_me, society_including_me, realm_including_me, sub_realm_including_me
- The regular versions of the above now consistently exclude the character themselves; in some cases before this restriction only applied if the AI was taking the decision
- Added max_defender_occupation_score and max_attacker_occupation_score modifiers for casus belli types
- Added documentation for the "aggression" parameter for governments
- Added a become_secret_heretic effect
- Added TRADE_ROUTE_SIEGE_MULTIPLIER and TRADE_ROUTE_OCCUPATION_MULTIPLIER defines
- Made the tributary system moddable and modular. You can now add new tributary types defining:
    - when and if the tributary relation breaks
    - what CBs the tributaries can use against their suzerain
    - The allowed_to_target_suzerains CB parameter no longer has any effect, as the above replaces it
    - if tributaries can unite together against their suzerain
    - if tributaries can fight against each other
    - if the suzerain can call their tributaries to arms, and if the tributaries are forced to join
    - if the tributaries can call their suzerain to their defense, and if the suzerain is forced to join
    - how much of what is paid by the tributary to the suzerain
    - What icon to use for the diplomatic relation
    - What modifiers to give the tributary
- You can now use the is_tributary trigger to check for a specific type, and a specific suzerain
- You can now use custom loc in the is_tributary trigger
- The set_tribute_suzerain now takes a "type" parameter, specifying the type. If none is specified, "default" is used
- Added set_trade_route_base_value and set_trade_route_value_multiplier effects
- Provinces with several trade routes will now show the presence and effect of all of them in their tooltip
- Effect and trigger scope changes now have an optional "show_scope_change" parameter. If set to "no", the scope change won't be shown in the tooltip. It'll be shown as just "effect description" rather than "scope change: effect description". This functionality isn't supported by any/random scopes.
- Added hostages_block_cb parameter for CBs
- Variables that haven't been set yet now work in localisation; they'll show "0" rather than simply being blank. "GetName" works as well. So [global_test.GetName] will return 0 for GetValue, and the "global_test" localisation for GetName
- Fixed the is_interested_in_society trigger not localising properly if negated, and not ending with a linebreak
- Added interested_in_society_of_character trigger
- Fixed empty "OR" triggers in some cases crashing the game on launch
- show_as_title = yes for minor titles now works even if the character has no titles
- Fixed a crash that could happen when a selectable object overlapped with an impassable province
- Fixed setting someone's employer on the same date that employer becomes landed not working properly
- Fixed capital changes in some cases failing if the county holder became holder on the same day as the capital change
- Added as_if_allied_to parameter for gain_settlements_under_title, vassalize_or_take_under_title, subjugate_or_take_under_title, and vassalize_or_take_under_title_destroy_duchies. This ensures that land occupied by people in that character's war against the title's holder can be taken
- Castes can now be enabled for individual religions rather than being hardcoded to the Indian group. This is done using the "castes" parameter
- Removed various hardcoding associated with the Hindu religion. This is now connected to the "caste_opinions" parameter instead
- The subjugation opinion is no longer applied when using vassalize_or_take_under_title, just subjugate_or_take_under_title
- Added event pretrigger for Game Book
- Decisions can now have a "_desc_extra" localisation key defined. This will be shown after the Requirements section in its tooltip
- Added "conditional_tooltip"; defines when a given piece of trigger script should be displayed. Its contents are only evaluated if it is displayed
- Added government parameters gets_religion_opinion_penalties, gives_religion_opinion_penalties, and vassal_government_opinion_penalties. See _governments.info for documentation
- Added title parameters can_be_claimed and can_be_usurped. See 00_landed_titles.info for documentation
- You can now use "extended" (bracket-based) localization in Artifact scopes:
    - [GetName] will display the name
    - [Owner] will rescope to the current owner of the artifact
    - [OriginalOwner] will rescope to the original owner of the artifact
- There is now an AI exclusion pretrigger in decision "ai = no" that can be used to avoid decisions being considered by the AI at all
- Removed the "coalition_threat" CB parameter as it had nothing to do with coalitions
- Fixed rulers in some cases being considered to have no primary holding on the day of their death when going backwards in history
- Added console commands "print_global_flags" (aka "pgf") and "print_global_variables" (aka "print_global_vars" and "pgv"). They print whatever they're named after
- "character_info" aliased to "debug_mode" since it is used by more than just character to display debug info
- Added "attrition" character modifier. This will reduce/increase the attrition suffered by the army they command. It is capped at -99%
- Added "army_reinforce_rate" character modifier. This will make the army the character commands reinforce faster. Affects retinues and horde units as well, not just levies. Does not affect the reinforcement of the settlement itself. Cannot go below 0
- Added "days_of_supply" character modifier. This modifies the number of days of supply of the army the character commands by an absolute number of days. Days of supply cannot go below 1
- Added command modifiers phase_skirmish_attack, phase_pursue_attack, phase_melee_attack, phase_skirmish_defense, phase_pursue_defense, and phase_melee_defense
- Added scopes any_neighbor_independent_ruler and random_neighbor_independent_ruler. A "neighbor independent ruler" is a ruler that neighbors the realm you're in (E.G., the HRE if you're a count in the HRE)
- Added "demesne_size_compared_to_limit" trigger. For example, "demesne_size_compared_to_limit < 0.5" will check if someone is below 50% of their demesne limit
- Added "multiplicative_trade_post_income_modifier" holding modifier
- Added "can_create_empires" government parameter (can_create_kingdoms already exists)
- Added "extra_ai_eval_troops" title parameter. See 00_landed_titles.info for documentation
- Added "relative_realm_size" trigger. For example, relative_realm_size = { who = liege size > 0.2 } checks that your realm size is at least 20% of your liege's
- Strings that are too long (above 1023 characters) will no longer crash the game, though they should still be avoided as they simply don't work beyond 1023 characters. This should also solve crashes involving mismatched quote signs
- Strings that are too long now get logged in error.log
- The game will no longer crash if more than 32767 flags (E.G., set_character_flag) are used. New limit is 2^32, which you will run out of memory long before reaching
- Using export_to_variable on a dead character will no longer crash the game
- has_coa_on_barony_only can now be set to yes/no on individual religions rather than just groups. This will override whatever has been set for the group
- The "give_title" console command now gives more feedback if something is wrong with the parameters
- Absolutely all tooltips now support custom loc. Generally, "Root" will be the player
- Most text directly related to religion (E.G., religion name, description, holy war name) now provide the religion itself for custom loc purposes
- Added a "RelHead" promotion for religion loc, meaning you can now for example name a religion "Cult of [RelHead.GetFirstName]"
- Added optional generate_tooltip parameter for hidden effects. If set to "no", the game won't generate the tooltip at all. Note that if event targets are set in the hidden effect, this will break them in tooltips. It may also break randomization, so only ever use it if you have a really compelling reason to do so
- Added 'add_modifier' and 'remove_modifier' console commands (for Character Modifiers.)
- Added 'decision' console command, which ignores the trigger conditions
- Stewardship no longer applies a debuff when below 5; 0 is its baseline now like all the other stats
- Added 'realm_levies_plus_allies' as an exportable value for the 'export_to_variable' effect.
- Added a Define for Looter army maintenance cost (LOOTER_ARMY_MAINT_MULT)
- random_list chances below 1% but above 0% will now use 2 decimals rather than 0
- The game will now log invalid tributary relationships in history (E.G., someone being a tributary of a title with no holder)
- Fixed looting for raiding adventurers not of a religion/culture/government that allows raiding not working
- If the flag "always_show_in_marriage_selection" is set on a character, they will bypass most conditions to be shown in the marriage selection view. Note that this does *not* allow otherwise illegal marriages, just ensures they show up in the listing
- Fixed observing unplayable characters instantly booting you back to regular observe mode
- Fixed the "completely_controls" trigger not considering empty non-wasteland provinces
- Fixed scoping to event targets in effects not being properly localised, thus showing just a colon with no name before it
- Added "ai_check_interval" parameter for decisions. This determines how rarely the AI checks a given decision, and can be useful for performance-heavy decisions that don't need to be checked often. See 00_decisions.info for documentation
- Added a "shares_realm_border_with" trigger. Checks if any province in your realm (everything under your titles) borders any province in their realm
- Added COALITION_THREAT_MAX_DISTANCE define. Independent AIs will consider independent rulers within this range to be threats if they're strong enough (COALITION_SCARY_TROOP_STRENGTH_THREAT_RATIO)
- "Added COURTIER_EVENT_PROCESS_OFFSET define, which determines how often courtiers check MTTH events. Set to 50, as compared to 20 for rulers". This changelog entry from 2.7 now actually has an effect
- Added num_of_society_members trigger. Scope must be a character or society. Returns true if the society has at least this many members. Also supports <, <=, ==, and >=
- A lot of error messages that previously only showed in the internal beta .exe now get logged at all times
- Added "hire_range" parameter for mercenary titles. If set, this overrides the MERCENARY_HIRE_DISTANCE_THRESHOLD define for that specific mercenary
- Added "can_demand_religious_conversion" government parameter. Decides whether people with the government can use the Demand Religious Conversion interaction. Defaults to yes
- create_character now supports "dynasty = actually_culture" which picks a random dynasty name from the culture if there's no unused static dynasty to use, rather than just resorting to a random holding in the world (what "dynasty = culture" does)
- Now possible to scope to timed modifiers in localisation. For example, if ROOT is a character, [Root.modifier_name.GetExpiryDate] would show the expiry date of the modifier. If no such modifier is present, nothing gets shown. Also supports "GetName"
- random_direct_de_jure_vassal_title now exists. Works like any_direct_de_jure_vassal_title, except picks one at random
- Fixed start_date and current_date checking that the days are equal rather than equal or greater
- All numerical triggers now support comparison operators (>=, <=, <, >, and ==) with a few exceptions: tier triggers, among_most_powerful_vassals. These exceptions are due to operation triggers breaking existing behavior (E.G., "tier = duke" isn't equivalent to "tier >= duke", which the comparison operators assume)
- Added "unsafe_destroy_artifact" effect, which can destroy indestructible artifacts
- Artifact localisation (E.G., name and desc) now provides the artifact as From
- The artifact activation and gift triggers now provide the artifact as From
- Added support for "else_if" and "else". If one of these is placed after an "if" or "else_if", it will be executed if the "if"/"else_if" limit returns false. Example:
    if = { limit = { something = yes } do_something = yes }
    else_if = { limit = { something_else = yes } do_something_else = yes }
    else = { do_another_thing = yes }
- Added trigger "artifact_can_be_gifted_to = ROOT", which checks if the artifact currently scoped to can be gifted to the target character
- Now possible to specify "sound = no" for death reasons, which will prevent killing someone with that reason causing a death sound
- Fixed FROMFROM (the holding title) not always being available in the building trigger
- Fixed whatever character is FROM getting included in event option portrait lists if you scope to something that isn't a character
- Improved the error messages for the reload_texture command, and made it more forgiving when it comes to "/" vs. "\\" and ".dds" vs. ".tga". Also fixed it in some cases crashing. Generally, simply copying the path specified in the .gfx file should work
- Added COST_COMBAT_RATING define for specifying the cost of combat rating in the ruler designer
- Added unsafe_impregnate and unsafe_impregnate_cuckoo effects. These can impregnate someone who is already pregnant, while the two old effects are no longer able to do so
- Added a fail_trigger_effect field for events. This effect is triggered if script attempts to trigger an event, but the trigger isn't fulfilled. Useful for handling things like one character in a chain dying for unrelated reasons partway through the chain
- Fixed not all parts of the society rank tooltip having the appropriate scopes set
- spawn_unit can now take "province = closest_to_capital", which will spawn as close to the character's capital as possible
- The "debug_mode" console command (AKA "charinfo") will now also show extra information about titles

I hope you’ve found what we’re doing for modders in 2.8 interesting.

And as promised, here’s five entries from the 2.8 changelog:
- Told the AI that if it is the attacker in a war, it *might* be a good idea to actually go attack the defender even if you're targeting their whole realm rather than a specific title within it, and it is a bit of a long walk
- The holy site icon for heresies are now shown in the holding view if their parent religion does not have the same holy sites (E.G., Ibadi and Manichean holy sites)
- Fixed the retinue screen showing the Horse Archer icon even if your retinues are composed of another special unit
- Armies now use whichever flank leader has the best siege modifier for determining the leader bonus to sieges, and the best movement speed flank leader for determining movement speed
- Raiding adventurers now realize once they've been settled that maybe, just maybe, they should consider their new realm their base of army operations, and return armies there when they're not up to anything

That’s all for this week. Next week I’ll be handing the reins over to Gustav “Gruffa” Groth, CK2’s Product Manager, who will tell you about what he and the publishing wing of Paradox does for CK2.
 
Nice Dev Diary thanks.
For other people, when Meneth talked about HoI UI Optimizations imported to CK2, he meant the entry on the bottom of the HoI IV Dev Diary Post:
There is one last that is my favorite. In our Clausewitz engine, there was an old code loop that nobody ever dared to touch. It was processing all the user interface elements in a "flat manner" instead of the "tree hierarchy". This means, that the more windows and buttons we add to the game, this loop was heavier and heavier. And the windows didn't even had to be shown for it to slow down the game. We always knew about this infamous spot, however reworking it without breaking all the interfaces was nearly impossible. Until now. I found the way! Previously that code loop had ~120 000 passes in each frame, now it's under 700, processing only the necessary interface elements. By that I mean, when you are looking at the technology trees, we are not processing through the hidden production windows and buttons, etc.
 
OT: When you say GUI optimisations, does that change the way something is displayed or just how often stuff displayed is calculated? Or both?
Bit of both. The optimization I ported from HoI4 is (sort of) the former. The optimization to the outliner is mostly the latter; basically making sure that elements of the list are kept rather than deleted and readded constantly (some of the elements already had this persistent behavior, but not all).
 
I have to be honest @Meneth Gehimisnacht already had many of the variable and scripting functions already done via complex scripting, so 2.8 will now create at least three months work on my part just revising old code... On the other hand, I am very excited about local_ variables. Could you possibly btw take a look at using the set_flank_tactic command inside an army flank and not just on a flank commander? At the moment, we have the issue that without a flank commander we cannot set a tactic manually. Further, could you also look at the damage_unit commands? With the troops command, we can set a positive value, and thus restore dead troops. However the damage_unit command will not accept a negative value which will heal the unit. It would be most appreciated if you could add this functionality.
 
Awesome to see the 50mb cap on Steam Workshop lifted. A lot of great mods are going to finally get releases there. Are there any plans in the future to make uploading/updating mods there easier? In newer titles like Stellaris, mods can be uploaded/updated from the launcher, and is a far smoother and easier process than doing it in-game in Crusader Kings 2.
 
I have to be honest @Meneth Gehimisnacht already had many of the variable and scripting functions already done via complex scripting, so 2.8 will now create at least three months work on my part just revising old code... On the other hand, I am very excited about local_ variables. Could you possibly btw take a look at using the set_flank_tactic command inside an army flank and not just on a flank commander? At the moment, we have the issue that without a flank commander we cannot set a tactic manually. Further, could you also look at the damage_unit commands? With the troops command, we can set a positive value, and thus restore dead troops. However the damage_unit command will not accept a negative value which will heal the unit. It would be most appreciated if you could add this functionality.
Looking at the code, set_flank_tactic should only work inside an actual army flank.
The damage_unit command I can definitely change.
 
@Meneth was there any news as well btw on getting an artifact_is_equipped condition? That seems like a really important one. Is there also any chance to get the army damage combat_modifiers as modifiers for a character as well? I had asked @Divine about it last year, and the report was that letting the combat_modifier blocks work on characters would be a performance hog. But seeing things like the attrition modifier for characters encourages me that it might be a good thing to have a number of the combat_modifier block modifiers as direct character effects, notably the army_speed modifiers and the modifiers for damage/morale/defense.
 
Looking at the code, set_flank_tactic should only work inside an actual army flank.
The damage_unit command I can definitely change.
That's odd then. If you use the set_flank_tactic inside a flank which lacks a flank commander, it will not set the tactic. That would based on your comment appear to be a bug.

below is an example used from Gehmisnacht that works. To get it working, I had to trigger it from within the leader scope of the army. Otherwise it would not apply to the flank.

Code:
random_army = {
            limit = {
                location = { province = event_target:spellloc }
            }       
            leader = {
                combat = {
                    if = {
                        limit = {
                            flank_has_tactic = lore_of_heavens_balanced_tactic_2
                        }
                        set_flank_tactic = lore_of_heavens_balanced_tactic_2
                    }                 
                    if = {
                        limit = {
                            flank_has_tactic = lore_of_heavens_balanced_tactic_1
                        }
                        set_flank_tactic = lore_of_heavens_balanced_tactic_2
                    }
                    if = {
                        limit = {
                            flank_has_tactic = lore_of_heavens_balanced_tactic
                        }
                        set_flank_tactic = lore_of_heavens_balanced_tactic_1
                    }
                    if = {
                        limit = {
                            nor = {
                                flank_has_tactic = lore_of_heavens_balanced_tactic
                                flank_has_tactic = lore_of_heavens_balanced_tactic_1
                                flank_has_tactic = lore_of_heavens_balanced_tactic_2
                            }
                        }
                        set_flank_tactic = lore_of_heavens_balanced_tactic
                    }
                }
            }
 
Last edited:
@Meneth was there any news as well btw on getting an artifact_is_equipped condition?
It's something I want to add in 2.8, but as it hasn't been done yet I can't make any promises.
Is there also any chance to get the army damage combat_modifiers as modifiers for a character as well? I had asked @Divine about it last year, and the report was that letting the combat_modifier blocks work on characters would be a performance hog. But seeing things like the attrition modifier for characters encourages me that it might be a good thing to have a number of the combat_modifier block modifiers as direct character effects, notably the army_speed modifiers and the modifiers for damage/morale/defense.
One issue with moving old modifiers is that it'd break all existing script using them.
 
It's something I want to add in 2.8, but as it hasn't been done yet I can't make any promises.

One issue with moving old modifiers is that it'd break all existing script using them.

Would it as a result be easier to make a new modifier which duplicates the function? The desire really is for doing something like applying a modifier based increase to army speed/damage/morale/defense that can have a timed duration and is capable of being stacked.
 
Would it as a result be easier to make a new modifier which duplicates the function? The desire really is for doing something like applying a modifier based increase to army speed/damage/morale/defense that can have a timed duration and is capable of being stacked.
Not really, no.
 
Not really, no.
Ah ok then, I would imagine that the modifiers in CKII right now are probably pretty labyrinthine. I will try just using the three flank scopes /centre/left_flank/right_flank with the set_flank_tactic btw, and see if it works for flanks without a leader. If it doesn't I will post here and tag you again if you don't mind?
 
Ah ok then, I would imagine that the modifiers in CKII right now are probably pretty labyrinthine. I will try just using the three flank scopes /centre/left_flank/right_flank with the set_flank_tactic btw, and see if it works for flanks without a leader. If it doesn't I will post here and tag you again if you don't mind?
Please do; it's a bug of some sort if it doesn't work I think.
 
Cultures can now have "dynasty_name_first = yes" which puts the dynasty name before the personal name

I love you! Finally Hungarians and Japanese can get proper names.

- Castes can now be enabled for individual religions rather than being hardcoded to the Indian group. This is done using the "castes" parameter

And this too!

- Added title parameters can_be_claimed and can_be_usurped. See 00_landed_titles.info for documentation

Very good!

- Added a "RelHead" promotion for religion loc, meaning you can now for example name a religion "Cult of [RelHead.GetFirstName]"

This sounds cool. Can be interesting for Rome and the Emperor Cult I think? Or some fantasy mods.
 
Last edited:
Please do; it's a bug of some sort if it doesn't work I think.
I think your problem might simply be that there's no way to scope to a flank except via its leader? There's left_flank_leader, but no left_flank.
 
Added 'decision' console command, which ignores the trigger conditions
This would be very useful to me, thanks.

- Cultures can now have "dynasty_name_first = yes" which puts the dynasty name before the personal name

So do Hungarian and East Asian cultures (such as Mongol and Khitan) has this in 2.8?
 
Last edited: