Jump to content

[CK2] Modding help: Dark World custom cultures


tyber14

Recommended Posts

So I'm new to modding ck2 and I was looking into adding custom cultures for the new races in Dark World Reborn. I know one of the submods adds an orc race for their invasion line (can't remember which one at the moment) and I was hoping to do something similar for elves, neko, fairies, and the like. I was also hoping to make it so their gfx_culture shows up as their custom race portrait but I don't know where to even start for either of these.

 

Anybody got some ideas on how I can do this? Even just pointing me in the direction of a good tutorial would be welcomed help.

Link to comment

First and for most I recommend reading up on this: https://ck2.paradoxwikis.com/Culture_modding and https://ck2.paradoxwikis.com/Portrait_modding

 

It will get you through most of the bumps with cultures. Well at least the actual culture file. 

 

Then you will need to make common/graphicalculturetypes folder. In that you will need a txt file showing skin tones. Ex of the one I use for dragons below;

 

Spoiler

# Skin tones are 0 (light), 1 (tan), 2 (dark) and 3 (black)

dragongfx =            { skin_tone = 0 }

 

 

After that you will need to get the pictures you want to use (PLEASE pay attention to the number of portraits you have, its important.)

 

After that you need to make the interface file. It needs to be file type GFX. it goes in interface/portraits 

Its the file that tells the game where to find your portraits AND what overlays to use.


EX of what I use for my dragons below:

Spoiler

# hair, mouth, chin, nose, eyes, cheek, ear, neck
spriteTypes = {
    
    
    
    spriteType = {
        name = "GFX_dragon_male"
        texturefile = "gfx\\characters\\dragons\\male_dragon.tga"
        noOfFrames = 43
        norefcount = yes
        can_be_lowres = yes
    }
    
### HORSE FEMALE ####

    spriteType = {
        name = "GFX_dragon_female"
        texturefile = "gfx\\characters\\dragons\\female_dragon.tga"
        noOfFrames = 43
        norefcount = yes
        can_be_lowres = yes
    }


    
    # children
    spriteType = {
        name = "PORTRAIT_dragongfx_child_male"
        texturefile = "gfx\\characters\\default_dragon_son.tga"
        noOfFrames = 1
        norefcount = yes
        can_be_lowres = yes
    }

    spriteType = {
        name = "PORTRAIT_dragongfx_child_female"
        texturefile = "gfx\\characters\\default_dragon_daughter.tga"
        #texturefile = "gfx\\characters\\default_son.tga"
        noOfFrames = 1
        norefcount = yes
        can_be_lowres = yes
    }
    
    
    
    ### DRAGON MALE ####
    
    # CULTURE_INDEX: 0 = clothes behind, 1 = headgear behind, 2 = clothes, 3 = headgear mid, 4 = clothes infront, 5 = headgear
    
    # Young dragon
    portraitType = {
        name = "PORTRAIT_dragongfx_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_empty:p3:c0"    # male_clothes_behind
            "GFX_empty:p5:c1"    # male_headgear_behind:p5:c1"
            "GFX_empty:p1:h:y"    # male_hair_behind:p1:h:y"
            "GFX_empty:p4:h:y"    # male_beard_behind:p4:h:y"
            "GFX_empty:p2"                    
            #"GFX_empty:d0"        # male_neck:d0"
            "GFX_empty:d1"        # male_chin:d1"
            "GFX_empty:d4"        # male_cheeks:d4"
            "GFX_empty:d2"        # male_mouth:d2"                    
            "GFX_empty:d6"        # male_eyes:d6"
            "GFX_empty:d3"
            "GFX_empty:d6:e"    # male_eyes2:d6:e"
            "GFX_empty:p7"        # scars:p7:y"
            "GFX_empty:p8"        # reddots:p8"
            "GFX_empty:p9"        # boils:p9"
            "GFX_empty:p10"        # blinded_eyes:p10"
            "GFX_empty:p3:c2"    # male_clothes:p3:c2"
            "GFX_empty:p5:c3"    # male_headgear_mid:p5:c3"            
            "GFX_empty:d7"        # male_ear:d7"
            "GFX_empty:p4:h:y"    # male_beard:p4:h:y"
            "GFX_empty:p13:y"    # eyepatch:p13:y:o32x63"
               "GFX_empty:p1:h:y"    # male_hair:p1:h:y"
               "GFX_empty:p12:y"    # mask:p12:y:o40x45"
            "GFX_empty:p3:c4"
            "GFX_empty:p5:c5"    #_male_headgear:p5:c5"    
            "GFX_dragon_male:d0"            
            "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 }

        }

        eye_color_index = 9
        eye_color = {
            { 0 0 0  }
        }
        
        headgear_that_hides_hair = { 10 }
    }
    
    portraitType = {
        name = "PORTRAIT_dragongfx_male1"
        effectFile = "gfx/FX/portrait.lua"
        layer = { # GFX_TYPE:[d|p]INDEX:COLOR_LINK:DONT_REFRESH_IF_VALID:CULTURE_INDEX
            "GFX_character_background:p0"                
            "GFX_empty:p3:c0"    # male_clothes_behind
            "GFX_empty:p5:c1"    # male_headgear_behind:p5:c1"
            "GFX_empty:p1:h:y"    # male_hair_behind:p1:h:y"
            "GFX_empty:p4:h:y"    # male_beard_behind:p4:h:y"
            "GFX_empty:p2"                    
            #"GFX_empty:d0"        # male_neck:d0"
            "GFX_empty:d1"        # male_chin:d1"
            "GFX_empty:d4"        # male_cheeks:d4"
            "GFX_empty:d2"        # male_mouth:d2"                    
            "GFX_empty:d6"        # male_eyes:d6"
            "GFX_empty:d3"
            "GFX_empty:d6:e"    # male_eyes2:d6:e"
            "GFX_empty:p7"        # scars:p7:y"
            "GFX_empty:p8"        # reddots:p8"
            "GFX_empty:p9"        # boils:p9"
            "GFX_empty:p10"        # blinded_eyes:p10"
            "GFX_empty:p3:c2"    # male_clothes:p3:c2"
            "GFX_empty:p5:c3"    # male_headgear_mid:p5:c3"            
            "GFX_empty:d7"        # male_ear:d7"
            "GFX_empty:p4:h:y"    # male_beard:p4:h:y"
            "GFX_empty:p13:y"    # eyepatch:p13:y:o32x63"
               "GFX_empty:p1:h:y"    # male_hair:p1:h:y"
               "GFX_empty:p12:y"    # mask:p12:y:o40x45"
            "GFX_empty:p3:c4"
            "GFX_empty:p5:c5"    #_male_headgear:p5:c5"    
            "GFX_dragon_male:d0"            
            "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 }

        }

        eye_color_index = 9
        eye_color = {
            { 0 0 0  }
        }
        
        headgear_that_hides_hair = { 10 }
        
    }
    
    portraitType = {
        name = "PORTRAIT_dragongfx_male2"
        effectFile = "gfx/FX/portrait.lua"
        layer = { # GFX_TYPE:[d|p]INDEX:COLOR_LINK:DONT_REFRESH_IF_VALID:CULTURE_INDEX
        "GFX_character_background:p0"                
            "GFX_empty:p3:c0"    # male_clothes_behind
            "GFX_empty:p5:c1"    # male_headgear_behind:p5:c1"
            "GFX_empty:p1:h:y"    # male_hair_behind:p1:h:y"
            "GFX_empty:p4:h:y"    # male_beard_behind:p4:h:y"
            "GFX_empty:p2"                    
            #"GFX_empty:d0"        # male_neck:d0"
            "GFX_empty:d1"        # male_chin:d1"
            "GFX_empty:d4"        # male_cheeks:d4"
            "GFX_empty:d2"        # male_mouth:d2"                    
            "GFX_empty:d6"        # male_eyes:d6"
            "GFX_empty:d3"
            "GFX_empty:d6:e"    # male_eyes2:d6:e"
            "GFX_empty:p7"        # scars:p7:y"
            "GFX_empty:p8"        # reddots:p8"
            "GFX_empty:p9"        # boils:p9"
            "GFX_empty:p10"        # blinded_eyes:p10"
            "GFX_empty:p3:c2"    # male_clothes:p3:c2"
            "GFX_empty:p5:c3"    # male_headgear_mid:p5:c3"            
            "GFX_empty:d7"        # male_ear:d7"
            "GFX_empty:p4:h:y"    # male_beard:p4:h:y"
            "GFX_empty:p13:y"    # eyepatch:p13:y:o32x63"
               "GFX_empty:p1:h:y"    # male_hair:p1:h:y"
               "GFX_empty:p12:y"    # mask:p12:y:o40x45"
            "GFX_empty:p3:c4"
            "GFX_empty:p5:c5"    #_male_headgear:p5:c5"    
            "GFX_dragon_male:d0"            
            "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 }

        }

        eye_color_index = 9
        eye_color = {
            { 0 0 0  }
        }
        
        headgear_that_hides_hair = { 10 }
        
    }

