• 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.
Sounds very strange and I can't reproduce it. If you can reproduce it on your end with one specific event, then paste it here and I will look at it.

The issue was with my assumption that there was a correlation between the "Assert failed" and "Previous assert occurred in Event #" entries in the error log.

It seems to sometimes be true, but often is not -- you'll get a bunch of "Assert failed" entries and then a "Previous assert occurred" which points to an event which has nothing to do with those failed asserts at all. Looking at it now, I think that disconnect happens when the asserts are caused by commands used in the cb_types file (since those are technically not events, I guess?), but I could be wrong.

Of course, the base problem (for us at CK2Plus, at any rate) seems to be that we get "Assert failed" entries in the error log for almost everything we do with variables...and with the aforementioned disconnect with the "Previous assert occurred in Event #" entries, it's hard to pinpoint what causes the assert and what doesn't (or if this is even a "real" error).

It's not a big issue, however -- just made it confusing trying to debug.
 
I finally got around to looking into this one. It doesn't have anything to do with the AI not looking at ai_will_do or the distance trigger not working. The problem is bad coding and using scopes for things they weren't made for. Any CB that is in title scope and has an attacker in the Root scope and a defender in the From scope will have this problem if you step into the Root scope, like this:

Code:
  ai_will_do = {
     factor = 1
     modifier = {
       factor = 0
       ROOT = {
         distance = {
           who = FROM
           value = 1000
         }
       }
     }

The ROOT scope here isn't the real ROOT scope (which instead is the title) and thus have no FROM scope, so when you use FROM here it will instead point to itself, and the character will check the distance against itself...

Unfortunately this is a pretty big bug and I can't do such a big change on my own. Will have to wait for the CK2 lead to return from vacation to discuss this. To "fix" the problem wight now you can do something like this (I feel dirty just writing it):

Code:
  ai_will_do = {
     factor = 1
     modifier = {
       factor = 0
       ROOT = {
         PREV = {
           FROM = {
             distance = {
               who = PREVPREV
               value = 1000
             }
           }
         }
       }
     }

So I assume ai_will_do will be fixed to act like can_use_title in terms of scopes (i.e. current scope = title, ROOT = attacker, FROM = defender)?
 
So I assume ai_will_do will be fixed to act like can_use_title in terms of scopes (i.e. current scope = title, ROOT = attacker, FROM = defender)?

It already is like that (current scope = title, ROOT = attacker, FROM = defender), the problem is in how those three scopes were set up. The FROM-pointer in the ROOT scope didn't point to the defender scope but back on ROOT.

The root of the problem (pardon the pun) is that we are using scopes in ways they weren't meant to. A better system would have been to have had two saved event targets called attacker and defender attached to the title scope. It's too late to make such changes to CK2 but it will be used in the next game we start to develop.

So: if you can wait for the patch you don't have to re-script anything, otherwise you can use the ugly fix I presented above.
 
The issue was with my assumption that there was a correlation between the "Assert failed" and "Previous assert occurred in Event #" entries in the error log.

It seems to sometimes be true, but often is not -- you'll get a bunch of "Assert failed" entries and then a "Previous assert occurred" which points to an event which has nothing to do with those failed asserts at all. Looking at it now, I think that disconnect happens when the asserts are caused by commands used in the cb_types file (since those are technically not events, I guess?), but I could be wrong.

Of course, the base problem (for us at CK2Plus, at any rate) seems to be that we get "Assert failed" entries in the error log for almost everything we do with variables...and with the aforementioned disconnect with the "Previous assert occurred in Event #" entries, it's hard to pinpoint what causes the assert and what doesn't (or if this is even a "real" error).

It's not a big issue, however -- just made it confusing trying to debug.

Sure. But as I said, if you put back one of those events and reproduce the log entry, I can take a look at it and see if there is a real problem or if we're just logging something unnecessarily.
 
There's an assert being thrown by SoA.5204:
[triggerimplementation.cpp:6713]: Assert failed for 'none': false && "Must be province or landed title scope"
[event.cpp:499]: Previous assert occured in Event '12605204'.
[eventmanager.cpp:218]: >=== NAMESPACE > 'SoA' is set to #12600000
Code:
# Relic is stolen by raiders
character_event = {
   id = SoA.5204
   desc = EVTDESC_SoA_5204
   picture = GFX_evt_burning_house
   border = GFX_event_normal_frame_religion
  
   only_rulers = yes

   trigger = {
     is_landed = yes
     has_dlc = "Sons of Abraham"
     NOT = {
       any_demesne_province = {
         controlled_by = ROOT
       }
     }
     has_character_modifier = owns_relic
   }
  
   mean_time_to_happen = {
     months = 50
   }

   option = {
     name = EVTOPTA_SoA_5204
     remove_character_modifier = owns_relic
   }
}
I tried adding "any_demesne_title = { tier = count }" to the triggers but it didn't make a difference.

Edit: I think this might be related to using ROOT as the right side of controlled_by; every other instance has e_rebels on the right side.
 
Last edited:
Just noticed a problem with the spawn_unit effect. It seems that any unit spawned this way now continuously reinforces by default. In the change log there is the following line:

- Added flags reinforcing [yes/no] and reinforce_rate_multiplier to the spawn unit effect.

These flags appear to not work however, event putting reinforcing = no and reinforce_rate_multiplier = 0 in the spawn_unit effect still produces a unit that reinforces.

I think this may have a detrimental effect on the vanilla game as well. If all spawned units are reinforcing by default there may eventually be many armies present on the map.

Fixed this one as well as mercenaries always reinforcing with a few men even when reinforcing should be zero.
 
Don't use the random in the reply events - since those five all got the same random seed from the original event. Use the random when you send out the events instead and then reply with fixed days or instant.

I'm doing this too:

Code:
# The Conference of Peace
# Invitation of independent characters
character_event = {
    id = EoG.510
    desc = EVTDESCEoG.510
    picture = GFX_evt_throne_room

    is_triggered_only = yes

    # Let's call all the independent characters
    option = {
        name = "EVTOPTOKEoG.510"

        set_character_flag = calling_independent_chars
        any_independent_ruler = {
            limit = {
                trait = independent_character
            }
            character_event = { id = EoG.506 days = 5 random = 15 }
        }
    }
}

Again all the responses happen together after circa 5 days or it is ignoring the random or applying the same seed to all the independent characters...
 
I'm doing this too:

Code:
# The Conference of Peace
# Invitation of independent characters
character_event = {
    id = EoG.510
    desc = EVTDESCEoG.510
    picture = GFX_evt_throne_room

    is_triggered_only = yes

    # Let's call all the independent characters
    option = {
        name = "EVTOPTOKEoG.510"

        set_character_flag = calling_independent_chars
        any_independent_ruler = {
            limit = {
                trait = independent_character
            }
            character_event = { id = EoG.506 days = 5 random = 15 }
        }
    }
}

Again all the responses happen together after circa 5 days or it is ignoring the random or applying the same seed to all the independent characters...

Hm, ok, I tested with three random_courtiers after each other and than it works. I see now that you are correct. For some reason that I don't know CK handles this different than our other games. Will try to sort it out tomorrow.
 
Sure. But as I said, if you put back one of those events and reproduce the log entry, I can take a look at it and see if there is a real problem or if we're just logging something unnecessarily.

Okay, what I did to reproduce this is make a new mod that only adds one test event and one test decision.

The test event:

Code:
#test event
character_event = {
   id = Plus.100
   hide_window = yes
  
   only_playable = yes
   religion = catholic
  
   trigger = {
     NOT = { check_variable = { which = "test_variable" value = 5 } }
   }
  
   mean_time_to_happen = {
     days = 1
   }
  
   immediate = {
     change_variable = { which = "test_variable" value = 1 }
   }
}

So that just fires an event for all catholic rulers to increase a "test_variable" on their character by 1.

It produces asserts like this:

[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[event.cpp:517]: Previous assert occured in Event '1800100'.


The "Previous assert" correctly identifies the event id, and there's one after every instance of it being used in the game -- but then the question is: why is this causing an assert?

The decision does essentially the same thing:

Code:
  test_variables = {
     potential = {
       ai = yes
       is_ruler = yes
       religion = catholic
     }
     allow = {
       NOT = {
         check_variable = { which = "test_variable" value = 5 }
       }
     }
     effect = {
       change_variable = { which = "test_variable" value = 1 }
     }
     ai_will_do = {
       factor = 1
     }
   }

Having removed the previous event, the decision causes these kinds of error entries:

[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
(and so on)
[event.cpp:499]: Previous assert occured in Event '230'.
[event.cpp:499]: Previous assert occured in Event '1001200'.


It'll do that in batches -- lots of "Assert failed" entries followed by a "Previous assert" that has an event id with no connection to where the assert fired -- presumably because it did not occur in an event.

Wondering if maybe the assert was caused by trying to change a variable which hadn't been set, I changed the decision to this:

Code:
  test_variables = {
     potential = {
       ai = yes
       is_ruler = yes
       religion = catholic
     }
     allow = {
       NOT = {
         check_variable = { which = "test_variable" value = 5 }
       }
     }
     effect = {
       if = {
         limit = {
           NOT = {
             check_variable = { which = "test_variable" value = 1 }
           }
         }
         set_variable = { which = "test_variable" value = 0 }
       }
       change_variable = { which = "test_variable" value = 1 }
     }
     ai_will_do = {
       factor = 1
     }
   }

So if there is no "test_variable" yet on the character, it sets it to 0 first and then increases it to 1.

That then produced errors like so:

[effectimplementation.cpp:8427]: Assert failed for 'set_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[event.cpp:499]: Previous assert occured in Event '450'.


Basically that pair of asserts for set_variable and change_variable, over and over -- again with the occasional "Previous assert" pointing to a seemingly random event id, since the variables were being set outside of an event.

It's possible that using the variable commands outside of an event isn't really intended, in which case so be it -- the fact that, in that case, the "Previous Assert" doesn't point somewhere real is something we'd just have to live with. Maybe more pertinent is why this is causing an "Assert failed" entry in the error log at all. This is just change_variable and set_variable being used in character scope.
 
Last edited:
  • 1
Reactions:
It already is like that (current scope = title, ROOT = attacker, FROM = defender), the problem is in how those three scopes were set up. The FROM-pointer in the ROOT scope didn't point to the defender scope but back on ROOT.

The root of the problem (pardon the pun) is that we are using scopes in ways they weren't meant to. A better system would have been to have had two saved event targets called attacker and defender attached to the title scope. It's too late to make such changes to CK2 but it will be used in the next game we start to develop.

So: if you can wait for the patch you don't have to re-script anything, otherwise you can use the ugly fix I presented above.

Ah okay, so the problems come from using FROM inside ROOT rather than from the title scope? I'm pretty sure we never did anything like that (only using FROM directly from the title scope) so I think we're okay.
 
Okay, what I did to reproduce this is make a new mod that only adds one test event and one test decision.

The test event:

Code:
#test event
character_event = {
   id = Plus.100
   hide_window = yes
 
   only_playable = yes
   religion = catholic
 
   trigger = {
     NOT = { check_variable = { which = "test_variable" value = 5 } }
   }
 
   mean_time_to_happen = {
     days = 1
   }
 
   immediate = {
     change_variable = { which = "test_variable" value = 1 }
   }
}

So that just fires an event for all catholic rulers to increase a "test_variable" on their character by 1.

It produces asserts like this:

[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[event.cpp:517]: Previous assert occured in Event '1800100'.


The "Previous assert" correctly identifies the event id, and there's one after every instance of it being used in the game -- but then the question is: why is this causing an assert?

The decision does essentially the same thing:

Code:
  test_variables = {
     potential = {
       ai = yes
       is_ruler = yes
       religion = catholic
     }
     allow = {
       NOT = {
         check_variable = { which = "test_variable" value = 5 }
       }
     }
     effect = {
       change_variable = { which = "test_variable" value = 1 }
     }
     ai_will_do = {
       factor = 1
     }
   }

Having removed the previous event, the decision causes these kinds of error entries:

[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
(and so on)
[event.cpp:499]: Previous assert occured in Event '230'.
[event.cpp:499]: Previous assert occured in Event '1001200'.


It'll do that in batches -- lots of "Assert failed" entries followed by a "Previous assert" that has an event id with no connection to where the assert fired -- presumably because it did not occur in an event.

Wondering if maybe the assert was caused by trying to change a variable which hadn't been set, I changed the decision to this:

Code:
  test_variables = {
     potential = {
       ai = yes
       is_ruler = yes
       religion = catholic
     }
     allow = {
       NOT = {
         check_variable = { which = "test_variable" value = 5 }
       }
     }
     effect = {
       if = {
         limit = {
           NOT = {
             check_variable = { which = "test_variable" value = 1 }
           }
         }
         set_variable = { which = "test_variable" value = 0 }
       }
       change_variable = { which = "test_variable" value = 1 }
     }
     ai_will_do = {
       factor = 1
     }
   }

So if there is no "test_variable" yet on the character, it sets it to 0 first and then increases it to 1.

That then produced errors like so:

[effectimplementation.cpp:8427]: Assert failed for 'set_variable': false && "Invalid scope for variable effect"
[effectimplementation.cpp:8549]: Assert failed for 'change_variable': false && "Invalid scope for variable effect"
[event.cpp:499]: Previous assert occured in Event '450'.


Basically that pair of asserts for set_variable and change_variable, over and over -- again with the occasional "Previous assert" pointing to a seemingly random event id, since the variables were being set outside of an event.

It's possible that using the variable commands outside of an event isn't really intended, in which case so be it -- the fact that, in that case, the "Previous Assert" doesn't point somewhere real is something we'd just have to live with. Maybe more pertinent is why this is causing an "Assert failed" entry in the error log at all. This is just change_variable and set_variable being used in character scope.

Thank you. I've found and fixed the problem. There are nothing wrong with your use of variables - the logging happened even though nothing was wrong.
 
It already is like that (current scope = title, ROOT = attacker, FROM = defender), the problem is in how those three scopes were set up. The FROM-pointer in the ROOT scope didn't point to the defender scope but back on ROOT.

The root of the problem (pardon the pun) is that we are using scopes in ways they weren't meant to. A better system would have been to have had two saved event targets called attacker and defender attached to the title scope. It's too late to make such changes to CK2 but it will be used in the next game we start to develop.

So: if you can wait for the patch you don't have to re-script anything, otherwise you can use the ugly fix I presented above.
Any chance that the documentation on the top of the 00_cb_types.txt file might be changed to say that, instead of the current confusing ROOT = receiver, FROM = giver "explanation"?
 
In 2.1.5.6 "local_speed_modifier" was added. I tried using this as a province modifier
Code:
stone_road = {
    local_speed_modifier = 0.1
    icon = 1
}
This has no effect, as it displays as NONE: +0.10 and doesn't affect the movement speed what-so-ever. I also tried just "local_speed_modifier" in a building to the same effect just for the sake of testing.

How does one make use of this modifier? I tried searching the string on the forum, but literally only the release thread that it came out with can be found on this subject.

Perhaps I am only misunderstanding its use and it's not a bug, my apologies if that's the case

Any comment on this? It seems to have gotten missed
 
Any chance that the documentation on the top of the 00_cb_types.txt file might be changed to say that, instead of the current confusing ROOT = receiver, FROM = giver "explanation"?

Perhaps you misunderstand. ROOT and FROM are exactly those things. The issue is that they don't work in the ai_will_do when used in the same argument, as a ROOT called from within FROM scope or a FROM called from within ROOT scope will not point to the correct place. And it's been fixed, anyhow.
 
Perhaps you misunderstand. ROOT and FROM are exactly those things. The issue is that they don't work in the ai_will_do when used in the same argument, as a ROOT called from within FROM scope or a FROM called from within ROOT scope will not point to the correct place. And it's been fixed, anyhow.
Yes, but I was referring to the explanation at the top of the file. Whenever I read the cb file, I keep instinctively thinking that ROOT is meant to refer to the defender, as they are the one receiving the war declaration, while FROM is the attacker because they are giving the war dec. I am aware this is incorrect, but it is almost certainly confusing to new modders, and also annoying to have to keep reminding myself of the correct meanings.

Edit:
That's why I asked if adding the simpler explanation of ROOT and FROM to the documentation at the start of the file would be possible.
 
I attached Visual Studio to CK2 and reproduced the crash with Celt's save game. Here's a save game that should reproduce the crash in about a year, playing as the Duke of Tuskegee. When the crash occurred, the debugger reported a stack overflow exception. Without source code or PDBs, I have very little ability to actually get the the bottom of this issue. I'm not sure if this is the appropriate venue to get help with this, but I'm running out of troubleshooting ideas.

1. Character X takes decision mictlantec_sacrifice, spawns mictlan.10 for himself
2. X picks out a random courtier and spawns mictlan.11
3. Random courtier goes into FROM (character X) and spawns mictlan.12
4. Character X again spawns mictlan.10...
5. Infinite loop, stack overflow, crash...
 
Speaking of scope issues, the COTC mod has a problem where all the decisions relating to military commands have filter = vassals and it appears to do literally nothing; the decisions can be used on anyone who meets the allow and potential conditions, whether they're independant rulers, your direct vassal, your indirect vassal, or someone else's vassal.

Can't reproduce this one. I made a test decision for my vassals with a trigger of being landed and over 35, and it doesn't who on any character except landed vassals over 35. If you still have the problem, give me a case to reproduce.
 
River_movement flag in governments is broken. If set it lets you graphically choose to move up a river, but your not capable of doing so. You also cannot set all the culture or religion modifiers in government type either yet. These seem like bugs to me. Futhermore, if your government allow consorts and you convert your religion it overrides the ability to have consorts. Moreso, you cannot use the Merchant republic flag in any scope but republic. Finally, the move_capital_time flag for nomads rolls over if you by any other government type. It starts adding time to when you can move governments.

The post of modding governments was a bit unclear, but river_movement can not be set from it. I've updated that post with a complete list of properties that can be used.
 
1. Character X takes decision mictlantec_sacrifice, spawns mictlan.10 for himself
2. X picks out a random courtier and spawns mictlan.11
3. Random courtier goes into FROM (character X) and spawns mictlan.12
4. Character X again spawns mictlan.10...
5. Infinite loop, stack overflow, crash...
Thanks. I looked at those events, modified the events to remove the loop, and I was able to play a few years past where the crash previously occurred.

When I tagged over to the king who was triggering the crashing event, I noticed that with HL enabled he would sometimes end up with a dead character in his prison. I never saw this happen without HL enabled, and I heard some other mods had seen the same bug with HL (GoT maybe?) Since each iteration of the event chain randomly selected a prisoner for sacrifice, interaction between the event chain (which worked fine before HL, though I never tested it with more than a dozen prisoners) would lead to the infinite recursion and stack overflow when HL was enabled.