# Modding - Quick questions

#### burny26

##### In bruges giving good tumbles
I am trying to understand the probability in this piece of vanilla code:
Code:
``````ai_chance = {
factor = 1
modifier  = {
factor = 0.1
ai = yes
trait = in_hiding
}
modifier = {
factor = 2
opinion = { who = from value = -40 }
}
modifier  = {
factor = 2
opinion = { who = from value = -20 }
}
}``````
Is the base chance here 1/100 muiltiplied by 2 if opinion of FROM is above -40 and again multiplied by 2 if opionion of FROM is above -20 ,making for a total of 4% ai_chance if not in hiding ?

#### richvh

##### Preserver of the Light
The weight of the option is 4 if the opinion is above -20 and not in hiding, but this is not a percentage chance. The percentage chance is the adjusted weight of this option divided by the adjusted weight of all other options.

#### burny26

##### In bruges giving good tumbles
So in combination with the following :
Code:
``````        ai_chance = {
factor = 1
modifier  = {
factor = 0
opinion = { who = from value = 0 }
NOT = { trait = in_hiding }
}
modifier  = {
factor = 2
NOT = { opinion = { who = from value = -60 } }
}
modifier  = {
factor = 2
NOT = { opinion = { who = from value = -80 } }
}
}``````
This would mean that an ai not in hiding with opinion of +5 would have (1*2*2)/(1*0) ? Or (1*2*2)/(1*0+1*2*2) ?

#### Tintiam

##### Captain
color2 is used for the border coloring, alternated with the main color.
So does it default to something if missing?

#### richvh

##### Preserver of the Light
So in combination with the following :
Code:
``````        ai_chance = {
factor = 1
modifier  = {
factor = 0
opinion = { who = from value = 0 }
NOT = { trait = in_hiding }
}
modifier  = {
factor = 2
NOT = { opinion = { who = from value = -60 } }
}
modifier  = {
factor = 2
NOT = { opinion = { who = from value = -80 } }
}
}``````
This would mean that an ai not in hiding with opinion of +5 would have (1*2*2)/(1*0) ? Or (1*2*2)/(1*0+1*2*2) ?
The latter.

• 1

#### Rorgloin

##### Major
Is it possible to make an "invisible" law that can only be enbaled or disabled via event? I just want to make one that I can give Charlemagne to increase his vassal limit, as I'm not aware of any means of doing that other than laws-- if anyone knows of a simpler way, I'm all ears.

##### Colonel
How to add my mod into workshop?

#### jursamaj

##### General
How to add my mod into workshop?
Have it installed so that your game can use it. Start the game up, and on the 1st screen where you pick Single Player, Load Game, etc., click Content. On the next page, click Mod. Scroll to your mod and click Manage next to it. Follow the instructions from there.

• 1

#### Dhekelian

##### First Lieutenant
I´m still still trying to mod the Vanilla file landed_titles so I can rename the counties of England into Anglo-Saxon. I have most of them done and thy appear in game as I would like. The counties of Cornwall, Devon Ergyng and Pengwern start off with a different culture and I hope I have made the changes that will see them change when they get Anglo-Saxon so they seem OK as well.
My problem is with three Counties, Northumbria, Wessex and Surrey. I can't see a reference to Wessex to change but I have changed the Duchy to Westseaxe and this appears correctly. I made the changes for Surrey and can't make that one out.

#### Zarathustra_the

##### Lt. General
Is there any way to scope to any character you are hostile with, not just at war, but any raider, or any raidee, or any one your at war with, Am looking for a scope that will pick up all of that.

#### Cpoffers

##### First Lieutenant
Modding noob here.

I'm trying to make a (largely cosmetic) "Imperial" government type for realms with the Imperial Administration law, but can't for the life of me get it working.

I thought it would be as simple as putting
Code:
``NOT { has_law = imperial_administration }``
in the "potential" field on non-Imperial governments, but this doesn't seem to work.

Is what I'm trying to do even possible, or am I bashing my head against hard-coded limitations?

EDIT: Should probably clarify that yes I've put it into feudal_governments.txt rather than giving it its own file.

Last edited:

#### richvh

##### Preserver of the Light
Governments are in character scope, laws in title scope. I think you need to scope to primary title before checking the imperial administration law.

#### Moarice

##### Tyrant
Where can I find (modded) trait IDs?

