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 Describing Faction:
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
}
}
}
}
}
}
}
}