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

Pernicio

Recruit
101 Badges
Aug 10, 2009
6
1
  • Hearts of Iron 4: Arms Against Tyranny
  • Hearts of Iron IV: No Step Back
  • Hearts of Iron IV: By Blood Alone
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Semper Fi
  • Sengoku
  • Ship Simulator Extremes
  • Crusader Kings II
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Cities: Skylines Deluxe Edition
  • Europa Universalis IV: Pre-order
  • Crusader Kings II: Charlemagne
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Knights of Pen and Paper +1 Edition
  • 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
  • Darkest Hour
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Hearts of Iron III: Their Finest Hour
  • Magicka
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Impire
  • For the Motherland
  • Cities: Skylines - Parklife
  • Stellaris: Megacorp
  • Surviving Mars: First Colony Edition
  • Europa Universalis IV: Dharma
  • Stellaris: Distant Stars
  • Cities: Skylines - Campus
Hi,

I'm trying to modify an existing mod and was wondering can you make nested options for events - or how do you make hidden options for events?

As an example, I have 2 options that are shown separately when done like this;'

option = {
name = add_finnish_primary_homelands.1.a
default_option = no

every_state_region = {
limit = {
any_scope_state = {
owner = ROOT
has_decree = decree_modify_homeland
}
}
add_homeland = cu:estonian
}
}
option = {
name = add_finnish_primary_homelands.1.b
default_option = no

every_state_region = {
limit = {
any_scope_state = {
owner = ROOT
has_decree = decree_modify_homeland
}
}
remove_homeland = cu:estonian
}
}

what is the most elegant way to hide the non-valid options from the event window, so that there wouldn't be hundreds or thousands of lines of script to correct when updating the mod? Or does this feature require or be preferably done via scripted UI?

I have tried various ways with limits and is_hidden, hidden and is_shown, but nothing has worked thus far. I have also tried googling with various search terms but haven't been able to find any examples after hours of searching and would appreciate the help.
 
Thank you, I have read the Wiki for Options, but it only shows an example of how you can make IF and ELSE for the option, but does not specify if it is possible to use them within the same event option to achieve something like this;

namespace = add_homelands
add_homelands.1 = {
type = country_event
placement = ROOT

title = add_homelands.1.t

flavor = add_homelands.1.u

event_image = {
video = "gfx/event_pictures/unspecific_ruler_speaking_to_people.bk2"
}
icon = "gfx/interface/icons/event_icons/event_portrait.dds"

on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
on_opened_soundeffect = "event:/SFX/Events/unspecific/leader_speaking_to_a_group_of_people"

duration = 1

trigger = {

}

option = {
default_option = no

if = { # this effect will only happen if its limit is true
limit = { # triggers go here
every_state_region = {
limit = {
any_scope_state = {
owner = ROOT
has_decree = decree_modify_homeland
NOT = {
is_homeland = cu:estonian
}
}
}
}
}
effect = {
name = add_homelands.1.a
any_scope_state = {
add_homeland = cu:estonian
}
}
}
else = {
limit = {
every_state_region = {
limit = {
any_scope_state = {
owner = ROOT
has_decree = decree_modify_homeland
is_homeland = cu:estonian
}
}
}
}
effect = {
name = remove_homelands.1.a
any_scope_state = {
remove_homeland = cu:estonian
}
}
}
}
}

The above does not work, but that contains the logic of what I'm trying to achieve, without the need to create separate events for adding and removing homelands, if that is even possible.
 
Last edited:
Thank you, I have read the Wiki for Options, but it only shows an example of how you can make IF and ELSE for the option, but does not specify if it is possible to use them within the same event option to achieve something like this;

namespace = add_homelands
add_homelands.1 = {
type = country_event
placement = ROOT

title = add_homelands.1.t

flavor = add_homelands.1.u

event_image = {
video = "gfx/event_pictures/unspecific_ruler_speaking_to_people.bk2"
}
icon = "gfx/interface/icons/event_icons/event_portrait.dds"

on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
on_opened_soundeffect = "event:/SFX/Events/unspecific/leader_speaking_to_a_group_of_people"

duration = 1

trigger = {

}

option = {
default_option = no

if = { # this effect will only happen if its limit is true
limit = { # triggers go here
every_state_region = {
limit = {
any_scope_state = {
owner = ROOT
has_decree = decree_modify_homeland
NOT = {
is_homeland = cu:estonian
}
}
}
}
}
effect = {
name = add_homelands.1.a
any_scope_state = {
add_homeland = cu:estonian
}
}
}
else = {
limit = {
every_state_region = {
limit = {
any_scope_state = {
owner = ROOT
has_decree = decree_modify_homeland
is_homeland = cu:estonian
}
}
}
}
effect = {
name = remove_homelands.1.a
any_scope_state = {
remove_homeland = cu:estonian
}
}
}
}
}

The above does not work, but that contains the logic of what I'm trying to achieve, without the need to create separate events for adding and removing homelands, if that is even possible.
I believe you have some script errors there. There should be related alerts/warnings in error.log.

Try this version:

Code:
namespace = add_homelands
add_homelands.1 = {
    type = country_event
    placement = ROOT

    title = add_homelands.1.t

    flavor = add_homelands.1.u

    event_image = {
        video = "gfx/event_pictures/unspecific_ruler_speaking_to_people.bk2"
    }

    icon = "gfx/interface/icons/event_icons/event_portrait.dds"

    on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
    on_opened_soundeffect = "event:/SFX/Events/unspecific/leader_speaking_to_a_group_of_people"

    duration = 1

    trigger = {
    }

    option = {
        default_option = no # at least one option needs default_option = yes
        if = { # this effect will only happen if its limit is true
            limit = { # triggers go here
                any_scope_state = { #any_scope_state from a country implies the owner is that country, "any_" is a trigger
                    has_decree = decree_modify_homeland
                    state_region = { #scope from the state to the state region
                       NOT = { is_homeland = cu:estonian }
                    }
                }
            }
            effect = {
                name = add_homelands.1.a
                every_scope_state = { # "every_" and "random_" are effects
                    state_region = { add_homeland = cu:estonian }
                }
            }
        }
        else_if = { #this effect only happens if the previous one doesn't and its triggers are true
            limit = { # triggers go here
                any_scope_state = {
                    has_decree = decree_modify_homeland
                    state_region = {
                       is_homeland = cu:estonian
                    }
                }
            }
            effect = {
                name = remove_homelands.1.a
                every_scope_state = {
                    state_region = { remove_homeland = cu:estonian }
                }
            }
        }
    }
}
 
  • 1Like
Reactions:
Thank you for the assistant and correcting my scripting mistakes, I highly appreciate it!

Though, it seems this correction still doesn't work. Here is the state of my event file currently;

Code:
namespace = add_remove_homelands
namespace = add_homelands
namespace = remove_homelands

add_remove_homelands.1 = {
    type = country_event
    placement = ROOT

    title = add_remove_homelands.1.t

    flavor = add_remove_homelands.1.u

    event_image = {
        video = "gfx/event_pictures/unspecific_ruler_speaking_to_people.bk2"
    }
    icon = "gfx/interface/icons/event_icons/event_portrait.dds"

    on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
    on_opened_soundeffect = "event:/SFX/Events/unspecific/leader_speaking_to_a_group_of_people"

    trigger = {
    }
  
    option = {
        default_option = no # at least one option needs default_option = yes
        if = { # this effect will only happen if its limit is true
            limit = { # triggers go here
                any_scope_state = { #any_scope_state from a country implies the owner is that country, "any_" is a trigger
                    has_decree = decree_modify_homeland
                    state_region = { #scope from the state to the state region
                       NOT = { is_homeland = cu:estonian }
                    }
                }
            }
            effect = {
                name = add_homelands.1.a
                every_scope_state = { # "every_" and "random_" are effects
                    state_region = { add_homeland = cu:estonian }
                }
            }
        }
        else_if = { #this effect only happens if the previous one doesn't and its triggers are true
            limit = { # triggers go here
                any_scope_state = {
                    has_decree = decree_modify_homeland
                    state_region = {
                       is_homeland = cu:estonian
                    }
                }
            }
            effect = {
                name = remove_homelands.1.a
                every_scope_state = {
                    state_region = { remove_homeland = cu:estonian }
                }
            }
        }
    }
}

Error codes are as follows;

[19:37:26][jomini_effect.cpp:541]: Unknown effect effect at events/add_remove_homelands.txt:35
[19:37:26][jomini_effect.cpp:541]: Unknown effect effect at events/add_remove_homelands.txt:51

which points to the lines 35 and 51, which are the name = -Lines . The rest of the effects does not work either, leaving the states unaffected.

The following, however, seems to work, but still doesn't show the name of the option properly;

Code:
option = {
        default_option = no # at least one option needs default_option = yes
        if = { # this effect will only happen if its limit is true
            limit = { # triggers go here
                any_scope_state = { #any_scope_state from a country implies the owner is that country, "any_" is a trigger
                    has_decree = decree_modify_homeland
                    state_region = { #scope from the state to the state region
                       NOT = { is_homeland = cu:estonian }
                    }
                }
            }
            name = add_homelands.1.a
            every_scope_state = {    # "every_" and "random_" are effects
                limit = {
                    owner = ROOT
                    has_decree = decree_modify_homeland
                }
                state_region = { add_homeland = cu:estonian }
            
            }
        }
        else_if = { #this effect only happens if the previous one doesn't and its triggers are true
            limit = { # triggers go here
                any_scope_state = {
                    has_decree = decree_modify_homeland
                    state_region = {
                       is_homeland = cu:estonian
                    }
                }
            }
            name = remove_homelands.1.a
            every_scope_state = {
                limit = {
                    owner = ROOT
                    has_decree = decree_modify_homeland
                }
                state_region = { remove_homeland = cu:estonian }
            }
        }
    }
 

Attachments

  • Screenshot (12).png
    Screenshot (12).png
    12,4 MB · Views: 0
Last edited:
Thank you for the assistant and correcting my scripting mistakes, I highly appreciate it!

Though, it seems this correction still doesn't work. Here is the state of my event file currently;

Code:
namespace = add_remove_homelands
namespace = add_homelands
namespace = remove_homelands

add_remove_homelands.1 = {
    type = country_event
    placement = ROOT

    title = add_remove_homelands.1.t

    flavor = add_remove_homelands.1.u

    event_image = {
        video = "gfx/event_pictures/unspecific_ruler_speaking_to_people.bk2"
    }
    icon = "gfx/interface/icons/event_icons/event_portrait.dds"

    on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
    on_opened_soundeffect = "event:/SFX/Events/unspecific/leader_speaking_to_a_group_of_people"

    trigger = {
    }
 
    option = {
        default_option = no # at least one option needs default_option = yes
        if = { # this effect will only happen if its limit is true
            limit = { # triggers go here
                any_scope_state = { #any_scope_state from a country implies the owner is that country, "any_" is a trigger
                    has_decree = decree_modify_homeland
                    state_region = { #scope from the state to the state region
                       NOT = { is_homeland = cu:estonian }
                    }
                }
            }
            effect = {
                name = add_homelands.1.a
                every_scope_state = { # "every_" and "random_" are effects
                    state_region = { add_homeland = cu:estonian }
                }
            }
        }
        else_if = { #this effect only happens if the previous one doesn't and its triggers are true
            limit = { # triggers go here
                any_scope_state = {
                    has_decree = decree_modify_homeland
                    state_region = {
                       is_homeland = cu:estonian
                    }
                }
            }
            effect = {
                name = remove_homelands.1.a
                every_scope_state = {
                    state_region = { remove_homeland = cu:estonian }
                }
            }
        }
    }
}

Error codes are as follows;

[19:37:26][jomini_effect.cpp:541]: Unknown effect effect at events/add_remove_homelands.txt:35
[19:37:26][jomini_effect.cpp:541]: Unknown effect effect at events/add_remove_homelands.txt:51

which points to the lines 35 and 51, which are the name = -Lines . The rest of the effects does not work either, leaving the states unaffected.

The following, however, seems to work, but still doesn't show the name of the option properly;

Code:
option = {
        default_option = no # at least one option needs default_option = yes
        if = { # this effect will only happen if its limit is true
            limit = { # triggers go here
                any_scope_state = { #any_scope_state from a country implies the owner is that country, "any_" is a trigger
                    has_decree = decree_modify_homeland
                    state_region = { #scope from the state to the state region
                       NOT = { is_homeland = cu:estonian }
                    }
                }
            }
            name = add_homelands.1.a
            every_scope_state = {    # "every_" and "random_" are effects
                limit = {
                    owner = ROOT
                    has_decree = decree_modify_homeland
                }
                state_region = { add_homeland = cu:estonian }
           
            }
        }
        else_if = { #this effect only happens if the previous one doesn't and its triggers are true
            limit = { # triggers go here
                any_scope_state = {
                    has_decree = decree_modify_homeland
                    state_region = {
                       is_homeland = cu:estonian
                    }
                }
            }
            name = remove_homelands.1.a
            every_scope_state = {
                limit = {
                    owner = ROOT
                    has_decree = decree_modify_homeland
                }
                state_region = { remove_homeland = cu:estonian }
            }
        }
    }
Right, so I think you want to use multiple options, each with a trigger, rather than what you have here. "name = loc_key" only works at the option block level. If you want to have a localization inside the effect, you can use custom_tooltip or custom_label

Code:
option = {
        default_option = yes
        trigger = { #this option is only shown if the trigger is true
                any_scope_state = { #any_scope_state from a country implies the owner is that country, "any_" is a trigger
                        has_decree = decree_modify_homeland
                        state_region = { #scope from the state to the state region
                                NOT = { is_homeland = cu:estonian }
                        }
                }
        }
        name = add_homelands.1.a
        every_scope_state = {    # "every_" and "random_" are effects
                limit = {
                        owner = ROOT
                        has_decree = decree_modify_homeland
                }
                state_region = { add_homeland = cu:estonian }
            }
        }
}
option = {
        default_option = yes
        trigger = { #this option is only shown if the trigger is true
                any_scope_state = {
                        has_decree = decree_modify_homeland
                        state_region = {
                                is_homeland = cu:estonian
                        }
                }
        }
        name = remove_homelands.1.a
        every_scope_state = {
                limit = {
                        owner = ROOT
                        has_decree = decree_modify_homeland
                }
                state_region = { remove_homeland = cu:estonian }
            }
        }
    }
 
  • 1Like
Reactions: