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

The Swert

Yours Swertically
51 Badges
Jan 28, 2007
1.627
56
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Stellaris
  • Hearts of Iron Anthology
  • Europa Universalis IV: Rights of Man
  • Cities: Skylines - Natural Disasters
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Mare Nostrum
  • Stellaris: Synthetic Dawn
  • Cities: Skylines - Green Cities
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Cities: Skylines Industries
  • Europa Universalis IV: Golden Century
  • Cities: Skylines - Campus
  • Europa Universalis IV: Common Sense
  • Hearts of Iron IV: No Step Back
  • Crusader Kings II: Legacy of Rome
  • Victoria 3 Sign Up
  • Europa Universalis 4: Emperor
  • Crusader Kings III
  • Europa Universalis III
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • For The Glory
  • Europa Universalis IV: Res Publica
  • 500k Club
  • Stellaris: Federations
  • Cities: Skylines Deluxe Edition
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Cities: Skylines - After Dark
  • Hearts of Iron IV: Expansion Pass
  • Cities: Skylines - Parklife
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: Together for Victory
  • Hearts of Iron IV: Cadet
  • Cities: Skylines
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Old Gods
Hi, I need some help brushing up on my boolean.

I'm trying to make a trigger so that an event will fire when a given country owns any 2 out of a group of 4 provinces, a bit similar to the Formation of Russia event.

I seem to be having some difficulty with the usages of the AND and OR operators.
I first tried something like this:

Code:
trigger = {
	OR = { 	[COLOR=Red]owned = { province = A data = -1 }		#If you own province A
		OR = {						#And if you own any of:
			owned = { province = B data = -1 } 	#province B
			owned = { province = C data = -1 } 	#province C
			owned = { province = D data = -1 } 	#province D
		}[/COLOR]	
		[COLOR=Yellow]owned = { province = B data = -1 }		#Or if you own province B
		OR = {						#And if you own any of:
			owned = { province = C data = -1 } 	#province C
			owned = { province = D data = -1 } 	#province D
		}[/COLOR]
		[COLOR=Lime]owned = { province = C data = -1 }		#Or if you own province C
		owned = { province = D data = -1 }		#And province D[/COLOR]
	}
}

But i realised that this would only work if each of the coloured blocks was treated as one OR condition and each line within those blocks was treated as an AND operation.

I'm really quite unsure if its even possible to make such a trigger using the boolean limitations.
 
Last edited:
Code:
trigger = {
	OR = {
		[b]AND = {[/b]
			[COLOR=Red]owned = { province = A data = -1 }		#If you own province A
			OR = {						#And if you own any of:
				owned = { province = B data = -1 } 	#province B
				owned = { province = C data = -1 } 	#province C
				owned = { province = D data = -1 } 	#province D
			}[/COLOR]	
		[b]}
		AND = {[/b]
			[COLOR=Yellow]owned = { province = B data = -1 }		#Or if you own province B
			OR = {						#And if you own any of:[/COLOR]
				[b]owned = { province = A data = -1 }	#province A	[/b]
				[COLOR=Yellow]owned = { province = C data = -1 } 	#province C
				owned = { province = D data = -1 } 	#province D
			}[/COLOR]
		[b]}
		AND = {[/b]
			[COLOR=Lime]owned = { province = C data = -1 }		#Or if you own province C[/COLOR]
			[b]OR = {						#And if you own any of:
				owned = { province = A data = -1 }	#province A	
				owned = { province = B data = -1 } 	#province C[/b]
				[COLOR=Lime]owned = { province = D data = -1 }	#province D[/COLOR]
			[b]}[/b]
		[b]}[/b]
	}
}
 
KaRei said:
Code:
trigger = { ... }

That might work although i didn't know you could actually use 'AND'. I'll give it a shot. Oh and those extra additions should not be neccessary as owning province A and province B is the same owning province B and province A.
 
The Swert said:
I'm trying to make a trigger so that an event will fire when a given country owns any 2 out of a group of 4 provinces, a bit similar to the Formation of Russia event.
Clean and logically written triggers are always easier to understand and modify later. :)
Code:
OR = {
	AND = {
		owned = { province = A data = -1 }
		owned = { province = B data = -1 }
	}
	AND = {
		owned = { province = A data = -1 }
		owned = { province = C data = -1 }
	}
	AND = {
		owned = { province = A data = -1 }
		owned = { province = D data = -1 }
	}
	AND = {
		owned = { province = B data = -1 }
		owned = { province = C data = -1 }
	}
	AND = {
		owned = { province = B data = -1 }
		owned = { province = D data = -1 }
	}
	AND = {
		owned = { province = C data = -1 }
		owned = { province = D data = -1 }
	}
}