• 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.
Is anyone willing to take a look at my mod and say why it's not working, please?

I am an experienced modder. I started making Doom 2 and Duke3D maps and have modded everything, from Football Manager to Skylines and beyond. I am a programmer and a visual artist. I have been using Photoshop for many years. I have debugged more programs than I have had hot meals.

But I have never once encountered as frustrating and baffling an experience as attempting to mod Crusader Kings II, ever.

I began by reading as much as I could from the CK2Wiki, the forums, and tutorial guides, and examining the mods I already had installed.

I then followed the excellent map making tutorial on these forums, and all was going well. I had a working mod.

Then something went wrong somewhere.

The error.log and setup.log contained no useful information.

The game crashes at random loading stages. Sometimes it's database, sometimes it's map, sometimes it's other things.

Sometimes it doesn't crash. Sometimes it loads just fine. Then next time I load, it crashes. The time after that, it loads fine.

I have tried disabling every piece of DLC (I have all of the main ones). Sometimes this makes a difference and other times it doesn't.

I have validated my game files to make sure I hadn't accidentally changed a core file. I have not.

I checked everything with the validator tool and nothing was wrong.

I even attached to the process using Visual Studio, but without the symbol files, there's no useful information in Visual Studio.

I tried removing things one by one until there was nothing left.

I have checked the format of every image file, and there are no issues. I have checked every pixel of every file, and there are none that should not be there or a different color to the expected values.

It took me 1 hour to create the small mod I started out with. It has taken a total of twenty hours (I have been sitting here for 10 hours at a time) of trying every combination of everything I can possibly think of and I still don't have a working mod.

I would really appreciate it if someone were able to look at my files and say "it's broken because of X" and I would then fix X and actually get back to trying to achieve something.

Like I said, the files I have will load sometimes. Mostly they crash. I can't understand why the game can allow them to load sometimes and not others with exactly the same files.

Link to files: https://drive.google.com/file/d/0B4PHSakiQ8gpWXM0Q3NUcGRIdE0/view?usp=sharing
 
The special immortal characters that I've modded in still keeping dying. ...of 'natural causes', at a young age, such as at thirty.
Haven't had any luck trying to track down the cause, and short of logging every single death event in the game, I don't think I can figure it out myself.

Any suggestions for what could be causing it? Could they just be getting pruned by the game? But I thought that immortals are supposed to be immune to that..
 
The special immortal characters that I've modded in still keeping dying. ...of 'natural causes', at a young age, such as at thirty.
Haven't had any luck trying to track down the cause, and short of logging every single death event in the game, I don't think I can figure it out myself.

Any suggestions for what could be causing it? Could they just be getting pruned by the game? But I thought that immortals are supposed to be immune to that..
Not sure if it still counts, since I've not played with it since the official implementation, but it used to be that a character had to obtain the Immortal effect post-game-start, or it would not apply properly; perhaps this is what is kicking in? Also, maybe consider giving them a high Health boost, as a fall-back?

@fw190a8
Have you tried running your mod through the Validator? It seems to catch some mistakes that the Logs don't report. Also, maybe try removing everything from your Mod and add it back one folder at a time, then one-file at a time once you find the faulty one? That is what I have had to do a few times for 'weird' errors I cannot locate :/



I have an issue with my Adjacencies. I've said before that they don't show up, but with a bit of experimenting I've found the "issue" : My adjacencies only show up IF I have the vanilla Adjacencies defined as well, even if the associated Province-IDs aren't actually being used on the Map. If I have the Vanilla Adjacency entries, my new entries will work correctly, and the adjacencies appear on the map; but as soon as I delete the vanilla Adjacency entries, my ones also disappear from the map...
Resolved : It seems you need at least one-working version of each (Sea, Major River, Portage) in the Adjacencies file; my Mod never used any Portages, but throwing a fake-one in makes the lines appear :D
 
Last edited:
Hello. Is there a condition for assessing whether a character is a commander in the same army as ROOT? I'm making an event where one commander in a victorious battle is envious of the leader, but i'm drawing a blank at the minute.
Use the on_battle_won_leader on_action to fire an event. In that event, ROOT will be the leader of the army (which is the center_flank_leader). From there, scope to liege -> any_army -> limit={center_flank_leader=<PREV>*} (use however much PREVPREV… is needed). In the army scope, you can test if right_flank_leader and/or left_flank_leader exist, and pick one to make envious.
 
It says right there: you attempted to spawn it to an invalid owner. Right off, only rulers can own units. I can't think of any other major limits.
Also try adding 'is_alive = yes' to the trigger. That seems to be a common cause for a lot of errors: trying to run events for (or target) characters that have just died. I've made a habit of adding it to everything I edit, and it has got rid of many vanilla errors.

Not sure if it still counts, since I've not played with it since the official implementation, but it used to be that a character had to obtain the Immortal effect post-game-start, or it would not apply properly; perhaps this is what is kicking in? Also, maybe consider giving them a high Health boost, as a fall-back?
Oh, right. The default immortal trait in itself gives +10 health. Which should already exclude them from pruning.

That other thing you mentioned is interesting, but all of my characters go through a genetics checker events, and the immortal traits are added there. So that shouldn't be the cause, since the traits are all added post-game-start.

And there's hardly any 'death_cause = death_natural' left, all of which I've checked repeatedly. And yet, immortals keep dying of 'natural causes'. If it's not pruning, then I don't know what else it could possibly be. Urgh. This is going to drive me insane.

Is anyone willing to take a look at my mod and say why it's not working, please?
Oh dear.
Well, for starters, you should enable expanded logging (see http://www.ckiiwiki.com/Troubleshooting) and then check error.log. Because your mod generates over 40000 lines of errors, and I don't even know where to begin. Even a single typo or missing culture will crash the game, and you have thousands of culture-related errors. Your added cultures overwrite the vanilla ones because you're using 00_cultures.txt as the filename, but vanilla content still tries to use the cultures that have been overwritten. Try renaming your culture file to something like 10_newcultures.txt, so both exist. That'll reduce the number of errors.

Also, not sure since map modding isn't my area of expertise, but flags might be required. You have a lot of missing ones.

Your 00_province_setup.txt is completely blank. Those definitely need to be defined for the map to work. Use this format for each province:
Code:
1 = {
   title=c_cormyr
   max_settlements=7
   terrain=plains
}

And default.map needs some work. You should have no more and no less than two different sea provinces in each entry. Because that's used to determine which zones are connected.

After fixing all of those, it's still crashing. But that's a start, at least.

I also see that you've tried to add religions, etc. Since it's your first CK2 mod, it would be best to focus on one thing (such as the map) and get it working before trying to add other things.
 
Last edited:
  • 2
Reactions:
It says right there: you attempted to spawn it to an invalid owner. Right off, only rulers can own units. I can't think of any other major limits.
That's kind of the problem, though, I don't know who the owner it's trying to spawn to is, or what event/cause is trying to do the spawning. I get an almost-immediate CTD upon pressing "play", and that is the last part of the error.log.
 
That's kind of the problem, though, I don't know who the owner it's trying to spawn to is, or what event/cause is trying to do the spawning. I get an almost-immediate CTD upon pressing "play", and that is the last part of the error.log.
Might not be related. Crashes are usually listed in exceptions.log, and whatever happens to be listed in error.log is often coincidental.
 
I also see that you've tried to add religions, etc. Since it's your first CK2 mod, it would be best to focus on one thing (such as the map) and get it working before trying to add other things.

Thanks a bunch for this. I think you're right, in that my scope is too large for a beginner. I will take your advice and leave out cultures and religions for the time being, so hopefully I can avoid overriding these elements and simplify the process.

It would be interesting to hear from a map maker on the pitfalls because the troubleshooting section doesn't really cover these in detail. For example, I quickly found a single stray pixel that wasn't supposed to be there, and after fixing it, the mod loaded, so I figured that was the problem, and took a backup after fixing it, and got on with changing more things.

Then it crashed again, so I restored the backup, which had loaded previously, and it crashed as well.

That's the main issue I'm facing: non-deterministic crashes, where it crashes at different places, or doesn't crash, on repeated loads of the exact same mod files.

Without better tools and debug information it's incredibly difficult, but I'm sure experienced CK2 modders know this already. Hopefully I can learn some shortcuts through perseverence, but I have to say, at this stage, now 28 hours of debugging later, I'm doing it more for the "**** you" of getting it to work than the modding itself.
 
Province setup does not need to be completed for a map to work, as far as I remember it just makes loading the game quicker but is a massive pain to create and I don't think anyone made a program to do it automatically from existing mod files
 
Province setup does not need to be completed for a map to work, as far as I remember it just makes loading the game quicker but is a massive pain to create and I don't think anyone made a program to do it automatically from existing mod files

Thanks for confirming this. All I need is a way to just get the mod to load, then I can make small changes and such. At the moment I have a mod that has been unable to load (except randomly sometimes it works) for the past 29 hours. Willing to do what's necessary, stripped it back to only the essentials, with nothing else modded, but the game's not giving me enough info to know what's wrong.
 
I am testing somethings with "random" function but I am not sure if this is working properly as intended

so the question is: is it possible to modify random chance with factor just for certain circumstances? like if someone with certain traits gets higher chances of happening something

will it be easier to do this with random_list function? or should I just stick with simple random?

maybe something like this might work better? I guess?
immediate = {
random_list = {
30 = { # win
modifier = {
trait = dwarf
factor = 0.5
}
character_event = { id = WoL.11107 }
}
60 = { # lose
random_courtier = {
limit = {
ai = yes
is_adult = yes
is_female = no
prisoner = no
NOT = {
OR = {
is_rival = ROOT
trait = incapable
trait = infirm
character = ROOT
}
}
}
character_event = { id = WoL.11108 }
}
}
}
}
}
 
