I got some intel from devs about what makes an event efficient or not. So if you create many events and see that the game is slowing compared to vanilla, you might want to look at what can make it run smoother.
This might not be clear for everyone, so what does it means:
* For regular MTTH events, try to exclude as many characters as possible with the super fast triggers 'only_playable = yes', 'only_men = yes' etc.
is better than
Also means that you should use it as much as possible to restrict the possible targets.
Those are the possible conditions found so far (yes/no and number are variable):
* Opinion triggers are very CPU heavy and should be checked after all other triggers
is better than
* I should add that triggers checking for flags and character modifiers are also fairly slow.
is better than
AND
is better than
Doomdark said:Some simple rules though:
* Opinion triggers are very CPU heavy and should be checked after all other triggers
* For regular MTTH events, try to exclude as many characters as possible with the super fast triggers 'only_playable = yes', 'only_men = yes' etc.
Doomdark said:I should add that triggers checking for flags and character modifiers are also fairly slow.
This might not be clear for everyone, so what does it means:
* For regular MTTH events, try to exclude as many characters as possible with the super fast triggers 'only_playable = yes', 'only_men = yes' etc.
Code:
character_event = {
only_ruler = yes
trigger = {
<other triggers>
}
}
is better than
Code:
character_event = {
trigger = {
is_ruler = yes
<other triggers>
}
}
Also means that you should use it as much as possible to restrict the possible targets.
Those are the possible conditions found so far (yes/no and number are variable):
age = 16
is_prisoner = no
is_ruler = yes
max_age = 11
capable_only = yes
min_age = 16
only_capable = yes
only_men = yes
only_playable = yes
only_rulers = yes
only_women = yes
prisoner = no
is_prisoner = no
is_ruler = yes
max_age = 11
capable_only = yes
min_age = 16
only_capable = yes
only_men = yes
only_playable = yes
only_rulers = yes
only_women = yes
prisoner = no
* Opinion triggers are very CPU heavy and should be checked after all other triggers
Code:
character_event = {
trigger = {
<other triggers>
any_vassal = {
<other triggers about vassal>
opinion = { who = ROOT value = 0 }
}
}
}
is better than
Code:
character_event = {
trigger = {
any_vassal = {
opinion = { who = ROOT value = 0 }
<other triggers about vassal>
}
<other triggers>
}
}
* I should add that triggers checking for flags and character modifiers are also fairly slow.
Code:
character_event = {
trigger = {
<other triggers>
has_character_flag = loan_taken
}
}
is better than
Code:
character_event = {
trigger = {
has_character_flag = loan_taken
<other triggers>
}
}
AND
Code:
character_event = {
trigger = {
<other triggers>
has_character_modifier = proving_bravery
}
}
is better than
Code:
character_event = {
trigger = {
has_character_modifier = proving_bravery
<other triggers>
}
}
Last edited: