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

asnys

Second Lieutenant
29 Badges
May 23, 2016
123
12
  • Stellaris: Synthetic Dawn
  • 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
  • Crusader Kings II
  • Stellaris: Lithoids
  • Age of Wonders
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Stellaris: Ancient Relics
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Federations
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Reapers Due
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Way of Life
  • Stellaris: Distant Stars
  • Crusader Kings II: Charlemagne
So, I'm trying to make a custom faction spawned by an event. My code (displayed below) does spawn the faction, but the next day they vanish, and I can't figure out what the issue is. Help would be much appreciated.

Code Spawning Faction:
Code:
  immediate = {
     create_pop_faction = {
       type = penitents
       pop = unhappiest_pop
     }
     last_created_pop_faction = {
       leader = {
         kill_leader = {
           type = governor
           show_notification = no
         }
       }
     }
   }

Code Describing Faction:
Code:
penitents = {
   #country scope
   is_potential = {
     has_country_flag = homeworld_deteriorating
   }

   #pop faction scope
   valid = {
     always = yes
   }

   parameters = {
     planet = {
       type = planet
       filter = owned
       valid_objects = {
         is_capital = yes
       }
     }
     empire = {
       type = country
       valid_objects = {
         is_same_value = root
       }
     }
   }
   
   #pop scope
   can_create = {   #this trigger is evaluated after parameters are initialized and a #pop is considering what faction to join or create. If this evaluates to true the #pop will calculate its attraction to this potential faction
     always = yes
   }
   
   #pop faction scope
   on_create = {   #an effect that is executed immediately after the faction has #been created. Faction will have one pop ( if created with a pop )
     set_name = "Penitents"
   }
   
   #pop faction scope
   on_set_leader = { # Effect that executes when a faction wants a leader, pop #faction scope, having it empty will have default behavior
     owner = {
       create_leader = {
         type = governor
         species = owner_main_species
         name = random
         skill = 0
         traits = {}
       }
       last_created_leader = {
         recruitable = no
         root = {
           assign_leader = prev
         }
       }
     }
   }

   attraction = {#executed with a pop scope, country is stored in root, faction is stored in from
     base = 100
     modifier = {
       add = 10
       parameter:planet = { has_modifier = "deteriorating_climate_1" }
     }
     modifier = {
       add = 30
       parameter:planet = { has_modifier = "deteriorating_climate_2" }
     }
     modifier = {
       add = 50
       parameter:planet = { has_modifier = "deteriorating_climate_3" }
     }
     modifier = {
       add = 5
       parameter:planet = { has_modifier = "deteriorating_climate_1_stable" }
     }
     modifier = {
       add = 15
       parameter:planet = { has_modifier = "deteriorating_climate_2_stable" }
     }
     modifier = {
       add = 30
       parameter:planet = { has_modifier = "deteriorating_climate_3_stable" }
     }
   }
   
   support_effects = {
     gather_support = {
       title = "POP_FACTION_PENITENTS_GATHER_SUPPORT"
       min_support = 0.0
       max_support = 1.0
       
       spawn_chance = {
         base = 5         
       }
       
       effect = {
         custom_tooltip = "POP_FACTION_PENITENTS_GATHER_SUPPORT_DESC"
         hidden_effect = {
           parameter:planet = {
             debug_scope_type = planet
             random_owned_pop = {
               limit = {
                 NOT = {
                   has_modifier = "penitents_supporter"
                 }
                 or = {
                   not = { exists = pop_faction }
                   pop_faction = {
                     not = { is_same_value = root }
                   }
                 }
               }
               add_modifier = {
                 modifier = "penitents_supporter"
                 days = 360
               }
             }
           }
         }
       }
     }     
   }
}
 
Do you have any other mods? There might be some incompatibility between them and this one.

So, after doing a bunch of tinkering, I got it to work. I'm still not sure what the problem was, but when I replaced the "pop = unhappiest_pop" line in the event with an on_creation event in the faction file, it stopped vanishing.

ETA: Spoke too soon, it's vanishing again... <confused> Gonna keep tinkering.

ETA2: Okay, that time turned out to be simple to fix - had accidentally changed valid = {always = yes} to valid = {always = no}.
 
Last edited: