News:

Please request registration email again and then check your "Spam" folder

Former www.henthighschool.com

[Resources] Writing events for BK

Started by Goldo, May 19, 2022, 09:17 AM

Previous topic - Next topic

GoldoTopic starter

Awesome! Was it yours? I'd like to credit the artist! ;)
Maker of BK. Looking for the latest patch for BK 0.2? The link doesn't change, so bookmark it!

neronero

My Girl Packs: [ link ] - Trait King mod: [ link ]

GoldoTopic starter

Take the credit you filthy animal!!!

Maker of BK. Looking for the latest patch for BK 0.2? The link doesn't change, so bookmark it!

reddok

#18
Hey y'all,

Just a little bit of context; I've been stalking the forums for a while, writing short events and trying stuff for myself, just to get an idea of what's possible in a mod. This means that I've got a very basic understanding of the language, so I would very much appreciate my questions to be answered in a ELI5 kind of way.
Edit: Maybe I exaggerated with the ELI5 part. But an explanation of any potential code is appreciated.

So, the question I have is:
It is possible, and which would be the most efficient/clean way of having an event end with the addition of a character to the brothel, and have said character's stats reflect the values of stats tracked during interactions with the player during those events?

Also, is it possible to have a girl folder inside a mod folder?

GoldoTopic starter

#19
Hi, sorry I just got back so it took me a while to get to your question.

Quote from: reddok on Aug 13, 2022, 05:42 PMIt is possible, and which would be the most efficient/clean way of having an event end with the addition of a character to the brothel, and have said character's stats reflect the values of stats tracked during interactions with the player during those events?

Also, is it possible to have a girl folder inside a mod folder?

Edit: Detailed answer below
Maker of BK. Looking for the latest patch for BK 0.2? The link doesn't change, so bookmark it!

GoldoTopic starter

#20
Okay, so here is a step by step guide on how to do it. I'll take the example of a mod called "My_Mod" and a modified version of Boa Hancock as our girl.

1/ Place the girlpack in your mod folder

Now, unless your girl is something you alone created, I highly recommend naming the girlpack folder something unique. Because you don't want the game to get errors if the player has another version of the pack in his girls folder with the same name. So we'll name our girlpack folder 'My_Mod_Boa'.

2/ Prepare a _BK.ini for your girl

While not strictly necessary, you'll want a _BK.ini file in your girlpack folder for at least two reasons (and maybe more, depending on your story):
  • You can set the first and last names of the girl yourself, preventing naming problems if you renamed the folder as I recommend in step 1
  • You can set the attribute 'generate_as' to 'story' and 'unique' to True, preventing your girl from generating in the city or the slave market and cloning (assuming that's what you want)

3/ Tell the game where to find your girl pack

Now, the game doesn't know that there is a girlpack in your mod folder, so you need to tell it where to look.
During init, the game looks at all folders that are in 'girl_directories', as defined in BKsettings.rpy (where the more user-friendly settings can be modified). By default, it looks like this:
init -4 python:

#### GIRLS FOLDER ####

    girl_directories = ["girls/", ] # You can specify one or more directories containing girl packs. The 'game' folder is the root folder

Now, you could edit BKsettings.rpy directly, but it wouldn't be clean because it would mean your mod would overwrite the player's settings.

Instead, we can add this code to your mod's .rpy file(s):
init -3 python: # Creation of 'girl_directories' happens on init -4, and parsing of girlpack templates on init -2, so -3 is fine here
    girl_directories.append("Mods/My_Mod/My_Mod_Boa/")  # You could simply add "Mods/My_Mod/" if you have several girlpacks, but it isn't recommended if you have subfolders with image files elsewhere in the mod because they will be parsed as girlpacks, unless you make sure to use an underscore prefix ("_") to exclude such folders

Now, the game will also browse through your girlpack folder when creating girl templates. This girl will still only generate through your story, if you configured _BK.ini as above.

4/ Create your girl in your event

Now, in your custom event, you can very simply create a girl from the girlpack template:
$ girl = create_girl("My_Mod_Boa", free=False, force_original=True, level=1)
You can of course change the attributes to what you want. We preface this with the '$' sign, because this is python code.

5/ Adjust her skills

Now, you could try to directly overwrite a skill value, but it would be a tad complex and risk breaking something if you go outside of the skill range, or something.

So instead, we'll use a workaround with the 'get_stat()' and 'change_stat()' methods, which have built-in sanity checks:
# In this example, we'll change the girl's libido to 50
$ girl.change_stat("Libido", 50 - girl.get_stat("Libido", raw=True)) # Changes the stat by the difference between 50 and the current stat

The 'raw=True' attribute means we do not check Traits and other effects for modifiers (but you could).

6/ Add her to the brothel

Now, the only thing left to do is to add her to the Brothel. This requires a sanity check, though: does the brothel have room for her? You need to check it with an 'if' clause, and deal with the exceptions.

if len(MC.girls) < brothel.bedrooms: # Checks that you have less girls in the brothel than bedrooms
    $ MC.girls.append(girl) # Adds the girl to the brothel
else: # Here, define what happens if the brothel is full. You can look in BKmain.rpy for inspiration, or in BKevents.rpy (such as the label 'found_runaway_girl_come_back')
    ...

Voila, that is all you need to know to make your use case work. Looking forward to seeing the results!
Maker of BK. Looking for the latest patch for BK 0.2? The link doesn't change, so bookmark it!

Hareb

#21
I actually wrote an event for BK. :o

The way it happened was that, while discussing some personality-specific events in the bloody yandere thread, I came up with the idea that you could have an event, where the mc finds of one three bookish girls (Nerd, Loyal, Class president) reading a book.

In the following days, my brain started producing ideas of the things that could happen in it and I thought, what the hell, I might as well try and write it out.

Here's a brief synopsis.
Spoiler
Your brothel is getting ready to serve customers, except you discover a nerdy bookworm girl, instead of getting ready, is reading a book. It turns out to be the Kama Sutr Amak Artus.

You have five options:

- Compliment her > happiness boost (ends scene very quickly)

- Let's try it out in practice (train her). This will give options to train any of the sex skills from nudity to group. She will first read a bit from the book (loosely based on the actual Kama Sutra) and then you can try it with her > this should lead to stats boost, and maybe happiness too

- Tell her that you learn by doing, not by reading (train her, harsh). This gives you the options to fuck her, fuck her ass or make her service you. The sex is rougher than in above option > this should boost sex skills and obedience, but maybe cause fear and unhappiness.

- Tell her to clean the brothel (discipline her) > boost obedience, brothel cleanness (ends scene quickly)

- Put an end to this reading nonsense (discipline her, harsh). This gives you the options of spanking her with the book, wiping her ass with it or cumming on her face, wiping it off with some pages from the book, then feeding them to her > this should lead to increase in fear and obidience and decrease in love and happiness.

[close]

I'm attaching two files. One is a simple version, which will work as a small standalone game, if you run it on Ren'Py. It doesn't have any programming logic, only text and menus, but you can use it to try all options.

The second one is my attempt to write it out as BK day event. It doesn't really work yet, so I could use some help on getting it to work.

I'm an absolute n00b with Ren'Py. Never used it before this week.

GoldoTopic starter

#22
I'm getting indentation problems, as well as missing text in the BK version. Are you sure the files saved properly? What editor are you using?

Edit: Also a bunch of ":" missing after if clauses.
Edit2: personality names should be spelled lower case. The method 'is_()' only looks for attributes (extravert, pervert, ...). To test for the presence of a specific personality, do this:
if girl.personality.name == "loyal":
   [...]

The following code is incorrect:
$ girl = rand_choice(able_girls, Nerd, Loyal, Class president)
Instead, build your list of able girls like this:
$ able_girls = [g for g in MC.girls if not (g.away or g.hurt or g.exhausted) and g.personality.name in ("nerd", "loyal", "class president")]
This way it will come directly populated with the right personalities.
Do not forget to handle cases where no girls are found:
if not able_girls:
    return

Edit3:
This doesn't exist:
girl.get_obedience()Use this:
girl.get_stat("obedience")
Edit4:
Finally, this doesn't work:
if service >= 80:
Instead, use this for a skill check:
if girl.get_stat("service") >= XX:
Or this for an attitude check:
if girl.get_sex_attitude("service") >= XX:(a measure of both her preference and skill, which is used for daily events)
Maker of BK. Looking for the latest patch for BK 0.2? The link doesn't change, so bookmark it!

GoldoTopic starter

Here is what I had time to do when debugging the event. You can test it in-game in the console by using:
call test_hareb
Of course it's not integrated as a daily event yet, but you can do that last when the event is fine-tuned.
Maker of BK. Looking for the latest patch for BK 0.2? The link doesn't change, so bookmark it!

Hareb

Quote from: Goldo on Sep 25, 2022, 02:40 PMHere is what I had time to do when debugging the event. You can test it in-game in the console by using:
call test_hareb
Of course it's not integrated as a daily event yet, but you can do that last when the event is fine-tuned.

Thank you so much  :) I promise my next efforts will require much less cleaning from you...

I got the console running just fine (first time using it). The only thing is it looks like I don't have any girls in my brothel with any of the three personalities, but working on it ... :P

neronero

Quote from: Hareb on Sep 25, 2022, 01:43 PMI'm an absolute n00b with Ren'Py. Never used it before this week.
Glad you didn't let it stop you ;D

Some fine-tuning suggestions:
- What if she's already nude/nudist? She wouldn't be able to undress.
- I feel like the succes/fail options don't cover all possibilities: What if she "refuses" a sexual act? Or what if she's a virgin? She wouldn't accept to be involved in this training at all, would she?
- Or what if she's already one of the world's most prominent sexperts with thousands of cocks on her CV? Do the "success" states all fit into that narrative?
My Girl Packs: [ link ] - Trait King mod: [ link ]

Hareb

Good questions...

If she is already nude or nudist, I think it's fine just to leave the undress option out. That will still leave all the other things to train from 'service' to 'group'.

(But, if she is nude, will need to display a nude profile pick – how does that work?)

That's a very good point about experience. :)

I sort of envisioned the event as taking place when she is already used to her work and life in the brothel... but not fully experienced yet and eager to learn more. That's why I set libido and obedience requirements to 60. In my mind, she would be early Rank B (maybe advanced C with the right perks and items). But it is true that the event will keep coming up, and eventually she will be a luxury prostitute of Rank A or S, who's worked thousands of cocks. I think the solution would be a three-way system and have different outcomes, if her skillz are above certain threshold ...

It looks like that is standard practice in existing day events. For example, as you almost certainly know, the very common 'you find the girl exercising' constitution event has different descriptions based on if her stat is above 200, above 100 or below that.

And should add complete refusals, if she has very low values for a sex act.

At the moment, there's no dice rolls, just straight up checks for value. I wonder, if that is ideal?

Also, I completely forgot about virgins :o Will need to come up with something for them...

Hareb

How do you check, whether a girl is scheduled to work on the day of the event or not?

I've been writing some extra dialogue for elite prostitutes with libido > 200, debugging and adding images and stat changes. It's a bit slow going, as I am very new to this.

Also, I'm currently pretty busy IRL: travelling for work this weekend and the coming week. Unlike last weekend, won't have time to work on this ...

Regarding virgins, I think it's just enough to add the usual code, if you pop the cherry. The game does not usually warn you in advance, if a girl is a virgin. If you have a virgin in your stable, you want to shelter, the event does allow you to just compliment her or make her clean the bordello.

neronero

Quote from: Hareb on Sep 30, 2022, 05:56 AMHow do you check, whether a girl is scheduled to work on the day of the event or not?
if girl.works_today():
My Girl Packs: [ link ] - Trait King mod: [ link ]

neronero

#29
You cannot view this attachment.

I made a mod that adds ~1000 lines of flavor text for relationships, friendships and rivalries. The girls in your brothel will occasionally chat with eachother.
The vanilla game also already does this, but it could use some more variety. Plus this mod adds neutral chatter (for 'neutral' relationships)

Mechanically it's pretty simple since it's just some flavor text. And I don't really intend to develop this a lot further for now. It's more meant as a dialogue-lines resource for a future mod or update (that's why I'm stealth-dropping it here instead of in a seperate thread)

@Goldo I hope the dialogue lines can be of use to improve random_relationship_event() in a future release.

edit: Reduced occurance + suggested code simplification
edit 26/12/2022: typo fix
My Girl Packs: [ link ] - Trait King mod: [ link ]