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

cristofolmc

Banned
32 Badges
Mar 5, 2009
3.455
4.351
  • 500k Club
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Heir to the Throne
  • Crusader Kings II
  • Rome Gold
  • Hearts of Iron IV Sign-up
  • Victoria 2
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Mandate of Heaven
  • Age of Wonders III
  • Europa Universalis IV: Cradle of Civilization
  • Imperator: Rome
  • Imperator: Rome Sign Up
  • Crusader Kings III
  • Europa Universalis 4: Emperor
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Europa Universalis IV
  • Victoria 2: A House Divided
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Old Gods
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Wealth of Nations
  • Rome: Vae Victis
  • Victoria 2: Heart of Darkness
  • Europa Universalis IV: Art of War
This is the event. The aim of the event is to get a modifier in all the provinces that produce grain. Everywhere. All of them.

Code:
namespace = trade_goods_value

trade_goods_value.1 = { #grain
    type = country_event
    title = "trade_goods_value.1.t"
    desc = "trade_goods_value.1.desc"
    picture = hellenic_marketplace
    hidden = yes
    left_portrait = root.current_ruler
    right_portrait = scope:city_1_target.governor
 
    trigger = {
        any_owned_province = {
            controller = root
            trade_goods = grain
        }
    }
 
    immediate = {
        set_variable = {
            name = grain_toggle
         
        }
        every_owned_province = {
            limit = {
                controller = root
                trade_goods = grain
            }
            set_variable = {
                name = grain_toggle
            }
        }
    }
 
    option = {
        name = "trade_goods_value.1.a"
        if = {
            num_goods_produced = 1
        }
        add_permanent_province_modifier    = grain_commerce_value_1 
    }
}

Can somebody help me spot the error? Im struggling with I:R since I only learn to code events in EU4. :(

Thanks
 

rivtaldm

VeF Team; URP/GeS Creator
48 Badges
Jan 4, 2014
1.351
473
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Third Rome
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • March of the Eagles
  • Magicka
  • Hearts of Iron III
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Europa Universalis IV: Art of War
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis 4: Emperor
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Golden Century
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Imperator: Rome Sign Up
  • Hearts of Iron IV: La Resistance
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Battle for Bosporus
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Mandate of Heaven
  • Hearts of Iron IV: Together for Victory
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV Sign-up
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Victoria 2
  • Europa Universalis IV
You're not scoping to the provinces in the option; right now you are applying a province trigger and effect to the root (country) scope. You would need every_owned_province = { in the option.
 

cristofolmc

Banned
32 Badges
Mar 5, 2009
3.455
4.351
  • 500k Club
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Heir to the Throne
  • Crusader Kings II
  • Rome Gold
  • Hearts of Iron IV Sign-up
  • Victoria 2
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Mandate of Heaven
  • Age of Wonders III
  • Europa Universalis IV: Cradle of Civilization
  • Imperator: Rome
  • Imperator: Rome Sign Up
  • Crusader Kings III
  • Europa Universalis 4: Emperor
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Europa Universalis IV
  • Victoria 2: A House Divided
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Old Gods
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Wealth of Nations
  • Rome: Vae Victis
  • Victoria 2: Heart of Darkness
  • Europa Universalis IV: Art of War
You're not scoping to the provinces in the option; right now you are applying a province trigger and effect to the root (country) scope. You would need every_owned_province = { in the option.

Thanks for replying. How about now? I removed it from the option as it made not much sense, and just add it as an immidiate effect. But I dont know if Im applying the scope and variable correctly now.

Code:
namespace = trade_goods_value

trade_goods_value.1 = { #grain
    type = country_event
    title = "trade_goods_value.1.t"
    desc = "trade_goods_value.1.desc"
    picture = hellenic_marketplace
    hidden = yes
    left_portrait = root.current_ruler
    right_portrait = scope:city_1_target.governor
   
    trigger = {
        any_owned_province = {
            trade_goods = grain
        }
    }
   
    immediate = {
        set_variable = {
            name = grain_toggle
           
        }
        every_owned_province = {
            limit = {
                has_local_variable = grain_toggle
                controller = root
                trade_goods = grain
            }
            if = {
                num_goods_produced = 1
            }
            add_permanent_province_modifier = grain_commerce_value_1   
            else_if = {
                num_goods_produced = 1
            }
            add_permanent_province_modifier = grain_commerce_value_2
            else_if = {
                num_goods_produced = 3
            }
            add_permanent_province_modifier = grain_commerce_value_3
        }
    }
   
    option = {
        name = "trade_goods_value.1.a"   
    }
}
 

rivtaldm

VeF Team; URP/GeS Creator
48 Badges
Jan 4, 2014
1.351
473
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Third Rome
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • March of the Eagles
  • Magicka
  • Hearts of Iron III
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Europa Universalis IV: Art of War
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis 4: Emperor
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Golden Century
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Imperator: Rome Sign Up
  • Hearts of Iron IV: La Resistance
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Battle for Bosporus
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Mandate of Heaven
  • Hearts of Iron IV: Together for Victory
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV Sign-up
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Victoria 2
  • Europa Universalis IV
1) the commands need to be inside the if/else_if statements
2) the triggers in those statements also need limit = { } around them
3) a quick check of the vanilla event files shows them using that command differently than you do
So it would look like:

if = {
limit = { num_goods_produced = 1 }
add_permanent_province_modifier = { name = grain_commerce_value_1 }
}
and so on.
 

cristofolmc

Banned
32 Badges
Mar 5, 2009
3.455
4.351
  • 500k Club
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Heir to the Throne
  • Crusader Kings II
  • Rome Gold
  • Hearts of Iron IV Sign-up
  • Victoria 2
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Mandate of Heaven
  • Age of Wonders III
  • Europa Universalis IV: Cradle of Civilization
  • Imperator: Rome
  • Imperator: Rome Sign Up
  • Crusader Kings III
  • Europa Universalis 4: Emperor
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Europa Universalis IV
  • Victoria 2: A House Divided
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Old Gods
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Wealth of Nations
  • Rome: Vae Victis
  • Victoria 2: Heart of Darkness
  • Europa Universalis IV: Art of War
1) the commands need to be inside the if/else_if statements
2) the triggers in those statements also need limit = { } around them
3) a quick check of the vanilla event files shows them using that command differently than you do
So it would look like:

if = {
limit = { num_goods_produced = 1 }
add_permanent_province_modifier = { name = grain_commerce_value_1 }
}
and so on.

Okay, its working now, but for some reason its not getting triggered. I've had to do it mannually.

Code:
namespace = trade_goods_value

trade_goods_value.1 = { #grain
    type = country_event
    title = "trade_goods_value.1.t"
    desc = "trade_goods_value.1.desc"
    picture = hellenic_marketplace
    hidden = yes
    left_portrait = root.current_ruler
    right_portrait = scope:city_1_target.governor
   
    trigger = {
        any_owned_province = {
            trade_goods = grain
        }
    }
   
    immediate = {
        every_owned_province = {
            limit = {
                trade_goods = grain
            }
            if = {
                limit = {
                    num_goods_produced = 1
                }
                add_permanent_province_modifier = {
                    name = grain_commerce_value_1
                }
            }   
            else_if = {
                limit = {
                    num_goods_produced = 2
                }
                add_permanent_province_modifier = {
                    name = grain_commerce_value_2
                }
            }
            else_if = {
                limit = {
                    num_goods_produced = 2
                }
                add_permanent_province_modifier = {
                    name = grain_commerce_value_3
                }
            } 
        }
    }
   
    option = {
        name = "trade_goods_value.1.a"   
    }
}

How do I make it so it gets automatically triggered at the start? There doesnt seem to be MTTH in this game.
 

rivtaldm

VeF Team; URP/GeS Creator
48 Badges
Jan 4, 2014
1.351
473
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Third Rome
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • March of the Eagles
  • Magicka
  • Hearts of Iron III
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Europa Universalis IV: Art of War
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis 4: Emperor
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Golden Century
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Imperator: Rome Sign Up
  • Hearts of Iron IV: La Resistance
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Battle for Bosporus
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Mandate of Heaven
  • Hearts of Iron IV: Together for Victory
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV Sign-up
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Victoria 2
  • Europa Universalis IV
There’s no MTTH in this game; everything is run by on_actions. So it needs to be added to the monthly country or yearly country lists or whatever.