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

Atoombom007

Corporal
15 Badges
Aug 27, 2018
49
1
  • Cities: Skylines
  • Cities: Skylines - After Dark
  • Stellaris
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Stellaris: Synthetic Dawn
  • Age of Wonders III
  • Stellaris: Apocalypse
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Cities: Skylines Industries
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Federations
TL;DR| how do I make a refugee from a pop with a specific flag?

As the title says, I've tagged pops with a flag. Through an event, I want to make them refugees. However, with the current code I created, the game crashes, BUT only under a specific circumstance:
  • if there is NO pop present which is NOT the same as the founder species, and that non-founder species pop has the flag --> no crash
  • if there is a pop present which is NOT the same as the founder species, and that non-founder species pop has the flag --> crash
So, its very existence is the problem somehow.
Code:
#xenophobe being xenophobe
country_event = {
    id = wagho_event.182
    title = wagho_event.182.name
    (...)
    option = { #bio
        name = wagho_event.182.0
        custom_tooltip = wagho_event.182.tooltip
        trigger = {
            OR = {
                has_ethic = ethic_fanatic_xenophobe
                has_ethic = ethic_xenophobe
            }
        }
        hidden_effect = {
            event_target:wagho_riot_planet = {
                while = {
                    limit = {
                        any_owned_pop = {
                            has_pop_flag = wagho_event_pop_infected
                            wagho_event_trigger_is_immune = no
                            NOT = { is_same_species = owner.species }
                        }
                    }
                    random_owned_pop = {
                        limit = {
                            has_pop_flag = wagho_event_pop_infected
                            NOT = { is_same_species = owner.species }
                        }
                        if = {
                            limit = { is_valid_refugee_pop = yes }
                            save_event_target_as = refugee_pop #Must be saved for refugee_pop_effect to work
                            refugee_pop_effect = yes       
                            root = {
                                add_event_chain_counter = {
                                    event_chain = wagho_event_count
                                    counter = wagho_event_infected_pop_count
                                    amount = -1
                                }
                            }
                            root = {
                                subtract_variable = {
                                    which = wagho_report_infected
                                    value = 1
                                }
                            }           
                        }
                        else = {
                            kill_pop = yes
                            root = {
                                add_event_chain_counter = {
                                    event_chain = wagho_event_count
                                    counter = wagho_event_killed_pop_count
                                    amount = 1
                                }
                                add_event_chain_counter = {
                                    event_chain = wagho_event_count
                                    counter = wagho_event_infected_pop_count
                                    amount = -1
                                }
                            }
                            root = {
                                change_variable = {
                                    which = wagho_report_killed
                                    value = 1
                                }
                                subtract_variable = {
                                    which = wagho_report_infected
                                    value = 1
                                }
                            }
is it mayve the refugee effect that I should edit or is something else not correct in here?