• 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.
Some questions related to Ruler Designer characters, because they are an edge case for some things:

- Is there an easy way to check if a character is such a character at the start of the game? I can't see anything obvious on the wiki, except possibly "Got an event on the second on_chronicle_start on_action".
I'm not aware of any such easy method, sadly.

- While the use case I have in mind -- firing a specific event only for Ruler Designer characters right at the start -- would make sense to fire on_chronicle_start, I very much would not want that event to fire if the on_action is called for any other reason, including the "play <charid>" command. Given that you can use that console command on the very first day of the game, "Check if some flag set right at the start has been set for X days" isn't sufficient to guarantee that the on_chronicle_start indeed fired for a ruler Designer character, and similarly "Check that a flag that's set the second time on_chronicle_start is called isn't set" wouldn't work if you start as one historical character and swaps to another since the flag only would be set after the swap. I can't really figure out a workaround for this problem (unless there's some "was_ruler_designed = yes" I'm missing); any ideas?
Assuming that on_startup occurs before on_chronicle_start then I think this would work:
  • In an on_startup event (fires for ALL characters except ruler designed):
    • Set flag received_startup_on_action_ping on this character
    • If global flag doing_startup_ruler_designed_character_detection is NOT set [1]:
      • Set global flag doing_startup_ruler_designed_character_detection
      • Schedule an event on a random province [2] in 1 day, which:
        • Clears the global flag doing_startup_ruler_designed_character_detection
        • Clears the character flag received_startup_on_action_ping from all characters

  • on_chronicle_start (fires for all PLAYER characters):
    • Pre-triggers:
      • ai = no (just in case)
      • has_global_flag = doing_startup_ruler_designed_character_detection
    • If this character does NOT have the character flag received_startup_on_action_ping:
      • Set character flag ruler_designed_character
[1] This construction ensures that only one cleanup event will be scheduled, and doing it this way (instead of "if character is player") should hopefully ensure that observer games aren't messed up.
[2] Scheduling the cleanup event on a province ensures that character deaths won't prevent the cleanup.

- In a multiplayer game, would some "Check for the second on_chronicle_start" option even work for identifying these characters? Does each player get their own chronicle, or would it just be the host that gets one? There could be as many Ruler Designer characters as players, and the host is not guaranteed to be one.
If every player gets their own chronicle, and if the test above works, then I expect it would also work in MP.
 
The following snippet seems to distinguish the two characters for which on_chronicle_start fires:

Code:
on_chronicle_start = {
    effect = {
        if = {
            limit = {
                ai = no
                historical = no
            }
            log = "on_chronicle_start player [This.GetID] - [This.GetBestName]"
        }
        else = {
            log = "on_chronicle_start ai [This.GetID] - [This.GetBestName]"
        }
    }
}

Code:
[effectimplementation.cpp:18398]: EVENT [769.1.1]:on_chronicle_start ai 6392 - King Karl of West Francia
[effectimplementation.cpp:18398]: EVENT [769.1.1]:on_chronicle_start player 2609869 - King Pepin of France
Wish I'd read this before writing my long response!

Anyway, does every playable character at game start always have historical = yes?
  • @GodModder rightly raised the issue of random/shattered games.
  • What about unimportant counts (sole members of their dynasty, with random CoA/traits/etc)? Are they explicitly specified in the history? Or are they filled dynamically by the game (before game start) based on province culture etc?
 
Wish I'd read this before writing my long response!

Anyway, does every playable character at game start always have historical = yes?
  • @GodModder rightly raised the issue of random/shattered games.
  • What about unimportant counts (sole members of their dynasty, with random CoA/traits/etc)? Are they explicitly specified in the history? Or are they filled dynamically by the game (before game start) based on province culture etc?

Yes, every single character in the history files satisfies that trigger, and those should be the only characters that can be selected, since characters for counties without a scripted historical ruler aren't generated until after leaving the new game lobby.

I've looked at a way to isolate ruler designed characters in alternate starts and the best I've been able to come up with is using on_new_holder_inheritance, which fires at least once to transfer the titles to the ruler designed character. At this point, has_game_started = no unfortunately is no longer true, but unless a mod specifically has start-up effects/events to change titles from one ruler to another by means of inheritance, this seems like a pretty good bet. Note that both rulers are AI-controlled at this point, where as they are both player controlled when their respective on_chronicle_start and on_startup fire.

Things that I hoped could be used instead were on_host_change and on_employer_change, but they do not fire here.
The order in which on_chronicle_start and on_startup fire also do not allow a neat check without delayed events to clean-up eventual unnecessary flagsetting, since it fires last for the ruler designed character, leaving no way to rule out that the replaced character is in fact being replaced.
 
Yes, every single character in the history files satisfies that trigger, and those should be the only characters that can be selected, since characters for counties without a scripted historical ruler aren't generated until after leaving the new game lobby.
Unfortunately, any attempt to use historical = no to identify ruler-designed characters can only work the very first time a game is started, and only if it is not random/shattered. (You can add ruler-designed characters to loaded games, at which point some inheritances may have occurred, so there will be some non-ruler-designed playable characters that are "not historical".) This kind of check might be sufficient for Tianxia, but it's too failure-prone for my liking.

I've looked at a way to isolate ruler designed characters in alternate starts and the best I've been able to come up with is using on_new_holder_inheritance, which fires at least once to transfer the titles to the ruler designed character. At this point, has_game_started = no unfortunately is no longer true, but unless a mod specifically has start-up effects/events to change titles from one ruler to another by means of inheritance, this seems like a pretty good bet. Note that both rulers are AI-controlled at this point, where as they are both player controlled when their respective on_chronicle_start and on_startup fire.
Given your description of on_new_holder_inheritance, I think we can construct a very simple check:
  • on_new_holder_inheritance: if {ROOT is not AI} and {FROMFROM has a different dynasty to ROOT} then {ROOT is ruler-designed}.
(NB: Assumption: Ruler-designed characters will always create a completely new dynasty. I think this is valid, but I basically never use the ruler designer, so there may be loopholes I'm unaware of.)

I've thought about it for a while and I actually can't think of any way for a player to fool this check (without getting a game over). But maybe you can think of something I've missed?

Obviously, this is purely theoretical on my end but, if it works out, then I think this might be exactly what @Silversweeeper needs.
 
Unfortunately, any attempt to use historical = no to identify ruler-designed characters can only work the very first time a game is started, and only if it is not random/shattered. (You can add ruler-designed characters to loaded games, at which point some inheritances may have occurred, so there will be some non-ruler-designed playable characters that are "not historical".) This kind of check might be sufficient for Tianxia, but it's too failure-prone for my liking.

I've never managed to be able to do that. Perhaps it was changed in some update and I never noticed it. I'll go have a look at it again. Thanks for letting me know.
Edit: The button shows up but clicking it does not open up the Ruler Designer window again.

Given your description of on_new_holder_inheritance, I think we can construct a very simple check:
  • on_new_holder_inheritance: if {ROOT is not AI} and {FROMFROM has a different dynasty to ROOT} then {ROOT is ruler-designed}.
(NB: Assumption: Ruler-designed characters will always create a completely new dynasty. I think this is valid, but I basically never use the ruler designer, so there may be loopholes I'm unaware of.)

I've thought about it for a while and I actually can't think of any way for a player to fool this check (without getting a game over). But maybe you can think of something I've missed?

Obviously, this is purely theoretical on my end but, if it works out, then I think this might be exactly what @Silversweeeper needs.

Note that both characters involved are AI at the moment of this title inheritance.
 
Note that both characters involved are AI at the moment of this title inheritance.
That's annoying. There is probably a workaround, but it won't be as clean. I'll have to think about it.

I've never managed to be able to do that. Perhaps it was changed in some update and I never noticed it. I'll go have a look at it again. Thanks for letting me know.
Edit: The button shows up but clicking it does not open up the Ruler Designer window again.

I tried again (both SP and as a MP host with no other participants) and I got the same behaviour.

I'm pretty sure we found a way to do it in MP a few weeks ago. (It didn't work properly so we ended up using the console instead, but I thought that was because we misclicked or something. I'm pretty sure we got the interface on-screen in the MP lobby somehow - I distinctly remember the frustration of spending ages creating a new character for this guy who joined our game late, only for the character to suddenly disappear.)

However, without being able to reproduce it, I think it's reasonable to assume that it's not actually possible.

---

Have you been able to confirm or refute the idea that random/shattered world characters (which have not been ruler-designed) might have historical = no?

If we can confirm that they all have historical = yes (unless they have been ruler-designed) then this approach might provide a complete test, and it might be a lot easier than the on_new_inheritance idea.
 
Have you been able to confirm or refute the idea that random/shattered world characters (which have not been ruler-designed) might have historical = no?

If we can confirm that they all have historical = yes (unless they have been ruler-designed) then this approach might provide a complete test, and it might be a lot easier than the on_new_inheritance idea.

Oh, no, there are no 'historical' characters in any alternate start, whether shattered or random. That's why I looked at other ways to detect ruler designed characters and stumbled upon on_new_holder_inheritance as a viable option.
 
Is there a way to make a province get over a disease faster? For example, if I give a province 20% disease_defence, will the disease go away faster, or does it just make it less likely to spread to that province in the first place? I want to give a province a disease but have it go away quicker than normal in an event.
 
Is there a way to make a province get over a disease faster? For example, if I give a province 20% disease_defence, will the disease go away faster, or does it just make it less likely to spread to that province in the first place? I want to give a province a disease but have it go away quicker than normal in an event.

There's the reduce_disease command, but since it's only used in one place in vanilla (and not at all in the Reaper's Due stuff) you might want to check that it actually works as expected.
 
When I put stuff gated by if statements in various parts of random lists, I see all the probabilities. If I changed it so I had different random lists inside if and elseif statements, would I only see the chances for the conditions I meet?
 
When I put stuff gated by if statements in various parts of random lists, I see all the probabilities. If I changed it so I had different random lists inside if and elseif statements, would I only see the chances for the conditions I meet?

You always only see the conditions you meet in a random_list; the ifs are separate conditions, so it'll show e.g. a 70 % chance of reaching the if (and what happens there) and a 30 % of getting a different outcome (and if the outcome with the if does nothing (visible) at all for anyone that fails the if, it'd show a 70 % "No effect" outcome for them and a 30 % chance of the other outcome (which also could be "No effect"), assuming there's nothing modifying the probability for the characters failing the if).

Wrapping random_list in ifs and wrapping ifs in random_list do not work the same; compare

Code:
random_list = {
    70 = {
        if = {
            limit = {
                independent = yes
            }
            prestige = -100
        }
        else = {
            prestige = 50
        }
    }
    30 = {
        # Do nothing
    }
}

and

Code:
if = {
    limit = {
        independent = yes
    }
    random_list = {
        70 = {
            prestige = -100
        }
        30 = {
            prestige = 50
        }
    }
}
else = {
    # Do nothing
}

- An independent ruler has a 70 % chance of losing 100 prestige and a 30 % chance of nothing happening in the first case, and a 70 % chance of losing 100 prestige and a 30 % chance of gaining 50 prestige in the second case.

- A vassal has a 70 % chance of gaining 50 prestige in the first case and a 30 % chance of nothing happening, while nothing at all will happen in the second case (the whole else can be cut).

Depending on what you're trying to do, either might be the correct option, but it might also be correct to use a random_list with entire outcomes locked behind a trigger block, using a trigger_switch, or some combination.
 
  • 1
Reactions:
Hello, I have a problem with a mod I am creating.
When running, the button to wage war does not appear...
When the game runs without the mod, everything works.

Anyone have a solution?
bugck2.png
 
Hello, I have a problem with a mod I am creating.
When running, the button to wage war does not appear...
When the game runs without the mod, everything works.

Anyone have a solution?
Are you sure that this Despot of the Maghreb is independent and not your tributary? (The green colour extends outside his owned territory, and the right-click menu is covering the spot where his liege/suzerain would appear.)

NB: It looks like you've done some pretty heavy history modding, so it's possible you've messed something up in there. To be completely sure, try giving him an empire title via the console, since empires must always be independent.
 
Are you sure that this Despot of the Maghreb is independent and not your tributary? (The green colour extends outside his owned territory, and the right-click menu is covering the spot where his liege/suzerain would appear.)

NB: It looks like you've done some pretty heavy history modding, so it's possible you've messed something up in there. To be completely sure, try giving him an empire title via the console, since empires must always be independent.
Thank you for the reponse!

First, the despot of the Maghreb is independent, not my tributary.
Then the green color around its territory is related to the fact that I have not finished define all the provinces, but the game considers them for now as deserts and fills them with the color of the nearest state.
Also, all the characters that the player plays (I tried with several) can not declare war, even when I have claims. AI can do it without a problem.

(Sorry if my answer is not very comprehensive, I do not speak English very well )
 
Thank you for the reponse!

First, the despot of the Maghreb is independent, not my tributary.
Then the green color around its territory is related to the fact that I have not finished define all the provinces, but the game considers them for now as deserts and fills them with the color of the nearest state.
Also, all the characters that the player plays (I tried with several) can not declare war, even when I have claims. AI can do it without a problem.

(Sorry if my answer is not very comprehensive, I do not speak English very well )
That's very weird.

As far as I'm aware, the only way to block the "declare war" button is if it's absolutely and completely invalid. (Eg: Declaring war on your own vassals, or on your own tributaries, or on non-independent characters, etc.) (If someone is aware of a way to block all war declarations via mods, please say something!)

It is possible that all of the AI war declarations are caused by some other method where the AI doesn't need to "press" the "declare war" button. (Eg: Decisions, events, plots, ambitions.)

---

My best guess at the moment is that you have a strange syntax error in your mod which is causing strange behaviour in-game.

The best way to check for this is by installing and running the Validator. It will probably throw a LOT of "history" errors (because you haven't populated the whole map), so I suggest you focus on fixing all of the other errors it finds before looking at the history.

---

Alternatively, there is a chance that the problem is that you have only partly populated the history. (I think CK2 can probably work properly with only partial history, but I'm not sure.)

To test this, you could create a temporary version of your mod which doesn't change the base game history, and see if the problem still exists. If the problem goes away when you use 100% base-game-history... well... it's your history files that are the problem, somehow.
 
The game's hardcoded diplomatic interactions can be disabled in defines, but I doubt anyone would accidentally do that without being aware of it. Can't think of anything else that would cause it to be entirely absent from the game.

Is it absent for all rulers, against all other independent rulers or fellow vassals?
 
I tried the Validator, but it doesn’t detect any problems with the mod, it’s really strange.
Also, I haven’t changed much other than the History files in the game files, I really don’t understand where the problem can come from...
If I attach my mod files, and the ".mod" file, would either of you take a look?
 
I tried the Validator, but it doesn’t detect any problems with the mod, it’s really strange.
Also, I haven’t changed much other than the History files in the game files, I really don’t understand where the problem can come from...
If I attach my mod files, and the ".mod" file, would either of you take a look?

I don't mind having a look.