My version is still pretty stiff. I add custom characters to existing list of premade characters (Cali, Maple etc.) in gallery.gd. For their images they all have their own assigned folder, where filenames are identical. This can of course be done however one wants, I just like to have my stuff in folders. I also tweaked it a little bit, pictures used in mansion main screen are now triggered by loyalty, while pictures in dating screen are triggered by lust. This is in mansion.gd under func updateSlaveListNode:
var customportrait = '' var customfull = '' if person.unique in [Your eligible characters listed in here]: if person.loyal >= 70: customportrait = "res://files/images/custom/" + person.unique + "/portrait2.png" customfull = "res://files/images/custom/" + person.unique + "/body2.png" else: customportrait = "res://files/images/custom/" + person.unique + "/portrait1.png" customfull = "res://files/images/custom/" + person.unique + "/body1.png" person.imageportrait = customportrait person.imagefull = customfull
I have to add characters to this list in case they don't all have multiple images. I'm not much of an artist myself, so I have to use whatever I can find. There's similar portion in dating.gd under func doaction:
var customportrait = '' var customfull = '' if person.unique in [Your eligible characters listed in here]: if person.lust >= 90: customportrait = "res://files/images/custom/" + person.unique + "/portrait3d.png" customfull = "res://files/images/custom/" + person.unique + "/dating3.png" elif person.lust >= 60: customportrait = "res://files/images/custom/" + person.unique + "/portrait2d.png" customfull = "res://files/images/custom/" + person.unique + "/dating2.png" else: customportrait = "res://files/images/custom/" + person.unique + "/portrait1d.png" customfull = "res://files/images/custom/" + person.unique + "/dating1.png" $textfield/slaveportrait.set_texture(globals.loadimage(customportrait)) $fullbody.set_texture(globals.loadimage(customfull)) updatelist()
So, there's nothing really fancy in here. But at least it's quite tidy, bringing the characters in game is a mess. I added some new stuff in globals.gd:
var custompool = [Your custom characters listed in here] var customchar var customtaken = [] var guildpool = [] func customslave(origins = 'slave'): customchar = globals.randomfromarray(custompool) for guild in guildslaves: var slaves = guildslaves[guild] for i in slaves: guildpool.append(i.unique) for i in globals.slaves: customtaken.append(i.unique) if customchar in customtaken || customchar in guildpool: guildpool.clear() return null else: return gallery.create(customchar)
When a new slave is brought in game, func newslave is used. In those situations I've added a rand_range check to see whether a custom character is introduced instead. I didn't put the random check in here because I wanted the random chance to be different in every situation. This code picks a character from list and then checks if said character is already in game, either in player's possession or in a slaver guild. If character is not yet in game, it's brought in, otherwise null is returned and original line is used. However, if custom character is already in game, the process is not repeated because I wanted the chances for new custom characters to be lower if there already are some in game.
Oh, and in original code, word "portrait" was typoed as "portait" in some parts. Instead of correcting that, some parts of original code were written to work with typo version, while others used the correct version. I couldn't get my code to work until I noticed it. This pissed me off beyond belief, so I went through all the files and fixed it. I highly recommend this to be done before doing anything related to portraits.
Also, keeping custom characters in separate files is a great idea that didn't even cross my mind. In fact, I think I came up with a way to keep custom characters in their own files, under a designated folder. It would make handling them much easier and they could even be easily shared one by one with other players. You'd still need to manually add the .unique values to those lists, but some proper coder could surely find a solution for that too. I need to take a look at this when I have some spare time.