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

schedim

First Lieutenant
146 Badges
Mar 21, 2005
208
81
  • March of the Eagles
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Impire
  • King Arthur II
  • Knights of Pen and Paper +1 Edition
  • Leviathan: Warships
  • The Kings Crusade
  • Magicka
  • Majesty 2
  • Majesty 2 Collection
  • For The Glory
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Europa Universalis: Rome
  • Rome Gold
  • Semper Fi
  • Sengoku
  • Ship Simulator Extremes
  • Sword of the Stars
  • Sword of the Stars II
  • Supreme Ruler 2020
  • Teleglitch: Die More Edition
  • Hearts of Iron IV: No Step Back
  • Crusader Kings II: Sunset Invasion
  • Ancient Space
  • Arsenal of Democracy
  • Hearts of Iron II: Armageddon
  • Cities in Motion
  • Cities in Motion 2
  • Crusader Kings II
  • 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
  • A Game of Dwarves
  • Crusader Kings II: Sword of Islam
  • Darkest Hour
  • Deus Vult
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
I try to create some pop centred events, and currently tries to understand how modifiers are to be applied to pops, but this has wrecked my mind and I need help to straighten it out. I got two troubles I can't solve:

First trouble
In the code below everything is peachy until the options. if I tries to use <any_pop> from base scope it just appiles to the pop in the tile.

zero.png

Ok, fair, so lets scope up to planet first and then scope <any_pop>, and then I cant parse the results. If unlimited the pop modifiern gets applied as a planetwide modifier (and the icon is just soo ironic).

First Riot.png zero.png

and if I tries to limit it in any way it just don't show up anywhere...

half.png

So what scope to use to for just apply modifiers to a limited number of pops on a planet? Or Am I just missing something?


Second trouble
Why don't the second option show up? I guess it can be realated to some error made in the first problem... but do I missing something here too?


[and yes I will limit these events so they do not spam the brain out of us]

Code:
namespace = schedim

pop_event = {
    id = schedim.1
    title = "schedim.1.name"
    desc = "schedim.1.desc"
    picture = "GFX_evt_burning_settlement"


   
    trigger = {

           
        has_ethic = ethic_fanatic_xenophobe
       
        AND = {
            NOT = {is_enslaved = yes}
            NOT = {is_being_purged = yes}
        }
       
        OR = {
            has_ethic = ethic_fanatic_militarist
            has_ethic = ethic_militarist
            }
               
        planet = {
            any_pop ={
           
                AND = {
                    NOT = {is_same_species = ROOT}
                    is_robot_pop = no
                    is_being_purged = no   
                }
            }                   
        }
    }
   

    mean_time_to_happen = {
        months = 120
    }

    immediate = {
       
        save_event_target_as = troubleMaker
        planet = {
            random_pop ={
                limit = {
                    is_robot_pop = no
                    is_being_purged = no
                    NOT = {
                        is_same_species = ROOT    
                    }
                }

                purge = yes
                save_event_target_as = victim
            }
        }
    }

    option = {
        name = schedim.1.option1
       
        immediate = {
            planet={
                any_pop={
                    #limit = {
                    #NOT = {is_same_species = ROOT }
                    #}
                    add_modifier = { modifier = "pop_governmental_oppression"  month = 6 }
                   
                }
            }
        }
    }

    option = {
        name = schedim.1.option2
           
        immediate = {
            event_target:victim = {
                purge = no
            }
           
            any_pop={
                limit = {
                    NOT = {is_same_species = ROOT }
                }
                add_modifier = { modifier = "pop_governmental_oppression"  month = 24 }   
            }
            }
        }   
    }
 

Attachments

  • Second.png
    Second.png
    422,9 KB · Views: 19
It's a bit tricky to specify just how many pops you want to add an modifier to. I guess you could just repeat the random_pop with a limiter like
NOT = { has_modifier = "pop_governmental_oppression" }
And then just repeat the random_pop the number or pop you want it to affect.

You can tweak this further with using for instance
Code:
if = {
    limit = {
        planet = {
            count_pops = {
                limit = {
                    is_robot_pop = no
                    is_being_purged = no
                    NOT = {
                        is_same_species = ROOT
                    }
                }
                count < 3
            }
        }
    random_pop = {
        DO STUFF
    }
    random_pop = {
        DO STUFF
    } and keep repeating the number times you want to affect pop count.
}

You also have like the option of using every_owned_pop on the planet scope with the desired limiters. And it will affect everyone on the planet that falls into the specified limits.

Hope that helps.

Oh and about the second part. Try checking the error.log in Documents\Paradox Interactive\Stellaris\logs and see what is causing the issue.
 
  • 1
Reactions:
That seems to be a very ... meadering way to do it, but sometimes that is the way of the CODE. All hail the CODE :)

I try it, and as I actually don't need everyone to become unhappy, just have some "reaction" to the governments action, it may actually be a better way to handle it. Thanks for the help!
 
That seems to be a very ... meadering way to do it, but sometimes that is the way of the CODE. All hail the CODE :)

I try it, and as I actually don't need everyone to become unhappy, just have some "reaction" to the governments action, it may actually be a better way to handle it. Thanks for the help!

Yeah, there might be a better way to do it. But not really any that i can think of.

Though, you might be able to reduce the size of the code by using set_variable and a while = { scope. Where the while will keep repeating until said limit is reached, like a specific variable number.
But i haven't played around with the while function enough to know if that actually would work as intended.

I recommend if you haven't already, to in game in console type trigger_docs. Which will make the game print out all the function triggers and effect to the log file in your documents folder. It also shows which scope a function will work at and such.
 
I recommend if you haven't already, to in game in console type trigger_docs. Which will make the game print out all the function triggers and effect to the log file in your documents folder. It also shows which scope a function will work at and such.

Yupp done that and have gone over the wiki with a loupe, and found nothing that explains the any_pop scope promoted to the planetary modifier, or understanding why limit not working. Also working my way through the EUIV and CK2 docs...

I'll mplement the <random_pop> way you suggests and see how it reacts to that...
 
any_pop is a "condition" scope, is does not work with limit, but with any_pop { condition = ...}. For your effect you want to use an effect scope, in this case the analogue should be "every_owned_pop". Effect scopes work fine with limits.
Also you seem to be missing planet = {...} in the second option, or am I misreading something there ?
 
Ah, hmm, I thought limits worked with Condition scopes too, or I just assumed it did, my bad. Well, actually the <random_pop> structure proposed fits better with what I actually envisioned. Small, flavour events.

Yes, it lacks the planet scope as I removed it while bug hunting for the reason to why the second option don't display. It is due to a "corrupt event table", what this actually means I have yet to understand, a forum search tells me that this occur now and then when modding Paradox code, but so far I haven't seen a solution or explanation. Neither have my testing found any system in the error appareance.
 
Last edited:
This is was the error message that persisted and confused me:

  • [effect_impl.cpp:411]: Error in scripted effect, cannot find: immediate

That was solved easy enough, immediate had no place in a option. I could have taken poison on that I copied that option straight from the event files...

The "corrupt event table" went away when I rewrote the code, don't know why, I suspect invisible trash code... or gremlins!


Edit: Also modifier times are in days, not months
 
  • 1
Reactions:
Still having troubles with scopes I get this error:
[11:26:23][trigger.cpp:323]: Invalid Scope type for trigger any_tile in events/schedim_event.txt line : 479
[11:35:45][trigger.cpp:500]: invalid scope for trigger. got [pop], expected {planet}. file: events/schedim_event.txt

But I can't figure out why the planet scope don't "take":
Code:
    option = {
        name = schedim.2.option2
           
        trigger = {       
         planet ={
                any_tile={
                    has_grown_pop = no
                    has_growing_pop = no
                    has_blocker = no
                    has_building_construction = no
                }       
            }
        }
 
what scope are you using the planet = { on? pop_event?

EDIT: Hmm seems these
has_grown_pop = no
has_growing_pop = no
has_blocker = no
has_building_construction = no

can only be used on a planet scope.. that's odd. pretty sure they should be able to be used on a tile scope.....

EDIT2: It's possible those condition chekcers can only be used on random_tile in a limit form..

In any case. Removing any_tile and keeping the condition checks should technically do the exact same thing you are trying to achieve.
 
Last edited:
Okie ... that I haven't tried...

Yes, I scoped from pop to planet as it was as I understod it should be done ...

In the comment field in the wiki it says tile or planet, in the scope only planet...
 
Okie ... that I haven't tried...

Yes, I scoped from pop to planet as it was as I understod it should be done ...

In the comment field in the wiki it says tile or planet, in the scope only planet...

Yeah, it's weird. As they should work on a tile as well, when i read the description for it.

has_growing_pop - Checks if a planet or tile has a growing pop
Supported Scopes: planet

May be some odd bug limitation with any_tile..
 
I pop a blood vessel on this. Removing the any_tile as you suggested don't work (or it works for something, but not what I want). Using any_tile actually gives the correct result but gives the error message in the log ...

I think I have to live with the error message...
 
  • 1
Reactions: