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

Ceranai

Major
64 Badges
May 21, 2013
738
719
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Third Rome
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Res Publica
  • Heir to the Throne
  • Hearts of Iron III
  • Crusader Kings II
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis IV
  • Europa Universalis III Complete
  • Europa Universalis III
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Divine Wind
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris: Distant Stars
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Age of Wonders III
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Necroids
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Reapers Due
  • Stellaris Sign-up
  • Stellaris
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
  • Europa Universalis III Complete
  • Europa Universalis III Complete
Hello Modders,

Just thought I would share this as I spent a lot of today trying to figure this out and its actually quite simple once you know how. I'm making a Christmas Mod which needed an event to fire on teh 25th. Tried various things and the thing that works best is this:

Code:
character_event = {
    id = YULE.200#pulse
   hide_window = yes
    religion = pagan

    trigger = {
        controls_religion = yes
       NOT = { has_character_flag = cooldown }
        month = 11
    }

    immediate = {
       character_event = { id = YULE.201 days = 20 }
        set_character_flag = cooldown

    }
}

character_event = {
    id = YULE.199#cooldown reset
   hide_window = yes
    religion = pagan

    trigger = {
        controls_religion = yes
       has_character_flag = cooldown
        month = 6
    }

    immediate = {
        clr_character_flag = cooldown
    }
}

In my mod Santa is the head of the Pagan religion but if you switch out pagan for christian it works just as well with the pope.

This basically lets you set a yearly pulse specific to any day of the year. For some reason 20 days meant that the final event fired on the 25th (there are another 2 events in this chain before the player event) but it is consistent.

Using this it would be possible to set a yearly event for all kinds of holidays. Im quite a newbie at modding but Im quite proud of this chain :).
 
  • 1
  • 1
Reactions:
Hello Modders,

Just thought I would share this as I spent a lot of today trying to figure this out and its actually quite simple once you know how. I'm making a Christmas Mod which needed an event to fire on teh 25th. Tried various things and the thing that works best is this:

Code:
character_event = {
    id = YULE.200#pulse
   hide_window = yes
    religion = pagan

    trigger = {
        controls_religion = yes
       NOT = { has_character_flag = cooldown }
        month = 11
    }

    immediate = {
       character_event = { id = YULE.201 days = 20 }
        set_character_flag = cooldown

    }
}

character_event = {
    id = YULE.199#cooldown reset
   hide_window = yes
    religion = pagan

    trigger = {
        controls_religion = yes
       has_character_flag = cooldown
        month = 6
    }

    immediate = {
        clr_character_flag = cooldown
    }
}

In my mod Santa is the head of the Pagan religion but if you switch out pagan for christian it works just as well with the pope.

This basically lets you set a yearly pulse specific to any day of the year. For some reason 20 days meant that the final event fired on the 25th (there are another 2 events in this chain before the player event) but it is consistent.

Using this it would be possible to set a yearly event for all kinds of holidays. Im quite a newbie at modding but Im quite proud of this chain :).

Your events lack a mean time to happen clause and an is_triggered_only = yes, and should have one of those. Even if they work, it's bad practice.

That said, I don't understand your code. Is YULE.201 the event supposed to fire on Christmas?

Also, regarding events that have to fire on a specific date, there is a much safer and more efficient way that don't rely on mtth.

It would consis on verifying at which day each bookmark is set. Set a global flag on game start, then fire an event with an delay depending on which flag is set. Then make that even recall itself with a dalay of 365 years. This would need to be adapted each time a new bookmark is added, and wouldn't support other mods adding more bookmarks, but would appear to be more reliable.

In any case, I'll be interested to try your mod if you publish it, to see how it performs in practice.
 
Your events lack a mean time to happen clause and an is_triggered_only = yes, and should have one of those. Even if they work, it's bad practice.

That said, I don't understand your code. Is YULE.201 the event supposed to fire on Christmas?

Also, regarding events that have to fire on a specific date, there is a much safer and more efficient way that don't rely on mtth.

It would consis on verifying at which day each bookmark is set. Set a global flag on game start, then fire an event with an delay depending on which flag is set. Then make that even recall itself with a dalay of 365 years. This would need to be adapted each time a new bookmark is added, and wouldn't support other mods adding more bookmarks, but would appear to be more reliable.

In any case, I'll be interested to try your mod if you publish it, to see how it performs in practice.


Why is it bad practice?
I want event A to trigger event B to then trigger event C especially for these events when I want it to trigger on a very specific timeline.

Oh well, given that it is working I really cba to go back and break it XD, ive spent too long on it already and this mod will need to be ready for the 27th (im making it for the official paradox discord server MP marathon, which I am also hosting (official in the sense that we are partnered with the reddit forum :p))
 
Why is it bad practice?
I want event A to trigger event B to then trigger event C especially for these events when I want it to trigger on a very specific timeline.

Oh well, given that it is working I really cba to go back and break it XD, ive spent too long on it already and this mod will need to be ready for the 27th (im making it for the official paradox discord server MP marathon, which I am also hosting (official in the sense that we are partnered with the reddit forum :p))

Bad practice, in that it only works by default, and the devs can change inadvertly that behaviour becausein theory we should use either mtth or is_triggered_only. One similar thing happend around 2.3 I think, where before you could put e.g. desc = "my description" in the event script instead of a localisation file, but this were supposed to use localisation files. So the devs fixed/changes that and many mods had to busy themselves with fixing it.
 
Bad practice, in that it only works by default, and the devs can change inadvertly that behaviour becausein theory we should use either mtth or is_triggered_only. One similar thing happend around 2.3 I think, where before you could put e.g. desc = "my description" in the event script instead of a localisation file, but this were supposed to use localisation files. So the devs fixed/changes that and many mods had to busy themselves with fixing it.

Yes but when I do make it triggered it doesnt fire coz nothing is firing it and using MMTH will make it fire unreliably i think.
 
Yes but when I do make it triggered it doesnt fire coz nothing is firing it and using MMTH will make it fire unreliably i think.
Why is nothing firing the event?!
If you use "is_triggered_only", it MUST be fired by something else - most easily just by putting an entry in on_actions. If the event should fire randomly on its own, you use MTTH, but yeah that would not work with your mod.
Anyway, nice idea for a mod :)
 
Why is nothing firing the event?!
If you use "is_triggered_only", it MUST be fired by something else - most easily just by putting an entry in on_actions. If the event should fire randomly on its own, you use MTTH, but yeah that would not work with your mod.
Anyway, nice idea for a mod :)

No, it doesnt have to be fired by something, I dont know how or why but it DID work the way I did it, it fired on the 25th of December every year
 
No, it doesnt have to be fired by something, I dont know how or why but it DID work the way I did it, it fired on the 25th of December every year
If you have not made it is_triggered_only or is given a mtth then the event works by assuming it has the lowest mtth possible so fires whenever it can. Bad practice as it is intensive on the game as it is constantly checking that event on every event pulse instead of having a chance of happening every event pulse (mtth) or being only specifically made to happen (is_triggered_only).
 
  • 2
Reactions: