• 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.
reloadevents in the console should do it, will be a bit slow though as it will go through all of them. Might crash the game if you messed up an event file in the mean time.

You can also put a file in the Documents\Paradox Interactive\Crusader Kings II folder (not the mod folder!) and execute it with [ run filename.txt ] - ROOT will be the player character. So this is only useful for character events.
Thanks, that'll help :D

Another query, is there a way to find out if a given character has a father/mother? I thought this would do it, based on the logic that the "if" would fail if a father wasn't found, but it seems not to work, as the Global is apparently not being set.

Code:
father_even_if_dead = {
    if = {
     limit = {
      any_child = {
       character = ROOT
      }
     }
     save_event_target_as = Player_Father
     set_global_variable = Player_Has_Parents
    }
   }
 
Another query, is there a way to find out if a given character has a father/mother? I thought this would do it, based on the logic that the "if" would fail if a father wasn't found, but it seems not to work, as the Global is apparently not being set.
This is the code you should be using:
Code:
father_even_if_dead = {
       always = yes                   
}
This will return true if the scoped character has a father, and false if the scoped character has no known father.
 
This is the code you should be using:
Code:
father_even_if_dead = {
       always = yes                  
}
This will return true if the scoped character has a father, and false if the scoped character has no known father.

Thanks for the help, can you take a look at this code and tell me what's up with it? What it's meant to do is check if the Player character has a Father/Mother, and assign them a flag, then if either one is not found randomly generate and assign them. It seems to be working in that the defined father gets the 'Is_Player_Father' flag, but then a fake-father is still generated and replaces the real one.

Code:
father_even_if_dead = {
    save_event_target_as = Player_Father
    set_character_flag = Is_Player_Father
   }
   
   mother_even_if_dead = {
    save_event_target_as = Player_Mother
    set_character_flag = Is_Player_Mother
   }
   
   if = {
    limit = {
     NOT = {
      any_character = {
       has_character_flag = Is_Player_Mother       
      }
     }
    }
    create_character = {
     name="Unknown"
     age = 99
     dynasty=ROOT
     random_traits = no
     religion=ROOT
     culture=ROOT
     fertility = 0.50
     health = 5
     female = yes
    }
   
    new_character = {
     set_character_flag = Is_Player_Mother
     save_event_target_as = Player_Mother
     set_character_flag = Is_Special_Character
     set_graphical_culture = Culture_Unkown_Female
    }
   
    set_mother = event_target:Player_Mother
   
    event_target:Player_Mother = {
     death = { death_reason = death_natural }
    }
   }
   
   if = {
    limit = {
     NOT = {
      any_character = {
       has_character_flag = Is_Player_Father       
      }
     }
    }
    create_character = {
     name="Unknown"
     age = 99
     dynasty=ROOT
     random_traits = no
     religion=ROOT
     culture=ROOT
     fertility = 0.50
     health = 5
     female = no
    }
   
    new_character = {
     set_character_flag = Is_Player_Father
     save_event_target_as = Player_Father
     set_character_flag = Is_Special_Character
     set_graphical_culture = Culture_Unkown_Male
    }
   
    set_father = event_target:Player_Father
       
    event_target:Player_Father = {
     death = { death_reason = death_natural }
    }
   }
 
Thanks for the help, can you take a look at this code and tell me what's up with it? What it's meant to do is check if the Player character has a Father/Mother, and assign them a flag, then if either one is not found randomly generate and assign them. It seems to be working in that the defined father gets the 'Is_Player_Father' flag, but then a fake-father is still generated and replaces the real one.
This appears to be because you add a character flag and check if the character flag has been set in the same effect.
Try this modification:
Code:
   father_even_if_dead = {
    save_event_target_as = Player_Father
    set_character_flag = Is_Player_Father
   }
  
   mother_even_if_dead = {
    save_event_target_as = Player_Mother
    set_character_flag = Is_Player_Mother
   }
  
   if = {
    limit = {
      mother_even_if_dead = {
       always = yes
      }
     }
    create_character = {
     name="Unknown"
     age = 99
     dynasty=ROOT
     random_traits = no
     religion=ROOT
     culture=ROOT
     fertility = 0.50
     health = 5
     female = yes
    }
  
    new_character = {
     set_character_flag = Is_Player_Mother
     save_event_target_as = Player_Mother
     set_character_flag = Is_Special_Character
     set_graphical_culture = Culture_Unkown_Female
    }
  
    set_mother = event_target:Player_Mother
  
    event_target:Player_Mother = {
     death = { death_reason = death_natural }
    }
   }
  
   if = {
    limit = {
      father_even_if_dead = {
       always = yes
      }
     }
    create_character = {
     name="Unknown"
     age = 99
     dynasty=ROOT
     random_traits = no
     religion=ROOT
     culture=ROOT
     fertility = 0.50
     health = 5
     female = no
    }
  
    new_character = {
     set_character_flag = Is_Player_Father
     save_event_target_as = Player_Father
     set_character_flag = Is_Special_Character
     set_graphical_culture = Culture_Unkown_Male
    }
  
    set_father = event_target:Player_Father
      
    event_target:Player_Father = {
     death = { death_reason = death_natural }
    }
   }
 
Thanks for the help, can you take a look at this code and tell me what's up with it? What it's meant to do is check if the Player character has a Father/Mother, and assign them a flag, then if either one is not found randomly generate and assign them. It seems to be working in that the defined father gets the 'Is_Player_Father' flag, but then a fake-father is still generated and replaces the real one.

This appears to be because you add a character flag and check if the character flag has been set in the same effect.
Also, is the existing father dead? Because I'm pretty sure dead characters can't hold flags.
 
Also, is the existing father dead? Because I'm pretty sure dead characters can't hold flags.
They can't.

Honestly everyone seems to be unnecessarily complicating this with trying to do a bunch of flags and strange ifs and searching through *every* character for one with a flag just do this:
Code:
if = {
    limit = {
        NOT = {
            father_even_if_dead = {
                always = yes
            }
        }
    }
    create_character = {
        name = "Unknown"
        age = 99
        dynasty = ROOT
        random_traits = no
        religion = ROOT
        culture = ROOT
        female = no
    }
    new_character = {
        save_event_target_as = father_target
        set_graphical_culture = Culture_Unkown_Male
        death = yes
    }
    set_father = event_target:father_target
}
if = {
    limit = {
        NOT = {
            mother_even_if_dead = {
                always = yes
            }
        }
    }
    create_character = {
        name = "Unknown"
        age = 99
        dynasty = ROOT
        random_traits = no
        religion = ROOT
        culture = ROOT
        female = yes
    }
    new_character = {
        save_event_target_as = mother_target
        set_graphical_culture = Culture_Unkown_Male
        death = yes
    }
    set_mother = event_target:mother_target
}
 
Is it possible to make the Alans use the Persian portraits but with russian clothing?
Yes, create a new graphical culture alangfx and apply it to the alan culture in common\cultures\00_cultures.txt

Then create the alangfx in interface\portrait\portraits_alan.gfx. Use the Persian portraits (persiangfx) as base and use the clothes/headgear from the easternslavicgfx (Russian) style.

Don't forget to also clone the persiangfx children to alangfx.
 
Yes, create a new graphical culture alangfx and apply it to the alan culture in common\cultures\00_cultures.txt

Then create the alangfx in interface\portrait\portraits_alan.gfx. Use the Persian portraits (persiangfx) as base and use the clothes/headgear from the easternslavicgfx (Russian) style.

Don't forget to also clone the persiangfx children to alangfx.
Thanks,but i don't understand how to use the easternslavicgfx in the new alan.gfx ive created.Which line do i have too change?Do i have too change every
gfx\\characters\\persian_male\\persian_male_headgear_behind.dds" line too something else?
 
Here's what your alan male would look like:

Code:
# alan Male
 portraitType = {
  name = "PORTRAIT_alangfx_male"
  effectFile = "gfx/FX/portrait.lua"
  layer = { # GFX_TYPE:[d|p]INDEX:COLOR_LINK:DONT_REFRESH_IF_VALID:CULTURE_INDEX
   "GFX_character_background:p0"    
   "GFX_easternslavic_male_clothes_behind:p3:c0"
   "GFX_easternslavic_male_headgear_behind:p5:c1"
   "GFX_persian_male_hair_behind:p1:h:y"
   "GFX_persian_male_beard_behind:p4:h:y"
   ":p5:c6"
   "GFX_persian_male_base:p2"     
   "GFX_persian_male_neck:d0"
   "GFX_persian_male_chin:d1"
   "GFX_persian_male_cheeks:d4"
   "GFX_persian_male_mouth:d2"     
   "GFX_persian_male_eyes:d6"
   "GFX_persian_male_nose:d3"
   "GFX_persian_male_eyes2:d6:e"
   "GFX_character_scars:p7:y"
   "GFX_character_reddots:p8"
   "GFX_character_boils:p9"
   "GFX_character_blinded_eyes:p10"
   "GFX_easternslavic_male_clothes:p3:c2"
   "GFX_easternslavic_male_headgear_mid:p5:c3"   
   "GFX_persian_male_ear:d7"
   "GFX_persian_male_beard:p4:h:y"
   "GFX_character_eyepatch:p13:y:o32x63"
     "GFX_persian_male_hair:p1:h:y"
   ":p5:c7"
   "GFX_character_mask:p12:y:o40x45"
   "GFX_empty:p3:c4"
   "GFX_easternslavic_male_headgear:p5:c5"    
   "GFX_character_imprisoned:p6"
   "GFX_player_overlay:p11"
  }
  hair_color_index = 8
  hair_color = { # dark, base, highlight
   { 10 10 10 } {  50 50 50 } { 255 255 255 } #Black
   { 15 8 0 } { 80 47 22 } { 255 255 255 } #Medium Brown
   { 10 10 10 } { 27 25 23 } { 255 255 255 } #Second Black
   { 20 12 8 } { 78 54 37 } { 255 255 255 } #Second Brown
   { 10 10 10 } { 65 65 65 } { 255 255 255 } #Third Black
  }
  eye_color_index = 9
  eye_color = {
   { 120 74 46 } #Brown
   { 34 103 36 } #Green
   { 86 74 46 } #Second Brown
   { 36 32 24 } #Dark Brown
  }
  
  headgear_that_hides_hair = { 10 }
 }

Anything that is clothes or headgear will be easternslavic, the rest you keep Persian. The result is a Persian person with eastern Slavic clothes.
 
Here's what your alan male would look like:

Code:
# alan Male
 portraitType = {
  name = "PORTRAIT_alangfx_male"
  effectFile = "gfx/FX/portrait.lua"
  layer = { # GFX_TYPE:[d|p]INDEX:COLOR_LINK:DONT_REFRESH_IF_VALID:CULTURE_INDEX
   "GFX_character_background:p0"   
   "GFX_easternslavic_male_clothes_behind:p3:c0"
   "GFX_easternslavic_male_headgear_behind:p5:c1"
   "GFX_persian_male_hair_behind:p1:h:y"
   "GFX_persian_male_beard_behind:p4:h:y"
   ":p5:c6"
   "GFX_persian_male_base:p2"    
   "GFX_persian_male_neck:d0"
   "GFX_persian_male_chin:d1"
   "GFX_persian_male_cheeks:d4"
   "GFX_persian_male_mouth:d2"    
   "GFX_persian_male_eyes:d6"
   "GFX_persian_male_nose:d3"
   "GFX_persian_male_eyes2:d6:e"
   "GFX_character_scars:p7:y"
   "GFX_character_reddots:p8"
   "GFX_character_boils:p9"
   "GFX_character_blinded_eyes:p10"
   "GFX_easternslavic_male_clothes:p3:c2"
   "GFX_easternslavic_male_headgear_mid:p5:c3"  
   "GFX_persian_male_ear:d7"
   "GFX_persian_male_beard:p4:h:y"
   "GFX_character_eyepatch:p13:y:o32x63"
     "GFX_persian_male_hair:p1:h:y"
   ":p5:c7"
   "GFX_character_mask:p12:y:o40x45"
   "GFX_empty:p3:c4"
   "GFX_easternslavic_male_headgear:p5:c5"   
   "GFX_character_imprisoned:p6"
   "GFX_player_overlay:p11"
  }
  hair_color_index = 8
  hair_color = { # dark, base, highlight
   { 10 10 10 } {  50 50 50 } { 255 255 255 } #Black
   { 15 8 0 } { 80 47 22 } { 255 255 255 } #Medium Brown
   { 10 10 10 } { 27 25 23 } { 255 255 255 } #Second Black
   { 20 12 8 } { 78 54 37 } { 255 255 255 } #Second Brown
   { 10 10 10 } { 65 65 65 } { 255 255 255 } #Third Black
  }
  eye_color_index = 9
  eye_color = {
   { 120 74 46 } #Brown
   { 34 103 36 } #Green
   { 86 74 46 } #Second Brown
   { 36 32 24 } #Dark Brown
  }
 
  headgear_that_hides_hair = { 10 }
 }

