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

Augustulus91

First Lieutenant
71 Badges
Mar 22, 2012
208
1
  • Hearts of Iron IV: La Resistance
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Heir to the Throne
  • March of the Eagles
  • Europa Universalis IV: Res Publica
  • Rome Gold
  • Semper Fi
  • Hearts of Iron III: Their Finest Hour
  • Supreme Ruler: Cold War
  • Europa Universalis IV: Third Rome
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Pre-order
  • Europa Universalis III Complete
  • Cities: Skylines - After Dark
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Europa Universalis IV: Wealth of Nations
  • Darkest Hour
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Crusader Kings II
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis 4: Emperor
  • Hearts of Iron IV: Death or Dishonor
  • Crusader Kings II: Jade Dragon
  • Cities: Skylines - Mass Transit
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife
  • Europa Universalis IV: Dharma
  • Crusader Kings II: Holy Fury
  • Europa Universalis IV: Golden Century
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Prison Architect
I have a very difficult question.

I am currently adding some tribal titles (of higher tiers), so I would like to know, if it is possible to code, conditions , such that the title can be created if the holder holds (or reigns over) a certain % of the total number of provinces with that culture?

For example "Emperor of the Czechs" if he holds 80% of the czech-cultured provinces in-game (at that moment) ?
 

Chris93

Captain
22 Badges
Jun 4, 2011
464
29
  • Crusader Kings II
  • Stellaris: Galaxy Edition
  • Semper Fi
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • Stellaris
  • Victoria 3 Sign Up
  • Crusader Kings III
  • Prison Architect
  • Imperator: Rome
  • Age of Wonders III
  • Surviving Mars
  • Hearts of Iron IV: Cadet
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • 500k Club
  • Victoria 2
  • Hearts of Iron III
  • Europa Universalis IV
  • For the Motherland
  • Europa Universalis IV: Art of War
  • Crusader Kings II: The Old Gods
Hi guys, I'm a member of Middle Earth Project and we're working on the compatibility for the latest patches. The only problem I have is that the mod does not recognizes the diplomatic range introduced by the last patch, the defines is updated, do I forget something?
 

richvh

Preserver of the Light
63 Badges
Dec 1, 2001
14.691
1.999
Visit site
  • Stellaris: Leviathans Story Pack
  • Pillars of Eternity
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Knights of Pen and Paper 2
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Crusader Kings II: Reapers Due
  • Tyranny: Archon Edition
  • Tyranny: Archon Edition
  • Tyranny: Gold Edition
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Tyranny - Tales from the Tiers
  • Tyranny - Bastards Wound
  • Age of Wonders III
  • Age of Wonders: Shadow Magic
  • Age of Wonders
  • Age of Wonders II
  • Crusader Kings II: Jade Dragon
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • A Game of Dwarves
  • King Arthur II
  • Knights of Pen and Paper +1 Edition
  • Magicka
  • Majesty 2 Collection
  • Europa Universalis IV: Res Publica
  • Europa Universalis: Rome
  • Rome Gold
  • Rome: Vae Victis
  • 500k Club
  • Cities: Skylines
I have a very difficult question.

I am currently adding some tribal titles (of higher tiers), so I would like to know, if it is possible to code, conditions , such that the title can be created if the holder holds (or reigns over) a certain % of the total number of provinces with that culture?

For example "Emperor of the Czechs" if he holds 80% of the czech-cultured provinces in-game (at that moment) ?

I don't think that's possible. You could however set up a titular title that can be formed if you control 80% of the Czech cultured provinces at the start of the game.
 

Augustulus91

First Lieutenant
71 Badges
Mar 22, 2012
208
1
  • Hearts of Iron IV: La Resistance
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Heir to the Throne
  • March of the Eagles
  • Europa Universalis IV: Res Publica
  • Rome Gold
  • Semper Fi
  • Hearts of Iron III: Their Finest Hour
  • Supreme Ruler: Cold War
  • Europa Universalis IV: Third Rome
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Pre-order
  • Europa Universalis III Complete
  • Cities: Skylines - After Dark
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Europa Universalis IV: Wealth of Nations
  • Darkest Hour
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Crusader Kings II
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis 4: Emperor
  • Hearts of Iron IV: Death or Dishonor
  • Crusader Kings II: Jade Dragon
  • Cities: Skylines - Mass Transit
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife
  • Europa Universalis IV: Dharma
  • Crusader Kings II: Holy Fury
  • Europa Universalis IV: Golden Century
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Prison Architect
I don't think that's possible. You could however set up a titular title that can be formed if you control 80% of the Czech cultured provinces at the start of the game.

How would I code that, would would need to specifiy all those provinces?
Example: Have 2 of 3 provinces:

Do I code the combinations: 1 & 2 OR 1 & 3 OR 2 & 3. Or can i Code it easier?
Btw, thank you for the response!
 

fanoI

General
2 Badges
Aug 26, 2012
1.870
106
  • Crusader Kings II
  • Europa Universalis IV
I've a problem to understand how to guide the IA to take an option on an event; the scope of the event is to emulate the Treaty of Lateran that is giving to a totally defeated Pope the Bishorship of Saint Peter (or Rome how Paradox calls it) vassalizing him in the process, all gone smooth until I've had only a possible decision to choose and effectively the Pope accepted and got Saint Peter and become my vassal :D

Then I've add the "F*ck option" and he started to always say no, but he has an opinion of 64 so... this code is freely inspired by the Paradox event in which a poor vassal petition the liege for a title in his de jure land:

Code:
namespace = COR

# The Roman Republic had success and reformed the Western Roman Empire / Roman Empire
# now we are requesting to the Pope to join the Empire.
character_event = {
	id = COR.0
	desc = "COR.0.desc"
    	picture = GFX_evt_emissary
	border = GFX_event_normal_frame_diplomacy
    
    	is_triggered_only = yes
    
	# The Pope accepts the demand
    	option = {
        	name = EVTOPTA_COR_0

	   	ai_chance = { 
			factor = 50
		
			# An ambitious Pope would not accept peaceful
			# vassalization!	
			modifier = {
				factor = 0
				trait = ambitious
			}
			modifier = {
				factor = 0
				NOT = {
					opinion = { who = FROM value = -20 }
				}
  			}
			modifier = {
				factor = 0.5
				NOT = {
					opinion = { who = FROM value = 25 }
				}
			}
			modifier = {
				factor = 0.5
				NOT = {
					opinion = { who = FROM value = 50 }
				}
			}	
		}

		b_roma = {
			grant_title = PREV
		}
		opinion = {
			who = FROM
			modifier = opinion_restored_to_rome
		}

		# Things to do:
		# - the Pope should become a Senator of Rome (only passive
		#   vote should never elected as the ruler!)
		# - the Pope should become Chaplain and should not never removed
		# - the Pope should not get the recurring claim on the County Rome

		# In exchange of the Bishorship of Rome
		# the Pope become a vassal of the callee
		set_defacto_liege = FROM
		# Inform the new Liege that the Pope is now ready to serve
		FROM = { character_event = { id = COR.1 tooltip = "EVTTOOLTIPCOR1" } } 
    	}

	# The Pope does NOT accept the demand
    	option = {
       	name = EVTOPTB_COR_0

	   	ai_chance = { 
			factor = 50
			
			modifier = {
				factor = 0.5
				trait = content
			}

			modifier = {
				factor = 0.75
				opinion = { who = FROM value = 20 }
			}
			modifier = {
				factor = 0.5
				opinion = { who = FROM value = 50 }
			}
		}

		FROM = {
			opinion = {
				modifier = opinion_disappointed
				who = ROOT
				months = 120
			}
			character_event = { id = COR.2 tooltip = "EVTTOOLTIPCOR2" } 
		}
	}
}

I've tried to modify the line:

Code:
modifier = {
			factor = 0.5
			NOT = {
					opinion = { who = FROM value = 50 }
			}
}

with a factor of "0.75" and if the Pope likes me more than 50 (that is this the sense of "NOT 50"? What if happens he likes me precisely 50 it would say no? There is not a more clear >= ?) effectively now he says yes and if he doesn't like me (the previous Pope was not in good term with me as I've declare war to him... for Saint Peter :rofl:) he indeed he says no...

The "no" branch how should be interpreted? The factors should be considered negated? If they don't make sense I don't understand how the IA should choose to give land to a vassal... I'm asking if they are not necessary for the "no" branch or the modifiers with "0" in the "yes" are sufficient as it is apparent in my situation.

I could consider this as if in C programming language I had written an "if" / "else if", and so I could write only an "else" for the "no" condition?
 

richvh

Preserver of the Light
63 Badges
Dec 1, 2001
14.691
1.999
Visit site
  • Stellaris: Leviathans Story Pack
  • Pillars of Eternity
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Knights of Pen and Paper 2
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Crusader Kings II: Reapers Due
  • Tyranny: Archon Edition
  • Tyranny: Archon Edition
  • Tyranny: Gold Edition
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Tyranny - Tales from the Tiers
  • Tyranny - Bastards Wound
  • Age of Wonders III
  • Age of Wonders: Shadow Magic
  • Age of Wonders
  • Age of Wonders II
  • Crusader Kings II: Jade Dragon
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • A Game of Dwarves
  • King Arthur II
  • Knights of Pen and Paper +1 Edition
  • Magicka
  • Majesty 2 Collection
  • Europa Universalis IV: Res Publica
  • Europa Universalis: Rome
  • Rome Gold
  • Rome: Vae Victis
  • 500k Club
  • Cities: Skylines
I could consider this as if in C programming language I had written an "if" / "else if", and so I could write only an "else" for the "no" condition?

Code:
if = {
   limit = {
      <condition>
   <effect>
if = {
   limit= {
      NOT = {
         <condition>
      }
   }
   <effect>
}
 

fanoI

General
2 Badges
Aug 26, 2012
1.870
106
  • Crusader Kings II
  • Europa Universalis IV
Yes but if I want to do an "else" it is not possible? That is I have to do another "if" with all negated or I could do something as:

Code:
if = {
   limit = {
      <condition>
   <effect>
}
else = {
   # no <condition> is implicit
   <effect>
}

If I write "opinion = { who = FROM value = 0 }" is this equivalent to:

  • value is 0?
  • value is < 0?
  • value is > 0?
  • value >= 0?
  • value <= 0?
 
Last edited:

richvh

Preserver of the Light
63 Badges
Dec 1, 2001
14.691
1.999
Visit site
  • Stellaris: Leviathans Story Pack
  • Pillars of Eternity
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Knights of Pen and Paper 2
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Crusader Kings II: Reapers Due
  • Tyranny: Archon Edition
  • Tyranny: Archon Edition
  • Tyranny: Gold Edition
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Tyranny - Tales from the Tiers
  • Tyranny - Bastards Wound
  • Age of Wonders III
  • Age of Wonders: Shadow Magic
  • Age of Wonders
  • Age of Wonders II
  • Crusader Kings II: Jade Dragon
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • A Game of Dwarves
  • King Arthur II
  • Knights of Pen and Paper +1 Edition
  • Magicka
  • Majesty 2 Collection
  • Europa Universalis IV: Res Publica
  • Europa Universalis: Rome
  • Rome Gold
  • Rome: Vae Victis
  • 500k Club
  • Cities: Skylines
value = 0 returns TRUE if value is >=0; NOT = { value = 0 } returns TRUE if value is < 0.
 

fanoI

General
2 Badges
Aug 26, 2012
1.870
106
  • Crusader Kings II
  • Europa Universalis IV
value = 0 returns TRUE if value is >=0; NOT = { value = 0 } returns TRUE if value is < 0.

Thanks richvh!

So when I write in the IA opinion:

Code:
	modifier = {
		factor = 0.75
		NOT = {
			opinion = { who = FROM value = 50 }
		}
	}

I've written if "opinion < 50"? If it so, I intended obviously >= 50 so I should remove the "NOT"?
But then why it seems to work :wacko: ?

So this should work?

Code:
namespace = COR

# The Roman Republic had success and reformed the Western Roman Empire / Roman Empire
# now we are requesting to the Pope to join the Empire.
character_event = {
	id = COR.0
	desc = "COR.0.desc"
    	picture = GFX_evt_emissary
	border = GFX_event_normal_frame_diplomacy
    
    	is_triggered_only = yes
    
	# The Pope accepts the demand
    	option = {
        	name = EVTOPTA_COR_0

	   	ai_chance = { 
			factor = 50
		
			# An ambitious Pope would not accept peaceful
			# vassalization!	
			modifier = {
				factor = 0
				trait = ambitious
			}
			modifier = {
				factor = 0
				# if opinion is < 0 he should never accept
				NOT = {
                                    opinion = { who = FROM value = 0}
				}
  			}
			modifier = {
				factor = 0.5
				# if opinion is >= 25 he could start to think to accept
				opinion = { who = FROM value = 25 }
				
			}
			modifier = {
				factor = 0.50
                                # if opinion is >= 50 a 50% of chance he would accept
				opinion = { who = FROM value = 50 }
			}
			modifier = {
				factor = 0.75
                                # if opinion is >= 75 a 75% of chance he would accept (that is he accepts for sure)
				opinion = { who = FROM value = 75 }
			}	
		}

		b_roma = {
			grant_title = PREV
		}
		opinion = {
			who = FROM
			modifier = opinion_restored_to_rome
		}

		# Things to do:
		# - the Pope should become a Senator of Rome (only passive
		#   vote should never elected as the ruler!)
		# - the Pope should become Chaplain and should not never removed
		# - the Pope should not get the recurring claim on the County Rome

		# In exchange of the Bishorship of Rome
		# the Pope become a vassal of the callee
		set_defacto_liege = FROM
		# Inform the new Liege that the Pope is now ready to serve
		FROM = { character_event = { id = COR.1 tooltip = "EVTTOOLTIPCOR1" } } 
    	}

	# The Pope does NOT accept the demand
    	option = {
       	name = EVTOPTB_COR_0
                
	   	ai_chance = { 
			factor = 50
                        # Nothing is needed as we get here automatically
		}

		FROM = {
			opinion = {
				modifier = opinion_disappointed
				who = ROOT
				months = 120
			}
			character_event = { id = COR.2 tooltip = "EVTTOOLTIPCOR2" } 
		}
	}
}
 

richvh

Preserver of the Light
63 Badges
Dec 1, 2001
14.691
1.999
Visit site
  • Stellaris: Leviathans Story Pack
  • Pillars of Eternity
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Knights of Pen and Paper 2
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Crusader Kings II: Reapers Due
  • Tyranny: Archon Edition
  • Tyranny: Archon Edition
  • Tyranny: Gold Edition
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Tyranny - Tales from the Tiers
  • Tyranny - Bastards Wound
  • Age of Wonders III
  • Age of Wonders: Shadow Magic
  • Age of Wonders
  • Age of Wonders II
  • Crusader Kings II: Jade Dragon
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • A Game of Dwarves
  • King Arthur II
  • Knights of Pen and Paper +1 Edition
  • Magicka
  • Majesty 2 Collection
  • Europa Universalis IV: Res Publica
  • Europa Universalis: Rome
  • Rome Gold
  • Rome: Vae Victis
  • 500k Club
  • Cities: Skylines
Thanks richvh!

So when I write in the IA opinion:

Code:
	modifier = {
		factor = 0.75
		NOT = {
			opinion = { who = FROM value = 50 }
		}
	}

I've written if "opinion < 50"? If it so, I intended obviously >= 50 so I should remove the "NOT"?
But then why it seems to work :wacko: ?

So this should work?

Code:
namespace = COR

# The Roman Republic had success and reformed the Western Roman Empire / Roman Empire
# now we are requesting to the Pope to join the Empire.
character_event = {
	id = COR.0
	desc = "COR.0.desc"
    	picture = GFX_evt_emissary
	border = GFX_event_normal_frame_diplomacy
    
    	is_triggered_only = yes
    
	# The Pope accepts the demand
    	option = {
        	name = EVTOPTA_COR_0

	   	ai_chance = { 
			factor = 50
		
			# An ambitious Pope would not accept peaceful
			# vassalization!	
			modifier = {
				factor = 0
				trait = ambitious
			}
			modifier = {
				factor = 0
				# if opinion is < 0 he should never accept
				NOT = {
                                    opinion = { who = FROM value = 0}
				}
  			}
			modifier = {
				factor = 0.5
				# if opinion is >= 25 he could start to think to accept
				opinion = { who = FROM value = 25 }
				
			}
			modifier = {
				factor = 0.50
                                # if opinion is >= 50 a 50% of chance he would accept
				opinion = { who = FROM value = 50 }
			}
			modifier = {
				factor = 0.75
                                # if opinion is >= 75 a 75% of chance he would accept (that is he accepts for sure)
				opinion = { who = FROM value = 75 }
			}	
		}

		b_roma = {
			grant_title = PREV
		}
		opinion = {
			who = FROM
			modifier = opinion_restored_to_rome
		}

		# Things to do:
		# - the Pope should become a Senator of Rome (only passive
		#   vote should never elected as the ruler!)
		# - the Pope should become Chaplain and should not never removed
		# - the Pope should not get the recurring claim on the County Rome

		# In exchange of the Bishorship of Rome
		# the Pope become a vassal of the callee
		set_defacto_liege = FROM
		# Inform the new Liege that the Pope is now ready to serve
		FROM = { character_event = { id = COR.1 tooltip = "EVTTOOLTIPCOR1" } } 
    	}

	# The Pope does NOT accept the demand
    	option = {
       	name = EVTOPTB_COR_0
                
	   	ai_chance = { 
			factor = 50
                        # Nothing is needed as we get here automatically
		}

		FROM = {
			opinion = {
				modifier = opinion_disappointed
				who = ROOT
				months = 120
			}
			character_event = { id = COR.2 tooltip = "EVTTOOLTIPCOR2" } 
		}
	}
}

Actually... that doesn't work that well. From 0 to 24 opinion, the pope has full potential to accept. At 25-49 opinion, his chance of accepting is halved, then halved again from 50-74, and above 75 opinion he .5*.5*.75 chance of accepting. You should reverse those opinion checks so the lower the opinion, the less likely he is to accept. All modifiers that meet the test are multiplied against the factor.
 

Zenthree

First Lieutenant
67 Badges
Jun 9, 2012
245
0
  • Divine Wind
  • Crusader Kings II
  • Magicka
  • Heir to the Throne
  • Europa Universalis IV
  • Europa Universalis III Complete
  • Mount & Blade: With Fire and Sword
  • Crusader Kings II: Reapers Due
  • War of the Roses
  • 500k Club
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: El Dorado
  • Hearts of Iron IV: Cadet
  • Shadowrun: Hong Kong
  • Crusader Kings III
  • Mount & Blade: Warband
  • Europa Universalis IV: Cradle of Civilization
  • Crusader Kings II: Way of Life
  • Stellaris: Galaxy Edition
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris: Leviathans Story Pack
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings II: Holy Fury
  • Shadowrun: Dragonfall
  • Surviving Mars
  • Crusader Kings II: Monks and Mystics
  • Cities: Skylines - Parklife
  • Imperator: Rome
  • Prison Architect
  • Surviving Mars: Digital Deluxe Edition
  • Tyranny: Archon Edition
  • Shadowrun Returns
  • Imperator: Rome Deluxe Edition
  • Surviving Mars: First Colony Edition
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Europa Universalis IV: Rule Britannia
  • Victoria 2
  • Victoria 2: Heart of Darkness
  • Cities: Skylines
  • Victoria 2: A House Divided
  • Victoria: Revolutions
  • Europa Universalis III: Chronicles
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
Code:
character_event = {
	id = 777100
	desc = EVTDESC777100
	
	is_triggered_only = yes
	
	immediate = {
		any_vassal = {
			limit = {
				any_realm_title = {
					AND = {
						higher_tier_than = BARON
						ROOT = {
							primary_title = {
								PREVPREV = {
									NOT = {
										de_jure_liege = PREV
									}
								}
							}
						}
					}
				}
			}
			set_defacto_liege = THIS
		}
		any_demesne_title = {
			limit = {
				is_capital = no
				ROOT = {
					primary_title = {
						PREVPREV = {
							de_jure_liege = PREV
						}
					}
				}
			}
			county = {
				create_character = {
					random_traits = yes
					religion = PREV
					culture = PREV
				}
				new_character = {
					usurp_title_plus_barony_if_unlanded = PREV
					set_defacto_liege = THIS
				}
			}
		}
	}
	
	option = {
		name = EVTOPTA777100 # I see...
	}
}

should work.

For some reason, this breaks the event and causes the option to not show up, making it impossible to close. It also didn't work :,(

I can't find an error in the syntax, though. Then again, my scripting is far from perfect.
 

fanoI

General
2 Badges
Aug 26, 2012
1.870
106
  • Crusader Kings II
  • Europa Universalis IV
Actually... that doesn't work that well. From 0 to 24 opinion, the pope has full potential to accept. At 25-49 opinion, his chance of accepting is halved, then halved again from 50-74, and above 75 opinion he .5*.5*.75 chance of accepting. You should reverse those opinion checks so the lower the opinion, the less likely he is to accept. All modifiers that meet the test are multiplied against the factor.

Indeed I was thinking this night that between 0 and 20 he could accept with full potential so it is for this that you should negate the condition to emulate the construct "x < y and x > z" so this version should be more correct (I hope :eek:o):

Code:
namespace = COR

# The Roman Republic had success and reformed the Western Roman Empire / Roman Empire
# now we are requesting to the Pope to join the Empire.
character_event = {
	id = COR.0
	desc = "COR.0.desc"
    	picture = GFX_evt_emissary
	border = GFX_event_normal_frame_diplomacy
    
    	is_triggered_only = yes
    
	# The Pope accepts the demand
    	option = {
        	name = EVTOPTA_COR_0

	   	ai_chance = { 
			factor = 50
		
			# An ambitious Pope would not accept peaceful
			# vassalization!	
			modifier = {
				factor = 0
				trait = ambitious
			}
			modifier = {
				factor = 0
				# if opinion is < 0 he should never accept
				NOT = {
                                    opinion = { who = FROM value = 0 }
				}
      			}
			modifier = {
				 factor = 0.25
				 # if opinion is between 0 and 25 he could start to think to accept
				  NOT = {
					 opinion = { who = FROM value = 25 }
				  }
			}
			modifier = {
				 factor = 0.50
                                 # if opinion is between 25 and a 50 he should have a 50% of chance to accept
                                NOT = {
				         opinion = { who = FROM value = 50 }
                               }
			}
			modifier = {
				factor = 0.75
                                # if opinion is between 50 and 75 he should have a 75% of chance he should accept (that is he accepts for sure)
                                NOT = {
				        opinion = { who = FROM value = 75 }
                                }
 			}
                        # if he has an opinion between 75 and 100 no check is needed, he always accept	
		 }

		b_roma = {
			grant_title = PREV
		}
		opinion = {
			who = FROM
			modifier = opinion_restored_to_rome
		}

		# Things to do:
		# - the Pope should become a Senator of Rome (only passive
		#   vote should never elected as the ruler!)
		# - the Pope should become Chaplain and should not never removed (a sort penalty?)
		# - the Pope should not get the recurring claim on the County Rome

		# In exchange of the Bishorship of Rome
		# the Pope become a vassal of the callee
		set_defacto_liege = FROM
		# Inform the new Liege that the Pope is now ready to serve
		FROM = { character_event = { id = COR.1 tooltip = "EVTTOOLTIPCOR1" } } 
    	}

	# The Pope does NOT accept the demand
    	option = {
       	name = EVTOPTB_COR_0
                
	   	ai_chance = { 
  			factor = 50
                        # Nothing is needed as we get here automatically
		 }

		 FROM = {
			opinion = {
				modifier = opinion_disappointed
				who = ROOT
				months = 120
			}
			character_event = { id = COR.2 tooltip = "EVTTOOLTIPCOR2" } 
		}
	}
}

It remains true that the "no" branch could not have conditions? In the end it the "yes" fails is OK to say not with the original modifier... doing checks in this case should have only sense if the Pope would have the possibility to make three choices (I don't now for example if he was greedy he could say "well if you give me some money maybe..." :laugh:).
 

Elm0__

First Lieutenant
73 Badges
Jan 31, 2012
229
457
  • Crusader Kings II
  • Europa Universalis III Complete
  • Divine Wind
  • Heir to the Throne
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • PDXCON 2018 "The Baron"
  • Stellaris: Distant Stars
  • Stellaris: Galaxy Edition
  • Stellaris: Apocalypse
  • Imperator: Rome
  • Crusader Kings II: Holy Fury
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Common Sense
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Hearts of Iron IV: Death or Dishonor
  • Cities: Skylines - Green Cities
  • Hearts of Iron IV: Expansion Pass
  • Crusader Kings II: Way of Life
  • Cities: Skylines - Parklife
  • Stellaris: Federations
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Europa Universalis IV: Dharma
  • Europa Universalis IV
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • 500k Club
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Golden Century
  • Stellaris: Synthetic Dawn
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Third Rome
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Europa Universalis III: Chronicles
  • Cities: Skylines
  • Europa Universalis IV: Cossacks
I've recently tried modding holy war casus belli. My aim is to make holy wars to give attacker only these holdings that were occupied during the war. Sadly, using gain_all_occupied_titles will give any holding, regardless of its de jure dependence. I tried using something like that in on_success:

Code:
any_demesne_title = {
				limit = {
					de_jure_liege_or_above = FROM
					any_realm_province = {
						limit = {
							controlled_by = ROOT
							is_occupied = yes
							}
						}
					}
				gain_title = ROOT	#
				}				
			}

This doesn't work too - attackers gets nothing every time :( Any ideas/suggestions?
 

jursamaj

General
125 Badges
Aug 20, 2012
2.360
216
  • Victoria 2: Heart of Darkness
  • Hearts of Iron III
  • Heir to the Throne
  • Knights of Pen and Paper +1 Edition
  • Cities in Motion
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Stellaris: Galaxy Edition
  • Stellaris - Path to Destruction bundle
  • Victoria 2: A House Divided
  • Leviathan: Warships
  • Rome: Vae Victis
  • Stellaris
  • Europa Universalis IV: Pre-order
  • Magicka 2 - Signup Campaign
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis III Complete
  • Europa Universalis IV: Conquest of Paradise
  • Divine Wind
  • Europa Universalis IV: Art of War
  • Europa Universalis III: Chronicles
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Conclave
  • Europa Universalis III Complete
  • Europa Universalis IV: Common Sense
  • Europa Universalis III Complete
  • Pillars of Eternity
  • Europa Universalis IV
  • Europa Universalis IV: El Dorado
  • 500k Club
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: No Step Back
It remains true that the "no" branch could not have conditions? In the end it the "yes" fails is OK to say not with the original modifier... doing checks in this case should have only sense if the Pope would have the possibility to make three choices (I don't now for example if he was greedy he could say "well if you give me some money maybe..." :laugh:).
You seem to have a basic misunderstanding of the language being used here. This is not a script, with branching & flow control based on if statements. The "we get here automatically" is meaningless.

The factors are weights. Both options will get their weights evaluated, then a random number generator will choose between the options in proportion to the weights. And each if in the 1st option will be evaluated, not just the first, and all the successful ones will be multiplied together with the base factor (50 in your case).

If the pope is ambitious or his opinion<0, the factor 0 will apply, but so will .25, .50, and .75. So, 50*0*.25*.5*.75=0. 0 weight vs. the 2nd option's 50 weight will always choose the 2nd.

If the pope is not ambitious, and his 0<=opinion<25: 50*.25*.5*.75=4.6875. Set against the 50 of the 2nd option, that gives about 8.6% chance to say yes.

If the pope is not ambitious, and his 25<=opinion<50: 50*.5*.75=18.75. Set against the 50 of the 2nd option, that gives about 27.3% chance to say yes.

If the pope is not ambitious, and his 50<=opinion<75: 50*.75=37.5. Set against the 50 of the 2nd option, that gives about 42.9% chance to say yes.

If the pope is not ambitious, and his 75<=opinion<=100: 50. Set against the 50 of the 2nd option, that gives 50% chance to say yes.

If you actually want the percentages described in your comments, you'll need to change things. 1st, give the 2nd option a base factor of 6, and a modifier with factor=0 when opinion=75. On the 1st option, base factor 2, drop the opinion not 25 modifier, and change the .50 and 0.75 opinion factors to .3333 and 9.
 
Last edited:

jursamaj

General
125 Badges
Aug 20, 2012
2.360
216
  • Victoria 2: Heart of Darkness
  • Hearts of Iron III
  • Heir to the Throne
  • Knights of Pen and Paper +1 Edition
  • Cities in Motion
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Stellaris: Galaxy Edition
  • Stellaris - Path to Destruction bundle
  • Victoria 2: A House Divided
  • Leviathan: Warships
  • Rome: Vae Victis
  • Stellaris
  • Europa Universalis IV: Pre-order
  • Magicka 2 - Signup Campaign
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis III Complete
  • Europa Universalis IV: Conquest of Paradise
  • Divine Wind
  • Europa Universalis IV: Art of War
  • Europa Universalis III: Chronicles
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Conclave
  • Europa Universalis III Complete
  • Europa Universalis IV: Common Sense
  • Europa Universalis III Complete
  • Pillars of Eternity
  • Europa Universalis IV
  • Europa Universalis IV: El Dorado
  • 500k Club
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: No Step Back
I've recently tried modding holy war casus belli. My aim is to make holy wars to give attacker only these holdings that were occupied during the war. Sadly, using gain_all_occupied_titles will give any holding, regardless of its de jure dependence. I tried using something like that in on_success:

Code:
any_demesne_title = {
				limit = {
					de_jure_liege_or_above = FROM
					any_realm_province = {
						limit = {
							controlled_by = ROOT
							is_occupied = yes
							}
						}
					}
				gain_title = ROOT	#
				}				
			}

This doesn't work too - attackers gets nothing every time :( Any ideas/suggestions?
Whose scope is that any_demesne_title in? If it's in ROOT's scope, then it's checking titles he already owns.
 

ShamanMcLamie

Pure Bred American Mutt
65 Badges
Apr 3, 2014
194
109
  • Crusader Kings II
  • Hearts of Iron IV: Field Marshal
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Stellaris: Galaxy Edition
  • Battle for Bosporus
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Imperator: Rome Sign Up
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Distant Stars
  • Hearts of Iron IV: Expansion Pass
  • Victoria 3 Sign Up
  • Stellaris: Federations
  • Imperator: Rome Deluxe Edition
  • Stellaris: Lithoids
  • Stellaris: Nemesis
  • Crusader Kings III
  • Europa Universalis IV
  • Stellaris: Megacorp
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Apocalypse
  • Hearts of Iron IV: La Resistance
  • Victoria 2
  • Stellaris: Necroids
  • Stellaris: Ancient Relics
  • Europa Universalis IV: El Dorado
  • Stellaris: Humanoids Species Pack
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Mare Nostrum
  • Crusader Kings II: Holy Fury
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Pre-order
  • 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: The Republic
  • Crusader Kings II: Rajas of India
Does anyone know of a mod, or how to mod CK2 in order to have expanded Coat of Arms Editor options. I'm particularly looking to add the designs from the three Dynasty Shields DLCs. I've seen expanded Coat of Arms editors in the Game of Thrones and Elder Kings mods, but I'm looking for a stand alone mod, or how to make my own to use in the vanilla game.
 

Hotl3looded

Second Lieutenant
17 Badges
Jun 11, 2012
146
18
  • Crusader Kings II
  • Crusader Kings II: Holy Fury
  • 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
  • Crusader Kings II: Way of Life
  • 500k Club
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • 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: Charlemagne
Let's say I add a building like this in a castle:

Code:
#Italian Pike formations
	ca_culture_italian_1 = {
		desc = ca_culture_italian_1_desc
		potential = {
			FROM = { culture = italian }
		}
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		prerequisites = { ca_wall_2 }
		build_cost = 200
		build_time = 730
		pikemen = 30
		pikemen_morale = 0.15
		ai_creation_factor = 101
		
		extra_tech_building_start = 0.8
	}

Will the pikemen_morale = 0.15 affect only the units from this building or will it affect all the pikemen produced in the castle?