#### richvh

##### Preserver of the Light
Traits are defined in common/traits/. The link between traits and their icons is defined in a spriteType in a .gfx file in interface, and the actual icon will be wherever the link in the spriteType says it should be (by convention somewhere in gfx/).

#### Cpoffers

##### First Lieutenant

Have modified to
Code:
``primary_title = { NOT = { has_law = imperial_administration } }``
but it still isn't working. Am I doing it right?

Last edited:

#### Liberty87

##### Recruit
Hey all,

Been trying to understand event modifiers and factors, particularly when it comes to attributes. For example, this vanilla code:

Code:
``````20221: The Marshal has managed to raise an eager force of raiders
character_event = {
id = 20221
title = EVTNAME20221

mean_time_to_happen = {
months = 120

modifier = {
factor = 3.0
liege = {
tier = count
}
}

modifier = {
factor = 1.25
NOT = { martial = 2 }
}
modifier = {
factor = 1.25
NOT = { martial = 3 }
}
modifier = {
factor = 1.25
NOT = { martial = 4 }
}
modifier = {
factor = 1.25
NOT = { martial = 5 }
}
modifier = {
factor = 0.75
martial = 9
}
modifier = {
factor = 0.75
martial = 10
}
modifier = {
factor = 0.75
martial= 11
}
modifier = {
factor = 0.75
martial = 12
}
modifier = {
factor = 0.75
martial = 13
}
}``````

My question is: Does an attribute factor (e.g. Martial or Diplomacy) behave like the "opinion" condition, where "opinion = { who = ROOT value = 50} " checks if the opinion is at least 50? Or does an attribute have to be that exact value for the modifier to work?

If it is "at least", then isn't the code (in the above example) for a Martial of 9, 10, 11, 12, and 13 redundant and unnecessary? If it is "exact value", then wouldn't it take a Marshal with a high martial score (>13) longer to raise a group of raiders than a Marshal with a martial score between 9 and 13?

#### richvh

##### Preserver of the Light
It's "at least", and all triggered factors are multiplied together, so no redundancy, and a marshal with martial 13+ will recruit faster than a marshal with a lower martial.

#### Liberty87

##### Recruit
It's "at least", and all triggered factors are multiplied together, so no redundancy, and a marshal with martial 13+ will recruit faster than a marshal with a lower martial.

Thanks!

Follow up question... As far as the actual formula goes, in this line of code:
Code:
``````    mean_time_to_happen = {
months = 10
modifier = {
factor = 0.9
has_trait = stressed
}
}``````

Does having the trait stressed mean the MTTH for this example event is decreased to 9 months? Or is there another formula as to how this is calculated?

#### Dhekelian

##### First Lieutenant
I think I have solved my naming of landed counties. Could someone point me to where I can rename 'seas'?

#### burny26

##### In bruges giving good tumbles
First try at variables , I am trying to get a positive on the trigger when all vassals are attending an event.
Validator gives me :
At <mod>\events\mongol.txt [character_event\option\trigger\any_vassal\if] (Line 648, column 5):
Invalid node "if" in scope CharTriggerWithCount (value is: <a complex type>)
At <mod>\events\mongol.txt [character_event\option\trigger\any_vassal\change_variable] (Line 647, column 5):
Invalid node "change_variable" in scope CharTriggerWithCount (value is: <a complex type>
--- Error 1 of 1 ---
At <mod>\events\mongol.txt [character_event\option\trigger\set_variable] (Line 645, column 4):
Invalid node "set_variable" in scope CharTrigger (value is: <a complex type>)
--- Error 1 of 1 ---
At <mod>\events\mongol.txt [character_event\option\trigger\set_variable] (Line 644, column 4):
Invalid node "set_variable" in scope CharTrigger (value is: <a complex type>)

I absolutely have no idea what to do here

Code:
``````        trigger = {
642                   NOT = { has_global_flag = mongol_horde_united}
643                   set_variable = { which = attending_clans value = 0}
644                   set_variable = { which = total_clans value = 0}
645                   any_vassal = {
646                               change_variable = { which = total_clans value = 1}
647                               if = {
648                                      limit = {
649                                           has_character_flag = attending_qurultai
650                                       }
651                                       change_variable = { which = attending_clans value = 1}
}
}
is_variable_equal = { which = total_clans value = attending_clans}
}``````