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

Nocan

Corporal
31 Badges
Jun 9, 2015
40
30
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Res Publica
  • Magicka
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Way of Life
  • Crusader Kings III
  • Prison Architect: Psych Ward
  • Prison Architect
  • Imperator: Rome
  • Crusader Kings II: Holy Fury
  • Cities: Skylines - Parklife
  • Crusader Kings II: Jade Dragon
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
  • War of the Roses
  • Europa Universalis IV
Would it be possible to change hair and beards to work in the same way as clothing, being changed by culture? I find it very weird that characters who don't have the same culture as ethnicity still use the hairstyles from the ethnicity. A Cuman-looking character raised by a German would have German styles, the same as it is with clothing.

I'm not completely sure how they work in the game, but both hair and clothes are defined in the portrait files. And yet they work differently; clothing being culture dependent. Could hair be changed to work in the same way?

I would love some help to do this in a way that doesn't require making hybrid cultures for all possible combinations
 
I've never made code like this from scratch, only changed existing, but I gave it a shot.
I made this:
Code:
spriteTypes = {

    portraitType = {
        name = "PORTRAIT_german_cultural_hair_male"
      
        weight = {
            additive_modifier = {
                value = 10000
                portrait_age > child
                portrait_is_female = no
                culture = german
            }
        }
      
        layer = {
            "GFX_german_male_hair_behind:c6"
            "GFX_german_male_hair:c7"
        }
    }
}

And added c6 and c7 in the german_portraits.txt:
Code:
"GFX_german_male_hair_behind:p1:h:y:c6"
"GFX_german_male_hair:p1:h:y:c7"

That had no effect in the game. Guesing something more needs to be done but I don't know what. Do i need to add PORTRAIT_german_cultural_hair_male to some other file? And is there a way to not have to make one for each culture?
 
C slots are hard-coded. Would probably be easier to export to any number of new property slots and make use of culture-dependent properties rules or hidden traits.
 
Using a phone so I cannot fully describe it right now, but look up the static portrait mod and check out how they do it. At the very least you'll need an image editing program like Photoshop or Gimp and the .dds plugin in addition to your text editor of choice.

Alternately, look up the override rules in the .gfx file for the societies and see if you can make use of them. You'd have to make separate .gfx files for each instance using similar .dds substitutions, assuming you have M&M.
 
I had a look at the static portrait mod. They use hidden traits to activate an all-covering gfx in place of c5. We could use hidden traits to activate the hair set if it could replace the hair the character already has, though I'm not sure how to do that. Since hair isn't one of the c's we can't just copy their way of doing it.

Also had a look at the society_clothing.gfx file, and it does part of what i want to do.
Code:
portraitType = {
        name = "PORTRAIT_society_benedictine_clothing_male"
       
        weight = {
            additive_modifier = {
                value = 10000
                portrait_age > child
                portrait_is_female = no
                portrait_clothing = yes
                portrait_society = monastic_order_benedictine
                NOT = { portrait_tier = king }
            }
        }
       
        layer = {
            "GFX_society_benedictine_male_clothing_behind:c0"
            "GFX_society_benedictine_male_clothing_front:c2"
            "GFX_society_benedictine_male_headgear_front:c5"
            "GFX_western_male_hair_behind_midage"
            "GFX_western_male_hair_midage"
            "GFX_empty:c3"
            "GFX_empty:c1"
            "GFX_empty:c4"
        }
       
        # Tonsure hairstyle, no beard
        allow_property_values = {
            1 = {
                6 = {
                    always = yes
                }
            }
            4 = {
                0 = {
                    always = yes
                }
            }
        }
    }
It changes the portrait to use western hair, then limits the properties so only one hairstyle and no beard is possible. In this code, if the allow_property_values was emptied, GFX_western_male_beard and GFX_western_male_beard_behind was added in the layer section, and the weight depended on the character being a culture that uses western hair and beard, would that then do what I want it to?
If so, it would be easy enough to do I think. Just need to make six for each culture (young, midage and oldage versions, and that for both genders)
 
The static portrait method is the most flexible, since the rules in the properties file are a lot more robust, but you'd have to physically adjust each hair and beard to have one extra blank slot and do a lot of tedious script work in the file. It would also not be able to be used for the public on strict interpretation of the usual modding rules since it's a redistribution of DLC assets.

The overriding rules would allow you to make things "workshop safe" but there are only like 10 or 11 separate conditions that can be used and it's therefore somewhat more limited.

Every time I make the DLC, I do try to include some "non-ethnically specific" hairstyles for situations like these, but there are a handful of the sets that couldn't really be feasible to have another culture's hair as a consequence. Not to bbe inflammatory, but most of the hair for the East African set, for instance, is pretty much limited to East African ethnic characters.
 
The basic principle is a strip of images is tied to a trait. If the trait it present, it pulls from the strip of images from the second image in the index onwards. If not, it still displays from that layer but on the "blank" portion and then tries again on one of the other properties. You could replicate this for hair by tying these invisible traits directly to culture, but it would involve expanding the frame by 1 with a pure blank slot in the first portion to work ideally. Technically, each male set should include a bald option on the first slot, but the females don't which means using vanilla assets would have multiple stacked hairsets and look terrible.

The other way isn't a bad way to do it, as far as I know. I just know the set of conditions that can be used for overriding layers the way they are in the societies stuff is limited to a handful of things, which has less overall flexibility. I'm less well-versed in them, considering my typical involvement is specifically towards making the art.
 
You say the other way has less flexibility, but could it still work? All it needs to do is override front and behind hair and beard, and then add the replacement