• 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:
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.
 
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.
 
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).
 
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.
 
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 :(
 
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.
 
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!