Hey guys, while testing my mod I noticed that the random_playable_ruler seems to always pick and add a trait to the same ruler. Am I doing something wrong? Is there an additional value I need to add in order to make sure it's fully random?
My Option Code:
Code:
option = {
trigger = { trait = immortalB}
name = EVTOPTAvnltbchtmds.1
random_playable_ruler = {
add_trait = immortalB
}
}
Edit: If it's done when the game starts, it will always pick Alfr of Alfheimr when using the 769 start date. Always picks High Cheif Tyueykezhut of Merya when starting in 867. If I fire the event in game later, from console, it will pick someone new every time.
Well, that's probably another problem with funky "randomness".
As with all PC games, or programs really, there is no such thing as true randomness: A random result is only simulated via a generated random seed. Problem is that because this seed is generated by some sort of algorithm, it's not really random and can be the same if the generation is the same.
In CK2 specifically, there used to be an oversight that made a random_list always give the same result, if it was called multiple times within the same event. For example, if you wanted to give every province in the game one of three modifiers, let's say "rich", "normal" and "poor", and at some point (maybe gamestart) you would call an event that scopes to every province, and fires a random_list with those three options for every province, it would result in all provinces getting the same modifier, e.g. all "rich" or all "poor", but no combination! That error was fixed a while ago, but
TL;DR: Maybe there is a similar problem with randomness related to random scopes in general, or this scope only? So that instead of true randomness, it always picks the same random result at a given time?
This should really be fixed by vanilla if that is true; but to circumvent it, maybe you could try some things: Fire another event first and have it call one of three events, which all basically do the same and apply your trait via a random_playable_ruler scope. But because they are called via a (now actually working) random thing, maybe the scope will also actually be random in the second event.
Maybe that would work, maybe not, I am not sure. But you could try it out.