• 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.

Sriseru

Second Lieutenant
82 Badges
Jan 20, 2014
156
137
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Jade Dragon
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Third Rome
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Reapers Due
  • Stellaris: Galaxy Edition
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Pre-order
  • Rome: Vae Victis
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Sword of the Stars II
  • Sword of the Stars
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II: Legacy of Rome
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Res Publica
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Imperator: Rome Deluxe Edition
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Shadowrun Returns
  • Surviving Mars: First Colony Edition
  • Hearts of Iron IV: No Step Back
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Europa Universalis IV: Golden Century
  • Stellaris: Nemesis
  • Hearts of Iron IV: Expansion Pass
  • Prison Architect
  • Imperator: Rome Sign Up
  • Stellaris: Lithoids
  • Hearts of Iron IV: La Resistance
  • Stellaris: Federations
  • Imperator: Rome - Magna Graecia
  • Battle for Bosporus
  • Europa Universalis 4: Emperor
I'm working on a mod, but I've encountered an issue that I cannot resolve on my own.
So I've added a culture, a trait, an event, and an on_actions call to fire said event, but the event is never fired. The event works perfectly fine if I call it via the console, but for some reason the on_actions won't fire it.

The event code is in a file named "sergal_on_action_events.txt" and it looks like this:
Code:
namespace = sergalevent

#Gives Sergals the Sergal trait
character_event = {
    id = sergalevent.1
    hide_window = yes

    is_triggered_only = yes

    trigger = {
        culture = oldsergal
        NOT = { trait = sergal_trait }
    }
    immediate = {
        add_trait = sergal_trait
    }
}

And the on_actions file is named "SERGAL_on_actions.txt" and its code looks like this:
Code:
#character
on_startup = {
    events = {
        sergalevent.1
    }
}

#character
on_yearly_pulse = {
    events = {
        sergalevent.1
    }
}

Could someone please tell me what I've done wrong?

Edit: on_yearly_pulse correctly fires the event, so the issue seems to be with on_startup. Has anyone else encountered this issue?
 
Last edited:
And the on_actions file is named "SERGAL_on_actions" and its code looks like this:
Could someone please tell me what I've done wrong?

The contents of your files look good to me. If this file does indeed not have a file extension, that would be why.
 
on_startup is a slightly dangerous
on_action event, because it will fire for all characters every single in the game every time you load the game. This could potentially increase your game load time a lot for an old save.

That being said, have you tested out when it works and when it doesn't work? Does the on_startup action work when loading a save but not when starting a new game? Checking the wiki, I noticed the following bug note on the on_startup description, "BUG (as of version 3.2.1): at the start of the new game, it does not fire for courtiers that are not defined in the history files." It also says that it doesn't work for ruler designed characters, but I am not sure if this is true, because I use this on_action for the player character in a mod of mine and I'm pretty sure it fires just fine even when the player character is made with the ruler designer.
 
on_startup is a slightly dangerous
on_action event, because it will fire for all characters every single in the game every time you load the game. This could potentially increase your game load time a lot for an old save.

That being said, have you tested out when it works and when it doesn't work? Does the on_startup action work when loading a save but not when starting a new game? Checking the wiki, I noticed the following bug note on the on_startup description, "BUG (as of version 3.2.1): at the start of the new game, it does not fire for courtiers that are not defined in the history files." It also says that it doesn't work for ruler designed characters, but I am not sure if this is true, because I use this on_action for the player character in a mod of mine and I'm pretty sure it fires just fine even when the player character is made with the ruler designer.
My character was made with the ruler designer (because the event uses a custom culture as a trigger), so that's probably why. Thanks for pointing it out. I've been checking the wiki extensively while working on my mod, but I completely missed the segment on on_actions.
 
My character was made with the ruler designer (because the event uses a custom culture as a trigger), so that's probably why. Thanks for pointing it out. I've been checking the wiki extensively while working on my mod, but I completely missed the segment on on_actions.

From what I remember when I was playing around with on_startup, it is a very special on action and seems to run before the game is actually fully initialized. In the case of a ruler designed character, I believe this means that the event actually runs on the character that should have the title your character is taking over. You could test this by adding a trait with the event and seeing if it is added to the original character or not, who should be a courtier in your court.

The easiest solution might be to have the on_startup event only run on the player character and have it call another event that is on a 1 day delay which checks all game characters and adds the trait if they have the right culture.

Since only the player can make a ruler designed character though, why not just add the trait to the ruler designer options?
 
Last edited:
From what I remember when I was playing around with on_startup, it is a very special on action and seems to run before the game is actually fully initialized. In the case of a ruler designed character, I believe this means that the event actually runs on the character that should have the title your character is taking over. You could test this by adding a trait with the event and seeing if it is added to the original character or not, who should be a courtier in your court.

The easiest solution might be to have the on_startup event only run on the player character and have it call another event that is on a 1 day delay which checks all game characters and adds the trait if they have the right culture.

Since only the player can make a ruler designed character though, why not just add the trait to the ruler designer options?
I managed to find a good workaround by using "on_chronicle_start" instead. I appreciate all the help though. <3