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.