I think this could work:
##########################
# The Crown Prince(ss)
##########################
title_crown_prince = {
courtier = yes
grantable = yes
grant_limit = 1
allow = {
country = { government = monarchy }
is_ruler = no
from_ruler_family = yes
}
gain_trigger = {
is_primary_heir = yes
}
gain_effect = {
loyalty = 50
}
lose_trigger = {
OR = {
is_primary_heir = no
country = { NOT = { government = monarchy } }
}
}
dismissal_trigger = {
always = no
}
lose_effect = {
loyalty = -30
}
prominence = 40
monthly_character_wealth = 0.3
monthly_character_loyalty = 1
monthly_character_popularity = 0.05
monthly_character_prominence = 0.3
}
Will add that I haven't tested this yet, will do straight away, just gave it a try as I read this post.