# Modding - Quick questions

#### -Rodri-

##### First Lieutenant
Like the quick question thread in the CK2 general forum, this is a place to ask quick questions about modding.

I would like to start it with a question about decisions:
What is the difference between the Potential part and the Allow part?
and one more generic:
How can I know who of the ruler´ sons has the highest Martial stat? Or the lowest?

I'm sure if we can keep this thread going there is a lot of people who could make their first steps in the modding realm a lot more easier!

Re: decisions, "potential" means the decision will show up even if you can't enact it, thus giving you a clue as to what else you need to be able to enact it. "allow" gives the prereq for enacting the decisions.

That was quick, thanks! I get it now.

Oh good. I was going to post something like this earlier today but then I found the answer on my own.

Here's a new one I encountered though: mean_time and factors. How do they work? In battle events it seems a higher factor makes it occur more often (judging by the traits) whereas looking at the job events it seems to be the reverse. Anybody can explain why this is so and what to keep in mind when messing with them?

I made myself the same question.
I really don't know why the battle events has any modifiers at all, as their mean_time_to_happen is very short (1 day).

The factors works by multiplying the MTTH. So if you have a MTTH of 100 and a factor of 0.5, the final MTTH is 50. If the factor is 2, the MTTH would be 200.
And the factors are accumulative

Look at this: MTTH in EUIII wiki

I made myself the same question.
I really don't know why the battle events has any modifiers at all, as their mean_time_to_happen is very short (1 day).
I suspect that is because of combat pulses.

I suspect that is because of combat pulses.

This is what I thought as well. It's the days = 1 part that's confusing me. How does that work with the random chance? Is that the minimum time between events or what?

I suspect that is because of combat pulses.
yes, but when the event fires, and it has a MTTH of 1 day... why bother with all the modifiers...

In the nicknames file does the chance per year factor for traits stack or will it just use the highest if you have more than one. Does (= trait) mean its required while (or trait) means its not? What does ai ambition and ai honor actually effect?

Last edited:
yes, but when the event fires, and it has a MTTH of 1 day... why bother with all the modifiers...

What apparently is happening with Battles instead of normal MTTH events is that instead of modifying the chances per period they're influencing the RANDOM CHANCE to encounter that event during the pulse. As in, when you're looking at a 20 frequency event and you get a Factor 2 modifier your "shares" of triggering for that event double, giving it 40 shares chance of triggering among all possible events. The MTTH listed of 1 day therefore probably means something besides what it does for other non-pulse events. Why Paradox's dev team didn't change it to something less confusing, and what it now means for pulse events, is a mystery.

n the nicknames file does the chance per year factor for traits stack or will it just use the highest if you have more than one. Does (= trait) mean its required while (or trait) means its not? What does ai ambition and ai honor actually effect?

Code:
``````nick_the_strong = {
allow = {
age = 20
trait = strong           #required trait
OR = {                    #one of the traits below required
trait = brave
trait = ambitious
}
}
chance = {
factor = 1
}``````

So, you have 1% chance per year to acquire the nick if you are older than 20 yo and strong and you are either brave or ambitious.

Thanks Rodri, so for nicks that have differnt factors for traits it will use the highest factor.

I really don´t know how the nicks mark precedence. So far I understand that given the conditions in the Allow section, you get some chance to get one nick.

Some nicks like the cruel you can get with ether the cruel or the wroth trait but cruel will have a factor of 5 while wroth will have a factor of 2. I would guess it will just use the higher of the 2 factors for someone with both traits or the nick would be way to common for those that can be gained from 3 to 4 traits .

Look at the piety gained nicknames.

Code:
``````nick_the_accursed = {
allow = {
age = 20
OR = {
NOT = { piety = -50 }
trait = possessed
trait = kinslayer
}
}
chance = {
factor = 1
modifier = {
factor = 2.0
NOT = { piety = -100 }
}
modifier = {
factor = 2.0
NOT = { piety = -200 }
}
modifier = {
factor = 2.0
NOT = { piety = -300 }
}
modifier = {
factor = 2.0
trait = hedonist
}
modifier = {
factor = 2.0
trait = gluttonous
}
modifier = {
factor = 2.0
trait = greedy
}
modifier = {
factor = 2.0
trait = envious
}
modifier = {
factor = 2.0
trait = cynical
}
}
}``````

There is no need to give different factors based on piety if they are not accumulative. I think (and someone correct me if I´m wrong) that if that character has:
piety -301
is greedy
is envious
then

final chance hast to be acumulative by addition (multiplying seems too much). So annual percentaje would be 1+2+2+2+2+2 = 11% (or by multiplying=32%)

I did not think to look at the piety nicks; looks like your correct as I can't think of any other reason for it to be that way. Thanks for all the help.

Two questions:

1) Is there a way to create my own variables (either global or attached to an object)?

2) How would I go about modifying warscore from an event? I guessed a few possible effect tags but none of them hit the mark.
EDIT: While at it, is there a trigger to detect warscore too?

3) I'm having some trouble getting a new opinion modifier to work. I added it to the opinion_modifiers.txt but it's not showing up in-game. Maybe it's something with my script? I'm using the following effect code:

Code:
``````any_realm_character = {
limit = {
liege = ROOT
}
opinion = {
who = liege
modifier = opinion_shared_spoils
months = 60
}
}``````

Last edited:
1) I don´t know.
2) Look if you can use set_variable and change_variable. They´re from EU3 (EU3 effects), but I don´t know if they can be used in CK2 or the scope of them.
3) What are you trying to do with that code? If I guess correctly, try this:

Code:
``````any_realm_character = {
limit = {
is_liege_of = ROOT
}
opinion = {
who = ROOT
modifier = opinion_shared_spoils
months = 60
}
}``````

I already played around with set_variable and check_variable but they don't seem to do anything.

The code is supposed to add an opinion modifier to all characters who have the ROOT character as their liege. It's inside an event option and their face icons show up, so I don't think the limit portion of the code is incorrect. The problem is that when I go to check their opinion it hasn't changed and the new opinion modifier isn't listed. Tried it with one of the vanilla OMs too but that didn't show either, so it must be a problem with the code, somehow.

Have you tried...
Code:
``````opinion = {
who = ROOT #instead of who = liege
modifier = opinion_shared_spoils
months = 60
}``````