Last edited:
I am testing somethings with "random" function but I am not sure if this is working properly as intended

so the question is: is it possible to modify random chance with factor just for certain circumstances? like if someone with certain traits gets higher chances of happening something

will it be easier to do this with random_list function? or should I just stick with simple random?

maybe something like this might work better? I guess?
immediate = {
random_list = {
30 = { # win
modifier = {
trait = dwarf
factor = 0.5
}
character_event = { id = WoL.11107 }
}
60 = { # lose
random_courtier = {
limit = {
ai = yes
is_adult = yes
is_female = no
prisoner = no
NOT = {
OR = {
is_rival = ROOT
trait = incapable
trait = infirm
character = ROOT
}
}
}
character_event = { id = WoL.11108 }
}
}
}
}
}
Yes, 'random' can take modifiers. Here's an example from vanilla's 00_scripted_effects.txt:
Code:
#Impregnation and venereal disease handling
unprotected_sex_effect = {
    random = {
        chance = 50
        venereal_disease_effect = yes
    }
    random = {
        chance = 10
        modifier = {
            factor = 2
            is_fertile_trigger = yes
        }
        modifier = {
            factor = 2
            FROM = { is_fertile_trigger = yes }
        }
        modifier = {
            factor = 0.5
            is_infertile_trigger = yes
        }
        modifier = {
            factor = 0.5
            FROM = { is_infertile_trigger = yes }
        }
        impregnate_effect = yes
    }
}
 
Can we use additive_modifier in just any place we can use modifier or are there places where additive_modifier don't work?

I remember Divine mentioning it's only supposed to work where additive_modifier is used in vanilla (council laws setup).
 
There is a way to enforce a regency upon a character AND allow said character to lead armies? (Trying with my scarce knowledge in modding to flash the leading of armies, since it bothers me that when rulers lead armies they can bang and administrate their realms like they were at their courts.)