• 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.
So I'm trying to make a mod that gives reformed African all benefits from animistic doctrine. I first made a text file named reformed african:

[snip]

For whatever reason this didn't work, so I had to make a copy of "00_religions.txt", make the above changes and then it worked. I don't understand why the first txt file didn't work. Is there a way to do this without copying the entire file?
edit: Ok it looks like I was mistaken re:animistic doctrine. According to the wiki it only gives +5% morale. Is there a way to verify that bonus is in reformed african?

Nope, if you want to edit an existing religion, you have to override the whole file. I don't know why they made it that way, it's very inconsistent about how you are allowed to override scripting elements. They did the same thing for scripted triggers, meaning that if you want to modify an existing scripted trigger you have to override a 9000-line file.

However, editing the religion isn't the only way to do what you want. You could also override the pagan reformation event to apply the changes you want at the time that west_african_pagan is being reformed. IIRC, this is event 670 in on_action_events.txt, and you can override it by simply copying the existing event definition into a new file in your events folder and making your changes there, and making sure that your file loads after the vanilla file (I like to do this by putting "zzz" on the front of the file). That event already applies various effects to reformed religions that can't be applied elsewhere, so this would be in following with the current conventions. There are even clauses in that event where unit modifiers are added to Romuva and Slavic if the player lacks Holy Fury that you can copy.
 
Last edited:
This would be a pointless task, as i stated above you can't be in multiple societies, that can't be changed via mods, trying to join another by modding the conditions would either would result in leaving the current society to join the new one or do nothing.
I was writing my response when you posted yours, so didn't see it. I was unaware single-society is hardcoded.
 
I made changes to Latvia territory 1204 start date. Gave titles of c_jersika, c_talava, etc to historically accurate created characters (Visvaldis, Talivaldis, etc).
In game: all belongs to Holy Order and is not playable.
In history: only Riga should belong to Holy Order, rest of territory was still independent and playable.

I had two problems with the mod:
1) I deleted Livonian Order rulers from holders and added my created historical characters. BUT - they reverted to previous 1187 generic holders instead of Order guys or my chars? Why?
2) For some reason even those (reverted) guys were unplayable? Would game continue consider those lands theocracy or some other problem could cause that?
 
Ok, understood the second. It was because the reverted guys were dead by that time already. When I made them live longer, it all worked well.
But I don’t understand.
- It seems like game is reading my history/characters /Lettigallish file (It reacted to changed death date and changed name)
- It seems like game is reading my relevant history/titles files. It reacts to removed holders.

But - for some reason it ignores my created characters, for example this one under “Lettigallish”:
7770005 = {
name = “Visvaldis”
Dynasty = 7770004
religion = “orthodox”
Culture = “lettigallish”
1168.3.2 = {
birth= yes
}
1238.5.4= {
death = yes
}
}
And when I give c_jersika to Visvaldis, like this:
1202.1.1= {holder=7770005}

Then nothing happens! What am I missing? Must be something really simple..,

Edit: it did not ignore when I gave to same guy my newly created Dynasty. So, it can read Dynasties and Cultures, and characters. But can’t give my character a county?!
 
Last edited:
"Dynasty" and "Culture" should be lower-case. Also, if the capital of the county is set as a bishopric, it will be a theocracy, yes, unless you change the capital to something else.
 
Would the following export the month as a value between 0 and 11, or 1 and 12?

export_to_variable = { which = global_month value = month }

Edit: Never mind, I figured it out on my own. The values are between 0 and 11.
 
Last edited:
I'm creating a mod that tracks new and full moons. The idea is for it to serve as a platform upon which to build other mods that would benefit from keeping track of such things -- e.g., a lycanthropy mod in which infected characters transform every full moon. So far I've come up with the following events:

Code:
namespace = mp_events
character_event = {
    id = mp_events.100
    hide_window = yes
    is_triggered_only = yes
  
    ai = no
  
    trigger = { has_game_rule = { name = moon_phases value = yes } }
  
    immediate = {
        export_to_variable = { which = global_year value = year }
        export_to_variable = { which = global_month value = month }
        export_to_variable = { which = global_day value = day }
      
        repeat_event = { id = mp_events.101 }
        repeat_event = { id = mp_events.102 }
        repeat_event = { id = mp_events.100 days = 1 }
    }
}

character_event = {        # New Moons
    id = mp_events.101
    desc = EVTDESCmp_events.101
    is_triggered_only = yes
  
    trigger = {
        has_game_rule = { name = moon_phases value = yes }
        new_moon_trigger = yes
    }
  
    immediate = {
        set_global_flag = new_moon
        repeat_event = { id = mp_events.103 days = 1 }
    }
  
    option = {
        name = EVTOPTAmp_events
    }
}

character_event = {        # Full Moons
    id = mp_events.102
    desc = EVTDESCmp_events.102
    is_triggered_only = yes
  
    trigger = {
        has_game_rule = { name = moon_phases value = yes }
        full_moon_trigger = yes
    }
  
    immediate = {
        set_global_flag = full_moon
        repeat_event = { id = mp_events.103 days = 1 }
    }
  
    option = {
        name = EVTOPTAmp_events
    }
}

character_event = {
    id = mp_events.103
    hide_window = yes
    is_triggered_only = yes
  
    trigger = {
        has_game_rule = { name = moon_phases value = yes }
        OR = {
            has_global_flag = new_moon
            has_global_flag = full_moon
        }
    }
  
    immediate = {
        IF = {
            limit = { has_global_flag = new_moon }
            clr_global_flag = new_moon
        }
        IF = {
            limit = { has_global_flag = full_moon }
            clr_global_flag = full_moon
        }
    }
}

The first event is triggered by an on_startup on_action. The second and third events set global_flags that can be used by other mods, and rely upon scripted triggers having the format:

Code:
new_moon_trigger = {
    OR = {
        AND = {            # 1066
            check_variable = { which = global_year value == 1066 }
            OR = {
                AND = {
                    check_variable = { which = global_month value == 0 }
                    check_variable = { which = global_day value == 5 }
                }
                AND = {
                    check_variable = { which = global_month value == 1 }
                    check_variable = { which = global_day value == 3 }
                }
                AND = {
                    check_variable = { which = global_month value == 2 }
                    check_variable = { which = global_day value == 5 }
                }
                AND = {
                    check_variable = { which = global_month value == 3 }
                    check_variable = { which = global_day value == 3 }
                }
                AND = {
                    check_variable = { which = global_month value == 4 }
                    check_variable = { which = global_day value == 3 }
                }
                AND = {
                    check_variable = { which = global_month value == 5 }
                    check_variable = { which = global_day value == 1 }
                }
                AND = {
                    check_variable = { which = global_month value == 6 }
                    check_variable = { which = global_day value == 1 }
                }
                AND = {
                    check_variable = { which = global_month value == 6 }
                    check_variable = { which = global_day value == 31 }
                }
                AND = {
                    check_variable = { which = global_month value == 7 }
                    check_variable = { which = global_day value == 29 }
                }
                AND = {
                    check_variable = { which = global_month value == 8 }
                    check_variable = { which = global_day value == 28 }
                }
                AND = {
                    check_variable = { which = global_month value == 9 }
                    check_variable = { which = global_day value == 27 }
                }
                AND = {
                    check_variable = { which = global_month value == 10 }
                    check_variable = { which = global_day value == 26 }
                }
                AND = {
                    check_variable = { which = global_month value == 11 }
                    check_variable = { which = global_day value == 25 }
                }
            }
        }
        etc.

The dates in the scripted triggers are compiled from a NASA emphemeris using a Python script and are historically accurate to within a few minutes. I'm facing two problems, however:
  1. The second and third events fire exactly one day late (e.g., a new moon on January 5 fires on January 6), and I have no idea why.
  2. The CKII calendar appears not to count leap years, and there are some years in which a new or full moon falls on February 29.
Can anyone think of a reason for #1?

For #2, is the calendar hardcoded? If so, I'd have to decrement each February 29 by one, sacrificing a bit of accuracy in order not to completely skip a phase. If not, I could probably mod the calendar to include leap years.
 
I'm creating a mod that tracks new and full moons. The idea is for it to serve as a platform upon which to build other mods that would benefit from keeping track of such things -- e.g., a lycanthropy mod in which infected characters transform every full moon. So far I've come up with the following events:

<code snipped>

The first event is triggered by an on_startup on_action. The second and third events set global_flags that can be used by other mods, and rely upon scripted triggers having the format:

<code snipped>

The dates in the scripted triggers are compiled from a NASA emphemeris using a Python script and are historically accurate to within a few minutes. I'm facing two problems, however:
  1. The second and third events fire exactly one day late (e.g., a new moon on January 5 fires on January 6), and I have no idea why.
  2. The CKII calendar appears not to count leap years, and there are some years in which a new or full moon falls on February 29.
Can anyone think of a reason for #1?

For #2, is the calendar hardcoded? If so, I'd have to decrement each February 29 by one, sacrificing a bit of accuracy in order not to completely skip a phase. If not, I could probably mod the calendar to include leap years.
For the date being off: just as the months are numbered 0 thru 11, the days are numbered 0 thru 27/29/30. You can tell the devs are diehard programmers, because starting lists from #0 is quite common. The same thing happens with coats of arms, and character genetics & properties.

For leap years, probably best to move all Feb 29 events to either Feb 28 or Mar 1, your choice which.

This project sounds useful to a lot of modders. I've considered doing something similar, but it could easily be done with your setup: a system that would allow modders to easily have an event fire on *any* specific day. (Your year and month exports are technically redundant, but since the year and month triggers only do equal-or-greater-than comparison, yours is still more useful.) Some people might like a day-of-the-year global variable, or even a day-of-epoch one, but I don't know that it's worth implementing until somebody asks for it.
 
"Dynasty" and "Culture" should be lower-case. Also, if the capital of the county is set as a bishopric, it will be a theocracy, yes, unless you change the capital to something else.
Did not work out :(
Changed to lower-case and no good.

Could it be that those 7770001 are taken by some other characters??
 
Did not work out :(
Changed to lower-case and no good.

Could it be that those 7770001 are taken by some other characters??
Ok, I think I screwed something up badly. The game just created a baby character for c_talava that used name and dynasty from character of c_vanema for whatever reason. And once I used ruler designer to make that baby into proper ruler, then game would just crash.
Any guide I could read on character modding? It should not be so screwed up. I mean to add 4 characters to Lettigallish and to make 4 provinces use them as rulers instead of game ones.

That should have been easy and not a cause of so much frustration...
 
For the date being off: just as the months are numbered 0 thru 11, the days are numbered 0 thru 27/29/30. You can tell the devs are diehard programmers, because starting lists from #0 is quite common. The same thing happens with coats of arms, and character genetics & properties.

Lol, that should have been the first thing that occurred to me, especially after I determined that the months started at 0. I was up way too late working on this, heh.

For leap years, probably best to move all Feb 29 events to either Feb 28 or Mar 1, your choice which.

Yeah, I think I'll just decrement to Feb 28. It's trivial to code, and a one day error every few decades isn't a terribly big deal.

This project sounds useful to a lot of modders. I've considered doing something similar, but it could easily be done with your setup: a system that would allow modders to easily have an event fire on *any* specific day. (Your year and month exports are technically redundant, but since the year and month triggers only do equal-or-greater-than comparison, yours is still more useful.) Some people might like a day-of-the-year global variable, or even a day-of-epoch one, but I don't know that it's worth implementing until somebody asks for it.

As I mentioned, I'm hoping to create something that modders can use as a basis for other projects. In addition to the mod itself, I plan on including the Python scripts I used to generate the scripted triggers, as these can be modified to also export quarter moons, solstices and equinoxes, etc.
 
Now, I fixed everything. Except now remaining question is how do I make a province
a) a Tributary State (I want c_jersika be a tributary state to d_polotsk since 1170)
b) a Tributary (I was c_talava be a tributary to k_novgorod since 1200)

Any help appreciated.

p.s.
I did fix the characters, but only by using already game defined characters, that I renamed, changed birth/death and used them. But still could not create my own character. If anyone knows most common issues with creating new characters pls let me know. Could it be I used ID (7770001) that was already taken?

p.s.2.
Another question - how do I give a lot of piety to D_Livonian_Order for a given start date, otherwise my changes made them too weak and easy to beat by my glorious pagans and they really need some Holy Order to stand their own.
 
The command to make a title a tributary is
Code:
make_tributary = {
   who = X
   type = Y
}
Who determines the title that becomes a tributary of the scoped character.
Type is the type of tributary, defined in common/tributary_types.

Edit: For your last question, you can't give piety to titles, only to characters. Find the character holding the title at they date you want and add effect = { piety = X } at the appropriate date in their history.
 
The command to make a title a tributary is
Code:
make_tributary = {
   who = X
   type = Y
}
Who determines the title that becomes a tributary of the scoped character.
Type is the type of tributary, defined in common/tributary_types.

Edit: For your last question, you can't give piety to titles, only to characters. Find the character holding the title at they date you want and add effect = { piety = X } at the appropriate date in their history.
I did not understand where I should put that line - should I copy this to D_Polotsk?
make_tributary = {
who = c_jersika
type = permanent
}
"Permanent" being for what game considers a "tributary state"? And "default" if I just wanted a "Tributary"?
 
Your correct on which tributary types to use, but the command can only be run from a character scope. So, like the piety, that would need to be added to the history of the character holding the title, not the title itself.
 
Your correct on which tributary types to use, but the command can only be run from a character scope. So, like the piety, that would need to be added to the history of the character holding the title, not the title itself.
But "Who" woudl that be a character or a title?

Who is c_jersika or <character>?