Jump to content

Mod coding question about pregnancy


Recommended Posts

Posted

Since it looks like ck3 code needs 2 parents to make a character pregnant. Is there a work around like make a random (or semi random) invisible npc (I.e. not show up in an event name or visually) to act as a proxy then get removed (die without consequence)?

 

Can someone point me to some code to copy or steal to do this or something similar?

Posted (edited)

#You can first create a character.
 

hidden_effect = {

     create_character = {
            name = "XX" #Specify name
            location = #Specify location
            culture = #Specify culture
            faith = #Specify faith
            gender = male
            save_scope_as = dummy_father
        }
 

#Not sure if you have to specify name, location, culture, and faith but I usually do.

#Then scope to the mother and use the following effect on her. You can also use make_pregnant_no_checks - doesn't error on things like celibacy

 

 

     scope:mother = { # Or whatever scopes to the mother

            make_pregnant = {
                  father= scope:dummy_father
                  number_of_children= X
                  known_bastard=yes/no
            }
     }

 

#Then make the father disappear. To be on the safe side you can use hidden_effect_new_object, It suppresses errors for effects using to-be created objects (like artifacts or characters) in tooltips. The effects inside are hidden from the tooltip, with no description generated whatsoever.
 

     hidden_effect_new_object = {
                        scope:dummy_father = {
                            silent_disappearance_effect = yes
                        }
      }
}

I haven't tried it but it looks to me that it should do the job. Also, not sure what happens to the child. Will it have scope:dummy_father and the mother as parents? Or just the mother? Need to test.
Edited by Frozen Lake

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...