• 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.
i was making a custom map into i ran into this problem on the graphic.log
Code:
[provincetemplate.cpp:244]: Province 0 has invalid origin
did i miss a step during map making or is it easy to fix?

I don't know if there's anything specific that's relevant in the case of Province 0 (I suspect that's either pure white (impassable sea) or pure black (impassable mountains)), but it's simply a case of the province not having any pixels on the map. It doesn't really cause any problems for higher number provinces (at least assuming they're not liked to any counties), though you should ideally avoid having a bunch of missing provinces if you can avoid it.
 
  • 1
Reactions:
I'm seeking to turn Viviers and Venaissin into a custom duchy by tweaking the files of one save. I've been suggested to post this as a question by amongst others Aardvark Bellay and jonjowett. Ideally I'd not wish to run afoul and prevent myself from running a game in Ironman mode, so seek your advice on this matter.

Ideally I'd like it to be a decision (in exchange for say, 500 ducats and 250 prestige) but if this proves difficult would be happy enough to see it as such from the start enabling dejure drift into the Papacy over time.

I'm starting an AAR on this theme imminently, but for the time being have used Title Manager which enables Venaissin to become a non-titular duchy. I'll probably delay progress on this until people's suggestions come forth, but shall proceed with my first AAR this weekend (11-12th)

Thanks everyone.
 
I'm seeking to turn Viviers and Venaissin into a custom duchy by tweaking the files of one save. I've been suggested to post this as a question by amongst others Aardvark Bellay and jonjowett. Ideally I'd not wish to run afoul and prevent myself from running a game in Ironman mode, so seek your advice on this matter.

Ideally I'd like it to be a decision (in exchange for say, 500 ducats and 250 prestige) but if this proves difficult would be happy enough to see it as such from the start enabling dejure drift into the Papacy over time.

I'm starting an AAR on this theme imminently, but for the time being have used Title Manager which enables Venaissin to become a non-titular duchy. I'll probably delay progress on this until people's suggestions come forth, but shall proceed with my first AAR this weekend (11-12th)

Thanks everyone.
I thought that any tampering or mods disable Ironman mode.

If there's ways to tamper or mod and still run in Ironman, I don't know how to do that. I'm new to CK2 modding, so my advice isn't perfect, but it's worked for me. So in lieu of a response from one of the experts, here's my suggestion. (I suggest waiting to see if one of the true experts responds, however.)

My method does require making a mod. (I don't know how to save edit this sort of thing.) I assume you know how to set up a mod folder structure and all that.

You'll need to make a file in common/landed_titles folder and define a titular duchy.
Code:
d_my_custom_duchy = { #this can be named anything, as long as d_ is in front, which tells the game it's a duchy
    color = { 255 255 255 } #these colors follow RGB logic, so you can set whichever colors you want
    color2 = { 0 0 0 }
}
You will need to localize it, so it has a proper name in the game instead of just appearing as "d_my_custom_duchy". For more on creating custom landed titles, see https://ck2.paradoxwikis.com/Title_modding

In the decisions folder, you can make a decision that allows you to add Viviers and Venaiissin into your custom duchy.
Code:
decisions = {  #There are multiple kinds of decisions. Using the normal decisions = { } block means it will appear in the Intrigue menu.
   create_my_custom_duchy = { #you can name this decision pretty much anything
 
        is_high_prio = yes # Will show an alert once decision is enabled

        potential = { #who can see it
        }

        allow = { #requirement to press it
            wealth = 500 #you must have 500 gold in order to use this decision
           prestige = 200 #you must have 200 prestige in order to use this decision
           owns = 222 # you must control Venaissin in order to use this decision
           owns = 223 # you must own Vivarais in order to use this decision
        }

        effect = { #what the decision does, once used
            grant_title = d_my_custom_duchy #gives you the duchy
            c_venaissin = {
                de_jure_liege = d_my_custom_duchy #makes Venaissin a de jure part of your duchy
            }
            c_viviers = {
                de_jure_liege = d_my_custom_duchy #makes Vivarais a de jure part of your duchy
            }
            wealth = -500 #removes 500 gold from you
            prestige = -200 #removes 200 prestige from you
        }

        revoke_allowed = {
            always = no
        }
  
        ai_will_do = {
            factor = 0 # this prevents the AI from ever using this decision even if they meet the requirements in the allow block
        }
    }
}

This is quick and dirty, but will work; I've used an almost identical setup in my own personal mod for a custom duchy creation. As written, it will make your duchy not a de jure part of any kingdom or empire, though I assume drift/assimilation will still work. You will need to localize the decision, of course.

For more on creating decisions, see https://ck2.paradoxwikis.com/Decision_modding
 
Last edited:
  • 2Like
  • 1
Reactions:
I thought that any tampering or mods disable Ironman mode.

If there's ways to tamper or mod and still run in Ironman, I don't know how to do that. I'm new to CK2 modding, so my advice isn't perfect, but it's worked for me. So in lieu of a response from one of the experts, here's my suggestion. (I suggest waiting to see if one of the true experts responds, however.)

My method does require making a mod. (I don't know how to save edit this sort of thing.) I assume you know how to set up a mod folder structure and all that.

You'll need to make a file in common/landed_titles folder and define a titular duchy.
Code:
d_my_custom_duchy = { #this can be named anything, as long as d_ is in front, which tells the game it's a duchy
    color = { 255 255 255 } #these colors follow RGB logic, so you can set whichever colors you want
    color2 = { 0 0 0 }
}
You will need to localize it, so it has a proper name in the game instead of just appearing as "d_my_custom_duchy". For more on creating custom landed titles, see https://ck2.paradoxwikis.com/Title_modding

In the decisions folder, you can make a decision that allows you to add Viviers and Venaiissin into your custom duchy.
Code:
decisions = {  #There are multiple kinds of decisions. Using the normal decisions = { } block means it will appear in the Intrigue menu.
   create_my_custom_duchy = { #you can name this decision pretty much anything
 
        is_high_prio = yes # Will show an alert once decision is enabled

        potential = { #who can see it
        }

        allow = { #requirement to press it
            wealth = 500 #you must have 500 gold in order to use this decision
           prestige = 200 #you must have 200 prestige in order to use this decision
           owns = 222 # you must control Venaissin in order to use this decision
           owns = 223 # you must own Vivarais in order to use this decision
        }

        effect = { #what the decision does, once used
            grant_title = d_my_custom_duchy #gives you the duchy
            c_venaissin = {
                de_jure_liege = d_my_custom_duchy #makes Venaissin a de jure part of your duchy
            }
            c_viviers = {
                de_jure_liege = d_my_custom_duchy #makes Vivarais a de jure part of your duchy
            }
            wealth = -500 #removes 500 gold from you
            prestige = -200 #removes 200 prestige from you
        }

        revoke_allowed = {
            always = no
        }
 
        ai_will_do = {
            factor = 0 # this prevents the AI from ever using this decision even if they meet the requirements in the allow block
        }
    }
}

This is quick and dirty, but will work; I've used an almost identical setup in my own personal mod for a custom duchy creation. As written, it will make your duchy not a de jure part of any kingdom or empire, though I assume drift/assimilation will still work. You will need to localize the decision, of course.

For more on creating decisions, see https://ck2.paradoxwikis.com/Decision_modding
Wow, thanks for this @GodModder. Is there a way of knowing what colour is what from the code? I'm a nominal vassal of the Pope, so suspect I'll be white but wouldn't mind a bright cardinal red if ever my duchy was independent.

It's too late to incorporate this into my AAR, but shall certainly make a file and alter the text to enable a new duchy by decision, as you've told me how this can be done. I'm guessing the graphics change for CoA is straightforward? Just personally dislike it when a county/duchy have the same design! Plus I've got a design in mind:

250px-Avignon.lau.jpg
1200px-Blason_ville_fr_Avignon_(Vaucluse).svg.png
300px-Avignon16.jpg


Unsure how this can be done or what PNG/JPEG etc is able to convert over to CKII shields, but that is what I want for the duchy.

Thanks again for your response. One final point is that by creating a new folder should enable a clickable mod interface in "mods" at the CKII startup screen, right? I am aware running such mods disable Ironman, but was apprehensive due to the risks of rendering CKII unplayable.
 
Last edited:
Wow, thanks for this @GodModder. Is there a way of knowing what colour is what from the code? I'm a nominal vassal of the Pope, so suspect I'll be white but wouldn't mind a bright cardinal red if ever my duchy was independent.

It's too late to incorporate this into my AAR, but shall certainly make a file and alter the text to enable a new duchy by decision, as you've told me how this can be done. I'm guessing the graphics change for CoA is straightforward? Just personally dislike it when a county/duchy have the same design! Plus I've got a design in mind:

View attachment 755084View attachment 755087View attachment 755088

Unsure how this can be done or what PNG/JPEG etc is able to convert over to CKII shields, but that is what I want for the duchy.

Thanks again for your response. One final point is that by creating a new folder should enable a clickable mod interface in "mods" at the CKII startup screen, right? I am aware running such mods disable Ironman, but was apprehensive due to the risks of rendering CKII unplayable.
I forgot to explain the coat of arms. Sorry. You'll need to create a gfx/flags folder in your mod folder. In it, place a TGA file with the exact same name as the internal mod name for your duchy. If you use d_my_custom_duchy as in my example, you'll need to name your TGA file d_my_custom_duchy.tga (tga being the file type, rather than JPG or PNG or something else).

The file should be 128x128 pixels in order to work. If you don't know how to create or edit TGA files, I suggest downloading a free program like GIMP. Even with minimal skill (like mine) you can use it similarly to Paint, and just Export your result as a TGA file from the file options presented.

For the color in the landed_titles entry, it follows an RGB format. You should be able to find something online that will let you enter in various values and see what color results. If you just want pure white, 255 255 255 will work for the color code. Pure red would be 255 0 0 instead.

To create a basic mod structure, follow steps 1 to 4 here: https://ck2.paradoxwikis.com/Creating_a_mod

This will make it appear as an option in the launcher mod menu. If you ever break your game, all you have to do is toggle the mod off in the launcher before starting the game. Because mods are in a folder that's entirely separate from the rest of the game, it's isolated and won't destroy your game install.

Toggling off a mod will prevent you from loading a save gave that you saved while the mod was toggled on, however.
 
  • 1
  • 1Love
Reactions:
I forgot to explain the coat of arms. Sorry. You'll need to create a gfx/flags folder in your mod folder. In it, place a TGA file with the exact same name as the internal mod name for your duchy. If you use d_my_custom_duchy as in my example, you'll need to name your TGA file d_my_custom_duchy.tga (tga being the file type, rather than JPG or PNG or something else).

The file should be 128x128 pixels in order to work. If you don't know how to create or edit TGA files, I suggest downloading a free program like GIMP. Even with minimal skill (like mine) you can use it similarly to Paint, and just Export your result as a TGA file from the file options presented.

For the color in the landed_titles entry, it follows an RGB format. You should be able to find something online that will let you enter in various values and see what color results. If you just want pure white, 255 255 255 will work for the color code. Pure red would be 255 0 0 instead.

To create a basic mod structure, follow steps 1 to 4 here: https://ck2.paradoxwikis.com/Creating_a_mod

This will make it appear as an option in the launcher mod menu. If you ever break your game, all you have to do is toggle the mod off in the launcher before starting the game. Because mods are in a folder that's entirely separate from the rest of the game, it's isolated and won't destroy your game install.

Toggling off a mod will prevent you from loading a save gave that you saved while the mod was toggled on, however.
Thank you so much, with all you've kindly shared I should be able to make my prospective "Duchy of Avignon" / "Comtat Venaissin" (I'm undecided as to what I shall call the new duchy, but am hedging towards Avignon - now I can make it a castle) mod over the weekend.

It's only a minor query, but I wondered if such a decision could be restricted until 1274? I'll probably be satisfied enough with seeing it all fully-functional with the alternate graphics of the three keys being slowly incorporated as a dejure core territory of the Papal States. As a history buff however, it would be nice to know how theoretically with a certain string of code this could be done as an optional extra.

Again, my sincere thanks and gratitude go to you @GodModder!
 
Thank you so much, with all you've kindly shared I should be able to make my prospective "Duchy of Avignon" / "Comtat Venaissin" (I'm undecided as to what I shall call the new duchy, but am hedging towards Avignon - now I can make it a castle) mod over the weekend.

It's only a minor query, but I wondered if such a decision could be restricted until 1274? I'll probably be satisfied enough with seeing it all fully-functional with the alternate graphics of the three keys being slowly incorporated as a dejure core territory of the Papal States. As a history buff however, it would be nice to know how theoretically with a certain string of code this could be done as an optional extra.

Again, my sincere thanks and gratitude go to you @GodModder!
Inside the allow = { } block of the decision, you'd add a line and put:
Code:
year = 1274

https://ck2.paradoxwikis.com/Conditions is a great reference for all the possible conditions you can use in various allow, potential, and trigger blocks for events, decisions, and so on.

Before you play a "real" game with your mod, make a new game and test it out to make sure you did everything right. Check to see that the decision shows up in the Intrigue menu, and use console commands to grant yourself the titles, gold, and prestige necessary to qualify for the decision, to see if it works right when you use it.
 
  • 1Like
Reactions:
Regarding your question about ironman: toggling Ironman is something you do at game start. It makes it harder to save scum and prevents usening the console. Iron man is a necessary but not sufficient condition for earning achievements. That requires having the correct checksum for the version of the game you are riding.
 
  • 1
Reactions:
Can you use an if block within another if block? I'm not sure if this event code is right, or if I have to do something differently with it.

Code:
immediate = {
        if = {
            limit = {
               age > 30
               NOT = {
                    any_player = {
                        is_close_relative = ROOT
                    }
                }
            }
            any_playable_ruler = {
                if = {
                    limit = { ai = no }
                    character_event = { id = mynamespace.1000 }
                }
            }
            break = yes
        }
        if = {
            limit = {
                age > 30
                any_player = {
                    is_close_relative = ROOT
                }
            }
            any_playable_ruler = {
                if = {
                    limit = { ai = no }
                    character_event = { id = mynamespace.1001 }
                }
            }
            break = yes
        }
}

Basically I have a trigger block set up to narrow down to several characters, then I want to have a bunch of if statements inside the immediate block that fires different events to the player based on other qualities they meet.
 
Can you use an if block within another if block? I'm not sure if this event code is right, or if I have to do something differently with it.

Code:
[...]

Basically I have a trigger block set up to narrow down to several characters, then I want to have a bunch of if statements inside the immediate block that fires different events to the player based on other qualities they meet.

As far as I know there's no limit on how many ifs you can stack, though at some point readability will be a concern even with comments.

A tangential tip: If you've got a number of exclusive ifs, such as in the example code, you might want to use else_if/else. It is particularly useful when the limit is getting large, e.g. this

Code:
if = {
    limit = {
        OR = {
            trait = chaste
            trait = humble
            trait = kind
            trait = patient
            trait = diligent
            trait = charitable
            trait = temperate
        }
    }
    <Do stuff>
}
if = {
    limit = {
        NOR = {
            trait = chaste
            trait = humble
            trait = kind
            trait = patient
            trait = diligent
            trait = charitable
            trait = temperate
        }
    }
    <Do stuff>
}

is the same as this

Code:
if = {
    limit = {
        OR = {
            trait = chaste
            trait = humble
            trait = kind
            trait = patient
            trait = diligent
            trait = charitable
            trait = temperate
        }
    }
    <Do stuff>
}
else = {
    <Do stuff>
}
 
As far as I know there's no limit on how many ifs you can stack, though at some point readability will be a concern even with comments.

A tangential tip: If you've got a number of exclusive ifs, such as in the example code, you might want to use else_if/else. It is particularly useful when the limit is getting large, e.g. this

Code:
if = {
    limit = {
        OR = {
            trait = chaste
            trait = humble
            trait = kind
            trait = patient
            trait = diligent
            trait = charitable
            trait = temperate
        }
    }
    <Do stuff>
}
if = {
    limit = {
        NOR = {
            trait = chaste
            trait = humble
            trait = kind
            trait = patient
            trait = diligent
            trait = charitable
            trait = temperate
        }
    }
    <Do stuff>
}

is the same as this

Code:
if = {
    limit = {
        OR = {
            trait = chaste
            trait = humble
            trait = kind
            trait = patient
            trait = diligent
            trait = charitable
            trait = temperate
        }
    }
    <Do stuff>
}
else = {
    <Do stuff>
}
Thanks. I didn't want to write up a whole bunch of code, then have it not work, and not know why.

I know about else, but there are going to be multiple if blocks for different combinations of conditions, not just two blocks.
 
I am trying to map out if a character who wins a siege on a trade post is capturing it or if they are liberating it (i.e. will it be counted as occupied afterward or not). I see 5 types of on_actions that fire when a siege ends, "on_siege_won_leader", "on_siege_lost_leader", "on_siege_over_winner", and "on_siege_over_loc_chars". Does one of these reliably scope to the defender in a way that lets you compare if they are the owner in a meaningful way? I'm not sure that checking if the owner is the defender and then setting a flag if they aren't will do what I want, but I am trying to work that out. I also need to take in to account three sided wars (normally claim pressing fests a la England in 1066), so this might not work.
 
That would be it, then - the maximum number of frames is 26. (This corresponds to the use of letters for character DNA entries.)

You would need to add a separate file, a separate corresponding sprite definition, and then add a clause to the portrait properties file so that there was a new layer corresponding to your crowns, and suppressing the existing crown layer and displaying yours instead where appropriate. You might also have to add the new layer to all the portrait definitions in the game, but I'm less certain of that bit. @Nendur is the true expert here.

nd
Could you provide a step by step guide to doing this? I need to make the crowns seperate from the crowns in game ( there are too many and it goes over the limit.) I would like to make a GFX_character_special_crownsA and GFX_character_special_crownsB. I have attached what I have done so far.
 

Attachments

  • 01_portrait_properties.txt
    10,6 KB · Views: 0
  • crown_artifacts.txt
    9,8 KB · Views: 0
I am trying to map out if a character who wins a siege on a trade post is capturing it or if they are liberating it (i.e. will it be counted as occupied afterward or not). I see 5 types of on_actions that fire when a siege ends, "on_siege_won_leader", "on_siege_lost_leader", "on_siege_over_winner", and "on_siege_over_loc_chars". Does one of these reliably scope to the defender in a way that lets you compare if they are the owner in a meaningful way? I'm not sure that checking if the owner is the defender and then setting a flag if they aren't will do what I want, but I am trying to work that out. I also need to take in to account three sided wars (normally claim pressing fests a la England in 1066), so this might not work.
There's also 'on_siege_won_leader_trade_post'. Trade posts are either occupied or destroyed after a siege, so you could check if the province (in FROM) has a trade post, which then means someone has occupied it. Not sure if that person is ROOT or a liege of ROOT, you'd have to do some testing.
 
So I think you can put code in on_action blocks. If I want to clear a flag on a province every time the trade post gets conquered, is it more performance friendly to put that in an event (possibly with some triggers so it only fires if the province has the flag) or to just do it in the on_action? Here is the snippet of code I was going to use:

Code:
FROM = { #province with the trade post
            clr_flag = trade_post_already_cleaned
        }
 
Hello. I am trying to figure out how to have a dispense justice event. I have it setup but when I go to have the prisoner kiilled I kill myself. How can I have the event target the prisoner? PS I would also like to pick specific people as my champion with their photos and names showing up in the text and event box. Please help!
 

Attachments

  • gabbs_justice_duel_1.txt
    1,6 KB · Views: 0
I'd like to write an event that fires when there exists any murder plot against anyone with a particular custom trait (held_in_awe), and would then end the plot automatically.

I'm not sure how to call this though. There's a condition for is_plot_target_of, but I'm not sure how to use that in this case, because I'd figure is_plot_target would be what to use for someone being plotted against - but there is no is_plot_target condition, just is_plot_target_of.

I feel like I'm brain farting and that this should be much easier to figure out than it is for me.
 
Hello. I am trying to figure out how to have a dispense justice event. I have it setup but when I go to have the prisoner kiilled I kill myself. How can I have the event target the prisoner? PS I would also like to pick specific people as my champion with their photos and names showing up in the text and event box. Please help!
Hello. I was able to figure it out by making another event directed at my target. But would anyone still be willing to help me out with setting up champions ( have a specific person do the killing for me?)
 
How can i fix the shiled on this cavalry? it's only happened on rebel troops with shield. It's really immersion breaking because Christians shouldn't use a shield with "Allah" written on it. I've tried eveything, I don't know what to do anymore.
 

Attachments

  • 20210926222146_1.jpg
    20210926222146_1.jpg
    759,4 KB · Views: 0