• 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.
Showing developer posts only. Show all posts in this thread.
Quick question, I just bumped into something I haven't noticed before while writing CK2 Events. From what I have been able to collect it seems like some people put their localization strings within quotation marks, and I can't seem to figure out why the hell they are doing it. Does anyone have a clue?

Code:
# Blackmail or not
letter_event = {
    id = 7255
    desc = "EVTDESC7255"
    picture = GFX_evt_whispers
   
    hide_from = yes
   
    is_triggered_only = yes
   
    option = {
        name = "EVTOPTA7255"
        ai_chance = {
            factor = 75
            modifier = {
                factor = 2
                NOT = { opinion = { who = FROM value = -25 } }
            }
        }
        FROM = { letter_event = { id = 7260 days = 1 tooltip = "EVTTOOLTIP7260" } }
    }
    option = {
        name = "EVTOPTB7255"
        ai_chance = {
            factor = 25
            modifier = {
                factor = 0
                NOT = { opinion = { who = FROM value = -50 } }
            }
        }
    }
}

Now the natural question would obviously be, why the hell would someone ask a question like this. Which also happens to be a question I'll quite happily answer!

For the last couple of days I've been working on a tool which converts the localization strings of an Event file and puts it in a .csv for you! So far it's working out pretty much as expected, but I'd like to ensure that it works with as many ways of creating localization as possible, and therefore knowing why some mod developers (and even Paradox employees mind you!) do this.

Looking forward to understanding this part of the localization process!
Stroopwaffel
It makes no difference, probably gets done by some as an old habit.
 
I can post all of the scripting, however there is a hefty amount and it could be a hassle to read through all of it.
Code:
#crown_parthava
    crown_parthava = {
        is_high_prio = yes
        desc = crown_parthava
      
        potential = {
            is_playable = yes
            culture = tocharian
            OR = {
                tier = KING
            }
            OR = {
                religion = zoroastrian
                religion = mazdaki
                religion = manichaean
            }
            OR = {
                has_landed_title = k_persia
            }
            e_parthava = { has_holder = no }
          
            NOT = { is_nomadic = yes }
            NOT = { is_tribal = yes }
        }
      
        allow = {
            war = no
            is_adult = yes
            culture = tocharian
            OR = {
                religion = zoroastrian
                religion = mazdaki
                religion = manichaean
            }
            NOT = { trait = incapable }
            prisoner = no
            prestige = 1500
            wealth = 1200
            NOT = { tier = EMPEROR }
            has_landed_title = k_persia
            NOT {
                OR {
                    primary_title = { title = e_persia }
                }
            }
            completely_controls = d_tabaristan
            completely_controls = d_khorasan
            completely_controls = d_hamadan
            realm_size = 100
        }
      
        effect = {
            set_character_flag = crown_parthava_flag         
            #set the capital to Gurgan if not already
            if = {
                limit = {
                    NOT = {
                        capital_scope = { province_id = 633 }
                    }
                }
                633 = { #Gurgan
                    ROOT = { capital = PREV }
                }
            }
          
            # set the new capital culture to tocharian, also religion
            capital_scope = {
                if = {
                    limit = {
                        NOT = { culture = ROOT }
                    }
                    culture = ROOT
                }
                if = {
                    limit = {
                        NOT = { religion = ROOT }
                    }
                    religion = ROOT
                }
            }
          
            prestige = 3000
          
            wealth = -1200
          
            character_event = { id = PH.0001 }
        }
      
        revoke_allowed = {
            always = no
        }
      
        ai_will_do = {
            factor = 1
        }
    }

As it stands, I think this is where the problem is, but I can post more if you need it.
As Rydelfox said, I fail to see the part here that gives out the title. Unless that part is in the event?
 
Is it possible to change mercenary title religion by effect? The wiki doesn't seem to have any entry for it, and the religion effect only scopes to character/province according to it.
Yep it does work, you can change the religions of title with the religion effect. A fix for an issue in 2.8 does exactly this.
- Fixed being able to found a Holy Order as a heresy that has become the orthodoxy but not be able to raise the Holy Order
Code:
immediate = {
    activate_title = { title = d_holy_sepulchre status = yes }
    create_character = {
        random_traits = no
        dynasty = random
        religion = ROOT
        culture = greek
        female = no
        age = 31
        trait = brilliant_strategist
        trait = zealous
        trait = humble
        trait = ambitious
        trait = strategist
        trait = holy_warrior
    }
    new_character = {
        wealth = 500
        d_holy_sepulchre = {
            grant_title = PREV
            religion = PREV ################Changing the religion of the title so the heresy that has become the new main can use the holy order
        }
 
I haven't tried modding Vic 2, but in CK2 and EU4 the quotes indicate a literal string. Without the quotes, it's treated as a localisation key.
Not strictly true, even with quotes it still looks for the loc key first. For example many of the options in the feast events use name = "KEY" and it prints the appropriate loc instead of the literal string of the key name.
 
Can anyone think of a reason why the following fails to identify a child of FROM residing at ROOT's court as being FROM's child?

Code:
        third_party_potential = {
            is_child_of = FROM
            NOT = { is_child_of = ROOT }
            prisoner = no
        }
The third_party_potential scope set up is ROOT = decision target, FROM = decisions taker and FROMFROM = the third party. You start off in the ROOT scope. So if you want to check the third party as being a child of FROM and not a child of ROOT you would need to wrap your current conditions in a FROMFORM = { } scope. As otherwise you are currently checking ROOT is a child of FROM and not a child of ROOT.
 
That's what the documentation says, and I previously did just that based on the documentation, but the problem is that it doesn't actually work that way in-game. Rather, when the conditions are wrapped in a FROMFROM scope, the game persistently evaluates FROMFROM as being both a child of and not a child of ROOT, thereby negating itself. I have now tested this in multiple playthroughs, and the result is always the same. For some reason, the game is treating FROM and ROOT as identical in the following block:
Code:
        third_party_potential = {
            FROMFROM = {
                is_child_of = FROM
                NOT = { is_child_of = ROOT }
                prisoner = no
            }
        }
It does work that way. Your issue is because the FROM in the is_child_of condition is not the original FROM. It is the FROM as you are in FROMFROM which evaluates to the original FROMFROMFROM which is undefined.
You need to do:
Code:
third_party_potential = {
    FROMFROM = {
        is_child_of = ROOT_FROM
        NOT = { is_child_of = ROOT }
        prisoner = no
    }
}
That is why ROOT_FROM chains exist, so you can get back to the original FROMs in one scope change or as a right hand side. Which is especially useful for the third party decisions.
Look at the third_party_potential chinese_grace_offer_concubine, for the is_close_relative_or_same_dynasty_tt custom_tooltip we do is_close_relative = ROOT_FROM etc. to check against the original FROM and not the one you get when you start nesting them.
 
Um… is there a guide or at least a list of this sort of "all caps scopes"? There are exactly 2 results of ["ROOT_FROM" crusader kings] on Google disregarding duplicates, one is a Reddit post that is similarly confused, and the other looks like somebody's mod repository.
They are very straight forward.
Code:
FROMFROM means FROM = { FROM = {
FROMFROM = { FROM = { means FROM = { FROM = { FROM = {

So if you want to get back to the very first from you would have to do:
Code:
FROMFROM = { ROOT = { FROM = {
But with the ROOT_FROM chains you can just do
Code:
FROMFROM = { ROOT_FROM = {

The ROOT_FROM chains can also be used as the right hand side of something as it is only one scope change as you cannot have scope chains as a right hand side.
So if you wanted to do
Code:
is_child_of = ROOT = { FROM = {
That would not work. Instead you would do
Code:
is_child_of = ROOT_FROM

In total the base scopes are:
  • THIS
  • ROOT
  • FROM chains
  • ROOT_FROM chains
  • PREV chains
  • event_targets
event_targets are a bit different in that they must be explicitly set whereas the others are context based.
 
Okay I just checked, and it turns out my custom localization on laws still works.
This got me really worried now, that for some ridiculous reason province modifiers are no longer allowed to have custom localization. Or, more likely, it might be a bug.

Anyway, since probably very few people would know about this, because it's not really the mainstream modding approach, I'm asking @blackninja9939 or one of you other dev guys directly: Can you give me any insight about this problem? And please tell me there is a fix...
I am not aware of anything about custom localisation changing with regards to province modifiers, what exactly are you doing that no longer works?
 
Can anyone figure out why this title does not show up in the game? It should show up as a titular title when using the title search in game but it does not for some reason.


Code:
k_thracia = {
    color = { 69 40 143 }
    color2 = { 255 255 23 }
  
    culture = greek
    pentarch = b_hagiasophia
    capital = 496    #Byzantion
    allow = {
        OR = {
            ai = no
            culture = greek
            NOT = {
                tier = king
            }
        }
    }
    orthodox = 5000 # Crusade target weight
    catholic = 2000 # Crusade target weight
    zoroastrian_group = 100 #Crusade Target Weight
}
pentarch = barony is not valid in a title.
You need to specify pentarchy = yes/religion in the barony's definition itself.
 
Hey, just asking again, has anybody here had any luck adding new decisions to the new Offmap Power menu? I've kept trying, but I can't seem to add decisions to any of the buttons there.
Make sure to specify which button you are actually adding it to like the vanilla decisions have.
 
Thanks for the quick reply. I have, and I posted my code just a couple pages back. My decision isn't showing up under the gifts menu. I've based it off the vanilla gift decision, and I spent some time stripping down the decision to it's most basic form, trying to find out what's going wrong. This is what I've got right now:

Code:
#PAYING TRIBUTE DECISIONS (GAIN GRACE)
offmap_decisions = {

    spirit_grace_send_gift = {
        only_playable = yes
        button_name = offmap_gifts
        ai_check_interval = 12

        potential = {
            is_offmap_tag = offmap_spirit_world
        }

        from_potential = {
            mercenary = no
            holy_order = no
            is_landed = yes
        }

        allow = {
            FROM = {
                show_scope_change = no
                scaled_wealth = { value = 4 min = 500 }
                prisoner = no
                NOT = { trait = incapable }
                is_inaccessible_trigger = no
            }
        }
        effect = {
            FROM = {
                sound_effect = china_grace_gain
                scaled_wealth = { value = -4 min = -500 } #If this changes the ai chances should probably be adjusted
            }
        }

        revoke_allowed = {
            always = no
        }

        ai_will_do = {
            factor = 1
            modifier = {
                factor = 0.1 # slow down
            }
            modifier = {
                factor = 0.1
                FROM = { NOT = { monthly_income = 11 } } #I.e. it would take more than 4 years to collect the 500 gold
            }
        }
    }
 
}
Have you made sure to have that button actually be in your offmap?
 
It's listed in the entry of the my offmap power.

Code:
buttons = {
        offmap_gifts = {
            is_active_trigger = {
                always = yes
            }
        }
        offmap_boons = {
            is_active_trigger = {
                offmap_spirit_world_boon_decisions_enabled_trigger = yes
            }
        }
        offmap_hostility = {
            is_active_trigger = {
                offmap_spirit_world_hostile_decisions_enabled_trigger = yes
            }
            display_trigger = {
                NOT = { offmap_spirit_world = { offmap_ruler = { dynasty = FROM } } }
            }
        }
        offmap_hostility2 = {
            display_trigger = {
                always = no
            }
        }
    }
And it is using the interface that has one of those with it?
 
It's using the vanilla offmap_china interface, as far as I know. Everything on the interface appears, and supposedly works. It's just when I click the gift button, no decisions show up at all. Is there an interface file where I have to specify something more?

Code:
offmap_spirit_world = {
    name = spirit_world
    window_name = domestic_offmaps_window
    button_name = icon_offmaps_entry
    currency_name = TXT_GRACE
    currency_gain = monthly_grace
    currency_reset_on_dynasty_change = yes
    holder_title = title_spirit_emperor            # minor title used to identify a character as holder of this offmap power
    governor_title = d_fire_sages
    tier = emperor
    non_aggression_modifier = peace_deal_with_china
    coa_religion = earth_spirituality
    government = feudal_government
    beginning_of_history = 1.1.1
    sound = china_interaction_interface
    display_trigger = {
        always = yes
    }
Hmm in that case it is likely something in decision file or how you set up the file itself. Upload the actual files as otherwise you are probably not going to get anything useful.
 
I need a triggered-only event to fire every time a new character is created by decision/event, rather than born. Normally, I'd do this with an on_action; however, there doesn't seem to be one for this purpose. Is it possible to simulate an on_action for newly created characters, and if so, how might this be accomplished?
There is currently no on_action for it, your best bet otherwise is to find every instance of create_character and its education variants in the script files and for each one add/edit the new_character clause to fire the event you want on them.
 
Okay, does anybody else here use "any_dynasty_member_even_if_dead"? I'm on 2.8.1. Cuz no matter what I do, the effects I want to happen are shown in the tooltip but not actually exceuted.

Code:
targeted_form_cadet_dynasty = {
   
        is_high_prio = yes
       
        third_party = ROOT
        third_party_filter = dynasty
        show_third_party_potential = yes
       
        from_potential = {
            ai = no
        }
       
        potential = {
            ai = yes
        }
       
        third_party_potential = {
            FROMFROM = {
                show_scope_change = no
                is_descendant_of = ROOT
                is_female = no
                mother_even_if_dead = {
                    NOT = {
                        is_descendant_of = ROOT
                    }
                }
            }
        }
       
        third_party_allow = {
            FROMFROM = {
                is_descendant_of = ROOT
                is_female = no
            }
        }
       
        allow = {
            always = yes
        }
       
        effect = {
           
            ROOT = {
                dynasty = father_bastard
            }
           
            FROMFROM = {
                dynasty = ROOT
                any_dynasty_member_even_if_dead = {
                    limit = {
                        is_descendant_of = ROOT
                        is_female = no
                        mother_even_if_dead = {
                            NOT = {
                                is_descendant_of = ROOT
                            }
                        }
                    }
                    dynasty = ROOT
                }
            }
           
        }
       
    }

Even if I don't use the third party, as I said in https://forum.paradoxplaza.com/forum/index.php?threads/modding-quick-questions.589686/page-1631, "any_dynasty_member_even_if_dead" doesn't work. Not sure if bug or what.

Also, I tried using variables and count or whatever to keep track of a generation, but it doesn't work? Probably doing it wrong. Like I've brought a character from the dead to make targetable but it still doesn't work.

How exactly do you use "is_descendant_of" and "is_ancestor_of"? Is there a generation condition or limit? It's not on the official CK2 wiki. I want to limit the scope to a character's great grandfather or something like that instead of the 16 (generation) max that the developers said is the limit.

I just want to (properly; with dynasty tree view working; no unlinked characters)prune a dynasty after it has dispersed. And I want to distinguish between (bastard) maternal and paternal descendants.

This patch made me think that what I want is now possible. It's just the commands are not working or conditions are missing.

Like if I use "any_child_even_if_dead", it works right. But I have to keep repeating it over and over again. That's why I was so stoked for "is_descendant_of" and "is_ancestor_of".

"effect_even_if_dead" also doesn't work in my context?

Again, "any_dynasty_member_even_if_dead" shows what I want in the tooltip but it doesn't actually execute it.
If I've correctly grasped what you want then the issue is you are changing the dynasty of FROMFROM to be ROOT's then looking for their dynasty members to make ROOT's dynasty as well. Because you are doing FROMFROM first you then look through all the members of their new dynasty and make the into the same dynasty they already are. Move the dynasty change of FROMFROM themselves to be after you search for their dynasty members.

effect_even_if_dead is only for history entries not decisions etc.
 
I believe the problem is that you are displaying the variable in the event description. If I'm not mistaken, the event description is assembled *before* the immediate clause is run. Try displaying the variable in the option instead.
The immediate is run first
 
(TL;DR there is no "day" condition, for reasons beyond my comprehension, so you need to do crazy workarounds.)
Because it is a mostly useless condition, only good if you want a decision to be specifically available only one day of the week for a player. Events are not checked daily so it has no use there. Hence no remote vanilla need so it never got added in.
 
Well, that might be true.
But the want to fire Christmas on a specific day must sound logical, does it not? I mean, why are days there when they can't be accessed via code - we could just have the month defined in the interface and have it randomly switch to another month at some point.
No offense really, I understand this is not needed in vanilla, but imo it would greatly destroy immersion if a hypothetical Christmas event fires on the 3rd of December.
It would be a valuable modding addition, of which you have added many for the community lately. So why not consider this one as well? :)
Because events and decisions are not checked daily so there is no need for a daily condition outside of the player decision to have Christmas. Of which is odd as well as time frames in the game are inflated as well as people being incredibly likely to miss the time slot to take said decision unless they are constantly on the look out for a specific date.
The date can be accessed by the code, just not the script. Saying it could just all be months is ridiculous, there are things that do get updated daily. It would stupid for the AI to only do their updates every month so you the player can declare war on 30 people and they won't have responded in any form during that time.
It is on my to do list but it is by no means an important or particular useful condition to even have.