Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(3 edits)

I've managed to test twins (and quadruplets and quintuplets) and in every case only one child was ever actually born

The quad and quin were from the player, and a slave respectively, and were after I edited the fertilisation process to prevent ghost babies. (if the mother had ovulation type 2, or gave birth to eggs it would count the first 3 children twice.

I have managed to get the birthing of multiple children working though, with the same quad and quin that weren't working before. All 9 children were successfully born. To fix it instead of repeatedly calling the birthing function, I store the birthing mother in the same manor as the baby being born, then at the end of the birthing function right before closing the birthing panel, if the mother has more children to birth I  call the start of the function.

There are 3 relevant blocks of code that were changed/moved to make all this work all of them are in the Mansion.gd file.

First I created a new variable right next to the baby variable above the childbirth function that I called birthing mother, it doesn't really matter where the variable is in the code long as it isn't in a function:

...

var baby
var birthingMother

func childbirth(person,baby_id):

...

next in the nextdayevents function right at the start where it checks for pregnant character to give birth, instead of calling the looping function I set the aforementioned birthingMother variable to the mother giving birth then call the childbirth function directly:

...

func nextdayevents():
     get_node("FinishDayPanel").hide()
     var player = globals.player
     if player.preg.duration > variables.pregduration && player.preg.is_preg == true:
          birthingMother = player
          childbirth(player, player.preg.unborn_baby[0].id)

          checkforevents = true
          return
     for i in globals.slaves:
          ###---Added by Expansion---### Hybrid Support
          if i.preg.baby != null && (i.preg.duration > variables.pregduration || (i.race.find('Goblin') >= 0 && i.preg.duration > variables.pregduration/2)):
               if i.race.find('Goblin') >= 0:
                    i.away.duration = 2
          ###---End Expansion---###
          else:
               i.away.duration = 3
          i.away.at = 'in labor'
          birthingMother = i
          childbirth(i, i.preg.unborn_baby[0].id)

          checkforevents = true
          return

...

finaly at the end of the babyage function after adding the baby to the list of slaves but before closing the panel I remove the newly born baby from the mother and then if there are any more children to be born call the clidbirth function again for the next baby that they are carrying:

...

     globals.slaves = baby
     globals.state.relativesdata[baby.id].name = baby.name_long()
     globals.state.relativesdata[baby.id].state = 'normal'

     globals.state.babylist.erase(baby)
     birthingMother.preg.baby_count -= 1
     birthingMother.preg.unborn_baby.erase(birthingMother.preg.unborn_baby[0])
     baby = null
  
     get_node("birthpanel/raise/childpanel").hide()
     if birthingMother.preg.baby_count > 0:
          childbirth(birthingMother, birthingMother.preg.unborn_baby[0].id)
     else:
          birthingMother.metrics.birth += 1
          birthingMother.preg.is_preg = false
          birthingMother.preg.duration = 0
          birthingMother.preg.ovulation_stage = 2
          birthingMother.preg.ovulation_day = -5
          birthingMother = null
          get_node("birthpanel").hide()

...


The bolded lines are the lines that I changed/added or moved from the original state.

(1 edit)

And while reviewing this post I realised that I didn't account for if you give away the baby or babies so you could either set it up in one of two ways first:

func _on_giveaway_pressed():
     birthingMother.preg.unborn_baby = []
     birthingMother.preg.baby_count = 0
     birthingMother.metrics.birth += 1
     birthingMother.preg.is_preg = false
     birthingMother.preg.duration = 0
     birthingMother.preg.ovulation_stage = 2
     birthingMother.preg.ovulation_day = -5
     birthingMother = null
     get_node("birthpanel").hide()

That should just delete all of the mother's remaining children when you can't or don't want to keep them, but won't allow you to pass on one and keep a later child

func _on_giveaway_pressed():
     birthingMother.preg.unborn_baby.erase(birthingMother.preg.unborn_baby[0])
     birthingMother.preg.baby_count -= 1
     if birthingMother.preg.baby_count > 0:
          childbirth(birthingMother, birthingMother.preg.unborn_baby[0].id)
     else:
          birthingMother.metrics.birth += 1
          birthingMother.preg.is_preg = false
          birthingMother.preg.duration = 0
          birthingMother.preg.ovulation_stage = 2
          birthingMother.preg.ovulation_day = -5
          birthingMother = null
          get_node("birthpanel").hide()

That should remove the baby being shown, then reload the panel for the next baby, but requires you to manually pass on every child

Love the fix and appreciate it! I'll work on integrating and testing it!

Well, I have tried to implement this myself. However, I do not see it ever working as it conflicts with the slave_tab.gd (atleast mine) Maybe I'll have to wait for Aric next update. I'll keep trying to see if I can get it through, maybe you can help put a guide where goes where because at least I tried to put it where it suppose to be it, the first time it conflicted with the actual Aric Script than it conflicted with slave_tab.gd. For the mean time, I'll just have to find the gad dang ghost babies ( ͡° ͜ʖ ͡°)

Could you provide a Mansion.gd file with this in effect? i've tried adding it in the places listed but it bricks my save