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

spartan448

Recruit
13 Badges
Mar 1, 2019
1
0
  • Cities: Skylines
  • Cities: Skylines - After Dark
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV
  • Knights of Pen and Paper +1 Edition
  • Sword of the Stars II
  • Stellaris - Path to Destruction bundle
My idea was to call an event on startup, and on yearly pulse, that would check every AI, and if they had a certain number of living children, give them a massive negative fertility modifier until they have less than that maximum, and a second event on the same timing specifically for use in existing games that would only trigger for characters with more than a certain number of children, and then kill those excess living children starting from the youngest until the character was inside the allowed number of children.

The first event works fine - as soon as I load an existing game, all the characters with more than a certain number of children get the negative fertility modifier. The problem is the other event. I included a simple opinion modifier with it for debug purposes, but I can't seem to even get that to apply, which means the even probably isn't even firing, to say nothing of actually killing off AI and thereby reducing character bloat

My code for the event is as thus:

#
# 1002. kill children starting from youngest if more than four children
#

character_event =
{
id = Lagcontrol.1002
hide_window = yes

ai = yes

trigger =
{
any_child =
{
count > 4
is_alive = yes
}
# triggers when 4 or more children
}

immediate = {
# kills excess children in each dynasty starting from youngest
add_character_modifier =
{
modifier = dynastyculled
duration = -1
}
while =
{
limit =
{
any_child =
{
count > 4
is_alive = yes
}
}

youngest_child =
{
limit =
{
is_alive = yes
}
death =
{
death_reason = death_hashshashin
}
}
}
}
}

and my code to trigger the event is as thus:

on_startup =
{
events =
{
Lagcontrol.1000
Lagcontrol.1001
Lagcontrol.1002
# Implements lag control on startup
}
}

The 1000 event fires fine, that applies the fertility debuff. The 1001 event would presumably work as well, though admittedly I haven't tested it yet. But I can't figure out why the third event isn't firing. Anyone have any ideas?
 
The condition is_alive must precede the count, I think.