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

Cheexsta

Veni, vidi, vici
60 Badges
Dec 22, 2005
2.897
62
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris Sign-up
  • Europa Universalis IV: Rights of Man
  • 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
  • Mount & Blade: Warband
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Imperator: Rome Sign Up
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Imperator: Rome - Magna Graecia
  • Stellaris: Necroids
  • Stellaris: Nemesis
  • Heir to the Throne
  • 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
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Crusader Kings II
  • Europa Universalis III Complete
  • Magicka
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
Hey fellas, I'm running into a bit of a block here.

What I'm trying to do is have an event that has different effects depending on what it is affecting (in this case, provinces). That is, if a province has 10 Civ value, I want the effect to be X, while if it has 20 Civ value, I want the effect to be Y and so on.

What I did at first was use:

Code:
		OR = {
			random_owned = {
					limit = {
						(conditions)
					}
					(effects)
			}
		OR = {
			random_owned = {
					limit = {
						(conditions)
					}
					(effects)
			}
		}
And so on, but while the event triggered properly and showed the effects, they wouldn't actually happen. When I changed the effects to have just one limit and no OR arguments, it worked fine.

I've also tried sticking an AND argument after each random_owned line as well, but that stuffed things up even more (and still had no effect).

The only other way I can think of solving this would be to have a separate event for each possibility, which in itself brings a whole host of headaches so I'd rather keep it all within one event if possible.

Any help would be greatly appreciated.
 
I think this does not work because you are mixing triggers and effects sections if you structure events in this way. What you are aiming at seems to be a "case of" structure which is not supported as far as I am aware.
I would be rather happy if someone could prove me wrong on the latter.
 
actually, there's a way through which it can be done.

I've developed a way to do this while working on an unified looting event (using civ and pop as factors influencing the outcome). are you doing something like this too?

don't have time to present all the details and code right now, maybe tonight when i'll get home.
 
sorry for yesterday, didn't had time to post anything.

now, if I understand correctly what you meant, you should try something like this:

Code:
xxx_event ={
	id = xxxxxx

	trigger = {
		random_owned = {
			limit = {
				condition1
				condition2
				...
				conditionn
			}
		}
	}

	mean_time_to_happen = {
		
	}

	title = "zzz"
	desc = "zzz"

	option = {
		name = "zzz"
		random_owned = {
			limit = {
				condition1
			}
			effect1
		}
		random_owned = {
			limit = {
				condition2
			}
			effect2
		}
		...
		random_owned = {
			limit = {
				conditionn
			}
			effectn
		}
	}
}

this should work correct if you want to have all effect1, effect2, effectn happening if the player choses the option. of course, depending on the conditions, only some of the effects will be added (for example if only condition1 is true, then only effect1 will be added; if condition2 and condition3 are true, then both effect2 and effectn will be added)
 
I did an editing yesterday on my post, but for some reason it seems to be lost (had some ISP problems yesterday).

it's very important to know exactly what you want to do, be cause depending on that, the code will look completely different.

yesterday's example will only work if you want to let the player chose (if you offer him more options), each option triggering different multiple effects depending on some conditions (even inside each option), but it won't allow you to don't offer a player a choice (like in elections, you can't present the player the options for each candidate, because that means he will pick anyone he wants to, instead, you'll want to offer him only the winning candidate as a choice), and even more, it won't allow weighted results (you can only have not-intersecting conditions, otherwise you will have multiple effects being added, each having 100% chance to be added if its condition is true).

anything else needs more complicated structures in order to keep everything grouped in a few events, instead doing different events for each case.

for example, in my almost-ready unified loot event, as soon as a province is controlled (and not owned, of course), the new controller is offered to choose between leave the province as it is, loot it and raze it to the ground. after the player makes his choice, an AI event is triggered (because only the damn AI can use a weighted modifier event script, for the player each option will be available as a simple option instead) and depending on controller's choice and on few province's characteristics (civilization and population), different effects will be added to that province, and then other controller/owner announcing events will be triggered.

so, I really need to exactly know what you intend to do, in order to present you the best possible way to do it.
 
for example, in my almost-ready unified loot event, as soon as a province is controlled (and not owned, of course), the new controller is offered to choose between leave the province as it is, loot it and raze it to the ground. after the player makes his choice, an AI event is triggered (because only the damn AI can use a weighted modifier event script, for the player each option will be available as a simple option instead) and depending on controller's choice and on few province's characteristics (civilization and population), different effects will be added to that province, and then other controller/owner announcing events will be triggered.
Will you release that one? :rolleyes:
 
For the record: I've now managed to get the limits working exactly as I had intended. Basically, in a single event option you can have different effects depending on what it's affecting. The exact event I'm working on is as follows:

Code:
	option = {
		name = "Ok"
		random_owned = {
			limit = {
				civilization_value = 10
				NOT = { civilization_value = 20 }
				NOT = { controlled_by = THIS }
				NOT = { has_province_flag = tcm_province_occupied_10 }
			}
			set_province_flag = tcm_province_occupied_10
			civilization_value = -10
		}
		random_owned = {
			limit = {
				civilization_value = 20
				NOT = { civilization_value = 30 }
				NOT = { controlled_by = THIS }
				NOT = { has_province_flag = tcm_province_occupied_20 }
			}
			set_province_flag = tcm_province_occupied_20
			civilization_value = -20
		}
...etc

Tested and working perfectly, and has the potential to really simplify the TCM files. Now, to get the event firing as soon as possible...