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

unmerged(6777)

Field Marshal
Dec 10, 2001
12.470
5
DEM 1.03 introduced a number of new conditions and a few new effects for you, but probably the most powerful of these are the new "context switching conditions" - or CSC's for short.

These may be used in the trigger and mtth modifier sections to test for a ream of things that used to be impossible to test because of the event's context - meaning that in a province event you couldn't test most character conditions and visa versa. Now you can.

At first glance, you might wonder why the heck there are only 2 csc's for province events while there are a couple dozen or so for character events. The answer is simple, and highlights an important point to beasr in mind:
Bjering said:
I hate writing the same code more than once
While there might be the odd thing you can't test for, remember that csc's can be nested so all you need to do if you want to test for one of the oodles of csc character conditions in a province event is start a nested csc with a switch to a charcter.

Example:

Let's say you only want a certain province event to trigger if the marshal of that province's demesne has a martial rating of 10 or higher (remember, we're now talking about the marshal's rating, not the realm rating. This can be achieved by:
Code:
	condition = {
		type = owner #this switches the context of the next condition to be a character condition
		condition = {
			type = marshal_csc #this switches context of next condition to apply from the POV of that owner's marshal
			condition = { type = martial value = 10 } #that's the actual test
		}
	}

You can nest these conditions as much as you like, so you can go and check pretty much anything you like.

In our experience working with these, the best approach to writing an evenet now is to work backwards from the effect you want since the only remaining restriction is that you can't use csc's to change context on an event effect. The effect you wish to achieve will then determine whether you need to write a character event, a province event, or a province_x_province event. Then you go back to your triggers and script them to do whatever you need them to, using csc's (potentially nested) to check values or using a mixture of province and character conditions.

Another word of advice: DO NOT USE THE "any_xxxxx" csc's unless you fully understand the impact of what you're doing! They will chew up your CPU and spit it out! ALWAYS use them in triggers, not in modifiers, if you can possibly help it, and ALWAYS make them the very last trigger condition (so it is only looked at if all the other trigger conditions have already been satisfied). If you use them, test the hell out of them to make sure that they don't destroy the game play (i.e. it's not much fun to have the game take 5-10 seconds to process each day).

Have fun!