### DRAGON FEMALE ####

    portraitType = {
        name = "PORTRAIT_dragongfx_female"
        effectFile = "gfx/FX/portrait.lua"
        layer = { # GFX_TYPE:[d|p]INDEX:COLOR_LINK:DONT_REFRESH_IF_VALID:CULTURE_INDEX
            "GFX_character_background:p0"                
            "GFX_empty:p3:c0"    # male_clothes_behind
            "GFX_empty:p5:c1"    # male_headgear_behind:p5:c1"
            "GFX_empty:p1:h:y"    # male_hair_behind:p1:h:y"
            "GFX_empty:p4:h:y"    # male_beard_behind:p4:h:y"
            "GFX_empty:p2"                    
            #"GFX_empty:d0"        # male_neck:d0"
            "GFX_empty:d1"        # male_chin:d1"
            "GFX_empty:d4"        # male_cheeks:d4"
            "GFX_empty:d2"        # male_mouth:d2"                    
            "GFX_empty:d6"        # male_eyes:d6"
            "GFX_empty:d3"
            "GFX_empty:d6:e"    # male_eyes2:d6:e"
            "GFX_empty:p7"        # scars:p7:y"
            "GFX_empty:p8"        # reddots:p8"
            "GFX_empty:p9"        # boils:p9"
            "GFX_empty:p10"        # blinded_eyes:p10"
            "GFX_empty:p3:c2"    # male_clothes:p3:c2"
            "GFX_empty:p5:c3"    # male_headgear_mid:p5:c3"            
            "GFX_empty:d7"        # male_ear:d7"
            "GFX_empty:p4:h:y"    # male_beard:p4:h:y"
            "GFX_empty:p13:y"    # eyepatch:p13:y:o32x63"
               "GFX_empty:p1:h:y"    # male_hair:p1:h:y"
               "GFX_empty:p12:y"    # mask:p12:y:o40x45"
            "GFX_empty:p3:c4"
            "GFX_empty:p5:c5"    #_male_headgear:p5:c5"    
            "GFX_dragon_female:d0"            
            "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 }

        }

        eye_color_index = 9
        eye_color = {
            { 0 0 0  }
        }
        
        headgear_that_hides_hair = { 10 }
        
    }
    portraitType = {
        name = "PORTRAIT_dragongfx_female1"
        effectFile = "gfx/FX/portrait.lua"
        layer = { # GFX_TYPE:[d|p]INDEX:COLOR_LINK:DONT_REFRESH_IF_VALID:CULTURE_INDEX
        "GFX_character_background:p0"                
            "GFX_empty:p3:c0"    # male_clothes_behind
            "GFX_empty:p5:c1"    # male_headgear_behind:p5:c1"
            "GFX_empty:p1:h:y"    # male_hair_behind:p1:h:y"
            "GFX_empty:p4:h:y"    # male_beard_behind:p4:h:y"
            "GFX_empty:p2"                    
            #"GFX_empty:d0"        # male_neck:d0"
            "GFX_empty:d1"        # male_chin:d1"
            "GFX_empty:d4"        # male_cheeks:d4"
            "GFX_empty:d2"        # male_mouth:d2"                    
            "GFX_empty:d6"        # male_eyes:d6"
            "GFX_empty:d3"
            "GFX_empty:d6:e"    # male_eyes2:d6:e"
            "GFX_empty:p7"        # scars:p7:y"
            "GFX_empty:p8"        # reddots:p8"
            "GFX_empty:p9"        # boils:p9"
            "GFX_empty:p10"        # blinded_eyes:p10"
            "GFX_empty:p3:c2"    # male_clothes:p3:c2"
            "GFX_empty:p5:c3"    # male_headgear_mid:p5:c3"            
            "GFX_empty:d7"        # male_ear:d7"
            "GFX_empty:p4:h:y"    # male_beard:p4:h:y"
            "GFX_empty:p13:y"    # eyepatch:p13:y:o32x63"
               "GFX_empty:p1:h:y"    # male_hair:p1:h:y"
               "GFX_empty:p12:y"    # mask:p12:y:o40x45"
            "GFX_empty:p3:c4"
            "GFX_empty:p5:c5"    #_male_headgear:p5:c5"    
            "GFX_dragon_female:d0"            
            "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 }

        }

        eye_color_index = 9
        eye_color = {
            { 0 0 0  }
        }
        
        headgear_that_hides_hair = { 10 }
        
        
    }
    portraitType = {
        name = "PORTRAIT_dragongfx_female2"
        effectFile = "gfx/FX/portrait.lua"
        layer = { # GFX_TYPE:[d|p]INDEX:COLOR_LINK:DONT_REFRESH_IF_VALID:CULTURE_INDEX
            "GFX_character_background:p0"                
            "GFX_empty:p3:c0"    # male_clothes_behind
            "GFX_empty:p5:c1"    # male_headgear_behind:p5:c1"
            "GFX_empty:p1:h:y"    # male_hair_behind:p1:h:y"
            "GFX_empty:p4:h:y"    # male_beard_behind:p4:h:y"
            "GFX_empty:p2"                    
            #"GFX_empty:d0"        # male_neck:d0"
            "GFX_empty:d1"        # male_chin:d1"
            "GFX_empty:d4"        # male_cheeks:d4"
            "GFX_empty:d2"        # male_mouth:d2"                    
            "GFX_empty:d6"        # male_eyes:d6"
            "GFX_empty:d3"
            "GFX_empty:d6:e"    # male_eyes2:d6:e"
            "GFX_empty:p7"        # scars:p7:y"
            "GFX_empty:p8"        # reddots:p8"
            "GFX_empty:p9"        # boils:p9"
            "GFX_empty:p10"        # blinded_eyes:p10"
            "GFX_empty:p3:c2"    # male_clothes:p3:c2"
            "GFX_empty:p5:c3"    # male_headgear_mid:p5:c3"            
            "GFX_empty:d7"        # male_ear:d7"
            "GFX_empty:p4:h:y"    # male_beard:p4:h:y"
            "GFX_empty:p13:y"    # eyepatch:p13:y:o32x63"
               "GFX_empty:p1:h:y"    # male_hair:p1:h:y"
               "GFX_empty:p12:y"    # mask:p12:y:o40x45"
            "GFX_empty:p3:c4"
            "GFX_empty:p5:c5"    #_male_headgear:p5:c5"    
            "GFX_dragon_female:d0"            
            "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 }

        }

        eye_color_index = 9
        eye_color = {
            { 0 0 0  }
        }
        
        headgear_that_hides_hair = { 10 }
        
    }
}

