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

Antimatter

Second Lieutenant
86 Badges
Sep 4, 2005
137
0
  • 500k Club
  • Heir to the Throne
  • Europa Universalis III Complete
  • Magicka
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Europa Universalis: Rome
  • Rome Gold
  • Semper Fi
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • Hearts of Iron III Collection
  • Cities: Skylines
  • Cities: Skylines Deluxe Edition
  • Europa Universalis III: Collection
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Europa Universalis: Rome Collectors Edition
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Europa Universalis 4: Emperor
  • Europa Universalis III
  • Cities in Motion
  • Cities in Motion 2
  • 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
  • Deus Vult
  • Hearts of Iron II: Armageddon
  • Europa Universalis III: Chronicles
  • Divine Wind
  • 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
  • For the Motherland
  • Hearts of Iron III
Hello all,

I'm trying to cede provinces that have been occupied for some amount of time to the controller. However, I'm not able to see any way to accomplish all of that. The closest I can get is the following:

Code:
country_event = {
	id = 7305
	
	trigger = {
		any_province = {
			controller = { NOT = { tag = THIS } }
			owner = { tag = THIS }
		}
	}
	
	name = "lose city"
	desc = "lost"
	
	option = {
		name = "boo"
		random_owned = {
			limit = {
				controller = { NOT = { tag = THIS } }
				owner = { tag = THIS }
			}
			secede_province = THIS # Here's the issue
		}
	}
}

So the problem is that the secede_province command in this case cede's the province to the country that gets the event, which is the owner. Essentially, this is backwards of what I want. However, I can't figure out how to turn it around. Switching the controller/owner tags in the trigger causes the event to never fire, I'm guessing because any_province only looks at owned provinces.

My other thought was to do a province_event and use a trigger like so:

Code:
trigger = {
	any_neighbor_province = {
		NOT = { owner = THIS }
		controller = THIS
	}
}

However, this goes nowhere as it looks like using THIS in a province event is not valid. So, any ideas?
 
Similar Problem

I'm having a similar problem using THIS as a tag. I'm using alot of code from the event string in Magnus Mundi that transfers provinces to the controller. (EU3) This is the code I'm using

province_event = {

id = 1313000

trigger = {

NOT = { controlled_by = THIS }
NOT = { controlled_by = REB }
NOT = { has_province_flag = booty_1 }
NOT = { has_province_flag = booty_2 }

}

mean_time_to_happen = { days = 5 }

title = "ENEMY IN CONTROL OF $PROVINCENAME$"
desc = "Enemy troops have overrun and now control $PROVINCENAME$."

option = {
name = "We will take it back!"
ai_chance = { factor = 100 }
set_province_flag = booty_1
}
}

Thats the gist of it anyways. What's happening is that

Not = { controlled_by = THIS }

doesn't seem to be taken into account. The event simply fires for everyone right from the start without any conquests taking place.

I guess our question seems to be if anyone knows how to write an event trigger that fires or doesn't fire based on if the country controls its province or an enemy does. Is there a different tag we need to used other than THIS?
 
Yeah, from manually firing it looks like the THIS tag in that context just always returns false. If you manually fire the event, you'll see lines like "IS" with no condition. It appears that these lines return false, so NOT of these lines returns true every time.
 
Antimatter, can you even get your event to fire? I rewrote it and waited for one of my provinces to be taken, but it never fired.

I think I know how to solve your issue though...instead of having that event secede the province, have it fire another event for the controller country. Have the controller country event include the line to secede to this and it should go to the controller.

Let me know if you can get this to work. I want to include it in a mod I'm starting but I can't figure out how to get the event to fire or fire correctly.
 
That would work, except that if I fire a country_event for the controller then I don't know how to go about finding that province again because the any_province scope only seems to check owned provinces. Similarly, setting a province flag and having a province_event that triggers on that will only fire for the owner and not the controller. I suppose I could do a province flag, fire a country event, then use any_neighbor_province, but then it only works if the province in question borders one you own.

Also, if I try to fire a province_event for the controller country, it does nothing. The text in game says something like < will get event ''>, leaving a blank where the country should be and a '' where something about the event should be. I don't have any idea what that's about. I will definitely post here if I find a solution, though.
 
This is what I could come up with which is basically taking your first event and firing an event from the Magnus Mundi mod that actually ceded the province to the controller. But it doesn't seem to work. The events fire fine, the AI gets and fires the event, but the province is not ceded. Take a gander and let me know if you see anything screwy. You seem to have a bit better knowledge of modding than I do. Plus I hate script. :wacko:

Code:
country_event = {
	
	id = 1313000

	trigger = {
		any_province = {
			controller = { NOT = { tag = THIS } }
			owner = { tag = THIS }
		}
	}

	mean_time_to_happen = { days = 2 }

	name = "Lose Province"
	desc = "Province has been lost!"

	option = {
		name = "Boo!"
		random_owned = {
			limit = {
				controller = { NOT = { tag = THIS } }
				owner = { tag = THIS }
			}

			set_province_flag = tomada

			controller = {
				country_event = 1313001
			}
		}
	}
}

country_event = {

	id = 1313001

	is_triggered_only = yes

	title = "AWESOME IF THIS FIRES!"
	desc = "You can't read this and it is only a test"

	option = {
		name = "Interesting?"
		ai_chance = { factor = 100 }

		any_country = {
			limit = {
				war_with = THIS
				num_of_cities = 1
			}
			random_owned = {
				limit = {
					has_province_flag = tomada
					controlled_by = THIS
				}
				clr_province_flag = tomada
				secede_province = THIS
				owner = {
					badboy = 1 }
			}
		}
	}
}

This should solve the finding province problem since it simply searches for it again.
 
Done and done :D

Code:
country_event = {
	
	id = 1313000

	trigger = {
		any_province = {
			controller = { NOT = { tag = THIS } }
			owner = { tag = THIS }
		}
	}

	mean_time_to_happen = { days = 2 }

	name = "Lose Province"
	desc = "Province has been lost!"

	option = {
		name = "Boo!"
		random_owned = {
			limit = {
				controller = { NOT = { tag = THIS } }
				owner = { tag = THIS }
			}

			set_province_flag = tomada
			set_country_flag = losing_prov

			controller = {
				country_event = 1313001
			}
		}
	}
}

country_event = {

	id = 1313001

	is_triggered_only = yes

	title = "AWESOME IF THIS FIRES!"
	desc = "You can't read this and it is only a test"

	option = {
		name = "Interesting?"
		ai_chance = { factor = 100 }

		any_country = {
			limit = {
				war = yes
				num_of_cities = 1
				has_country_flag = losing_prov
			}
			random_owned = {
				limit = {
					has_province_flag = tomada
					controlled_by = THIS
				}
				clr_province_flag = tomada
				secede_province = THIS
				civilization_value = 5
				owner = {
					clr_country_flag = losing_prov
				}
                controller = {
					badboy = 2
				}
			}
		}
	}
}

It seems the war_with tag doesn't work anymore, so I just worked around it by using a country_flag and the war tag. Seems to work now. :) One last thing, anyone know if there is a way to display the province name without using an effect. That first event that fires for the owner currently doesn't show which province is being talked about. I could do something like:

Code:
civilization_value = 1
civilization_value = -1

but that's not very elegant. Is there a way to show it in the desc?
 
Thanks for getting that posted. It seems to be almost identical to the solution I've been able to come up with and, unfortunately, seems to be the only way to do it.

As far as I can tell, without doing something like you just did there isn't a way. Since the first event had to be changed from a province_event to a country_event you can't use the province name in the description.

I wonder if we'll get any indication if the triggers which no longer work are actually broken(and will be fixed) or were removed for some reason? war_with seems fairly important, as does being able to check the controller in a province_event.
 
Tested this quickly.

Provinces taken by rebels are ceded to the Reb tag. The AI doesn't seem too interested in invading the rebel 'nation' and if you click on the rebel 'capital' (which I assume is the first province to be taken by the rebels) the game crashes.

You might want to restrict it so rebels can't take land.
 
Fintilgin said:
Tested this quickly.

Provinces taken by rebels are ceded to the Reb tag. The AI doesn't seem too interested in invading the rebel 'nation' and if you click on the rebel 'capital' (which I assume is the first province to be taken by the rebels) the game crashes.

You might want to restrict it so rebels can't take land.
Yeah, definitely don't take this as 100% working. I tested it for about 2 seconds by loading up as Rome in 552 AVC (I think...it was when they already occupy a bunch of Carthagian territories). It did what I was trying to do, but I don't guarantee it works :) . In any case, to fix that just add a 'controller = { not = { tag = REB } }' to the trigger and limit in the first event. And thanks for pointing that out :)

warpanda said:
Antimatter, you beat me to the punch! Stupid sleep.... jk. Thanx for figuring it out.
Heh, I actually made the quick change and tested before I left home this morning. You just gotta wake up earlier ;) . Anyway, thanks for the assistance.
 
Anyone done anything more with this? I've tweaked it a bit, but still have some issues - among other things, my coding to prevent it from working for barbarians or rebels and to not take capitols aren't working. Also, if I and another nation are both at war and both control provinces, one firing of the event seems to give both provinces to the AI nation, which is frustating. Here is the code as I am currently using it:

country_event = {

id = 1313000

trigger = {
any_province = {
controller = { NOT = { tag = THIS } }
owner = { tag = THIS }
NOT controller = {
tag = REB
}
NOT controller = {
tag = BAR
}
is_capital = no
}
}

mean_time_to_happen = { days = 1 }

name = "Lose Province"
desc = "Province has been lost!"

option = {
name = "Boo!"
random_owned = {
limit = {
controller = { NOT = { tag = THIS } }
owner = { tag = THIS }
}

set_province_flag = tomada
set_country_flag = losing_prov
badboy = -1

controller = {
country_event = 1313001
}
}
}
}

country_event = {

id = 1313001

is_triggered_only = yes

title = "AWESOME IF THIS FIRES!"
desc = "You can't read this and it is only a test"

option = {
name = "Interesting?"
ai_chance = { factor = 100 }

any_country = {
limit = {
war = yes
num_of_cities = 1
has_country_flag = losing_prov
}
random_owned = {
limit = {
has_province_flag = tomada
controlled_by = THIS
}
clr_province_flag = tomada
secede_province = THIS
owner = {
clr_country_flag = losing_prov
}
controller = {
badboy = 1
}
}
}
}
}
 
The Regent said:
Code:
province_event = {
	id = 7305
	
	trigger = {
		controller = { tag = THIS }
		owner = { NOT = { tag = THIS } }
	}

This trigger should fire for a country which controls a province, but doesn't own it.

It does. The problem is that the secede_province = THIS line defaults to the province owner, regarless of who the event fires for with this trigger, so even though the event fires properly, it just gives the province back to its original owner, rather then moving it to its controller. This is the event I was initally playing around with before switching over to antimatters, but unfortunately its doesn't function either:

Code:
province_event = {

id = 8675309

trigger = {
is_capital = no
controller = { NOT tag = BAR}
controller = { NOT tag = REB}
controller = { tag = THIS }
owner = { NOT tag = THIS }
}

mean_time_to_happen = {
days = 1
}

title = "Accepting reality."
desc = "The people of this province have bowed to reality and accepted your rule, regardless of what their 'offical' government might say. At least for the moment."

option = {

name = "Good!"
owner = { badboy = -1}
secede_province = THIS
controller = {badboy = 1}
}
}

It works if I replace the THIS in the secede_province line with a specific country tag, but then only for that country. :/
 
The Regent said:
Code:
province_event = {
	id = 7305
	
	trigger = {
		controller = { tag = THIS }
		owner = { NOT = { tag = THIS } }
	}

This trigger should fire for a country which controls a province, but doesn't own it.
In my tests, that didn't fire for anybody. If it's firing for you, I don't know what's going on.

BTW, you can check the code I'm using in my mod (linked in my sig), but it's pretty much what was posted before. I experimented with a few other ways of doing it, but it never seemed to work right.
 
I did some tests and got the same results. After looking through the existing vanilla events it looks like that trigger should work, but we all know that proves nothing in modding. Once we get the full trigger list I imagine we'll be on much more stable ground.

I was able to manually trigger it and get the results you got. However, I've had trouble with manual firing in the past. It always seemed to fire for the wrong country, but when it fires on its own it worked correctly. That could be what's going on here.