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

Emre Yigit

Creeping out of Covid hibernation
74 Badges
Jun 13, 2001
5.462
3.807
  • Cities: Skylines - Snowfall
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • 500k Club
  • Cities: Skylines
  • Cities: Skylines Deluxe Edition
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Pride of Nations
  • Europa Universalis IV: Common Sense
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Semper Fi
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Hearts of Iron IV: No Step Back
  • Europa Universalis IV: Wealth of Nations
  • 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
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II
  • Europa Universalis IV: Call to arms event
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III Collection
  • Heir to the Throne
  • Europa Universalis III Complete
  • March of the Eagles
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
In EUIV, it was possible to create an event along the lines of:

Code:
province_event = {
    id = emre.300
    title = "flavor_rus.EVTNAME3404"
    desc = "flavor_rus.EVTDESC3404"
    picture = MILITARY_CAMP_eventPicture

    trigger = {
        is_year = 1444
        owned_by = BYZ
        NOT = { has_province_modifier = supply_increase }
    }

    mean_time_to_happen = {
        months = 1
    }
  
    option = {
        name = "flavor_rus.EVTOPTB3404"
        add_province_modifier = {
            name = "supply_increase"
            duration = -1
        }
    }
}

In Imperator, I've tried

Code:
ey.1 = {
    type = state_event

    trigger = {
        owned_by = JUD
    }
  
    immediate = {
        add_state_modifier = {
            name = supply
            duration = -1
            mode = add
        }
    }

}

and

Code:
ey.2 = {
    type = country_event
    title = "Supply Increase"
    desc = "provincial_events.1.desc"
    picture = city_construction
  
    left_portrait = current_ruler
    right_portrait = scope:governor_of_province
  
    goto_location = scope:governorship_capital
  
    trigger = {
        num_of_cities >= 1
        owns_or_subject_owns = JUD
        NOT = { has_variable = supply }
    }

    immediate = {
        set_variable = {
            name = supply
            duration = -1
        }
    }
}

and

Code:
ey.3 = {
    type = state_event

    trigger = {
        num_of_cities >= 1
        owns_or_subject_owns = JUD
        NOT = { has_variable = supply }
    }

    immediate = {
            set_variable = {
                name = supply
            }
        add_state_modifier = {
            name = supply
            duration = -1
        }
    }
}

none of which seem to even fire.

I'm floundering. Any help or ideas would be most appreciated.
 
  • 1Like
Reactions:
OK, I have an answer to this, though it may not be terribly useful.

The syntax foe events in I:R is more complicated (but more useful, perhaps) than in EU4. In the end, I wrote the event as follows:

Code:
emre.1 = {
    type = country_event
    title = "city.16.t"
    desc = "city.16.desc"
    picture = farming

    trigger = {
        is_ai = no
        tag = JUD
        any_owned_province = {
            NOT = {
                has_province_modifier = supply
            }
        }
        NOT = {
            has_variable = emre_city
        }

    }

    immediate = {
        set_variable = {   
            name = emre_city
            days = 2
        }
        random_owned_province = {
            limit = {
                NOT = {
                    has_province_modifier = supply
                }
            }
            weight = {
                modifier = {
                    factor = 10
                    trade_goods = grain
                }
            }
            save_scope_as = emre_city_target
        }
    }
    
    option = {
        name = "city.16.a"
        scope:emre_city_target = {
            add_province_modifier = {
                name = supply
                duration = -1
            }
        }
    }

}

However, it still didn't fire, and I started to notice that events in I:R didn't have days or months to fire. So I thought I'd amend the on_action/00_monthly_country_pulse.txt as follows:
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
        family_events.1 #Rise of a Family
        family_events.2 #Prune Family
        family_events.5 #Rise of new Royal Dynasty
        family_events.6 #Tribal family rise
        family_events.7 #Tribal family fall
        family_events.9 #Rise of Family in Republics
        emre.1

(rest unchanged)
    }

and it worked.
 
Yeah, events can only really be fired by on_actions and other events.

Btw it's important to know some syntax
the smallest unit is the territory, but in the files, this is called a province, some triggers might also call it a city, so this can be confusing.
The provinces in game are called areas and states. Areas refer to the whole province, state refers to the portion of a province owned by a single country. A province can have multiple states because of different countries, but only one area.
Then there's regions and governorships, and governorships are to regions what states are to areas.