Most if not all of the GFX_empty are needed if you want them to work in ruler designer.

 

In the spriteType for the portraits (one for male one for female and one for children if you want kids to have their own portraits) the "noOfFrames = X " is very important to make sure your portraits are CENTERED. X must equal the number of Pictures you have. Or the circle will not be centered. 

 

Once you have ALL of that. It should be good to go. Now I hope I explained it well enough because 90% of the work getting Dragons working was done by Noxbestia as my original attempt failed horribly. 

 

Best bet for getting it working: Rip a race from another mod (like my dragons) and use is it as a template to get your race working. Frankenstiening a culture together is a lot easier than starting form scratch.

 

 

Link to comment
1 hour ago, tyber14 said:

Thanks for walkthrough! Is there a way to ensure a certain race has a certain trait, again like your dragons have the dragon trait when spawned, or vice versa? Do I need an event for that or can I do that through the culture file?

For me the Dragons get the dragon trait when hatched (event spawned) and they CANNOT breed normally. (So all children have to be created by event so they can get the trait)

 

You need an event, or a decision. However the one problem you may run into if you want to make the races have their darkworld trait is that you may end up with humans having the trait. With the trait based inheritance of darkworld  you can make the chance of the trait passing on whatever you want. With portraits its almost always a 50/50 split. 50% chance of having fathers culture portrait or 50% chance of having mothers culture portrait. The problem is the portrait and the culture are independent of one another so you could have an elf portrait but be a different culture.  

 

EX. A Welsh character could marry a Norse character. The child could inherit the Norse portrait but have Welsh culture. 

 

If you use an event or decision make sure you are checking for graphic_culture and not just culture or you will encounter the bugs mentioned above. 

 

 

Link to comment
1 hour ago, zia said:

For me the Dragons get the dragon trait when hatched (event spawned) and they CANNOT breed normally. (So all children have to be created by event so they can get the trait)

 

You need an event, or a decision. However the one problem you may run into if you want to make the races have their darkworld trait is that you may end up with humans having the trait. With the trait based inheritance of darkworld  you can make the chance of the trait passing on whatever you want. With portraits its almost always a 50/50 split. 50% chance of having fathers culture portrait or 50% chance of having mothers culture portrait. The problem is the portrait and the culture are independent of one another so you could have an elf portrait but be a different culture.  

 

EX. A Welsh character could marry a Norse character. The child could inherit the Norse portrait but have Welsh culture. 

 

If you use an event or decision make sure you are checking for graphic_culture and not just culture or you will encounter the bugs mentioned above. 

 

 

I'm actually not too concerned with children, as I figure it makes sense a kid grown in a different culture will still have that culture regardless of race, but more wondering about spawned NPCs from the region of said culture. Say my ruler is of the elf culture and I spawn a debutante from that culture, how do I make sure that courtier has both the elf trait and custom portrait that goes along with it?

Link to comment
57 minutes ago, tyber14 said:

I'm actually not too concerned with children, as I figure it makes sense a kid grown in a different culture will still have that culture regardless of race, but more wondering about spawned NPCs from the region of said culture. Say my ruler is of the elf culture and I spawn a debutante from that culture, how do I make sure that courtier has both the elf trait and custom portrait that goes along with it?

Well, you would have to change the spawn debutante decision (or write your own) to make sure the trait and portrait was added.  Or instead of adding the portraits you could just add the trait then add the following:

            new_character = { 

                  character_event = { id = DWCore.8010 }

            }

 

That is if you were wanting the DARKWORLD Portraits. But if instead you wanted your cultural portraits you just make sure the new character is added with culture = (your culture)

 

So for Elves it would be: 

                    create_character = {
                        age = 16
                        dynasty = random  #(I highly Recommend this, and not using dynasty = none, otherwise the game MAY delete your character as non inessential. )
                        culture = elf

                        trait = elf
                        female = yes
                        random_traits = yes
                    }
 

Link to comment
33 minutes ago, zia said:

Well, you would have to change the spawn debutante decision (or write your own) to make sure the trait and portrait was added.  Or instead of adding the portraits you could just add the trait then add the following:

            new_character = { 

                  character_event = { id = DWCore.8010 }

            }

 

That is if you were wanting the DARKWORLD Portraits. But if instead you wanted your cultural portraits you just make sure the new character is added with culture = (your culture)

 

So for Elves it would be: 

                    create_character = {
                        age = 16
                        dynasty = random  #(I highly Recommend this, and not using dynasty = none, otherwise the game MAY delete your character as non inessential. )
                        culture = elf

                        trait = elf
                        female = yes
                        random_traits = yes
                    }
 

I figured it just be simpler to use the custom portraits that come with DARKWORLD. Not a very good artist myself.

 

So would both of those threads you just mentioned go into the new spawn courtier decision? 

 

Also is it possible to make an event trigger whenever a new character is spawned? Figure that would be an easy way to ensure AI rulers who auto spawn their own courtiers are guaranteed that if the courtier has the trait it will be auto assigned a custom portrait aligned with that trait. Like an AI orc count with the orc culture fills his court with orc courtiers, I want a way to make sure they have the right portraits for their race trait and don't end up with some vanilla characters.

Link to comment

To save you some headaches, a couple of gotchas I have hit:

  1. Be careful of using "graphical_culture" in your code except where you have to.  Use "race" instead.
  2. A race can have no more than 26 images per sex (a-z & zero).
  3. You need dynasties for your save or they will all be named "smith"

My newest race (found in NDPA) is Night Wolves ("noxwolf_culture" in the code).  Looking at the code for it may help.  In dealing with the "trap" trait, I also wrote some code to make some races use the young adult female portrait rather than the male portraits so they 1) don't appear to age; 2) males never end up with beards, and 3) required so that Muslims could exist without bears.  Also look to the Warhammer:Geheimnisnacht mod for some advanced work on custom races as well as an interesting take on using "reverse" cultures to visually represent sex changes.  As of yet, CK2 code sill won't let us do proper gender changes on a character.

 

The AGOT mod was a great help in figuring out how to make custom races without doing trait portrait replacement.  That said, none of this would have likely ever come to pass were it not for @ReMeDy's understanding and sharing of advanced portrait properties and trait-based replacement.   

 

FYI - I have Kitsune, Tanuki, and Neko races in various stages of unreleased development, as well as a couple of other races.

Link to comment
12 minutes ago, noxbestia said:

To save you some headaches, a couple of gotchas I have hit:

  1. Be careful of using "graphical_culture" in your code except where you have to.  Use "race" instead.
  2. A race can have no more than 26 images per sex (a-z & zero).
  3. You need dynasties for your save or they will all be named "smith"

My newest race (found in NDPA) is Night Wolves ("noxwolf_culture" in the code).  Looking at the code for it may help.  In dealing with the "trap" trait, I also wrote some code to make some races use the young adult female portrait rather than the male portraits so they 1) don't appear to age; 2) males never end up with beards, and 3) required so that Muslims could exist without bears.  Also look to the Warhammer:Geheimnisnacht mod for some advanced work on custom races as well as an interesting take on using "reverse" cultures to visually represent sex changes.  As of yet, CK2 code sill won't let us do proper gender changes on a character.

 

The AGOT mod was a great help in figuring out how to make custom races without doing trait portrait replacement.  That said, none of this would have likely ever come to pass were it not for @ReMeDy's understanding and sharing of advanced portrait properties and trait-based replacement.   

 

FYI - I have Kitsune, Tanuki, and Neko races in various stages of unreleased development, as well as a couple of other races.

Awesome! thanks nox I'll have to take a look at that stuff.

 

Also I'm not trying to step on any toes, just wanted a personal use mod so I can have elves, orcs, and all that have their own stuff instead of the custom art just being placed over vanilla portraits. Can't wait to see what you have in store!

Link to comment
10 minutes ago, tyber14 said:

Awesome! thanks nox I'll have to take a look at that stuff.

 

Also I'm not trying to step on any toes, just wanted a personal use mod so I can have elves, orcs, and all that have their own stuff instead of the custom art just being placed over vanilla portraits. Can't wait to see what you have in store!

Warhammer has excellent Elves and (and to a lesser degree orcs last time I looked) with custom art.  Check it out.  :smile:

Link to comment
7 hours ago, noxbestia said:

To save you some headaches, a couple of gotchas I have hit:

  1. Be careful of using "graphical_culture" in your code except where you have to.  Use "race" instead.
  2. A race can have no more than 26 images per sex (a-z & zero).
  3. You need dynasties for your save or they will all be named "smith"

My newest race (found in NDPA) is Night Wolves ("noxwolf_culture" in the code).  Looking at the code for it may help.  In dealing with the "trap" trait, I also wrote some code to make some races use the young adult female portrait rather than the male portraits so they 1) don't appear to age; 2) males never end up with beards, and 3) required so that Muslims could exist without bears.  Also look to the Warhammer:Geheimnisnacht mod for some advanced work on custom races as well as an interesting take on using "reverse" cultures to visually represent sex changes.  As of yet, CK2 code sill won't let us do proper gender changes on a character.

 

The AGOT mod was a great help in figuring out how to make custom races without doing trait portrait replacement.  That said, none of this would have likely ever come to pass were it not for @ReMeDy's understanding and sharing of advanced portrait properties and trait-based replacement.   

 

FYI - I have Kitsune, Tanuki, and Neko races in various stages of unreleased development, as well as a couple of other races.

What is the difference between race and graphical_culture triggers? I thought they were alias of each other.

Link to comment

I'm still having trouble figuring out how to get NPCs spawned from a specific culture to have that cultures DARKWORLD racial trait.

Orcs having the "Orc" trait, Elves having the "Elf" trait, Nekko having the "Nekko" trait, and so on.

 

Does that make any sense? Any ideas?

Link to comment
22 minutes ago, tyber14 said:

I'm still having trouble figuring out how to get NPCs spawned from a specific culture to have that cultures DARKWORLD racial trait.

Orcs having the "Orc" trait, Elves having the "Elf" trait, Nekko having the "Nekko" trait, and so on.

 

Does that make any sense? Any ideas?

Well it is rather difficult for "Natural spawned" Npcs. (ones the game generates randomly, normally to fill ai courts). But for any that are decision or event spawned  then all you have to do is add:

 

trait = (race trait) under the create character:

 

                    create_character = {
                        age = 16
                        culture = elf

                        trait = elf
                    }

 

For the above a courtier would be spawned with both the culture and trait. But again this method is limited to decision and event spawned NPCS. 

 

For all others you would need a descison or event that adds the trait to anyone with that race.

 

EX of Decision:

 

Spoiler

    give_elf = {
        filter = self
        ai_target_filter = self
        from_potential = {
        }
        potential = {
            FROM = {
                race = elf
            }
        }
        allow = {
            FROM = {
                race = elf
            }
        }
        effect = {
            add_trait = elf
        }
        ai_will_do = {
            factor = 1 # 100%
            modifier = {
                factor = 1
            }
        }

#now do Note that validator will give you crap for having a factor = 1, but it is the only way to make sure EVERYONE takes the descison.

 

Now there are flaws with using a decision for these things, namely a lot of AI characters cant actually use them. Most AI courtiers in foreign courts don't really do ANYTHING except exist and age. The game would get waaaay to laggy if EVERYSINGLE character was able to seduce others. (people with landed titles, people in your immediate court, and I think council members can use decisions however) 

 

Events are a lot better to use but add additional problems. Such as Triggering them.  In theory all you would need to do is setup an event with a Trigger = { race = elf NOT = { trait = elf} } so that only elves get the event and then the effect of the event would be add_trait = elf . Which would add the trait. 

 

This is where my knowledge gets cloudy on the subject. I am just now starting to work with on_action triggers to start events (Yearly_pulse, on_birth, on_marrige, etc.) Which is where an event like this would be needed. 

 

Now Events arn't perfect either as CK2 may just not fire it properly for some courts. (Take on_birth for example in regards to Darkworlds werewolves: The werewolf trait is only given by event and CANNOT be inherited normally. I had a game as the Queen of Wales and had made the Isle Of Mann a Republic. The Doge's kids got the traits but none of his grandkids did. He died and his son inherited. His son had 6 human sons before inheriting, none had werewolf trait. After he inherited he had 5 more sons, 4 had the trait.)  So to sum it up: A lot o characters cant use descions and a lot of character dont get events. BUUT do not fear I have a nifty work Around:

 

Spoiler

    give_elf = {
        filter = realm
        ai_target_filter = realm
        from_potential = {
        }
        potential = {
            FROM = { 
                ai = yes
            }
            race = elf
            NOT = {
                trait = elf 
            }
        }
        allow = {
            always = yes # For our testing purposes
        }
        effect = {
            add_trait = elf
        }
        ai_will_do = {
            factor = 1 
            modifier = {
                factor = 1
            }
        }
    }
 

 

For the above ANY AI can target ANYONE (in the realm, so have ATLEAST 1 vassal to insure it happens)  with the race = elf that does not have the elf trait and it will add it to them.  

 

The biggest problem here is it can take a few days to occur. (I use a similar event to handle dragons leaving when their 'Mother' Dies. It can take a few days up to a month before the event happens) Another problem is like I mentions above about certain people not able to use decisions: If you are an independent count and have no vassals (sometimes city and temple vassals don't count, CK2 is WEIRD) a Decision like this may not fire. In my testing it happened about 50% of the time... so have at least one landed vassal for best performance. Switching   ai_target_filter = realm to  ai_target_filter = all , may fix this issue but.. using ALL tends to get a bit laggy later on. 

 

Factor = 1 will help make sure it happens the fastest (as it means there is a 100% chance of them doing it) 

 

 

Now one last piece of advice: Use Validator.  It isn't going to teach you how to code things but it is amazing at pointing out issues in the code. (Mostly checking for those tricky missed {} )

 

Link: https://forum.paradoxplaza.com/forum/index.php?threads/the-validator-find-errors-quickly-and-with-minimal-pain.597480/

 

Another thing that might help is to read up on the wiki about modding, the CK2 WIKI is one of the most helpful tools I have found for learning this stuff. 

 

Link: https://ck2.paradoxwikis.com/Modding  Most sections are divided at the very bottom. I would recommend checking out both decisions and events  and see which one works best for you.

Link to comment
38 minutes ago, zia said:

Well it is rather difficult for "Natural spawned" Npcs. (ones the game generates randomly, normally to fill ai courts). But for any that are decision or event spawned  then all you have to do is add:

 

trait = (race trait) under the create character:

 

                    create_character = {
                        age = 16
                        culture = elf

                        trait = elf
                    }

 

For the above a courtier would be spawned with both the culture and trait. But again this method is limited to decision and event spawned NPCS. 

 

For all others you would need a descison or event that adds the trait to anyone with that race.

 

EX of Decision:

 

  Hide contents

    give_elf = {
        filter = self
        ai_target_filter = self
        from_potential = {
        }
        potential = {
            FROM = {
                race = elf
            }
        }
        allow = {
            FROM = {
                race = elf
            }
        }
        effect = {
            add_trait = elf
        }
        ai_will_do = {
            factor = 1 # 100%
            modifier = {
                factor = 1
            }
        }

#now do Note that validator will give you crap for having a factor = 1, but it is the only way to make sure EVERYONE takes the descison.

 

Now there are flaws with using a decision for these things, namely a lot of AI characters cant actually use them. Most AI courtiers in foreign courts don't really do ANYTHING except exist and age. The game would get waaaay to laggy if EVERYSINGLE character was able to seduce others. (people with landed titles, people in your immediate court, and I think council members can use decisions however) 

 

Events are a lot better to use but add additional problems. Such as Triggering them.  In theory all you would need to do is setup an event with a Trigger = { race = elf NOT = { trait = elf} } so that only elves get the event and then the effect of the event would be add_trait = elf . Which would add the trait. 

 

This is where my knowledge gets cloudy on the subject. I am just now starting to work with on_action triggers to start events (Yearly_pulse, on_birth, on_marrige, etc.) Which is where an event like this would be needed. 

 

Now Events arn't perfect either as CK2 may just not fire it properly for some courts. (Take on_birth for example in regards to Darkworlds werewolves: The werewolf trait is only given by event and CANNOT be inherited normally. I had a game as the Queen of Wales and had made the Isle Of Mann a Republic. The Doge's kids got the traits but none of his grandkids did. He died and his son inherited. His son had 6 human sons before inheriting, none had werewolf trait. After he inherited he had 5 more sons, 4 had the trait.)  So to sum it up: A lot o characters cant use descions and a lot of character dont get events. BUUT do not fear I have a nifty work Around:

 

  Hide contents

    give_elf = {
        filter = realm
        ai_target_filter = realm
        from_potential = {
        }
        potential = {
            FROM = { 
                ai = yes
            }
            race = elf
            NOT = {
                trait = elf 
            }
        }
        allow = {
            always = yes # For our testing purposes
        }
        effect = {
            add_trait = elf
        }
        ai_will_do = {
            factor = 1 
            modifier = {
                factor = 1
            }
        }
    }
 

 

For the above ANY AI can target ANYONE (in the realm, so have ATLEAST 1 vassal to insure it happens)  with the race = elf that does not have the elf trait and it will add it to them.  

 

The biggest problem here is it can take a few days to occur. (I use a similar event to handle dragons leaving when their 'Mother' Dies. It can take a few days up to a month before the event happens) Another problem is like I mentions above about certain people not able to use decisions: If you are an independent count and have no vassals (sometimes city and temple vassals don't count, CK2 is WEIRD) a Decision like this may not fire. In my testing it happened about 50% of the time... so have at least one landed vassal for best performance. Switching   ai_target_filter = realm to  ai_target_filter = all , may fix this issue but.. using ALL tends to get a bit laggy later on. 

 

Factor = 1 will help make sure it happens the fastest (as it means there is a 100% chance of them doing it) 

 

 

Now one last piece of advice: Use Validator.  It isn't going to teach you how to code things but it is amazing at pointing out issues in the code. (Mostly checking for those tricky missed {} )

 

Link: https://forum.paradoxplaza.com/forum/index.php?threads/the-validator-find-errors-quickly-and-with-minimal-pain.597480/

 

Another thing that might help is to read up on the wiki about modding, the CK2 WIKI is one of the most helpful tools I have found for learning this stuff. 

 

Link: https://ck2.paradoxwikis.com/Modding  Most sections are divided at the very bottom. I would recommend checking out both decisions and events  and see which one works best for you.

THANK YOU! This is what I was looking for. I've been scouring the wiki on how to do this but I'm a crap modder and most of what I was reading looked like the squiggle code from The Matrix. This will help out alot.

Link to comment
6 minutes ago, tyber14 said:

THANK YOU! This is what I was looking for. I've been scouring the wiki on how to do this but I'm a crap modder and most of what I was reading looked like the squiggle code from The Matrix. This will help out alot.

Not a problem, Honestly the only reason I am able to any of this stuff is because I ripped apart mods that I liked and saw how it was done. The wiki is great but sometimes actually seeing how it is done helps a lot more. 

 

But honestly the best resource? Your already using it. You're asking here. (Paradox fourms might get better answer but I can understand not going there. )  Honestly if you have questions keep asking. Helping you with this is helping me. Its making me re-look at my code and gain a better understanding on how I did it. Which is odd to say.

Link to comment

So here's my attempt at an event to get this done. I used a DARKWORLD core event as my base.

 

Spoiler

character_event = {
    id = DWCulture.01
    trigger = { 
        race = elven
        race = orc
        race = neko
        NOT = {
            trait = neko
            trait = orc
            trait = elf
        }
    }
    hide_window = yes # Nothing to see here
    immediate = {
        if = {
            limit = {
                race = orc
            }
            add_trait = orc
            add_random_orc_portrait = yes
            break = yes
        }
        if = {
            limit = {
                race = elven
            }
            add_trait = elf
            add_random_elf_portrait = yes 
            break = yes
        }
        if = {
            limit = {
                race = neko
            }
            add_trait = neko
            add_random_neko_portrait = yes
            break = yes
        }
    }
}
 

 

Used that event so instead of having to mess with the portraits too much I figured it would add the custom portraits that come with the mod itself.

 

You guys see any reason why this wouldn't work?

Link to comment
1 hour ago, tyber14 said:

So here's my attempt at an event to get this done. I used a DARKWORLD core event as my base.

 

  Hide contents

character_event = {
    id = DWCulture.01
    trigger = { 
        race = elven
        race = orc
        race = neko
        NOT = {
            trait = neko
            trait = orc
            trait = elf
        }
    }
    hide_window = yes # Nothing to see here
    immediate = {
        if = {
            limit = {
                race = orc
            }
            add_trait = orc
            add_random_orc_portrait = yes
            break = yes
        }
        if = {
            limit = {
                race = elven
            }
            add_trait = elf
            add_random_elf_portrait = yes 
            break = yes
        }
        if = {
            limit = {
                race = neko
            }
            add_trait = neko
            add_random_neko_portrait = yes
            break = yes
        }
    }
}
 

 

Used that event so instead of having to mess with the portraits too much I figured it would add the custom portraits that come with the mod itself.

 

You guys see any reason why this wouldn't work?

Your trigger is self-negating and will never activate.  By default it is an AND so it is looking for a single character who has 3 different races at once which isn't possible.  Your NOT would need to be a NAND or a NOR (too late for me to think that one out with certainty tonight but I think NAND).  You need to either add "is_triggered_only = yes" or a mtth section.  The "immediate" block seems like it would work.

Link to comment
58 minutes ago, tyber14 said:

So here's my attempt at an event to get this done. I used a DARKWORLD core event as my base.

 

  Hide contents

character_event = {
    id = DWCulture.01
    trigger = { 
        race = elven
        race = orc
        race = neko
        NOT = {
            trait = neko
            trait = orc
            trait = elf
        }
    }
    hide_window = yes # Nothing to see here
    immediate = {
        if = {
            limit = {
                race = orc
            }
            add_trait = orc
            add_random_orc_portrait = yes
            break = yes
        }
        if = {
            limit = {
                race = elven
            }
            add_trait = elf
            add_random_elf_portrait = yes 
            break = yes
        }
        if = {
            limit = {
                race = neko
            }
            add_trait = neko
            add_random_neko_portrait = yes
            break = yes
        }
    }
}
 

 

Used that event so instead of having to mess with the portraits too much I figured it would add the custom portraits that come with the mod itself.

 

You guys see any reason why this wouldn't work?

One issue that I can see:

Switch this:

 

Spoiler

    trigger = { 
        race = elven
        race = orc
        race = neko
        NOT = {
            trait = neko
            trait = orc
            trait = elf
        }
    }

With:

Spoiler

    trigger = {
        OR = { 
                race = elven
               race = orc
                race = neko
        }
            NOR = {
                trait = neko
                trait = orc
                trait = elf
           }
    }
 

 

# NOR is short for 
NOT = {
    OR = {
        trait = neko
        trait = orc
        trait = elf
    }
}


If you just use NOT then it looks for some who does not have ALL THREE traits rather than just one of them. (So if they just had orc trait it would say to fire the event for them since they lack neko and elf)

Same for just listing the races at the beginning, if you don't use OR it may try and check for someone with ALL THREE races instead of just one. (normaly at least, with characters only have ONE race it may be able to interpret it correctly or it might not. Best use OR to be safe.)

Link to comment
57 minutes ago, noxbestia said:

Your trigger is self-negating and will never activate.  By default it is an AND so it is looking for a single character who has 3 different races at once which isn't possible.  Your NOT would need to be a NAND or a NOR (too late for me to think that one out with certainty tonight but I think NAND).  You need to either add "is_triggered_only = yes" or a mtth section.  The "immediate" block seems like it would work.

I thought "is_triggered_only = yes" meant the event wouldn't trigger on it's own and would need to be fired by something else? I was hoping to make this auto trigger so it checks for characters belonging to the race but lack the trait and portraits necessary. What would I need to make that happen or do I have the understanding of "is_triggered_only = yes" wrong?

 

53 minutes ago, zia said:

One issue that I can see:

Switch this:

 

  Hide contents

    trigger = { 
        race = elven
        race = orc
        race = neko
        NOT = {
            trait = neko
            trait = orc
            trait = elf
        }
    }

With:

  Hide contents

    trigger = {
        OR = { 
                race = elven
               race = orc
                race = neko
        }
            NOR = {
                trait = neko
                trait = orc
                trait = elf
           }
    }
 

 

# NOR is short for 
NOT = {
    OR = {
        trait = neko
        trait = orc
        trait = elf
    }
}


If you just use NOT then it looks for some who does not have ALL THREE traits rather than just one of them. (So if they just had orc trait it would say to fire the event for them since they lack neko and elf)

Same for just listing the races at the beginning, if you don't use OR it may try and check for someone with ALL THREE races instead of just one. (normaly at least, with characters only have ONE race it may be able to interpret it correctly or it might not. Best use OR to be safe.)

Thanks. I didn't think of that.

Link to comment
7 hours ago, tyber14 said:

I thought "is_triggered_only = yes" meant the event wouldn't trigger on it's own and would need to be fired by something else? I was hoping to make this auto trigger so it checks for characters belonging to the race but lack the trait and portraits necessary. What would I need to make that happen or do I have the understanding of "is_triggered_only = yes" wrong?

 

Thanks. I didn't think of that.

That is why I said "or".  For something that fires on its own you need a MTTH section, which can be a bit confusing at first.  If you don't have a MTTH section the event tries to fire constantly (a relative term but too often) and bogs down the system.  It can be as simple as something like:

mean_time_to_happen = { days = 90 }

to something fairly complicated with modifiers to speed it up or slow it down.  Here is a more complex, but BROKEN one:

	mean_time_to_happen = {
		months = 6
		modifier = {
			factor = 0.05					# rush the event if 16
			NOT = { age = 10 }
			age = 16
		}
		modifier = {
			factor = 0
			OR = {
				nox_is_old_enough = no
				nox_is_sexually_developed = no
				has_character_flag = nox_rejected_wolfmother_sex
			}
		}
	}

I said this is broken.  The first modifier happens for someone who age is less than 10 AND greater than or equal to 16 at the same time.  So every now and then I screw up my triggers also.  :smile:  However, the event still works, just without the speedup I had planned.  

Link to comment

You can either use is_triggered_only and trigger it from another piece of code or use a mean_time_to_happen. Using neither is equivalent to using mean_time_to_happen = { days = 1 }, but it's always advisable to be explicit in case you get a bug lster and need to figure it out.

 

BTW you may want to modify the trigger so once a character has a portrait the event never fires again. Otherwise, you'll get people changing portraits once each 20 days or so.

 

Also, you may want to instead write it as a decidion that only the ai can take. Reason being thst mtth events are checked wvery 20 days for rulers and every 50 days for courtiers, while decisions are run every 30 days for everyone.

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use