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

BeingDS

Sergeant
64 Badges
Jan 3, 2015
67
35
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Mare Nostrum
  • Victoria 2
  • Europa Universalis IV: Res Publica
  • Leviathan: Warships
  • Hearts of Iron III
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis III Complete
  • Europa Universalis III
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Stellaris - Path to Destruction bundle
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Together for Victory
  • Tyranny: Archon Edition
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Mandate of Heaven
  • Empire of Sin
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Cradle of Civilization
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • 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
  • Mount & Blade: With Fire and Sword
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
  • The Showdown Effect
  • Europa Universalis III Complete
  • Europa Universalis III Complete
Trying to better understand event modding.

This is my idea: to have more monarch power for the mid-to-late game by having an event grant it to you based on how you've developed your empire. But the code isn't working:

Code:
namespace = more mana

more_mana.2 = {
    type = country_event
    
    hidden = yes
    
    trigger = {
        monthly_country_pulse
    }
    
    immediate = {
        every_country = {
            add_military_power = 20
            add_civic_power = 20
            add_oratory_power = 20
            add_religious_power = 20
        }
    }
}

This is a stripped-down version of the whole thing that I wrote, which you can see below if you feel like it. Not sure why it isn't running. But I'm new at this, so maybe you can enlighten me.

:- )

Code:
namespace = more mana

more_mana.1 = {
    type = country_event
    
    hidden = yes
    
    trigger = {
        monthly_country_pulse
    }
    
    immediate = {
        every_country = {
            limit = {   #player countries and adjacent AI countries only
                AND = {   
                    OR = {
                        is_ai = no
                        any_neighbor_country = {
                            is_ai = no
                        }
                    }
                    
                    stability > 0
                    has_civil_war = no
                    is_subject = no
                }
            }
                
            every_owned_province = { # add military power
                limit = {
                    AND = {   
                        AND = {
                            has_building = military_building
                            num_of_freemen >= 10
                            freemen_happiness >= 50
                        }
                    
                        NOR = {
                            has_siege = yes
                            province_unrest >= 10
                            any_unit_in_province = {
                                in_combat = yes
                            }
                        }
                    }
                }
                
                random_number = { 0 1 }
                add_military_power = random_number
            }
            
            every_owned_province = { # add oratory power
                limit = {
                    AND = {   
                        AND = {
                            has_building = commerce_building
                            num_of_citizen >= 10
                            citizen_happiness >= 50
                        }
                    
                        NOR = {
                            has_siege = yes
                            province_unrest >= 10
                            any_unit_in_province = {
                                in_combat = yes
                            }
                        }
                    }
                }
                
                random_number = { 0 1 }
                add_oratory_power = random_number
            }
            
            every_owned_province = { # add civic power
                limit = {
                    AND = {   
                        AND = {
                            has_building = population_building
                            num_of_slaves >= 10
                            slaves_happiness >= 50
                        }
                    
                        NOR = {
                            has_siege = yes
                            province_unrest >= 10
                            any_unit_in_province = {
                                in_combat = yes
                            }
                        }
                    }
                }
                
                random_number = { 0 1 }
                add_civic_power = random_number
            }
            
            every_owned_province = { # add religious power
                limit = {
                    AND = {   
                        AND = {
                            total_population >= 20
                            dominant_province_religion = {
                                religion = {
                                    owner
                                }
                            }
                        }
                    
                        NOR = {
                            has_siege = yes
                            province_unrest >= 10
                            any_unit_in_province = {
                                in_combat = yes
                            }
                        }
                    }
                }
                
                random_number = { 0 1 }
                add_religious_power = random_number
            }
        }
    }
}
 
You have to call the event in the monthly country pulse. It is not a trigger :)
You'll find those in game/common/on_actions

You should also be aware that such events/effects are called on every country.


Additionally, this is not valid syntax:
Code:
random_number = { 0 1 }
add_religious_power = random_number
I'd recommend having a browse through the use of variables in vanilla events/on_actions.
 
You have to call the event in the monthly country pulse. It is not a trigger :)
You'll find those in game/common/on_actions

You should also be aware that such events/effects are called on every country.


Additionally, this is not valid syntax:
Code:
random_number = { 0 1 }
add_religious_power = random_number
I'd recommend having a browse through the use of variables in vanilla events/on_actions.

Thanks!
 
I'm struggling and frustrated by the explanations so far given for queries like this. I'm used to the 'MTTH' style, I've no idea how to 'call' an event via a monthly country pulse. What do I actually do?
 
I'm struggling and frustrated by the explanations so far given for queries like this. I'm used to the 'MTTH' style, I've no idea how to 'call' an event via a monthly country pulse. What do I actually do?

I spent a few hours trying to figure this out. It took awhile, but it turns out there are multiple steps.

1. Write your event. Don't worry about putting in code to make it happen when the month changes. Put it in the mod/<yourmod>/events folder. The following is a short testing mod I made to see if I could get any event at all to fire on month change:
Code:
namespace = more_mana

more_mana.2 = {
    type = country_event
 
    hidden = no
 
    trigger = {
    }
 
    immediate = {
        every_country = {
                add_treasury = 1000
        }
    }
}

NOTE: This doesn't actually work right now. It fires, so that was successful, but what it does is count the number of countries that exist in the game and add 1,000 times that number to *my* treasury. That's my new challenge -- figuring out how to make the event target an AI player.

2. In the ~/ImperatorRome/game/common/on_action folder, there is a file called "00_monthly_country". Copy this file into your mod's folder and make a "common" folder for it to live in.

3. This inside of that file looks like this:
Code:
monthly_country_pulse = {

    events = {
        rel_flavor_druidic.10
        dhe_rome.9
        dhe_judea.2
        dhe_judea.3
        dhe_judea.4
        dhe_judea.5
        dhe_judea.7
    }
 
    random_events = {
    }
 
    on_actions = {
        dictatorship_power_held_pulse
    }
}

You add your mod like this:
Code:
monthly_country_pulse = {

    events = {
        rel_flavor_druidic.10
        dhe_rome.9
        dhe_judea.2
        dhe_judea.3
        dhe_judea.4
        dhe_judea.5
        dhe_judea.7
        your_mods_name #<----
    }
 
    random_events = {
    }
 
    on_actions = {
        dictatorship_power_held_pulse
    }
}

Once you save all these files and enable your mod, you should be able to see something happen, and adjust the settings from there.

Hope this helped.
 
Last edited:
COPY the file? Not create a "00_monthly_pulse" in your mod folder? That's a change from previous for sure, not that that's saying anything - there's been a LOT of change in this!
I know, because I've done it and it works, that you don't have to copy the whole "common" folder.

I'm also unsure of the syntax (read, I haven't a clue) for a random event happening, say, about once every two years, where the old code would have had a section like the following, which comes from a working EU4 mod:-

Code:
mean_time_to_happen = {
        months = 24
        
        modifier = {
            factor = 0.75
            NOT = { ruler_age = 20 }
        }
        
        modifier = {
            factor = 1.5
            ruler_age = 40
        }
    }

Also, you say "your_mods_name", shouldn't there be namespacing in there, too? Or some way of saying "This event, not THAT event, which I want to happen when the ruler's wife falls ill (or something)?

Like i say, struggling and frustrated.
 
COPY the file? Not create a "00_monthly_pulse" in your mod folder? That's a change from previous for sure, not that that's saying anything - there's been a LOT of change in this!
I know, because I've done it and it works, that you don't have to copy the whole "common" folder.

I'm also unsure of the syntax (read, I haven't a clue) for a random event happening, say, about once every two years, where the old code would have had a section like the following, which comes from a working EU4 mod:-

Code:
mean_time_to_happen = {
        months = 24
       
        modifier = {
            factor = 0.75
            NOT = { ruler_age = 20 }
        }
       
        modifier = {
            factor = 1.5
            ruler_age = 40
        }
    }

Also, you say "your_mods_name", shouldn't there be namespacing in there, too? Or some way of saying "This event, not THAT event, which I want to happen when the ruler's wife falls ill (or something)?

Like i say, struggling and frustrated.
What I did was copy the file. I'm sure you could create your own, too. I don't see any reason why you couldn't.

Code:
namespace = more_mana

more_mana.2 = {  #<----- This is the name I used in the "00_monthly_pulse" file
   type = country_event

    hidden = no

    trigger = {
    }

    immediate = {
        every_country = {
                add_treasury = 1000
        }
    }
}