• 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.
I want to create an event that will trigger for a character if a parent has a particular trait. Is there a scope command for parents?
AFAIK, no. You have to use OR = { mother = { } father = { } }

Does anyone know if there's a command to move characters to a different court? set_liege or set_host, or something like that.
 
AFAIK, no. You have to use OR = { mother = { } father = { } }

Does anyone know if there's a command to move characters to a different court? set_liege or set_host, or something like that.

Then prepare to learn something new.

guardian
father
mother
spouse

are all scopes you can use. I believe I initially took them from the child personality traits file? Not sure, but you should be able to find examples of them.

I'm not positive off-hand about a move court command but I know of the transfer vassal event which might be of use here. It's in vassal_requests.txt I think? Not sure.

-----------------------------------------

My own problem:

This was working fine until I added character flags but now it's suddenly sending me blank letter events for some reason. Did I miss a bracket somewhere? I've combed through it several times and I don't see where I screwed up.

Code:
# 140100: Found a Tutor to help one of the realm's courtiers
character_event = {
	id = 140100
	title = "EVTNAMELSP100"
	desc = "EVTDESCLSP100"
	picture = GFX_evt_emissary
	
	capable_only = yes
	prisoner = no
	
	trigger = {
		has_job_action = action_advance_cul_tech
		location = {
			any_province_character = {
					same_realm = ROOT
					AND = {
						NOT = { trait = mastermind_theologian }
						NOT = { trait = brilliant_strategist }
						NOT = { trait = midas_touched }
						NOT = { trait = grey_eminence }
						NOT = { trait = elusive_shadow }
					}			
			}
		}
	}
	
	mean_time_to_happen = {
		days = 5 # testing value
		
		modifier = {
			factor = 1.5
			NOT = { learning = 2 }
		}
		modifier = {
			factor = 1.5
			NOT = { learning = 3 }
		}
		modifier = {
			factor = 1.25
			NOT = { learning = 4 }
		}
		modifier = {
			factor = 1.25
			NOT = { learning = 5 }
		}
		modifier = {
			factor = 0.75
			learning = 10
		}
		modifier = {
			factor = 0.8
			learning = 11
		}
		modifier = {
			factor = 0.8
			learning = 12
		}
		modifier = {
			factor = 0.8
			learning = 13
		}
		modifier = {
			factor = 0.9
			learning = 15
		}
		modifier = {
			factor = 0.9
			learning = 17
		}
		modifier = {
			factor = 0.9
			learning = 20
		}		
		modifier = {
			factor = 0.75
			location = {
				any_province_character = {
					same_liege = ROOT
					has_job_action = action_advance_eco_tech
				}
			}
		}
		modifier = {
			factor = 0.75
			location = {
				any_province_character = {
					same_liege = ROOT
					has_job_action = action_advance_mil_tech
				}
			}
		}		
	}
	
	immediate = {
		hidden_tooltip = {
			location = {
				random_province_character = {
					limit = {
						NOT = { age = 40 }
						same_realm = ROOT
						AND = {
							NOT = { trait = mastermind_theologian }
							NOT = { trait = brilliant_strategist }
							NOT = { trait = midas_touched }
							NOT = { trait = grey_eminence }
							NOT = { trait = elusive_shadow }
						}
					}
					set_character_flag = has_been_found_a_tutor
				}
			}
			
		}
	}
	
	# I'll tell my employer at once
	option = {
		name = "EVTO1LSP100"
		ai_chance = {
			factor = 100
			modifier = {
				factor = 1.25
				trait = diligent
			}
			modifier = {
				factor = 1.25
				trait = kind
			}
			modifier = {
				factor = 1.25
				trait = charitable
			}
			modifier = {
				factor = 3
				random_province_character = {
					limit = { 
						has_character_flag = has_been_found_a_tutor 
					}
					reverse_opinion = { who = ROOT value = 25 }
				}
			}			
		}		
		employer = { letter_event = { id = 140101 days = 1 } }
	}
	
	# Screw that guy!
	option = {
		name = "EVTO2LSP100"
		ai_chance = {
			factor = 100
			modifier = {
				factor = 0.5
				trait = humble
			}
			modifier = {
				factor = 2
				AND = {
					trait = wroth
					NOT = { reverse_opinion = { who = ROOT value = 0 } }
				}
			}
			modifier = {
				factor = 1.25
				trait = greedy
			}
			modifier = {
				factor = 5
				random_province_character = {
					limit = { 
						has_character_flag = has_been_found_a_tutor 
					}
					NOT = { reverse_opinion = { who = ROOT value = -40 } }
				}
			}			
		}
		clr_character_flag = has_been_found_a_tutor
	}
}

# 140101: The liege is informed of the possible increase
letter_event = {
	id = 140101
	desc = "EVTDESCLSP101"
	
	is_triggered_only = yes
	
	# Hire the Tutor
	option = {
		name = "EVTO1LSP101"
		trigger = { wealth = 5 }
		wealth = -5
		FROM = {
			location = { 
				any_province_character = {
					limit = {
						has_character_flag = has_been_found_a_tutor
						same_realm = FROM
					}
					
					# Intrigue
					if = {
						limit = { trait = intricate_webweaver }
						add_trait = elusive_shadow
						remove_trait = intricate_webweaver
					}		
					if = {
						limit = { trait = flamboyant_schemer }
						add_trait = intricate_webweaver
						remove_trait = flamboyant_schemer
					}					
					if = {
						limit = { trait = amateurish_plotter }
						add_trait = flamboyant_schemer
						remove_trait = amateurish_plotter
					}

					# Diplomacy
					if = {
						limit = { trait = charismatic_negotiator }
						add_trait = grey_eminence
						remove_trait = charismatic_negotiator
					}	
					if = {
						limit = { trait = underhanded_rogue }
						add_trait = charismatic_negotiator
						remove_trait = underhanded_rogue
					}					
					if = {
						limit = { trait = naive_appeaser }
						add_trait = underhanded_rogue
						remove_trait = naive_appeaser
					}

					# Stewardship
					if = {
						limit = { trait = fortune_builder }
						add_trait = midas_touched
						remove_trait = fortune_builder
					}	
					if = {
						limit = { trait = thrifty_clerk }
						add_trait = fortune_builder
						remove_trait = thrifty_clerk
					}
					if = {
						limit = { trait = indulgent_wastrel }
						add_trait = thrifty_clerk
						remove_trait = indulgent_wastrel
					}					

					# Martial
					if = {
						limit = { trait = skilled_tactician }
						add_trait = brilliant_strategist
						remove_trait = skilled_tactician
					}		
					if = {
						limit = { trait = tough_soldier }
						add_trait = skilled_tactician
						remove_trait = tough_soldier
					}					
					if = {
						limit = { trait = misguided_warrior }
						add_trait = tough_soldier
						remove_trait = misguided_warrior
					}

					# Learning
					if = {
						limit = { trait = scholarly_theologian }
						add_trait = mastermind_theologian
						remove_trait = scholarly_theologian
					}					
					if = {
						limit = { trait = martial_cleric }
						add_trait = scholarly_theologian
						remove_trait = martial_cleric
					}
					if = {
						limit = { trait = detached_priest }
						add_trait = martial_cleric
						remove_trait = detached_priest
					}

					clr_character_flag = has_been_found_a_tutor
				}
			}			
		}		
	}
	
	# Can't afford it
	option = {
		name = "EVTO2LSP101"
		clr_character_flag = has_been_found_a_tutor
	}
}

EDIT: Just noticed 2 scope errors involving clr_character_flag in an option, but changing them didn't solve the problem. I still get a blank letter.
 
Last edited:
I have a question about the way OR operator works.
In portrait_properties.txt there is the following construction:
Code:
OR = {
	NOT = {
		trait = has_measles
		trait = has_small_pox
	}
}
I tested it and it works exactly the same way as the following:
Code:
NOT = {
	OR = {
		trait = has_measles
		trait = has_small_pox
	}
}
The question is: are contents of NOT operator affected by external OR or AND operator? In other words, do these constructs return the same result:
Code:
OR = {
	NOT = {
		trait = has_measles
		trait = has_small_pox
	}
}
Code:
AND = {
	NOT = {
		trait = has_measles
		trait = has_small_pox
	}
}
?
 

The standard trigger condition is AND so that when you're writing any two conditions in between the trigger brackets both of them have to be fulfilled in order for the event to trigger. When you're writing the AND condition that usually means you want a number of conditions inside the AND brackets to have been fulfilled . The OR condition only needs one of the conditions inside of it to be true in order for the OR to be true itself.

Code:
AND = {
	NOT = {
		trait = has_measles
		trait = has_small_pox
	}
}

The AND doesn't do anything, it only has 1 condition inside of it so you could just as well have left it out.

Code:
OR = {
	NOT = {
		trait = has_measles
		trait = has_small_pox
	}
}

Same thing here, the OR condition only has 1 condition inside of it.

Essentially, AND means that every NOT or AND or OR condition inside of it has to be true while OR only have to have one condition inside of it to be true in order for itself to be true... Hope that makes sense. :p
 
The standard trigger condition is AND
That`s why I`m asking. In my case it doesn`t work like this.
In vanilla trigger for red dots NOT appearing on character`s face is the following:
Code:
OR = {
	NOT = {
		trait = has_measles
		trait = has_small_pox
	}
}
Let`s assume you`re right and this construction equals
Code:
OR = {
	NOT = {
		AND = {
			trait = has_measles
			trait = has_small_pox
		}
	}
}
Lets also assume our character has measles but doesn`t have small pox. In this case this construction returns TRUE:
Code:
OR = {
	NOT = {
		AND = {
			TRUE
			FALSE
		}
	}
}
But in game that character WILL have red dots on his face! It means that inside OR operator default trigger condition is OR, not AND.
 
That`s why I`m asking. In my case it doesn`t work like this.
In vanilla trigger for red dots NOT appearing on character`s face is the following:
Code:
OR = {
	NOT = {
		trait = has_measles
		trait = has_small_pox
	}
}
Let`s assume you`re right and this construction equals
Code:
OR = {
	NOT = {
		AND = {
			trait = has_measles
			trait = has_small_pox
		}
	}
}
Lets also assume our character has measles but doesn`t have small pox. In this case this construction returns TRUE:
Code:
OR = {
	NOT = {
		AND = {
			TRUE
			FALSE
		}
	}
}
But in game that character WILL have red dots on his face! It means that inside OR operator default trigger condition is OR, not AND.
Could it be that in this particular instance Paradox messed up the conditions but it still works because of a coincidence?

I'll explain. You took that snip of code from a place where the game must choose between just two options. If this works as Humble Hubert says (which would be the logically correct way), none of these options would apply when the characters have just one of these traits. In this case, since both factors are 0 because none of them apply, it might be that the engine just chooses the first one (and in the case of portrait features, the fist one is the second on the list).

EDIT: Looks like I'm wrong after all, I gave the first option's modifier a factor of 0.01 instead of 0 so the engine would choose it if none of them apply and it still chose the second. It seems like OR and AND indeed propagate inside NOTs.
 
Last edited:
I have a question about how to tie events and modifiers to terrain type. I'm working on my combat overhaul mod and I took out all the old tactics and put in new ones that are chosen completely based on martial skill rather than unit composition. My idea from there was to tie unit bonuses to the terrain so that light infantry would excel in forests, for instance, and horse archers on plains, ect.

In static_modifiers.txt you have this section:
Code:
##########################################################################
# Combat Static Modifiers
##########################################################################

river_crossing = {	
	icon = 2
	archers_defensive = -0.1
	light_infantry_defensive = -0.1
	pikemen_defensive = -0.15
	heavy_infantry_defensive = -0.15
	light_cavalry_defensive = -0.125
	knights_defensive = -0.15
	horse_archers_defensive = -0.125

	archers_offensive = -0.05
	light_infantry_offensive = -0.1
	pikemen_offensive = -0.15
	heavy_infantry_offensive = -0.15
	light_cavalry_offensive = -0.125
	knights_offensive = -0.15
	horse_archers_offensive = -0.075
}

strait_crossing = {
	icon = 3
	archers_defensive = -0.15
	light_infantry_defensive = -0.15
	pikemen_defensive = -0.2
	heavy_infantry_defensive = -0.2
	light_cavalry_defensive = -0.172
	knights_defensive = -0.2
	horse_archers_defensive = -0.172

	archers_offensive = -0.1
	light_infantry_offensive = -0.15
	pikemen_offensive = -0.2
	heavy_infantry_offensive = -0.2
	light_cavalry_offensive = -0.172
	knights_offensive = -0.2
	horse_archers_offensive = -0.125
}

amphibious_landing = {
	icon = 4
	archers_defensive = -0.15
	light_infantry_defensive = -0.15
	pikemen_defensive = -0.2
	heavy_infantry_defensive = -0.2
	light_cavalry_defensive = -0.175
	knights_defensive = -0.2
	horse_archers_defensive = -0.175

	archers_offensive = -0.1
	light_infantry_offensive = -0.15
	pikemen_offensive = -0.2
	heavy_infantry_offensive = -0.2
	light_cavalry_offensive = -0.175
	knights_offensive = -0.2
	horse_archers_offensive = -0.125
}

defenderbonus_mountain = {
	icon = 1
	archers_defensive = 0.3
	light_infantry_defensive = 0.1
	pikemen_defensive = 0.2
	heavy_infantry_defensive = 0.1
	horse_archers_defensive = 0.25

	archers_offensive = 0.2
	pikemen_offensive = 0.1
	horse_archers_offensive = 0.15
}

defenderbonus_hills = {
	icon = 1
	archers_defensive = 0.2
	pikemen_defensive = 0.1
	horse_archers_defensive = 0.15

	archers_offensive = 0.15
	pikemen_offensive = 0.05
	horse_archers_offensive = 0.10
}

Adding additional defender modifiers to each terrain is as easy as putting defenderbonus_terrainX = {

But how would I force bonuses/multiplers for attackers as well? It seems possible, in the case of river crossings/amphibious landings, but I want to add modifiers for normal attacks on different terrain types.

If that isn't possible how would I use terrain as a modifier for tactics? For instance making only certain tactics available on certain terrain types? I've tried everything I can think of and I can't make it work.
 
I am writing a "Disband levy" event tied to a "Disband levy decision". I was able to add a character modifier to my character (and his/her vassals) but unable to add a province_modifier to their demesnes. Here is my code for the event.



Code:
# Disband thematic levy - Levy disbanded
letter_event = {
	id = 2001011
	title = "DISBANDLEVYTITLE"
	desc = "EVTDESC2001011"
	#picture = "GFX_evt_courier"
	is_friendly = yes
	is_triggered_only = yes

	option = {
		name = "EVTOPTA2001011" # Put down burden of arms
		clr_character_flag = levy_disband_enacted
		add_character_modifier = {
				name = levy_disbanded
				duration = 7300
			                               }
		
	`      any_demesne_province = {
			
			add_province_modifier = {
				name = levy_disbanded_province
				duration = 7300
					                      }
				                      }
}
 
Hi all. Could anyone save me a lot ot time & headache by telling me how or giving an example of code for the action I'd like to achive?

Ok what I want to do is:

- every character of all ages immeadiatly gets 1 of a set number of specially reserved traits at the start of the game.

- also every new born character will be asigned one of the specially reserved traits as soon as their born.

please note - I dont need any event windows or messages just everyone getting one of the set traits.

Thank you in advance!
 
Hi all. Could anyone save me a lot ot time & headache by telling me how or giving an example of code for the action I'd like to achive?

Ok what I want to do is:

- every character of all ages immeadiatly gets 1 of a set number of specially reserved traits at the start of the game.

- also every new born character will be asigned one of the specially reserved traits as soon as their born.

please note - I dont need any event windows or messages just everyone getting one of the set traits.

Thank you in advance!
If you really need it to happen immediately, then the best way is to have an event with a MTTH of 1 day, that fires whenever a character doesn't have one of those traits.

You could also see if on_birth = { } is a valid on action scope. It's not listed, but on_bastard_birth is, so it might be valid, just unused.
 
Where are the triggers for nicknames such as the usurper and the conqueror?
Trying to learn how to script in CK2 and do triggered nicknames and i'm lost.
 
Where are the triggers for nicknames such as the usurper and the conqueror?
Trying to learn how to script in CK2 and do triggered nicknames and i'm lost.

The Conquerer can be found in Crusader Kings II/common/cb_types.txt
 
What determines if a character can join a plot? Is it the same trigger as to start a plot? In other words, does the potential = { } section cover both the primary plotter and the plot backers?