Anything that is clothes or headgear will be easternslavic, the rest you keep Persian. The result is a Persian person with eastern Slavic clothes.

Hmm ,i have done everything you wrote but now the Alans have the generic facepack (the one french and occitan use).
 
Also, is the existing father dead? Because I'm pretty sure dead characters can't hold flags.

They can't.

Honestly everyone seems to be unnecessarily complicating this with trying to do a bunch of flags and strange ifs and searching through *every* character for one with a flag just do this:
Thanks for the help :D and to Metanetwork, too :D It all appears to be working perfectly now.

---
I have another issue, but it might not be important...
I have a set of new e_, k_ and d_ titles which are assigned to certain rulers via History files. If I look at the e_ title, I can see the k_titles listed as being below it, but if I look at the k_titles, the d_titles are not shown. If I then go to the d_titles directly, the k_titles are listed at the top in the de_jure segment. Is this something I should be concerned about?
 
Greetings, so this might be a bit of an niche question, but to those of you that have worked with portraits, more specifically the new clothing override:
Is it possible to reference real age there in any way?
I know there is portrait_age which differentiates between adult, oldage etc, but I want to check the actual character age.

What I am really trying to do is overwrite the default child portrait for a certain age period. Does anyone know if this is even possible?
 
Greetings, so this might be a bit of an niche question, but to those of you that have worked with portraits, more specifically the new clothing override:
Is it possible to reference real age there in any way?
I know there is portrait_age which differentiates between adult, oldage etc, but I want to check the actual character age.
Unfortunately portrait_age only takes one of the four defined age stages: child, young, middle, old.

However you might be able to use portrait_has_trait, then set the trait you want by event for the ages you want. Still won't work for children though as the child age is pretty much hardcoded to only use the sprites PORTRAIT_yourgfx_child_(fe|)male.

But you could use it to for example make special teenager clothes, if you set the young age to start at e.g. 14 or 16 instead of 18 and then use the portrait_has_trait = teenager_trait (which you'd give by event on the 14th birthday and clear on the 18th, e.g. with the on_adulthood on_action) to override the normal sprites in the override gfx file. Would only work for clothes, hats and hairs though, you can't change the base (DNA) sprites this way. So if you'd do this, you'd have teens with adult faces still.


Note that the above is untested, just going by logic here.
 
Last edited:
Two questions - music and stats

First - Music. I have created custom music for my total conversion mod and everything is running great, but every one in a while I get an occasional track from one of the DLC's. I know that the songs.txt file determines what gets played, I also know that certain DLC's have their own songs.txt file. My question is that short of going in and killing the DLC song lists or making my music have ridiculously high chance factors (eg 10000 or more each), is there any way of stopping everything but my tracks playing ?\

Second - Stats. I am considering making an event that fires on the death of the Shaman (Chaplain) that may remove some of the player's accumulated "knowledge" (tech points). Does anyone know how long the average Councilor lives ? I have a fair guess (20-25 years ?) and I know that I can simple run a zillion sims, but does anyone have anything more rigorous available now ? If not I will go with a figure of 20 years, I don't want the player to lose everything !
 
Thanks @jordarkelf, I didn't notice traits, yes that would work.
However, I'm specifically trying to overwrite child portraits, so I am unsure if that will even work cause they normally don't have clothing, or indeed an property defined...
I just need to test it I guess.

Edit: It works! Woo-hoo!
 
Last edited: