• 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
54 Badges
May 21, 2013
737
719
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Mare Nostrum
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Res Publica
  • Crusader Kings II
  • Heir to the Throne
  • Hearts of Iron III
  • 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: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings II: Holy Fury
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Age of Wonders III
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Crusader Kings III
  • Europa Universalis IV: Dharma
  • Surviving Mars: First Colony Edition
  • Stellaris: Megacorp
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • 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
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:

ngppgn

Field Marshal
19 Badges
Jan 29, 2011
3.508
656
  • Crusader Kings III
  • Imperator: Rome
  • Imperator: Rome Deluxe Edition
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Stellaris
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Res Publica
  • Crusader Kings II
  • Heir to the Throne
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Conquest of Paradise
  • Divine Wind
  • Europa Universalis III: Chronicles
  • Europa Universalis III
  • Crusader Kings II: The Old Gods
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.
 

Ceranai

Major
54 Badges
May 21, 2013
737
719
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Mare Nostrum
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Res Publica
  • Crusader Kings II
  • Heir to the Throne
  • Hearts of Iron III
  • 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: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings II: Holy Fury
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Age of Wonders III
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Crusader Kings III
  • Europa Universalis IV: Dharma
  • Surviving Mars: First Colony Edition
  • Stellaris: Megacorp
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • 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
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))
 

ngppgn

Field Marshal
19 Badges
Jan 29, 2011
3.508
656
  • Crusader Kings III
  • Imperator: Rome
  • Imperator: Rome Deluxe Edition
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Stellaris
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Res Publica
  • Crusader Kings II
  • Heir to the Throne
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Conquest of Paradise
  • Divine Wind
  • Europa Universalis III: Chronicles
  • Europa Universalis III
  • Crusader Kings II: The Old Gods
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.
 

Ceranai

Major
54 Badges
May 21, 2013
737
719
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Mare Nostrum
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Res Publica
  • Crusader Kings II
  • Heir to the Throne
  • Hearts of Iron III
  • 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: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings II: Holy Fury
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Age of Wonders III
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Crusader Kings III
  • Europa Universalis IV: Dharma
  • Surviving Mars: First Colony Edition
  • Stellaris: Megacorp
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • 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
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.
 

LordPeter

Marjoram
49 Badges
Mar 5, 2012
2.249
382
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Conclave
  • Stellaris Sign-up
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Prison Architect
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris: Synthetic Dawn
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Imperator: Rome
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: El Dorado
  • 500k Club
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis IV
  • Crusader Kings II: Sword of Islam
  • Stellaris
  • Europa Universalis IV: Third Rome
  • Cities: Skylines
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Cradle of Civilization
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 :)
 

Ceranai

Major
54 Badges
May 21, 2013
737
719
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Mare Nostrum
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Res Publica
  • Crusader Kings II
  • Heir to the Throne
  • Hearts of Iron III
  • 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: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings II: Holy Fury
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Age of Wonders III
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Crusader Kings III
  • Europa Universalis IV: Dharma
  • Surviving Mars: First Colony Edition
  • Stellaris: Megacorp
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • 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
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
 

blackninja9939

Experienced Programmer - Crusader Kings 3
Paradox Staff
78 Badges
Aug 28, 2013
2.401
7.847
  • Crusader Kings III
  • Stellaris: Federations
  • Battle for Bosporus
  • Stellaris: Nemesis
  • Hearts of Iron IV: No Step Back
  • Europa Universalis IV
  • Crusader Kings III: Royal Edition
  • Europa Universalis 4: Emperor
  • Stellaris: Necroids
  • Crusader Kings II
  • Crusader Kings II: Holy Fury
  • Imperator: Rome - Magna Graecia
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Old Gods
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Synthetic Dawn
  • Surviving Mars
  • BATTLETECH
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings II: Monks and Mystics
  • Tyranny: Archon Edition
  • Europa Universalis IV: Rule Britannia
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Colonel
  • Stellaris Sign-up
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Apocalypse
  • Stellaris: Lithoids
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Shadowrun Returns
  • Imperator: Rome Deluxe Edition
  • Prison Architect
  • Imperator: Rome Sign Up
  • Stellaris: Ancient Relics
  • Age of Wonders: Planetfall
  • Crusader Kings II: Conclave
  • Crusader Kings II: The Republic
  • Victoria 2
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Stellaris
  • Mount & Blade: Warband
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Sunset Invasion
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: