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

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
Sorry, it probably works, I just mean I cant figure out how to scope it correctly lol. Thank you for taking time to answer these questions.
Code:
textbox = {
                    name = "new_stat_test"
                    position = { 72 3 }
                    using = MarbleButtonFont
                    autoresize = yes
                    text = "var_testing"
                    tooltip = "tooltip_test"
                    widgetanchor = top|hcenter
                }
I tried both this method with localization, but also directly using [PREV.Var('test_var_1').GetValue] inside text = "". - with the scopes Phlopsi suggested (SCOPE,THIS,PREV,ROOT) and tried InGameTopbar.GetPlayer as well.
My localization:
Code:
 var_testing:0 "[PREV.Var('test_var_1').GetValue]"
So there are two issues here, one is a misunderstanding of the data system and another is something that is not in the released version of the game yet.

The misunderstanding is that you have no PREV or SCOPE etc. there. All you have is whatever InGameTopbar gives you and what is globally accessible. There is no PREV or SCOPE to give you anything so you've got to work with what you have there.

What you would need to type for the localisation is [InGameTopbar.GetPlayer.MakeScope.Var( 'test_var_1' ).GetValue], which brings us to the second issues. In the release version you cannot chain to anything after MakeScope, it can only be the last link in a chain. This is something I have changed for an upcoming patch, probably 1.1 but no guarantees.
 

Nicolas-

Nc-Rm
32 Badges
Oct 24, 2015
746
1.677
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II
  • Europa Universalis IV: Wealth of Nations
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Nemesis
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Europa Universalis IV: Golden Century
  • Imperator: Rome Sign Up
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Stellaris: Necroids
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Rome: Vae Victis
  • Victoria 2: A House Divided
  • Victoria 2
  • Europa Universalis IV
  • Stellaris: Synthetic Dawn
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Rome Gold
If I wanted to display the portrait of someone (saved as "cool_person" (scope)) instead of the ruler in the government view tab, this syntax wouldn't work? Or is it something not doable:

Code:
                portrait_button = {
                    using = portrait_100_no_pop
                    name = "player_portrait"
                    position = { 0 33 }
                    datacontext = "[GovernmentView.GetPlayer.SCOPE.sChar('cool_person')]"
                }
 

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
If I wanted to display the portrait of someone (saved as "cool_person" (scope)) instead of the ruler in the government view tab, this syntax wouldn't work? Or is it something not doable:

Code:
                portrait_button = {
                    using = portrait_100_no_pop
                    name = "player_portrait"
                    position = { 0 33 }
                    datacontext = "[GovernmentView.GetPlayer.SCOPE.sChar('cool_person')]"
                }
No, you can't just stick SCOPE wherever you want, its got to actually be something available in the context of where you are.
Currently MakeScope does not work as a promote so you cannot do what you want, but in an upcoming patch you would be able to type [GovernmentView.GetPlayer.MakeScope.Var( 'cool_person' ).Char] and it would work.
 

Nicolas-

Nc-Rm
32 Badges
Oct 24, 2015
746
1.677
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II
  • Europa Universalis IV: Wealth of Nations
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Nemesis
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Europa Universalis IV: Golden Century
  • Imperator: Rome Sign Up
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Stellaris: Necroids
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Rome: Vae Victis
  • Victoria 2: A House Divided
  • Victoria 2
  • Europa Universalis IV
  • Stellaris: Synthetic Dawn
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Rome Gold
No, you can't just stick SCOPE wherever you want, its got to actually be something available in the context of where you are.
Currently MakeScope does not work as a promote so you cannot do what you want, but in an upcoming patch you would be able to type [GovernmentView.GetPlayer.MakeScope.Var( 'cool_person' ).Char] and it would work.

I think that update will make a lot of things possible :)

But for the time being, is there any efficient way to display a country or province variable in a GUI or even a tooltip (say for example I created a new mana type (custom variable) for a country, where would it be possible to display its value?)

Or is it better to wait for that update before modding such things?
 

SirPenetrator

Second Lieutenant
32 Badges
Apr 20, 2019
105
255
  • Stellaris: Nemesis
  • Stellaris: Federations
  • Stellaris: Ancient Relics
  • Stellaris: Megacorp
  • Stellaris: Synthetic Dawn
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II
  • Stellaris: Galaxy Edition
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Age of Wonders III
  • Victoria 3 Sign Up
  • Crusader Kings III
  • Imperator: Rome - Magna Graecia
  • Imperator: Rome Sign Up
  • Prison Architect
  • Imperator: Rome
  • Imperator: Rome Deluxe Edition
  • Cities: Skylines - Parklife
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Cadet
  • Cities: Skylines - After Dark
  • Cities: Skylines
  • Europa Universalis IV
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: The Old Gods
Hello @blackninja9939
Thanks a lot for your post and work.

I have a little question:
Do you know if it is possible, via modding, to enable Windows to stay open? For example: If I open 'diplomacy_overview.gui' and then open 'trade_overview.gui' the Diplomacy Window will close. But the Outliner is a Window that always stays open. That's why I already have taken a look at the 'outliner.gui' but sadly can't find anything indicating that the Window should stay open. I already asked in a dedicated Discord Modding Server but no one is answering me there or doesn't seem to know an answer...

Would be really nice if that would be possible!

Thanks and have a nice day!
 

Phlopsi

General
48 Badges
May 15, 2016
2.197
688
  • BATTLETECH
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Europa Universalis 4: Emperor
  • Stellaris: Federations
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Rule Britannia
  • PDXCon 2017 Awards Winner
  • Cities: Skylines - Mass Transit
  • Hearts of Iron IV: Cadet
  • Cities: Skylines - Snowfall
  • Cities: Skylines - After Dark
  • Europa Universalis IV
  • Crusader Kings II
  • Hearts of Iron III
  • Magicka
  • Cities: Skylines
  • Stellaris
  • Prison Architect
  • Imperator: Rome
I think that update will make a lot of things possible :)

But for the time being, is there any efficient way to display a country or province variable in a GUI or even a tooltip (say for example I created a new mana type (custom variable) for a country, where would it be possible to display its value?)

Or is it better to wait for that update before modding such things?
You can use a scripted gui like shown in the first post and use a custom_tooltip in the effect section, e.g.
Code:
custom_tooltip = "THIS.Var('my_var').GetValue"
 

Nicolas-

Nc-Rm
32 Badges
Oct 24, 2015
746
1.677
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II
  • Europa Universalis IV: Wealth of Nations
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Nemesis
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Europa Universalis IV: Golden Century
  • Imperator: Rome Sign Up
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Stellaris: Necroids
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Rome: Vae Victis
  • Victoria 2: A House Divided
  • Victoria 2
  • Europa Universalis IV
  • Stellaris: Synthetic Dawn
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Rome Gold
You can use a scripted gui like shown in the first post and use a custom_tooltip in the effect section, e.g.
Code:
custom_tooltip = "THIS.Var('my_var').GetValue"

That worked thanks though I had to set up the tooltip in localization not directly in the scripted gui file. We can use that until it becomes possible to display such values on the GUI.
 

Slasky

Sergeant
75 Badges
Aug 20, 2013
61
10
  • Stellaris - Path to Destruction bundle
  • Leviathan: Warships
  • Crusader Kings II
  • Steel Division: Normand 44 - Second Wave
  • Stellaris: Synthetic Dawn
  • Dungeonland
  • Europa Universalis III
  • Cities: Skylines Deluxe Edition
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Leviathans Story Pack
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Steel Division: Normandy 44
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Golden Century
  • BATTLETECH
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Age of Wonders III
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Rule Britannia
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Apocalypse
  • Shadowrun Returns
  • Stellaris: Ancient Relics
  • Crusader Kings II: Holy Fury
  • Europa Universalis IV: Dharma
  • Hearts of Iron IV: La Resistance
  • Imperator: Rome Sign Up
  • Stellaris: Distant Stars
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: No Step Back
  • Europa Universalis IV
  • Age of Wonders: Planetfall Deluxe edition
  • Age of Wonders: Planetfall
  • Cities: Skylines - Parklife
  • Imperator: Rome
  • The Showdown Effect
  • Warlock: Master of the Arcane
  • War of the Roses
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
You can use a scripted gui like shown in the first post and use a custom_tooltip in the effect section, e.g.
Code:
custom_tooltip = "THIS.Var('my_var').GetValue"
Can you give some more tips on how to use the custom_tooltip? I find this in the triggers.log:
Code:
custom_tooltip - Replaces the tooltips for the enclosed triggers with a custom text
custom_tooltip = {
    text = <text>
    <trigger>
}
Supported Scopes: none
So i tried with the below withouth much luck:
Code:
custom_tooltip = {
text = "Is Rome"                           
tag = ROM
 }
I want to make some button with tooltip that checks if i have done certain conditions (for example own proviince XYZ) but not sure how to get it working
 

Phlopsi

General
48 Badges
May 15, 2016
2.197
688
  • BATTLETECH
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Europa Universalis 4: Emperor
  • Stellaris: Federations
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Rule Britannia
  • PDXCon 2017 Awards Winner
  • Cities: Skylines - Mass Transit
  • Hearts of Iron IV: Cadet
  • Cities: Skylines - Snowfall
  • Cities: Skylines - After Dark
  • Europa Universalis IV
  • Crusader Kings II
  • Hearts of Iron III
  • Magicka
  • Cities: Skylines
  • Stellaris
  • Prison Architect
  • Imperator: Rome
Can you give some more tips on how to use the custom_tooltip? I find this in the triggers.log:
Code:
custom_tooltip - Replaces the tooltips for the enclosed triggers with a custom text
custom_tooltip = {
    text = <text>
    <trigger>
}
Supported Scopes: none
So i tried with the below withouth much luck:
Code:
custom_tooltip = {
text = "Is Rome"                          
tag = ROM
 }
I want to make some button with tooltip that checks if i have done certain conditions (for example own proviince XYZ) but not sure how to get it working
You want the custom_tooltip in the effects.log, dunno if that supports triggers directly. You can always use regular conditional logic in effect sections.
Code:
if = { limit = { <triggers go here> } custom_tooltip = "…" }
 

Nicolas-

Nc-Rm
32 Badges
Oct 24, 2015
746
1.677
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II
  • Europa Universalis IV: Wealth of Nations
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Nemesis
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Europa Universalis IV: Golden Century
  • Imperator: Rome Sign Up
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Stellaris: Necroids
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Rome: Vae Victis
  • Victoria 2: A House Divided
  • Victoria 2
  • Europa Universalis IV
  • Stellaris: Synthetic Dawn
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Rome Gold
Is it possible to set a variable for a pop? Although I managed to create a button in the pop view window, it doesn't seem that pops support variables, is it so?

Here's the code:
Code:
subsidize_pop_button = {
    scope = pop
    saved_scopes = {
        province
    }
    is_shown = {
    }
    is_valid = {
    }
    effect = {
    
    set_variable = {
    name = wealth
    value = 10}
    
    custom_tooltip = SUBSIDIZE_POP
}
}
 
Last edited:

Konju

Recruit
84 Badges
Oct 9, 2016
7
1
  • Europa Universalis IV: Call to arms event
  • Hearts of Iron III
  • Victoria 2: A House Divided
  • Semper Fi
  • Crusader Kings II
  • Victoria 2: Heart of Darkness
  • Sengoku
  • Europa Universalis IV: El Dorado
  • Surviving Mars
  • Stellaris: Federations
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Imperator: Rome Sign Up
  • Cities: Skylines - Campus
  • Crusader Kings II: Conclave
  • Cities: Skylines - Snowfall
  • Imperator: Rome - Magna Graecia
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings III
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris: Nemesis
  • Europa Universalis IV
  • Prison Architect
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Dharma
  • Imperator: Rome Deluxe Edition
  • Europa Universalis III
  • Europa Universalis III Complete
  • Hearts of Iron IV: Death or Dishonor
  • Imperator: Rome
  • Crusader Kings II: Holy Fury
  • Europa Universalis IV: Golden Century
  • Cities: Skylines - Green Cities
  • Stellaris: Synthetic Dawn
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Battle for Bosporus
  • Victoria 2
A scope object can be saved with an arbitrary name to reference later on in the top scope, in our older games these were called event targets. The name was changed as internally both were called event targets and one is shorter to type for script. Eg:
Code:
father = { save_scope_as = cool_person }
scope:cool_person = { kill_painfully = yes }

I have a question about this.

As far as I understand save_scope_as it should store the current scope so it's accessible for the entire event, so I can use it anywhere I want.

However, when I try the following:

Code:
immediate = {
        if = {
            limit = {
                any_state_province = {
                    OR = {
                        trade_goods = grain
                        trade_goods = fish
                        trade_goods = cattle
                    }
                }
            }
            every_state_province = {
                limit = {
                    OR = {
                        trade_goods = grain
                        trade_goods = fish
                        trade_goods = cattle
                    }
                }
                save_scope_as = _target
            }
        }
        if = {
            limit = {
                any_state_province = {
                    num_of_slaves > 0
                }
            }
            every_state_province = {
                limit = {
                    num_of_slaves > 0
                }
                random_pops_in_province = {
                    limit = {
                        pop_type = slaves
                    }
                    move_pop = scope:_target
                }
            }
        }
    }

The error log shows that the scope _target is undefined. The exact error is:
Code:
Undefined event target '_target' at location file: ...
Event target link 'scope' returned an unset scope at location file:

Now my question is, how do I make this work so that the game nows which scope I'm talking about?
 

omega20056

Basileus Basileon
94 Badges
Dec 27, 2012
4.463
2.009
  • Crusader Kings III: Royal Edition
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Expansion Pass
  • Battle for Bosporus
  • Crusader Kings III
  • Europa Universalis 4: Emperor
  • Stellaris: Necroids
  • Victoria 3 Sign Up
  • Hearts of Iron IV: By Blood Alone
  • Hearts of Iron IV: No Step Back
  • Stellaris: Nemesis
  • March of the Eagles
  • Europa Universalis IV
  • Cities: Skylines - Natural Disasters
  • Cities: Skylines - Green Cities
  • Stellaris: Federations
  • Europa Universalis IV: Res Publica
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Crusader Kings II
  • Europa Universalis IV: Pre-order
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Mare Nostrum
  • Imperator: Rome Deluxe Edition
  • Stellaris
  • Stellaris - Path to Destruction bundle
  • Imperator: Rome Sign Up
  • Europa Universalis IV: Third Rome
  • Imperator: Rome - Magna Graecia
  • Crusader Kings II: Jade Dragon
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: El Dorado
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Legacy of Rome
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Mandate of Heaven
  • 500k Club
  • Stellaris: Ancient Relics
  • Victoria 2
  • Imperator: Rome
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Synthetic Dawn
  • Stellaris: Lithoids
Is it possible to limit who can use certain diplomatic functions or wargoals? For example, if I wanted to prevent certain cultures from being able to claim provinces, or disallow tribal states from conquering territory. I want to slow down the AI's expansion outside of the diadochi, Rome, and Carthage, essentially.
 

Aule_the_creator

Second Lieutenant
58 Badges
May 19, 2013
103
36
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Pre-order
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Semper Fi
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II
  • 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: Sword of Islam
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Art of War
  • Imperator: Rome Sign Up
  • Hearts of Iron IV: Together for Victory
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: La Resistance
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Golden Century
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV Sign-up
  • Stellaris
  • Imperator: Rome - Magna Graecia
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • Victoria 2
  • Hearts of Iron IV: No Step Back
I have a question about this.

As far as I understand save_scope_as it should store the current scope so it's accessible for the entire event, so I can use it anywhere I want.

However, when I try the following:

Code:
immediate = {
        if = {
            limit = {
                any_state_province = {
                    OR = {
                        trade_goods = grain
                        trade_goods = fish
                        trade_goods = cattle
                    }
                }
            }
            every_state_province = {
                limit = {
                    OR = {
                        trade_goods = grain
                        trade_goods = fish
                        trade_goods = cattle
                    }
                }
                save_scope_as = _target
            }
        }
        if = {
            limit = {
                any_state_province = {
                    num_of_slaves > 0
                }
            }
            every_state_province = {
                limit = {
                    num_of_slaves > 0
                }
                random_pops_in_province = {
                    limit = {
                        pop_type = slaves
                    }
                    move_pop = scope:_target
                }
            }
        }
    }

The error log shows that the scope _target is undefined. The exact error is:
Code:
Undefined event target '_target' at location file: ...
Event target link 'scope' returned an unset scope at location file:

Now my question is, how do I make this work so that the game nows which scope I'm talking about?


I am getting the same error for an event chain. Event 1 uses the scope just fine, but when I try to use the scope in event 2 which comes after it, I get this same error.
 

Nicolas-

Nc-Rm
32 Badges
Oct 24, 2015
746
1.677
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II
  • Europa Universalis IV: Wealth of Nations
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Nemesis
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Europa Universalis IV: Golden Century
  • Imperator: Rome Sign Up
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Stellaris: Necroids
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Rome: Vae Victis
  • Victoria 2: A House Divided
  • Victoria 2
  • Europa Universalis IV
  • Stellaris: Synthetic Dawn
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Rome Gold
I had the same issue with scopes. It's almost like they're not saved after the script is executed?

I tried using them with scripted guis, button 1 saves scope, button 2 executes something for that scope. Didn't work. I think the scope expires when the script is executed?

I don't know if it's possible to use variables instead, didn't work for me either (something along the lines of move_pop = var:name, i guess it only accepts saved scopes?)
 
Last edited:

Aule_the_creator

Second Lieutenant
58 Badges
May 19, 2013
103
36
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Pre-order
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Semper Fi
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II
  • 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: Sword of Islam
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Art of War
  • Imperator: Rome Sign Up
  • Hearts of Iron IV: Together for Victory
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: La Resistance
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Golden Century
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV Sign-up
  • Stellaris
  • Imperator: Rome - Magna Graecia
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • Victoria 2
  • Hearts of Iron IV: No Step Back
Looking through the game files, for example pyrrhus' events, it seems like that file saves Pyrrhus as the scope for each individual event, but this uses the character ID, in Pyrrhus' case 70. If you create a character in event 1, and save him as a scope, the character ID will be entirely dependent upon when the event fires, does this mean it is impossible to save a character as a scope over the course of several related events? This is extremely frustrating if true.
 

Nicolas-

Nc-Rm
32 Badges
Oct 24, 2015
746
1.677
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II
  • Europa Universalis IV: Wealth of Nations
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Nemesis
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Europa Universalis IV: Golden Century
  • Imperator: Rome Sign Up
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Stellaris: Necroids
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Rome: Vae Victis
  • Victoria 2: A House Divided
  • Victoria 2
  • Europa Universalis IV
  • Stellaris: Synthetic Dawn
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Rome Gold
Looking through the game files, for example pyrrhus' events, it seems like that file saves Pyrrhus as the scope for each individual event, but this uses the character ID, in Pyrrhus' case 70. If you create a character in event 1, and save him as a scope, the character ID will be entirely dependent upon when the event fires, does this mean it is impossible to save a character as a scope over the course of several related events? This is extremely frustrating if true.

I think saved scopes expire as soon as that event expires. A workaround would be to save the character in a variable, I see it being used in olympics.txt

Code:
 scope:olympic_champion = {
                set_variable = {
                    name = olympic_attendee
                    value = root
                }}

Later on, they accessed the variable in another event and saved it as scope in that event

I guess they saved them as a variable to be able to use them in other events?

Hopefully someone will give us a clarification on how saved scopes work.
 

Aule_the_creator

Second Lieutenant
58 Badges
May 19, 2013
103
36
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Pre-order
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Semper Fi
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II
  • 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: Sword of Islam
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Art of War
  • Imperator: Rome Sign Up
  • Hearts of Iron IV: Together for Victory
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: La Resistance
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Golden Century
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV Sign-up
  • Stellaris
  • Imperator: Rome - Magna Graecia
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • Victoria 2
  • Hearts of Iron IV: No Step Back
So trying to make this work, but not having much success:

scope:tiberius_gracchus = {
give_office = office_plebeian_aedile
set_variable = {
name = gracchus_1
value = root
}
}

and then next event:

immediate = {
any_character = {
has_variable = gracchus_1
save_scope_as = tiberius_gracchus

}

}

option = { #Reform
name = "gracchus_reforms.2.a"
set_as_ruler = scope:tiberius_gracchus
change_law = lex_sempronia_agraria
}

No luck, still says the scope is undefined. How were you thinking it would work, @Nc-Rm ?
 

Nicolas-

Nc-Rm
32 Badges
Oct 24, 2015
746
1.677
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II
  • Europa Universalis IV: Wealth of Nations
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Nemesis
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Europa Universalis IV: Golden Century
  • Imperator: Rome Sign Up
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Stellaris: Necroids
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Rome: Vae Victis
  • Victoria 2: A House Divided
  • Victoria 2
  • Europa Universalis IV
  • Stellaris: Synthetic Dawn
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Rome Gold
So trying to make this work, but not having much success:

scope:tiberius_gracchus = {
give_office = office_plebeian_aedile
set_variable = {
name = gracchus_1
value = root
}
}

and then next event:

immediate = {
any_character = {
has_variable = gracchus_1
save_scope_as = tiberius_gracchus

}

}

option = { #Reform
name = "gracchus_reforms.2.a"
set_as_ruler = scope:tiberius_gracchus
change_law = lex_sempronia_agraria
}

No luck, still says the scope is undefined. How were you thinking it would work, @Nc-Rm ?


If I'm not mistaken, any_character does not support effects. Try random_character or every_character (but make sure only 1 character has such variable).

Or try:
immediate = {
var:gracchus_1 = { save_scope_as = tiberius_gracchus}
}
 

Aule_the_creator

Second Lieutenant
58 Badges
May 19, 2013
103
36
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Pre-order
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Semper Fi
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II
  • 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: Sword of Islam
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Art of War
  • Imperator: Rome Sign Up
  • Hearts of Iron IV: Together for Victory
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: La Resistance
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Golden Century
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV Sign-up
  • Stellaris
  • Imperator: Rome - Magna Graecia
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • Victoria 2
  • Hearts of Iron IV: No Step Back
already tried var:gracchus_1, that didn't work, but I also noted that removing root helped set the variable (I think in the olympics event root was the country they were from not the character itself, since it was a country event).

so, I ended up with this:

Code:
    immediate = {
        if = {
            limit = {
                any_character = {
                    count >= 1
                    has_variable = gracchus_1
                }
            }
            every_character = {
                limit = {
                    has_variable = gracchus_1
                }
                save_scope_as = tiberius_gracchus
            }
        }
    }

I am guessing I could remove the "if" and "limit" and "any character", and go straight to "every character", if I understood you correctly?
It'd be nice to have something more intuitive to be able to refer to the same character over and over again, but it'll do for now.

And yes, there will only be one "gracchus_1". Gaius Gracchus wil obviously be "gracchus_2" ;)
 
Last edited:

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
already tried var:gracchus_1, that didn't work, but I also noted that removing root helped set the variable (I think in the olympics event root was the country they were from not the character itself, since it was a country event).

so, I ended up with this:

Code:
    immediate = {
        if = {
            limit = {
                any_character = {
                    count >= 1
                    has_variable = gracchus_1
                }
            }
            every_character = {
                limit = {
                    has_variable = gracchus_1
                }
                save_scope_as = tiberius_gracchus
            }
        }
    }

I am guessing I could remove the "if" and "limit" and "any character", and go straight to "every character", if I understood you correctly?
It'd be nice to have something more intuitive to be able to refer to the same character over and over again, but it'll do for now.

And yes, there will only be one "gracchus_1". Gaius Gracchus wil obviously be "gracchus_2" ;)
That is a lot of redundant stuff, you don't need the count in the if, by default it will look for at least one hence the name any_x. You don't need the if because the every checks that itself anyway.

As far as I've gathered you are just looking at saving some specific unique character to be referenced from anywhere else, why not just use a global variable?