• 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.
Hi, I'm trying to set the graphical_culture of a child after birth to the graphical_culture of its father ( or real_father is existing). I made an on_action event which works fine, but somehow, the graphical_culture setting part in the option is not executed:

Code:
option = {
        name = OK
        if = {
            limit = {
                is_father_real_father = yes
            }
            father = { ROOT = { set_graphical_culture = PREV }}
        }
        if = {
            limit = {
                is_father_real_father = no
            }
            real_father = { ROOT = { set_graphical_culture = PREV }}
        }
    }

Can you maybe help me? Thanks :)
 
set_graphical_culture only accepts cultures.

Example
Code:
set_graphical_culture = german

This would set the character's graphical culture to "germangfx". To do what you want to do you'd need to do something like this;
Code:
    if = {
        limit = {
            is_father_real_father = yes
        }
        if = {
            limit = { father = { graphical_culture = germangfx } }
            set_graphical_culture = german
        }
    }

Repeating the ifs for each graphical culture. Until we get the elses anyway.
 
Last edited:
set_graphical_culture only accepts cultures.

Example
Code:
set_graphical_culture = german

This would set the character's graphical culture to "germangfx". To do what you want to do you'd need to do something like this;
Code:
    if = {
        limit = {
            is_father_real_father = yes
        }
        if = {
            limit = { father = { graphical_culture = germangfx } }
            set_graphical_culture = german
        }
    }

Repeating the ifs for each graphical culture.

Adding to this, it might be worth scripting a scripted effect to fix graphical culture in case you want to reuse it so you can call it with e.g. change_graphical_culture = yes instead of copy-pasting all the cultures again and having to update a multitude of references to it if new cultures are added. Ideally, you should set it up so that it works for any PREV and ROOT (e.g. "capital_scope = { ROOT = { change_graphical_culture = yes }", with change_grapical_culture looking for the culture of PREV).
 
Oh thank you. The wiki said the command was able to use cultures, characters and provines:

Sets the ethnicity of character, based on the default graphical_culture of a culture, or of the culture of another character or province.

Which is wrong I assume :(
 
Order of pre triggers matter?
What best order in most cases?

@blackninja9939
How to get variable in log?
Can I increase the number of provinces under the direct control for the nomads?
Any way to trigger artifact by slot (need to count only equipped things)?
Can i disable trade post for government type?
 
No it is not wrong the command does take a scope.

Well ... then I'm confused. If it actually can take a scope, why does code like this do not work for me?:

Code:
       if = {
            limit = {
                is_father_real_father = yes
            }
            father = { ROOT = { set_graphical_culture = PREV }}
        }

or even

Code:
 set_graphical_culture = father

What would be the correct syntax?
 
Well ... then I'm confused. If it actually can take a scope, why does code like this do not work for me?:

Code:
       if = {
            limit = {
                is_father_real_father = yes
            }
            father = { ROOT = { set_graphical_culture = PREV }}
        }

or even

Code:
 set_graphical_culture = father

What would be the correct syntax?

Did you try the script I suggested?
 
Yes I tried it and using it the way you have said it works. I'm more confused by @blackninja9939 who said the command actually could take a character or province scope as input - which would be a lot more elegant.

I completely understand.
EK uses the method I described as the scoping method didn't work properly 3 or 4 (5?) years ago when I first wrote the script, maybe it's been fixed but that method at least is proven to work. I'm sure @blackninja9939 will be around to post the correct method sometime ;)

It'd be great to simplify my own scripts if it works.
 
I completely understand.
EK uses the method I described as the scoping method didn't work properly 3 or 4 (5?) years ago when I first wrote the script, maybe it's been fixed but that method at least is proven to work. I'm sure @blackninja9939 will be around to post the correct method sometime ;)

It'd be great to simplify my own scripts if it works.
@Drakons @Korbah
It definitely works with scopes, maybe there is an issue with some specific scopes or in certain use cases but I tested it by just making a file in Documents/Paradox Interactive/Crusader Kings 2 called test.txt and added the following to it:
Code:
create_character = {
    random_traits = yes
    culture = english
    dynasty = ROOT
}
new_character = {
    ROOT = { 
        set_father = PREV
        set_graphical_culture = PREV
    }
}
Then get in game and start as a character who is say Muslim and type in the console "run test.txt" and you will get a newly generated father and your graphical culture will change to be his aka the English graphics.
 
@Drakons @Korbah
It definitely works with scopes, maybe there is an issue with some specific scopes or in certain use cases but I tested it by just making a file in Documents/Paradox Interactive/Crusader Kings 2 called test.txt and added the following to it:
Code:
create_character = {
    random_traits = yes
    culture = english
    dynasty = ROOT
}
new_character = {
    ROOT = {
        set_father = PREV
        set_graphical_culture = PREV
    }
}
Then get in game and start as a character who is say Muslim and type in the console "run test.txt" and you will get a newly generated father and your graphical culture will change to be his aka the English graphics.
Wait… you can do that? Just execute a text file of commands from the console? That is *so* cool! Is that in the production version, or just the dev build?
 
Wait… you can do that? Just execute a text file of commands from the console? That is *so* cool! Is that in the production version, or just the dev build?
Yep it is in the public build and has been for a few versions now, not sure when it was added though
 
I'm not very experienced in CK2 scripting, so I'm slightly confused by the ai_will_do clause regarding Casus Belli:
Casus Belli file comments said:
"#ai_will_do: modifies value AI places on the CB compared to other CBs (default: 1) Note: is in title scope"

does that mean that I can't use something like this:
Code:
 ai_will_do = {
factor = 0
       ROOT =
       {
           has_character_flag = peaceful_ai
       }
}

Because that is character scope, not title?

Basically, I want to make a (useful in MP) mod that allows the player to forbid the AI to declare war. I was going to put this check in the can_use section, but since there's an ai_will_do section, I thought it was potentially more convenient (albeit more difficult to test and be sure it is actually working).

Thanks in advance :)
 
I am trying to scope to two different random dead characters. I can scope to one of my dynasty without problem, but I am unable to scope to any dead character from some other random dynasty. Here is what works:

Code:
random_dynasty_member_even_if_dead = {
            limit = {
                is_alive = no
                is_female = no
            }
            save_global_event_target_as = NOX_dead_male_family
        }

Here are a couple of the things I have tried and failed in order to get some random dead guy:
Code:
random_character = {
            limit = {
                is_alive = no
                is_female = no
            }
            save_global_event_target_as = NOX_dead_male1
        }

Code:
any_character = {
            limit = {
                NOT = { is_lowborn = yes}
                random_dynasty_member_even_if_dead = {
                    limit = {
                        is_alive = no
                        is_female = no
                    }
                    save_global_event_target_as = NOX_dead_male1
                }
            }
        }

It would be easier if there was a "random_character_even_if_dead" or "any_character_even_if_dead" command, but both of those blow up the event.

I would greatly appreciate any help on how to do this.

Thanks!
 
I'm not very experienced in CK2 scripting, so I'm slightly confused by the ai_will_do clause regarding Casus Belli:


does that mean that I can't use something like this:
Code:
 ai_will_do = {
factor = 0
       ROOT =
       {
           has_character_flag = peaceful_ai
       }
}

Because that is character scope, not title?

Basically, I want to make a (useful in MP) mod that allows the player to forbid the AI to declare war. I was going to put this check in the can_use section, but since there's an ai_will_do section, I thought it was potentially more convenient (albeit more difficult to test and be sure it is actually working).

Thanks in advance :)
I'm not sure what scope it starts in, but if it's in a title scope, you can just change to the title holder's scope like this:
Code:
 ai_will_do = {
    holder_scope = {
            has_character_flag = peaceful_ai
    }
}
 
I'm not sure what scope it starts in, but if it's in a title scope, you can just change to the title holder's scope like this:
Code:
 ai_will_do = {
    holder_scope = {
            has_character_flag = peaceful_ai
    }
}

I don't know what scope it starts in. On the comments at the top of the file , it specifically notes that it "is in title scope". I would assume that means I have to do as you said, but checking another CB as example...
Code:
(stuff went before)
ai_will_do = {
       factor = 1
       modifier = {
           factor = 0
           ROOT = {
               opinion = { who = FROM value = 25 }
           }
       }
       modifier = {
           factor = 0.5
           ROOT = {
               opinion = { who = FROM value = 0 }
           }
       }      
       modifier = {
           factor = 0.5
           ROOT = {
               opinion = { who = FROM value = -25 }
           }
       }          
   }      
(stuff after)
Isn't that what is called character scope in CK2 scripting, what with the ROOT opinion, which implies ROOT is a character?
Again, I'm not experienced with CK2 scripting, just trying to understand if I got it right :)
 
  • ROOT is the character who has a case for war. (for both titles and character scopes)
  • FROM is the character who is being declared war on. (for both titles and character scopes)
http://www.ckiiwiki.com/Casus_Belli_modding#Scopes

So I assume you need to do something like this:

Code:
your_cb = {
  ai_will_do = {
    factor = 1
    modifier = {
      factor = 0
      ROOT = {
        has_character_flag = peaceful_ai
      }
    }
  }
}

However if you just want to overwrite all CB for your mp-mod just set
Code:
ai_will_do = { factor = 0 }
for any CB? no need to check a flag then.

-----------------------------

@NoxBestia

Code:
random_character = {
  limit = {
    is_lowborn = no
  }
  random_dynasty_member_even_if_dead = {
    limit = {
      is_alive = no
      is_female = no
    }
    # your code
  }
}

Does this work?
 
Last edited: