Hey so I've replaced a number of vanilla traits with new ethnic traits for my upcoming mod. So now the Roman characters can get traits that describe them as an Illyrian-Roman or an Italo-Roman, etc. I set the chance to 100 and the value to 1 for each trait. I want every Roman general to have 1 of these traits. Below is the code I'm using at the moment, and its working for the most part. The traits work, and appear, but the code doesn't know how to limit them. So when I spawn a new general he ends up with 2-3 of them. My commanders are Iberian, Brito, and Dacian-Romans at the same time haha. The last piece of the code needed is a way stop that and ensure that the general only receives 1 of them.

char_is_general(context:character()) and context:character():faction():name() == "emp_antony" or context:character():faction():name() == "emp_lepidus" or context:character():faction():name() == "emp_octavian" or context:character():faction():name() == "emp_pompey" and context:character():model():campaign_name("main_emperor") and context:character():number_of_traits() <1