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

adonys

Sergeant
88 Badges
Apr 5, 2008
85
2
  • BATTLETECH: Season pass
  • Shadowrun: Dragonfall
  • Empire of Sin
  • Mount & Blade: With Fire and Sword
  • Knights of Pen and Paper 2
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Cadet
  • Tyranny: Archon Edition
  • Tyranny: Gold Edition
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Surviving Mars: First Colony Edition
  • Steel Division: Normandy 44
  • Steel Division: Normandy 44 Deluxe Edition
  • Knights of Honor
  • Crusader Kings Complete
  • BATTLETECH
  • Prison Architect
  • Crusader Kings III
  • Stellaris: Necroids
  • Tyranny - Bastards Wound
  • Stellaris: Humanoids Species Pack
  • Surviving Mars: Digital Deluxe Edition
  • Imperator: Rome Sign Up
  • Imperator: Rome - Magna Graecia
  • Stellaris: Federations
  • BATTLETECH: Heavy Metal
  • Stellaris: Lithoids
  • Age of Wonders: Planetfall Sign Up
  • BATTLETECH: Flashpoint
  • Shadowrun: Hong Kong
  • Europa Universalis III Complete
  • Steel Division: Normandy 44 -  Back to Hell
  • Shadowrun Returns
  • Europa Universalis III Complete
  • BATTLETECH - Digital Deluxe Edition
  • Surviving Mars: First Colony Edition
  • Imperator: Rome Deluxe Edition
  • Stellaris: Megacorp
  • Teleglitch: Die More Edition
  • Rome: Vae Victis
  • War of the Roses
  • Stellaris: Distant Stars
  • 500k Club
  • Pride of Nations
  • Mount & Blade: Warband
  • Tyranny: Archon Edition
  • Stellaris: Galaxy Edition
As none of us is pleased with PI's peace mechanism, I've thought of new ways to do it, and I thought I've found a perfect way. Later on, while searching PI and community's scripts for used scripting language components, I've discovered that something similar was actually imagined before in the War and Peace mod.

Here's my implementation, it's a rough script which needs tweaking, as it is intended as a part of a bigger mod, and I haven't worked on tuning it. Atm, it triggers instantly, immediately after someone occupies a province, giving it an occupied province modifier, and after a month of occupation, it offers the occupier an option to annex it. Therefore, it needs is a proper occupation duration and modifiers (commander's attributes, size of the army, war situation, etc) to trigger the script, which also needs testing in order to see how long is enough in order to not be too short, or too long.

Also, because I don't know what happens if the province is enemy's capital and you try to annex it, nor had time to test it, you can't annex a capital province.

Because many are complaining about this (it seems most of them are people which bought EUR from steam which don't know much about PI or EU game series), I'll release it as it is right now, before completing the rest of the intended mod (which contains province looting events and much more).

Code:
################################################
#	Province occupied (owner)
################################################
province_event = {
	id = 57000

	trigger = {
		NOT = { controlled_by = owner }
		NOT = { has_province_modifier = adem_anex_occupied_province }
		is_capital = no
		has_siege = no
	}

	mean_time_to_happen = {
		days = 1
	}
	
	title = "Province occupied!"
	desc = "Our $PROVINCENAME$ province is in enemy hands!"
	
	option = {
		name = "We'll take it back"
		ai_chance = { factor = 100 }
		add_province_modifier = { name = "adem_anex_occupied_province" duration = 73000}
		controller = {
			country_event = 57001
		}
	}
}

################################################
#	Province occupied (new controller)
################################################
country_event = {
	id = 57001
	
	is_triggered_only = yes

	title = "Province occupied!"
	desc = "An enemy province is in our hands!"

	option = {
		name = "We won't let them take it back"
		ai_chance = { factor = 100 }
	}
}

################################################
#	Province occupied (controller = new owner)
################################################
country_event = {
	id = 57002

	trigger = {
		any_country = {
			limit = {
				NOT = { tag = THIS }
				any_province = {
					controller = { tag = THIS }
					has_province_modifier = adem_anex_occupied_province
					is_capital = no
					has_siege = no
				}
			}
		}
	}

	mean_time_to_happen = {
		month = 1
	}
	
	title = "Province annexed!"
	desc = "$PROVINCENAME$ belongs to us now!"
	
	option = {
		name = "It's ours now"
		ai_chance = { factor = 90 }
		any_country = {
			limit = {
				NOT = { tag = THIS }
				any_province = {
					limit = {
						controller = { tag = THIS }
						has_province_modifier = adem_anex_occupied_province
						is_capital = no
						has_siege = no
					}
					province_event = 57003
					remove_province_modifier = adem_anex_occupied_province
					secede_province = THIS
				}
			}
		}

	option = {
		name = "Don't want it"
		ai_chance = { factor = 10 }
	}
}

################################################
#	Province occupied (old owner)
################################################
country_event = {
	id = 57003
	
	is_triggered_only = yes

	title = "Province lost!"
	desc = "$PROVINCENAME$ is not ours anymore!"

	option = {
		name = "Damn them"
		ai_chance = { factor = 100 }
	}
}

################################################
#	Province occupied (controller = owner)
################################################
province_event = {
	id = 57004

	trigger = {
		controlled_by = owner
		has_province_modifier = adem_anex_occupied_province
#		is_capital = no
#		has_siege = no
	}

	mean_time_to_happen = {
		month = 1
	}
	
	title = "Province liberated!"
	desc = "We've cut enemy's hands holding our province. $PROVINCENAME$ belongs to us again!"
	
	option = {
		name = "Hurrray"
		remove_province_modifier = adem_anex_occupied_province
	}
}

PS: forgot about the event modifier it needs

Code:
### ad_annexation
adem_anex_occupied_province = {
	ruler_popularity_gain = 0.01
	global_revolt_risk = -0.01
	land_morale = 0.05
	cavalry_morale = 0.05
	naval_morale = 0.05
	local_population_growth = -0.05
	local_tax_modifier = -0.5
	local_revolt_risk = 3
	icon = 3
}

PPS: added the province liberated event which removes the occupied province event modifier.

enjoy!
 

Attachments

  • ad_provinceannexation_v1.0.zip
    3,5 KB · Views: 30
Last edited:

Descartes

Lt. General
42 Badges
Oct 12, 2008
1.212
2
  • Crusader Kings II
  • 500k Club
  • Sengoku
  • Europa Universalis: Rome
  • Heir to the Throne
  • Europa Universalis IV
  • Divine Wind
  • Europa Universalis III Complete
  • Hearts of Iron II: Armageddon
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • 200k Club
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Rome: Vae Victis
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Europa Universalis IV: Third Rome
  • Crusader Kings II: Rajas of India
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Crusader Kings II: The Old Gods
  • Europa Universalis IV: Pre-order
  • Europa Universalis IV: Res Publica
  • Cities: Skylines
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Charlemagne
A clever solution :)
Just on a side note, I don't think it's possible to have a mtth of one day. The game usually waits for a month. Another idea would be to give 100% weight on an event for the occupier in on_siege_won (on_actions.txt). This event would give a modifier to the province and another event to the enemy.
 

Sute]{h

Field Marshal
88 Badges
Jun 25, 2002
3.505
199
  • Europa Universalis IV: Pre-order
  • Victoria: Revolutions
  • Europa Universalis: Rome
  • Semper Fi
  • Sengoku
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • 500k Club
  • Crusader Kings II: Holy Knight (pre-order)
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Res Publica
  • Europa Universalis: Rome Collectors Edition
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Victoria 3 Sign Up
  • Europa Universalis IV: Art of War
  • 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
  • Deus Vult
  • Europa Universalis III
  • Divine Wind
  • Europa Universalis IV
  • Crusader Kings II
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Europa Universalis III Complete
  • Magicka
  • Majesty 2
MTTH of 1 day will work, BUT it wont be instantaneous. The only way to create instant effects is via titles. Someone suggested it in a thread somewhere.
 

adonys

Sergeant
88 Badges
Apr 5, 2008
85
2
  • BATTLETECH: Season pass
  • Shadowrun: Dragonfall
  • Empire of Sin
  • Mount & Blade: With Fire and Sword
  • Knights of Pen and Paper 2
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Cadet
  • Tyranny: Archon Edition
  • Tyranny: Gold Edition
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Surviving Mars: First Colony Edition
  • Steel Division: Normandy 44
  • Steel Division: Normandy 44 Deluxe Edition
  • Knights of Honor
  • Crusader Kings Complete
  • BATTLETECH
  • Prison Architect
  • Crusader Kings III
  • Stellaris: Necroids
  • Tyranny - Bastards Wound
  • Stellaris: Humanoids Species Pack
  • Surviving Mars: Digital Deluxe Edition
  • Imperator: Rome Sign Up
  • Imperator: Rome - Magna Graecia
  • Stellaris: Federations
  • BATTLETECH: Heavy Metal
  • Stellaris: Lithoids
  • Age of Wonders: Planetfall Sign Up
  • BATTLETECH: Flashpoint
  • Shadowrun: Hong Kong
  • Europa Universalis III Complete
  • Steel Division: Normandy 44 -  Back to Hell
  • Shadowrun Returns
  • Europa Universalis III Complete
  • BATTLETECH - Digital Deluxe Edition
  • Surviving Mars: First Colony Edition
  • Imperator: Rome Deluxe Edition
  • Stellaris: Megacorp
  • Teleglitch: Die More Edition
  • Rome: Vae Victis
  • War of the Roses
  • Stellaris: Distant Stars
  • 500k Club
  • Pride of Nations
  • Mount & Blade: Warband
  • Tyranny: Archon Edition
  • Stellaris: Galaxy Edition
It works, it's in PI's scripts and I've tested it anyway, even if from what I saw from testing, it seems to trigger the event still in one moth (or at the beginning of the next month), needs more testing.

Getting a title to a character works instantly, but because it's triggered by the action itself (meaning it needs the player to actively give that title), for AI still needs to rely on a MTTH trigger.

Yet, there's another thing I saw while searching through PI's scripts: there are some triggered only events which still contains a trigger with an always = yes condition (see ruler.txt scrips). I didn't had time to test it yet (it's on my large list of to do/test things), but it may work in a normal triggered event without a MTTH (will need usage of a flag though to avoid have it triggered repeatedly).
 

Sute]{h

Field Marshal
88 Badges
Jun 25, 2002
3.505
199
  • Europa Universalis IV: Pre-order
  • Victoria: Revolutions
  • Europa Universalis: Rome
  • Semper Fi
  • Sengoku
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • 500k Club
  • Crusader Kings II: Holy Knight (pre-order)
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Res Publica
  • Europa Universalis: Rome Collectors Edition
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Victoria 3 Sign Up
  • Europa Universalis IV: Art of War
  • 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
  • Deus Vult
  • Europa Universalis III
  • Divine Wind
  • Europa Universalis IV
  • Crusader Kings II
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Europa Universalis III Complete
  • Magicka
  • Majesty 2
Getting a title to a character works instantly, but because it's triggered by the action itself (meaning it needs the player to actively give that title), for AI still needs to rely on a MTTH trigger.

Yet, there's another thing I saw while searching through PI's scripts: there are some triggered only events which still contains a trigger with an always = yes condition (see ruler.txt scrips). I didn't had time to test it yet (it's on my large list of to do/test things), but it may work in a normal triggered event without a MTTH (will need usage of a flag though to avoid have it triggered repeatedly).
As for titles you can assign titles automatically without player/AI initiative. Look at the title consort/queen for an example of a title given when the character furfills the requirements. This can be used to trigger an event indirectly and nearly instantly.

is_triggered_only = yes means that the event wont happen unless another event triggers it. Though testing if it has an alternative meaning for a proper trigger is assigned would indeed be very useful.
 

AWarGuy

Private
62 Badges
Jan 25, 2009
12
0
  • Arsenal of Democracy
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Sengoku
  • Europa Universalis: Rome
  • Victoria: Revolutions
  • March of the Eagles
  • Magicka
  • Heir to the Throne
  • Hearts of Iron III
  • For The Glory
  • Europa Universalis IV: Art of War
  • Europa Universalis IV
  • Divine Wind
  • Europa Universalis III
  • Crusader Kings II
  • Hearts of Iron Anthology
  • Darkest Hour
  • Europa Universalis III: Chronicles
  • Crusader Kings II: Conclave
  • Crusader Kings II: Monks and Mystics
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Battle for Bosporus
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Jade Dragon
  • Age of Wonders III
  • Hearts of Iron IV: Death or Dishonor
  • Surviving Mars
  • Crusader Kings Complete
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Pride of Nations
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
  • 500k Club
  • Victoria 2
  • 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
I have sum questions:
1.Will this script allow me to annex other countries?
2.Where do put this script
3.It wont screw up my game will it? Couse the last mod i used it screw up HoI and some campaigns i cant play :(
 

Cheexsta

Veni, vidi, vici
60 Badges
Dec 22, 2005
2.894
59
  • Europa Universalis IV: Rights of Man
  • Rome: Vae Victis
  • 500k Club
  • Europa Universalis IV: El Dorado
  • Europa Universalis: Rome Collectors Edition
  • Mount & Blade: Warband
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris Sign-up
  • Victoria 2: Heart of Darkness
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Third Rome
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Distant Stars
  • Stellaris: Nemesis
  • Europa Universalis IV: Conquest of Paradise
  • 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
  • Europa Universalis III: Chronicles
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Crusader Kings II
  • Europa Universalis IV: Wealth of Nations
  • Heir to the Throne
  • Europa Universalis III Complete
  • Magicka
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Europa Universalis: Rome
  • Rome Gold
  • Victoria 2
It works, it's in PI's scripts and I've tested it anyway, even if from what I saw from testing, it seems to trigger the event still in one moth (or at the beginning of the next month), needs more testing.

Getting a title to a character works instantly, but because it's triggered by the action itself (meaning it needs the player to actively give that title), for AI still needs to rely on a MTTH trigger.

Yet, there's another thing I saw while searching through PI's scripts: there are some triggered only events which still contains a trigger with an always = yes condition (see ruler.txt scrips). I didn't had time to test it yet (it's on my large list of to do/test things), but it may work in a normal triggered event without a MTTH (will need usage of a flag though to avoid have it triggered repeatedly).

What Sute]{h said. You can get titles to be selectable, but you can also get titles that are triggered automatically. It wouldn't be too hard to implement pretty much seamlessly, either.

I haven't tried the always = yes thing yet, though.
 

adonys

Sergeant
88 Badges
Apr 5, 2008
85
2
  • BATTLETECH: Season pass
  • Shadowrun: Dragonfall
  • Empire of Sin
  • Mount & Blade: With Fire and Sword
  • Knights of Pen and Paper 2
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Cadet
  • Tyranny: Archon Edition
  • Tyranny: Gold Edition
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Surviving Mars: First Colony Edition
  • Steel Division: Normandy 44
  • Steel Division: Normandy 44 Deluxe Edition
  • Knights of Honor
  • Crusader Kings Complete
  • BATTLETECH
  • Prison Architect
  • Crusader Kings III
  • Stellaris: Necroids
  • Tyranny - Bastards Wound
  • Stellaris: Humanoids Species Pack
  • Surviving Mars: Digital Deluxe Edition
  • Imperator: Rome Sign Up
  • Imperator: Rome - Magna Graecia
  • Stellaris: Federations
  • BATTLETECH: Heavy Metal
  • Stellaris: Lithoids
  • Age of Wonders: Planetfall Sign Up
  • BATTLETECH: Flashpoint
  • Shadowrun: Hong Kong
  • Europa Universalis III Complete
  • Steel Division: Normandy 44 -  Back to Hell
  • Shadowrun Returns
  • Europa Universalis III Complete
  • BATTLETECH - Digital Deluxe Edition
  • Surviving Mars: First Colony Edition
  • Imperator: Rome Deluxe Edition
  • Stellaris: Megacorp
  • Teleglitch: Die More Edition
  • Rome: Vae Victis
  • War of the Roses
  • Stellaris: Distant Stars
  • 500k Club
  • Pride of Nations
  • Mount & Blade: Warband
  • Tyranny: Archon Edition
  • Stellaris: Galaxy Edition
I've added a download in thread's starting post. This script will allow you to occupy any foreign province you're controlling (meaning you invaded it and won the siege) for more than a month.

Conqueror's keepers!