Hello everyone, I have a problem about an event mod. This event is supposed to remove some
character_flag
. The code is below:
Code:
adventure.1005 = {
type = character_event
title = adventure.1005.t
desc = adventure.1005.desc
theme = adventure
left_portrait = root
immediate = {
remove_character_flag = flag_adventure_1st
remove_character_flag = flag_adventure_2nd
remove_character_flag = flag_adventure_3rd
remove_character_flag = flag_adventure_4th
remove_character_flag = flag_adventure_5th
remove_character_flag = flag_adventure_diplomacy
remove_character_flag = flag_adventure_martial
remove_character_flag = flag_adventure_stewardship
remove_character_flag = flag_adventure_intrigue
remove_character_flag = flag_adventure_learning
}
option = {
name = adventure.1005.option.a
}
}
But I found that this event will add
flag_adventure_5th
if the character doesn't have this flag!
By the way, if I change
immediate
to
after
, the problem would have gone.
Does anyone know why that is?
I uploaded the mod file as an attachment.
EDIT:
After testing, I found:
1. Everything is all right if I fire
adventure.1005
by typing
event adventure.1005
in console;
2. Everything is all right if I delete
trigger_event = adventure.1005
in
adventure.1002 - option b
and then fire
adventure.1005
in console;
3. The problem occurred when I first fire
adventure.1002
and then click
adventure.1002 - option b
to fire
adventure.1005
.
4. My guess is, when
adventure.1005
is fired by
adventure.1002 - option b
, the
after
block in
adventure.1002
and the
immediate
block in
adventure.1005
are executed at the same time, even if the later is executed before the former, so that the character execute
if-else
without any flags, which means the
else
branch will be executed, thus adding
flag_adventure_5th
.