The existing implementation of racial traits could be improved a bit, I think. Particularly, keying off culture itself means that visual appearance and species are disconnected from each other - an elf child raised by orcs will be considered an orc (and in fact not be immortal). Also, handling it as half a dozen different short MTTH events is pretty non-optimal.
I've written up a basic event keying off graphical_culture and triggered with on_birth (and on_yearly_pulse as well, to catch courtiers generated as adults). Seems to work decently with some testing, assigning race traits immediately on birth and allowing a persistent difference between trait race and culture.
Code:
namespace = racetraits
character_event = {
id = racetraits.0
title = ELF_TRAIT # elf trait
desc = "EVTDESCRACETRAITS.0"
picture = "GFX_evt_coronation"
hide_window = yes
trigger = {
NOT = { has_character_flag = racetraitpassed }
}
is_triggered_only = yes
option = {
name = "OK"
set_character_flag = racetraitpassed
if = {
limit = {
graphical_culture = elfgfx
}
add_trait = elf
break = yes
}
if = {
limit = {
graphical_culture = dwarfgfx
}
add_trait = dwarven
break = yes
}
if = {
limit = {
graphical_culture = goblingfx
}
add_trait = goblin
break = yes
}
if = {
limit = {
graphical_culture = orkgfx #Both Orogs and Gnolls use this
OR = {
AND = { #Orog mother, real father is not a gnoll - child must be orog
mother_even_if_dead = { trait = orog }
NOT = {
AND = {
father_even_if_dead = { trait = gnoll }
NOT = { real_father = { always = yes } }
}
real_father = { trait = gnoll }
}
}
AND = { #Orog father, mother is not a gnoll - child must be orog
OR = {
AND = {
father_even_if_dead = { trait = orog }
NOT = { real_father = { always = yes } }
}
real_father = { trait = orog }
}
NOT = { mother_even_if_dead = { trait = gnoll } }
}
AND = { #Generated character or game start - use culture
OR = {
AND = {
NOT = { mother_even_if_dead = { always = yes } }
NOT = { real_father = { always = yes } }
NOT = { father_even_if_dead = { always = yes } }
}
NOT = { year = 1526 }
}
culture = Orog
}
AND = { #Event bastard for female orog - no father exists
NOT = { real_father = { always = yes } }
NOT = { father_even_if_dead = { always = yes } }
mother_even_if_dead = { trait = orog }
}
AND = { #Event bastard for male orog - no mother exists
NOT = { mother_even_if_dead = { always = yes } }
father = { trait = orog }
}
}
}
add_trait = orog
break = yes
}
if = {
limit = {
graphical_culture = orkgfx #Both Orogs and Gnolls use this
OR = {
AND = { #Gnoll mother, real father is not an orog - child must be gnoll
mother_even_if_dead = { trait = gnoll }
NOT = {
AND = {
father_even_if_dead = { trait = orog }
NOT = { real_father = { always = yes } }
}
real_father = { trait = orog }
}
}
AND = { #Gnoll father, mother is not an orog - child must be gnoll
OR = {
AND = {
father_even_if_dead = { trait = gnoll }
NOT = { real_father = { always = yes } }
}
real_father = { trait = gnoll }
}
NOT = { mother_even_if_dead = { trait = orog } }
}
AND = { #Generated character, or just after game start - use culture
OR = {
AND = {
NOT = { mother_even_if_dead = { always = yes } }
NOT = { real_father = { always = yes } }
NOT = { father_even_if_dead = { always = yes } }
}
NOT = { year = 1526 }
}
culture = Gnoll
}
AND = { #Event bastard for female gnoll - no father exists
NOT = { real_father = { always = yes } }
NOT = { father_even_if_dead = { always = yes } }
mother_even_if_dead = { trait = gnoll }
}
AND = { #Event bastard for male gnoll - no mother exists
NOT = { mother_even_if_dead = { always = yes } }
father = { trait = gnoll }
}
}
}
add_trait = gnoll
break = yes
}
if = {
limit = {
graphical_culture = orkgfx #Both Orogs and Gnolls use this
OR = {
AND = { #Child of gnoll and orog
OR = {
AND = {
father_even_if_dead = { trait = gnoll }
NOT = { real_father = { always = yes } }
}
real_father = { trait = gnoll }
}
mother_even_if_dead = { trait = orog }
}
AND = {
OR = {
AND = {
father_even_if_dead = { trait = orog }
NOT = { real_father = { always = yes } }
}
real_father = { trait = orog }
}
mother_even_if_dead = { trait = gnoll }
}
}
}
random_list = {
50 = { add_trait = gnoll }
50 = { add_trait = orog }
}
break = yes
}
if = {
limit = {
graphical_culture = hobbitsgfx
}
add_trait = halfling
break = yes
}
if = {
limit = {
graphical_culture = wraithgfx
}
#no trait for this, but need to exclude as non-human
break = yes
}
if = {
limit = {
graphical_culture = trollgfx
}
#no trait for this, but need to exclude as non-human
break = yes
}
#Anything after this is human-looking (at least one human or half-race parent), but we need to check for half-races
if = {
limit = {
OR = {
mother_even_if_dead = { trait = elf } #mother's an elf
AND = {
father_even_if_dead = { trait = elf }
NOT = { real_father = { always = yes } } #Father's an elf, and not a cuckoo child
}
real_father = { trait = elf } #IS a cuckoo child, and real dad's an elf
AND = {
mother_even_if_dead = { trait = half_elf }
OR = {
AND = {
father_even_if_dead = { trait = half_elf }
NOT = { real_father = { always = yes } }
}
real_father = { trait = half_elf }
}
}
}
}
add_trait = half_elf
break = yes
}
if = {
limit = {
OR = {
mother_even_if_dead = { trait = goblin } #mother's a goblin
AND = {
father_even_if_dead = { trait = goblin }
NOT = { real_father = { always = yes } } #Father's a goblin, and not a cuckoo child
}
real_father = { trait = goblin } #IS a cuckoo child, and real dad's a goblin
AND = {
mother_even_if_dead = { trait = half_goblin }
OR = {
AND = {
father_even_if_dead = { trait = half_goblin }
NOT = { real_father = { always = yes } }
}
real_father = { trait = half_goblin }
}
}
}
}
add_trait = half_goblin
break = yes
}
}
}
Though if this were to be used, then layers 20 and 21 in portrait_properties (the static gnoll images) should probably key off of the trait instead of the culture. Obviously, it replaces the contents of both BRraces_events and halfelf_events, and is easily extensible to other halves - orcs are at least one other clear candidate.
A lot of code is kinda wasted here distinguishing between gnolls and orcs, too. Be better to split them into separate culturegfx, if possible.
I also noticed that the 'province level' buildings are lost when a tribe converts to feudalism/tribalism. They need to have, for example, for tr_province_0
Code:
convert_to_city = ct_province_0
convert_to_castle = ca_province_0
and so on for the higher levels, in order to preserve province level.
edit: Event edited to take cuckoo children into account