HentHighSchool Development Forum

Game Development => Brothel King => Topic started by: Goldo on May 19, 2022, 09:17 AM

Title: [Resources] Writing events for BK
Post by: Goldo on May 19, 2022, 09:17 AM
A GUIDE ON WRITING EVENTS FOR BK

SUMMARY

1- FAQ (https://henthighschool.net/index.php?msg=100)
2- HOW TO WRITE EVENTS FOR BK (https://henthighschool.net/index.php?msg=101)
3- THE LORE (https://henthighschool.net/index.php?msg=103)
Title: Re: [Resources] Writing events for BK
Post by: Goldo on May 19, 2022, 09:17 AM
PART 1: FAQ

You can ask questions on event creation in this thread. New questions will be added to this FAQ as they come.


- Is writing new events for BK easy?

Yes! Writing events for BK only requires a basic understanding of Ren'py and, optionally, very light Python coding.

Ren'py is a simple, beginner-friendly language designed for writing visual novels.

To give you an idea, here is what Ren'py coding looks like behind the scene:

"Nothing is moving in the sleepy brothel. All your girls are fast asleep, exhausted by the hard work they had to pull last night."
 
play sound s_creak

"Suddenly, you hear some noise coming from the maintenance room."

you "This is strange... That room is locked, and there is no other entrance... Except maybe the old chimney?"

"Openning the door as silently as you can with your spare key, you prepare to confront the intruder."

you "Whoever is in here... Show yourself!"

play sound s_door

scene black with fade
show bg hmas at top with dissolve

play sound s_spell

if seen_hmas:

    hmas_girl "Hi, [MC.name]..."

    "You recognize the strange girl from last year."

    you "Oh, it's you again..."

else:
    you "Who are you?"

Even if you have zero experience with coding, you should be able to more or less find your way around this code, right? There isn't much more involved when coding basic events with Ren'py.
There are many tutorials online about writing events in Ren'py. All of them apply to writing events for this game as well.

In fact, the hardest part of writing BK events may be the writing. Many people volunteer to write for the project, only to face the H-game equivalent of writer's block or crumble under the weight of an overtly complex overarching story with dozens of events and characters...

As in learning anything, start simple: try to make a one-shot event with only a few characters, or a very short event chain with max 3-4 small events. Don't bite more than you can chew at first, you'll quickly find that writing (and testing, and proof-reading) is more time-consuming than you thought.


- Ok, but how easy is it to write complex events?

Complex events are a subjective category, of course, but generally-speaking there are several types of events in increasing order of difficulty.


My advice is always the same if you are new to writing events with Ren'py: start with the easy 'set character' pieces before venturing into more complex territory. Don't get too ambitious at first.

When you do get ambitious, you can always drop me a PM or leave some comments in the code for me if you are trying to achieve something in particular and don't know how to do it.


- How long should my events be?

I guess everyone has their own worthy ideas here, but I think most players agree that shorter is better. The story events I write are typically too long (sorry), and I struggle to make them shorter. I would recommend being more concise if you can manage it, especially for side events that are outside of the main story.
I find that breaking events down into chunks that let the player do something else in-between helps. If your event runs longer than 100 lines (you'll be surprised how quickly you'll get there), I would consider breaking it down.

The final trial scene in Chapter 1, for instance, has about 400 lines split along 3 different timelines, so about 150 lines for a single playthrough. For me, that's about as long as any single event should get without seriously overstaying its welcome.

With that said, I have found through testing that I much prefer to split dialogue in smaller snippets of 1 or 2 sentences (thus, ending up with more lines) rather than have long paragraphs for the player to read.

So, I try to avoid this:

sill "Hello Master! It's a nice day to take a walk, don't you think? Let's go to the harbor, I want to show you a nice jewelry shop I discovered there... I mean, I just want to look at it, it's not like I'm expecting a present... *blush*"
...and do this instead:
sill "Hello Master! It's a nice day to take a walk, don't you think?"
sill "Let's go to the harbor, I want to show you a nice jewelry shop I discovered there..."
sill sad "I mean, I just want to look at it, it's not like I'm expecting a present... *blush*"


Of course, that's just my preference. Other people might reasonably disagree.


- What tools do I need to write events?

Wordpad. I'm half-kidding, because obviously it's not good for any kind of serious coding, but if you want to check any .rpy file in a pinch, Wordpad works just fine (I don't recommend Notepad, because of readability issues, and definitely not Word, which will add a bunch of metadata that will mess up your file. Notepad++ is of course fine, if you use it.).

For any serious event writing, however, you want to use a code editor that highlights various parts of the code as you type and helps with indentation. I use Editra Atom now, which works fine if you have the correct set-up. Check the Ren'py website for links to editors that work with the language, and download it from there so that the set-up is already done for you.

As for trying out your custom events, there are ways to test them directly in-game, but you might want to download Ren'py on its own anyway, if only to play through the tutorial.
They are all free distributions.


- How do I test my events in-game?

For simple events, the most convenient way might be to download Ren'py and start your own project, testing your events as stand-alones.

However, this often won't work for conditional events, because if you need to check for BK variables like player name, class or alignment, or girl love or fear, etc., the stand-alone game will start throwing errors.

So the next best thing is to test your events directly in-game.

First, you must understand this basic fact: ALL .rpy files in BK's game folder and its subfolders are read together as one big chunk of code by the game. So it doesn't really matter where you drop your code, or how many .rpy files you write, it will behave the same as long as it is dropped somewhere within the game folder and subfolders.

But just because your events are read doesn't mean they will actually play out in-game, though. To play them out, you need to go through a couple of steps:
call my_label_name

# Alternative python command if Renpy is disabled
renpy.call("my_label_name")

While this might not work for all complex events, this should be enough to get you started.

- How should I call my events?

Events are introduced by labels. The game already uses a lot of labels, so calling your event something like 'start' or 'next_day' will probably result in conflicts with the main game. I recommend using a prefix for all your events (such as: 'goldo_start' or 'goldo_next_day'), or use the new Ren'py system of local labels to avoid problems. As long as you use a unique prefix, you can then name your labels whatever you like.

- How do I make my events available to everyone?

There are a few ways:

          - The events should match the lore and direction I want for the game (more on that below)
          - The events should be bug-free, and the text seriously proof-read (no typos, missing punctuation, etc.)
 

- Can I use characters from the main game in my events?

Yes! Do keep in mind that I have plans for all of the named characters that are currently in-game, so if you want to kill them off, significantly rewrite their back-story, or change their personality completely, know that I will most likely never include your event as part of the vanilla game. You're free to do it in your own mod, of course.

But if you stick to the game characters' current personality as described in game events and refrain from going all 'game of thrones' on them, you're more than welcome to make them parts of your events, for extra flavor. :)
Title: Re: [Resources] Writing events for BK
Post by: Goldo on May 19, 2022, 09:17 AM
PART 2: HOW TO WRITE EVENTS FOR BK

This guide assumes that:

- You're looking for a quick and efficient way of trying your hands at making your own events for BK
- You have zero experience with coding
- You are willing to learn basic Ren'py and go through its tutorial

If you are already proficient with Ren'py and Python, you will know most of what is here already; but there are a few tips specifically for BK that might interest you.

Note: I have tried to use every day language here, so some of my wording might not be correct or 'pythonic'.

For any serious effort, you'll want to use a code editor. There are for instance Atom, Notepad++, Editra: they are all free. Some of them support Ren'Py (download their builds on the Ren'Py website, they come with the right set-up), but in a pinch setting them up with regular Python syntax is perfectly fine.

When writing events for BK, I generally follow these steps:

1 - Create characters and pictures
2 - Write the story and dialogues
3 - Add sound and visual effects
4 - Add conditions
5 - Proof-read and test events

You can fudge the order of steps 2-4 a little bit, but for starting out I would recommend following this primer.


1 - Create characters and pictures

This is the step where you introduce your new characters and pictures. Of course, you could also use existing characters and pictures from the game. But you will probably want to have some of your own.
For this part, let me refer you to all the great Ren'py tutorials online.

Most vanilla BK declarations happen in BKdeclarations.rpy. Declaring pictures in the classic Ren'py way is recommended. The game uses home-made 'declare' functions to save coding space, but I wouldn't recommend using them unless you know what you are doing.


Note that many characters in BK have their own portrait, so it is recommended you have one for each of your non-generic characters. Name color also changes for main characters.

For truly minor characters, most of the time, you do not need to declare them. Ren'py lets you use a string (= text between quotes) as a character's name to introduce dialogue, like this:

"Random guy" "Watch out! Aaaaaah!!!"
The name of such characters will always display in white.


2 - Write the story and dialogues

While time-consuming, this is by far the easiest part. If you would like to write events for BK, and think of yourself as a good writer, know that writing is only about 25% of the actual work. This is, however, one of the most fun (to me).

Do yourself a favor and write directly in the code editor. Copy-pasting from word processors will result in disasters more often than not (Indentation will screw you... See below.)

Ren'py makes writing story and dialog a breeze. There are a few tips specific to BK:

- The main character is referred to as 'you'. You can write any text for the MC like so:
you "Hello, world."

- It's good to add flavor to the text by using user-defined names such as 'MC.name' or 'brothel.name', like so:
sill "Hello, Master [MC.name]. I feel today will be a good day for [brothel.name]!"Note that 'brothel.name' is supposed to include the article (if applicable).

- If referring to a specific Girl object in-game, a Ren'py character is created as the 'char' property so you can write this to have the correct character show up:
girl.char "Hello, Master. I am [girl.fullname]."Where 'girl' is a variable that must been set first to the correct girl, of course. If this last part doesn't make sense to you, best to skip such events for now.


3 - Add sound and visual effects

Writing the dialogue is only half the battle in a Visual Novel, we must not forget the visuals - and sounds.


3.1 Pictures

First, you want to show relevant images as background for your dialogues.

A few common operations:

Show a black background
scene black with fade
Hides all pictures and shows a black screen with a longer Fade effect. As a rule, the game uses fades when changing scenes or when a significant stretch of time is supposed to pass in the story.

This does not, however, hide screens (such as the home menu). If needed, you can call the following BK label which should clear most screens:
call hide_everything()

Show a character
show sill with dissolve
Shows a picture on top of all other active pictures. Note that as a rule, most showing and hiding in game happens with a 'dissolve' transition. Following that rule for your events will make them integrate more seamlessly with the vanilla game.

Show an image as the background
scene black with fade
show bg spice_market at top with dissolve
This is the recommended way to show a background. If the background image is exactly the same size ratio as the screen, you could go with a simple 'scene bg xxx with fade'. However, many pictures are in a wide format that doesn't match the screen. In those cases, it is best to use the code above. The black background will avoid an ugly checkered default background from showing next to the picture.
The 'at top' instruction will align the picture at the top instead of the default bottom, where it would be hiding behind text.
Note that the game doesn't "know" that this is a background, so the picture will still show on top of all other active pictures. This is why the order of 'show' statements matters: always start with the background.

Hide an image
hide bg
hide sill
with dissolve
Hides both pictures with a single dissolve transition. Note that in many cases, 'scene black' is enough to hide all pictures: using 'hide' is only necessary when only some pictures are hidden.
When written by itself, a transition such as 'with dissolve' will apply to all the statements above it.


3.2 Transitions

You might notice the 'with' statements above. With statements introduce transitions. Ren'py comes with set transitions like 'dissolve' or 'fade' or 'pixellate', but advanced renpyists can create their own.

I heavily recommend using a transition EVERY time you show or hide a picture. Omitting a transition results in pictures popping in or out in a harsh, unnatural way.
It is also possible to use transitions by themselves, and is useful in a number of situations to create special effects.

Here are the most common transitions:

with fade
Fades to black for a second then to the new picture

with dissolveFades the new picture in/out. This is the one I use the most when showing/hiding pictures.

with vpunchI use this one a lot: it shakes the screen vertically, for instance when the player is hit. There is also 'hpunch', but I tend to use it less as I don't like the effect.

with flash
with doubleflash
These transitions flash the screen once or twice. Useful for lightning effects and, ahem, 'finish' scenes.

with pixellateBlurs the picture in or out with a pixellating effect. I use this mainly for combat KOs or deaths.

The ninja minigame has some creative uses of transitions.
It is possible to get very creative (and much, much better than I am) at using transitions. Look up 'ren'py ATL' if you want to learn more.

By all means, feel free to experiment and tinker with transitions or add your own for your events. It's part of the fun of Ren'py.


3.3 Sounds and music

It's easy to forget sound when writing events, but a few strategically placed sound effects help make the event more lively, as well as an appropriate background music.

On the other hand, sounds playing at an inappropriate time or mismatching music can take away from the event's quality. Thus, it is vital to test sounds and music carefully before releasing an event.

Also, some breaks from overbearing music is sometimes needed. Don't forget to stop the music when it is no longer needed.
To get Ren'py to play sound or music is very easy:

Sound

play sound s_punchThe 'play' command line will play sound or music. 'sound' is the channel on which it plays, in that case, it's the basic channel for sound. 's_punch' is a sound file: for ease of reference, all the sound files BK uses are defined as variables starting with 's_' and can be checked or edited in BKsettings.rpy.

Here is a more complex example:
play sound s_crash
pause 0.3
play sound2 s_wscream

This code will play the first sound (crash), wait 0.3 seconds, then play the second sound (scream). I use another channel here, 'sound2', to allow for both sounds to be heard without the second one cutting off the first one.
There are 3 default sound channels in BK: 'sound', 'sound2', 'sound3'. Note that all three channels refer to sounds in the 'game/sounds' directory. You could create your own channel if you're modding and want to use another path (see channel declaration examples in BKsettings.rpy).

Music

play music m_disco fadein 3.0Using the 'play' command line again, we can activate the 'music' channel. The music channel refers to the 'game/music' folder. For convenience, all BK musics are stored in variables starting with 'm_'.
'fadein 3.0' means that the music volume will increase gradually over 3.0 seconds. This is recommended, as it helps the music transition to be smoother.

stop music fadeout 3.0
This stops the music currently playing with a 3.0 second fadeout. Remember to shut down the music when appropriate, especially epic or dramatic music, to avoid wearing down the players' nerves.
Music will keep playing in a loop until it is actively shut down with 'stop'.
Title: Re: [Resources] Writing events for BK
Post by: Goldo on May 19, 2022, 09:17 AM
4 - Add conditions

Until now, writing an event has been laughably simple, right? Only use quotation marks, a few 'show' and 'play' commands...

But many times, you will need to use menus, or even Python code (ominous background music playing) to add various conditions so that your event feels more dynamic.


4.1 Choice menus

Let's start simple, with renpy choice menus.

menu:
    "Are you ready to use Python?"
 
    "Yes":
        "Bring it on, bitches!"
 
    "No":
        "I'd rather not, thank you very much."
This code presents a menu to the player, with the 'prompt' being the first sentence, then the choices in the menu being "Yes" or "No", followed by ':'.
Now is the time to introduce a concept that will kick your ass over and over when coding, no matter how simple or difficult the task: indentation.

As you can see, the 'prompt' and choices are indented once, meaning they are four spaces to the right of the command line menu.
This is how Ren'py knows that these are instructions linked to the menu command line (your code editor will usually auto-convert a press of the 'tab' key to four spaces as required).

The same is true for each choice: notice how each choice is followed by ':' and the following lines are indented one step further.
This is how Ren'py knows that these lines should follow this choice or that choice.

Like I said, it's easy to get indentation wrong, and all hell will break loose if you do. This code, for instance, will throw errors at you like bricks:

menu:
"Are you ready to use Python?"
 
    "Yes":
        "Bring it on, bitches!"
 
        "No":
        "I'd rather not, thank you very much."
All I did was change the indentation slightly, but that's enough to make this code an unworkable mess. This is also why you want to be using a code editor: they make indentation problems easier to spot and fix.

Indentation ruins lives. You've been warned.


4.2 Variables

Let's say that you get indentation and are not deterred by the risks to your sanity. You might think: 'Cool, I can give choices to the player, but how can I have the game remember their choices?'

To do that, you need to use python variables. It might sound scary, but it's really quite easy. Take the following code:
$ result = "Yes"This simple line creates (or overwrites if it already exists) a variable called 'result' and tells it that its value is 'Yes'. 'Yes' is called a string (basically, text) because it is contained between quotes.

Very importantly, the line starts with the '$' sign. This tells Ren'py that what follows is a python line of code. Every time you change a variable, you will need to use python, and thus, the '$' sign, so get used to it.

There are many, many things to say about python variables, but you should be able to learn little by little about them on your own.
I would recommend getting a good comprehension of strings, integers, floats, lists/tuples and dictionaries, and it should suit most if not all of your needs.

For starters, though, using simple variable like 'result' above will do, but be careful: some nouns are already used by the game (like 'game' or 'district'), others are reserved for Ren'py or Python: you should try to name your variables something unique to avoid problems.

I use the variable name 'r' or 'result' all the time in-game for storing temporary variables, so you can do the same in a pinch.

But for variables that need to be used throughout an event chain, please make sure to use a unique name (I recommend using a prefix specific to your mod to name variables, such as mymod_xxx).


4.3 Player input

Now that you know about variables, here is a useful application that you can use in your events: asking the player for input.
$ middle_name = renpy.input(prompt="What is your middle name?", default="Danger")

"Wait, [middle_name] is your middle name?"
This will show the input screen and ask the player to type something. The 'prompt' will be shown, and 'default' will be written as the default answer.
The result will be stored as the ''middle_name' variable. The second line shows how you could use it in a Ren'py sentence.

Important: Note that even though renpy.input is specific to Ren'py, this line is still python code, so it needs to be introduced with '$'.

Side note: Results of 'renpy.input' are stored as strings (text). If you want the player to input numbers, you need to convert the result to a number format like float or integer, likeso:

$ number = int(renpy.input(prompt="Go ahead, pick a number.", default=1))

4.4 If clauses

Arguably the cornerstone of programming, the 'if' clause is of major importance to make many events work.

'if' typically comes with secondary clauses such as 'elif' and 'else':
if number > 0:
    "The number is positive."

elif number < 0:
    "The number is negative."
 
else:
    "The number is zero."
'elif' means 'else if' and is useful to check other conditions after the first one. 'else' activates if no prior condition was met. Note that 'if', 'elif' and 'else' must be followed by ':', and (typically) an indented block, otherwise you will get errors.

Interestingly, Ren'py lets you use 'if', 'elif', 'else' directly as part of Ren'py, even though they originally come from Python. So you DON'T need to use '$' with 'if' clauses in Ren'py, in fact adding it will cause errors.


Another cool feature Ren'py has is the ability to integrate choice menus and if clauses. Consider this example:

menu:
    "Do you want to buy something?"
 
    "Buy the red dress for 50 gold" if MC.gold >= 50:
        you "Give me that dress."
     
        play sound s_gold
     
        $ MC.gold -= 50
     
    "Give up":
        you "Nah, I'm just browsing."
The first choice option will only be shown if the player has at least 50 gold to pay for the dress. Neat.


4.5 Useful variables/methods

Note that the game has many built-in variables and methods that can save you time. Here are a few useful ones for events:

- MC.name is the player's name
- MC.gold is the player's gold
- MC.playerclass will return 'Warrior', 'Wizard' or 'Trader'
- MC.god will return 'Arios', 'Shalia' or None (without quotes)
- MC.get_alignment() will return 'good', 'evil' or 'neutral'
- calendar.time is a number showing the total number of days since the beginning
- calendar.get_weekday() returns the current weekday (e.g. 'Thursday')
- calendar.get_date() returns the short M/D date format (e.g. 4/25)
- calendar.get_season() will return 'winter', 'spring', 'summer' or 'fall'
- game.chapter will give you the current chapter (from 1 to 7)
- game.has_active_mod(mod name) will check if 'mod name' is activated
...

Note: 'Object properties' like game.chapter work just like regular variables. 'Methods' like calendar.get_weekday() are not variables and MUST be used with the brackets '()', otherwise you will get nasty bugs.


4.6 More advanced stuff

Using choice menus, variables and if clauses will let you do pretty much anything you want for your events with a little imagination.
Of course, at some point you might want to do something a little more complex than that.

Here are a couple of more advanced techniques you might need to use for your events.


Using 'for' loops

One of the limitations of using Python within Ren'py with the '$' sign is that you can only make Ren'py read one line at a time. So a simple 'for' loop you might be used to from other languages will cause an error.

To make it work, you need to write a python block:
python:
    hurt_girls = 0
 
    for girl in MC.girls:
        if girl.hurt:
            hurt_girls += 1

"There are [hurt_girls] hurt girls in your brothel."

The whole indented block after 'python:' is python code. Thus, there is no need to use the '$' sign anywher within that block.


Setting up a chain of events

If your event is split in several chapters, it's very likely you will want to set up a chain of events so that a second event happens the next day, or the next time the player visits a specific location...

For this, I would recommend using the mod system I implemented, using 'Goldo's cool mod' as your introduction.

If you don't want to use a mod and are willing to get into a little complexity, here is a quick and dirty cookbook to set up your event chains:

$ add_event(label = "kosmo_returns", date = calendar.time+7, type = "morning")This code will call the 'kosmo_returns' label 7 days after the current date, in the morning.

$ add_event(label = "dodgy_meeting", chance = 0.5, type = "city", location = "thieves guild")This code has a 50% chance of calling the 'dodgy_meeting' label the next time the player visits the Thieves guild.

Accepted values for 'type' here are 'night', 'morning', 'any', and 'city'.
The add_event() function can be found in BKfunction.rpy and takes many other useful arguments.

Those two examples should be enough to get you started. Drop me a PM if you need to do something more advanced and can't figure out how to go for it.


5 - Proof-reading and testing events

Did you think you were finished? Far from it. Proof-reading and testing is by far the most time-consuming part of making events.

If you are not spending at least as much time testing as you did on steps 1 to 4, you're doing this wrong!

Yes, testing is tedious, but it's the only way to make sure your events are bug free and that the 'flow' of the event with its different parts (text, pictures, sounds, effects, choices...) feels good and natural.
As for typos, well, some people don't care, but I do. Typos or poorly-written lines are immersion-breaking and will make your events look amateurish.

I personally try to eliminate typos whenever possible, and would not consider making any event part of the main game if it had sloppy spelling. I'm glad people like DougTheC are here to kick my butt when I let some slip!

When you are reasonably proud of your work, don't forget to put it out there for other people to test it! People might see things differently and help you catch the last remaining bugs or typos. Plus, it's a great motivator to have people try and comment constructively on your work.

But before releasing even as a test version, make sure you did your homework first as far as proof-reading and testing goes. People are not necessarily happy to pick up the slack...



Final tips on writing events

This checklist might help you make sure that your events are not just working but actually good:

- Do the characters have an engaging personality, a believable backstory (even if it isn't spelled out in the events) and understandable motivations? (for instance: this is a H game, so obviously some women are sluts, but if all random girls you meet while doing groceries just drop on their knees to suck you off, you might be light on character background and motivation ;) )

- Don't forget the MC! Did you allow for various lines or outcomes depending on the player's class, god, alignment? Having an event where the player plays the part of a romantic hero might look very odd in the middle of an evil playthrough.

- Did you remember to cover exceptions (e.g. the player must pay but has no money, a girl is picked from the brothel but the player has 0 girls, ...)?

- Are the events written in digest chunks and not too long?

- Are your sentences reasonably short and to the point?

- Are there no bugs or typos?

- Is the event fun?

Perfect then. I can't wait to see what you come up with! 8)
Title: Re: [Resources] Writing events for BK
Post by: Goldo on May 19, 2022, 09:18 AM
PART 3: THE LORE

I've always thought that making a hentai game does not mean that the game shouldn't have an engaging back story, so I've put some efforts into making a world that is fleshed out.
Event writers will find some background information below. I've kept all of this spoiler free, even though many of the details below can be learnt simply by playing the game and paying attention to the small talk.

The world of Brothel King

Welcome to the world of Brothel King!
A world of fantasy where gods, magic and monsters are all facts of life.
The main continent, Xeros, contains all kinds of climates and cultures, and the game's location, the city of Zan, heavily draws from oriental influences.
While the world's advancement could be compared to our own medieval/early renaissance period, magic and ancient technology means that pretty much anything is possible.


Society and culture

Obviously, as befitting a hentai game, sex plays a large role in this world and the people's morals regarding sex are a lot looser than IRL. In particular, things like harems, prostitution, sexual slavery, having sex with monsters (don't try this at home)... are not frowned upon so much.

These are normal occurrences for the people in this world, and they just don't think too hard about it. Of course, 'reputable' people still care about looking moral and chaste, so they still make some effort to hide their personal kinks.

As the game is set in a medieval/fantasy setting, there are kings and nobles, peasants and serfs. Social class plays a much larger part in Xeros than it does in your own place and time (hopefully).

Nevertheless, the times they are a-changin', and wealthy bourgeois often wield just as much if not more power than many high-born nobles, thanks to the almighty denar (the currency of Zan, and one of the most commonly used in Xeros). Organized religion and the military also play their parts at leveling the playing field a little between the elites and the masses, even though they are also dominated by the noblety.


Geography

(https://i.imgur.com/kvLmtaZ.jpg)

BK's main events are set in Zan, aka the City of Jade, the most prosperous city on the super-continent of Xeros (very cool map courtesy of Neronero).

Zan sits in the North-East corner of Xeros, with easy access to major sea routes and surrounded by good agricultural land. It has a mix of oriental influences drawing from the real world, from the Middle East to India or Japan. Zan's wealth is built on trade and slave trading, and its economy is as strong as its leaders are divided and weak. Corruption runs rampant, as a matter of course.

Other major locations in Xeros can feature in your events, if they strike your imagination:

The Holy Lands: The Holy Lands are wild lands in the North of Xeros, layered with jagged mountains and dense forests where the god Arios is said to have first descended on Xeros. A bloody war has been waged here for years, involving humans, non-humans and monsters to settle the control of this region. This is where the Warrior spent most of his adulthood.

Karkyr: Smack in the center of Xeros, Karkyr is the City of Mages, a place where magic-users gather to learn and experiment freely with magic. Karkyr sits at the confluence of several rivers and atop a powerful magical nexus, allowing its inhabitants to easily use magic to improve their daily lives. This is where the Wizard used to study.

The Arik mountains: These high peaks sit between the Holy lands and Karkyr, some ways off from major trade routes and settlements. They have a mystical aura, and many legends feel alive there, attracting hermits and rogues alike.

Westmarch: The West of Xeros is occupied by feuding principalities, where dozens of minor noble families vie for power, prisoners of a complex network of alliances and grudges that are often inscrutable for foreigners. The Princes tend to live easy and privileged lives, with some being eager patrons of science, arts, and magic, while their subjects live squalid lives of hard menial and agricultural labor to pay for it all. Westmarch is where the Wizard used to work as an advisor to a local prince.

Borgo: Borgo is Zan's main rival as a major port, located further South in the East of Xeros. Called the Harbor city, it sits at the entrance of a massive river that allows for boat transport to reach as far inland as Karkyr.
Borgo is significantly rougher than Zan with lots of poor, working class people or outlaws. Only a loose coalition of merchants and middle class citizens calling itself the 'Republic' ensures something akin to 'Law and order', still leaving a lot to be desired. This is the native city of the Trader.

Hokoma: The far South of Xeros is at first a large desert, then covered by dense jungles that haven't been properly mapped yet by the 'civilized'. There aren't any large settlements, but a great many nomad tribes, some of them with truly bizarre cultures and rituals. They sometimes venture North to acquire modern goods and captives. This is where the Trader lost his previous livelihood in an ambush.

The Goliath desolations: In the far North-West of Xeros sits a harsh realm of ice and rock known as the Goliath desolations. Forgotten to many, the West of Xeros was once a center of culture and power rivaling the East, but this ended long before recorded history. Legend has it that it used to be a charming and bucolic place, full of green pasture, but it all ended during the time of the Goliath invasion. A nearly mythical event in Xeros, the invasion or invasions were a terrible war fought against a mysterious people of giants, that found its conclusion in the infamous wastes. Whatever happened, it devastated the land so that, to this day, it remains harsh and barren. Human settlements still cling to the desolations, perhaps remnants of large cities that existed before the event. The people there are hardened Nordic folks, used to handle the brutal cold and many dangers of the desolations.

The Blood Islands: A hundred miles off the coast of Zan lies a large archipelago called the Blood Islands. It is surrounded by the Blood Sea, which gets its name from the reddish color of the ocean and the violent reputation of the islands' slavers.
The absolute masters of the islands are the Blood Council, powerful nobles and mages said to have high-elf blood running in their veins. They are cruel slavers who made their reputation on their creativity and ability to accommodate every customer need - for a steep price.

Other places: This only scratches the surface of the massive continent that is Xeros. In addition, there are many stories about what lies beyond the seas that surround it. Some large islands trade heavily with the continent, while other landmasses remain completely unmapped. A few mad men claim there are even other continents out there, but if it's true, no reliable scientific expedition has been able to prove it. Not that there are many of these, of course, as most governments in Xeros are too weak or self-centered to support such intellectual endeavours.


Politics and religion

Zan is a city-state ruled over by a king for the past 20 years, Pharo the First, from the Pharo dynasty. The king is a widower with an only daughter, princess Kurohime. The king's grip on power is weak, however, as the real power in Zan belongs to a coterie of wealthy nobles and bourgeois guilders that control the flow of trade and slavery. The high level of corruption in Zan means that most of the city's loyalty is up for grabs, and that any faction's domination is short-lived.

The weakness of the King is seen as an advantage by many, thus the unrest has not affected the stability of the royal family so far. Princess Kurohime is now ripe for marriage, however, and the city is holding its breath to see which noble family will gain an edge by allying itself to the King's bloodline. The King's choice in this matter could very well upset the fragile balance between the big families and power brokers that compete for control.

As befits a city-state, the King's powers only cover Zan and its surrounding lands. Xeros is home to hundreds of big or small and realms which all have their own system of government, such as the Princes of Westmarch, the Elder Circle of Karkyr, the Freelancer Republic of Borgo, the Blood Council of the Blood Islands...

The weakness of most of Xeros's governments means that many private organizations wield just as much if not more power, especially the guilds that exist for every possible trade, and the churches or cults. Some major factions of note:

The Slavers Guild: This guild handles most slave trading in Xeros and is especially powerful in Zan. They are a separate organization from the Blood Islands slavers that provide the continent with some of the highest priced sex slaves. The two organizations mostly ignore each other, although some kind of deal must have been struck in the shadows to prevent them from encroaching on each other's turf.

The Magic Guild: This guild handles the affairs of magic-users away from Karkyr, where its headquarters are located. The magicians are always eccentric and aloof, and prefer to handle their affairs between themselves. They also worry (with good reason) that ill-informed citizens might sometimes mistake their lawful magical activities for the forbidden kinds, such as necromancy or sexomancy, and burn them at the stake before asking questions.

The Thieves Guild: This guild is very secretive, some even doubt it really exists, as thieves are not likely to be able to trust each other enough to organize themselves. Its headquarters are rumored to be in Borgo. It has strong links to the Goddess Shalia.

The Arios Church: The leading cult in Xeros, the Arios church and its followers worship Arios, the Sun, god of Light and Strength. It is a powerful and flamboyant religion, which tends to be rigid and intolerant of other creeds and minorities. Its seat of power in Zan is the Cathedra (no final 'L'), currently operated by nuns (the high priest and knights are at war).

The Shalia cult: Not an organized religion, but still a popular one, Shalia followers worship the Moon, goddess of Shadows and Cunning. It is a favorite among misfits and outlaws. Arios followers don't like it one bit.

The elder races: Wood elves are the main elder race that people think about, but these includes many other beings from diminutive fairies to dog, cat or fox people, to sentient dragons and giants. Elves, animal people and similar races are known as 'the fairy people'; they live a lot longer than humans, and most of them are female, for reasons unknown (convenient, eh?). They aren't well understood by 'civilized' humans and most cling to their old nature-worshiping ways (with some notable exceptions). They rarely show up in human cities and are not welcome there, mostly because of the ongoing Holy war, where most people equate elves with the enemy.

Cimeria: An extinct race of technology-advanced beings, about which very little is known. Some say they were the dwarves or gnomes of legend. Little is left of their once mighty empire, but their ruins and artifacts still lie beneath the foundations of Zan.

The City Guard: Responsible for maintaining order in the lower quarters of Zan, they are an organized militia paid for by city taxes.

The Knight orders: In charge of the higher quarters of Zan, the knights are high-born and sworn to protect the King, although most of them also leverage their position to advance the interests of their noble family.

The Ninja Dojos: All over Xeros, ninja dojos act as training grounds, shelters and temples for the ninja and their apprentices. Each follows a given 'school' blending martial arts and combat magic. The ninjas usually work for hire, serving all sides of the many conflits plaguing Xeros, but some take sides and even forge long-lasting alliances with powerful factions.
Ninjas can be male or female, but exceptional female ninjas can be elevated to the rank of 'Kunoichi'. Their activities are even more shrouded in myth and mystery than that of the regular ninjas.


The Holy War

Although the causes of the war are murky, it started as a concerted effort by the Church of Arios to settle the Holy lands and un-root the elder races and monsters that call it home.

Much like a real-world crusade, they called on volunteers from all-over Xeros to join the war effort: some out of faith, other for glory or gold. It was conceived as a simple expedition that would crush the local resistance in a matter of months. Instead, the war has been dragging on for many years with heavy casualties and little territory gain.

The Arios armies enjoy technological and numerical superiority, but suffer from ambushes, long and fragile supply lines, and lack of knowledge of the surrounding land and environment. Their adversaries, a loose coalition of resistance fighters drawn from local villages, regional powers, mercenaries and wandering monsters or marauders, appear to be uncoordinated, but manage to continuously wear down the Sun God's followers. Frustrated at their lack of progress, the Arios armies have been known to raid and loot peaceful elven, animal people and even human villages, and cause terror and mayhem as payback against their invisible enemies.

The burden in lives and coin of the war effort is being felt widely across Xeros and fuels prejudice and resentment, especially towards elves and other elder races that are unfairly seen as enemies, regardless of their actual involvement in the war.



Final note: Hints on writing 'canon' events

If you want to write events that may become part of the vanilla game, I recommend following a few tips below. Of course, when modding or creating stand-alone events, you're free to do exactly as you please and move the story in another direction altogether.

Matching the game setting and tone

The game is set in a classic fantasy setting with some elements of steampunk. Magic, elves, monsters exist alongside humans, medieval weapons and renaissance guns...
This loose setting allows almost all kinds of stories and pictures to fit in.

While this setting gives you a very broad sandbox to play with, there are some story lines that will not necessarily fit in (modern high school drama, giant robot sci fi, 21 jump street fan fic, you name it). Use your best judgement and try to fit the setting.

As far as 'tone' is concerned, I'm going for a traditional 'light eroge setting' such as the one in Alicesoft games, for instance, which does not mean there cannot be some dark moments and story lines, but it's clear that terrible tales of bloody revenge, depressing emo drama or gory horror stories will likely not fit the general mood of Brothel King. Once again, use your best judgement to try and match the game's tone.

Allowing for different play styles

There are good and evil characters in the world of BK, and the best written events will reflect that, as well as the diversity of gods, classes, factions that the player can choose from.

Using existing locations and NPCs

When using elements from the game such as locations, NPCs... Feel free to draw inspiration from what's there or to create your own. It's safe to assume that I have a precise plan for every named character in the game.

But as long as you don't go too far, killing them off or changing their personalities in-depth, you're welcome to use them within your own events.
Title: Re: [Resources] Writing events for BK
Post by: Vaan on May 23, 2022, 06:12 PM
Hi Goldo,

I had an idea about expanding the bisexual tag by creating some events, was wondering if you would be able to point me in the right direction. At first i wanted to be able to mix two packs with tags, so that if one girl is included in the other girl's pack and you have them both, they will both appear in the event or in training, instead of calling Sil. I feel like it's a bit too complicated and came up with another idea. I wanted to check if instead of mixing packs of photos, there is an event which can include and play them one of the other. What i mean by that is, i want to create an event which includes more than one girl, will i be able to add a code which  plays images from 2 - 3 packs or more, one after the other? For instance, taking the constitution event and adding more girls to it. Instead of starting the event with only one other person, you meet 2 - 3 or more. The event then plays their constitution images, one from each pack, one after the other. Then i simply call that event "Sports Day" or something. The idea of it being, that more people are included in it and it gives you the feeling that you actually have more people in the brothel when you recruit more, instead of doing events with one person. I have this idea to try and expand some of your events and create some of my own, by including more girls into them, by playing their packs one after the other. Hope you can give me some pointers if something like that is achievable? I'm not really good at coding and i want to try and make this my first project. If it's not too hard, i will eventually use that as a base to include battle events, where if a girl has a perk warrior or something, she will be able to join those events and fight. Kind of like a mini rpg game with different characters. Her constitution and defense points will be considered and so on. I wanted to get your opinion first, because you know the game better than anyone, i want to know what i'm getting myself into and whether you think it's something too difficult for a beginner?
Title: Re: [Resources] Writing events for BK
Post by: neronero on May 23, 2022, 09:27 PM
The multi-girl bisexual events sound complicated to me, because there aren't any image tags that allow you to identify who the secondary girl is in a bisexual/lesbian picture. One way around this would be to hardcode the event to only work with specific girlpacks of your own making, but then you're putting in quite a lot of effort into a very niche event that only works under very specific conditions.

The "Sports Day"-type event on the other hand seems very achievable. Let's look at a 1-girl constitution event for inspiration (from BKday_events.rpy) and examine what we would need to change to include multiple girls:

label random_morning_events():

    # This event is a hub dispatching the various events that can happen in the morning (this avoids several events popping up at once)

    # Girl events

    $ able_girls = [g for g in MC.girls if not (g.away or g.hurt or g.exhausted)]

    if able_girls:
        $ girl = rand_choice(able_girls)
First in the line ($ able_girls...) a list of eligible girls is created by copying over every girl that's in the brothel, as long as they're not away or hurt or exhausted. Next, if that list is not empty (if able_girls:), then out of that list a random girl is selected for the event ($ girl = rand_choice(able_girls)).

This bit you would want to change to:
1) Make sure not to start the event unless there are multiple girls in the list instead of just checking that it's not empty (as many as you want to use in the event)
2) Give the random girl you pick out of the list a more unique identifier than "girl" ("girl1" will do)
3) Remove "girl1" from the able_girls list
4) Select another random girl like in step 2 with a unique identifier ("girl2")*

*There might actually be a way to instantly pick 3 random girls within a single line of code so you don't need to repeat step 3 for each girl, but this is how I would code it as a fellow amateur.

On to the event code itself:

            # Constitution event

            if ev_type == "constitution" and girl.energy >= 25:

                $ renpy.show_screen("show_img", brothel.pic, _layer = "master")
                with fade

                "As you come out for some fresh air in the early morning, rubbing the sleep from your eyes, you are surprised to meet [girl.fullname], already up and running."

                show screen show_event(girl.get_pic("constitution", "dance", "profile", naked_filter=True, soft=True), x=config.screen_width, y=int(config.screen_height*0.8), bg=None)
                with dissolve

                girl.char "One, two, three, four..."

                "She is doing her morning exercise, bursting with energy."

Wherever it says "girl" in this part of the code, you can now use "girl1", "girl2", "girl3".
For example:

                # show a picture of girl3 exercising

                show screen show_event(girl3.get_pic("constitution", "dance", "profile", naked_filter=True, soft=True), x=config.screen_width, y=int(config.screen_height*0.8), bg=None)
                with dissolve

                # the other girls comment

                girl1.char "Wow, look at her go... Where does she get the energy?"

                if girl2.personality.name == "creep":
                    girl2.char "I want to taste her sweat!"
                else:
                    girl2.char "Let's join her!"
Title: Re: [Resources] Writing events for BK
Post by: Vaan on May 23, 2022, 11:23 PM
I'll give it a go, thank you. Have been trying to copy some of the original code and change it around a bit for the past few hours, and i keep getting errors...I'll give your example a try tomorrow and see where it leads me. Thank you!
Title: Re: [Resources] Writing events for BK
Post by: Hareb on May 24, 2022, 07:15 AM
The sports day sounds like a good idea for an event.  8)

I just wanted to add: if enjoy writing, there is still one personality (Easy) up for grabs in the Community Dialogue Project.

It doesn't require knowledge of Python, but will familiarise you a bit with how the markup in Ren'Py works. I've been planning to get into writing events once I'm done with dialogue.
Title: Re: [Resources] Writing events for BK
Post by: Vaan on May 24, 2022, 05:47 PM
Thank you, i'll give it a go over the weekend and see how it feels, it was nothing but errors yesterday and i gave up. I will give it a try when i'm not working and see what happens. I have so many ideas for this game, but i have no idea how to make them a reality and it's a bit frustrating haha. Will let you know if i go through with it :)
Title: Re: [Resources] Writing events for BK
Post by: neronero on May 24, 2022, 07:23 PM
I started out the same way ;D in fact I'm still outstanding at producing errors.

Feel free to share your progress/errors if you're starting to get a headache from banging your head into the wall.
Title: Re: [Resources] Writing events for BK
Post by: Vaan on May 24, 2022, 07:32 PM
Will do, thank you! I think i'll start small and just add a function after function to familiarise myself with coding. I thought i could do it all immediately and went to try what was probably the more advanced code. I started small today, by just adding some sound and a dialogue, will slowly build up on that, was happy when it worked
Title: Re: [Resources] Writing events for BK
Post by: Goldo on May 27, 2022, 02:25 PM
Quote from: Vaan on May 23, 2022, 06:12 PMHi Goldo,

I had an idea about expanding the bisexual tag by creating some events, was wondering if you would be able to point me in the right direction.

Ouch, wall-of-text alert ;)

I will try to break it down in smaller sections and answer your questions.


QuoteAt first i wanted to be able to mix two packs with tags, so that if one girl is included in the other girl's pack and you have them both, they will both appear in the event or in training, instead of calling Sil. I feel like it's a bit too complicated and came up with another idea.
Some tips to help you achieve this:

1/ How to check if a girl exists in your brothel with the right template:
$ girl_list = [g for g in MC.girls if g.pack_name == "Boa Hancock"]

if girl_list:
    $ girl = rand_choice(girl_list)

This code will check if one or more of the brothel girls follows the Boa Hancock template (must be spelled like the girl pack folder name), and return one of them as "girl", or False if there are none.


2/ How to create a girl on the fly (if you'd like her to show up anyway):
$ girl = create_girl("Boa Hancock", free=False, force_original=True, level=1)
The first argument is the girl pack folder name. The next 3 arguments allow you to create either a slave or a free girl, decide if she's an original or a clone, and decide her starting level. They can be omitted if you are fine with the default options above.

3/ Where should you edit the code to add the extra girl:
Check 'BKinteractions.rpy' and check the references to "bisexual" acts to edit those sections.

QuoteI wanted to check if instead of mixing packs of photos, there is an event which can include and play them one of the other. What i mean by that is, i want to create an event which includes more than one girl, will i be able to add a code which  plays images from 2 - 3 packs or more, one after the other? For instance, taking the constitution event and adding more girls to it. Instead of starting the event with only one other person, you meet 2 - 3 or more. The event then plays their constitution images, one from each pack, one after the other. Then i simply call that event "Sports Day" or something. The idea of it being, that more people are included in it and it gives you the feeling that you actually have more people in the brothel when you recruit more, instead of doing events with one person. I have this idea to try and expand some of your events and create some of my own, by including more girls into them, by playing their packs one after the other. Hope you can give me some pointers if something like that is achievable? I'm not really good at coding and i want to try and make this my first project.

Some pointers:

1/ How to get several random girls from your brothel:

if len(MC.girls) >= 3: # Important to check that there are enough girls in the brothel before attempting this
    $ girl1, girl2, girl3 = rand_choice(MC.girls, 3)
This will fetch 3 girls from the brothel, but you can of course edit the code to fetch a different number of girls. If you want to fetch girls from the city instead, you could replace instances of 'MC.girls' with 'game.free_girls'.

2/ How to display a girl's picture

neronero's suggestion is fine:
# show a picture of girl3 exercising
$ pic = girl3.get_pic("constitution", "dance", "profile", naked_filter=True, soft=True)
show screen show_event(pic, x=config.screen_width, y=int(config.screen_height*0.8), bg=None)
with dissolve

Some explanation of what's going on here.
$ pic = girl3.get_pic("constitution", "dance", "profile", naked_filter=True, soft=True)This part will look for a picture from girl3 in the following order of preference: 'constitution', then if not found 'dance', then if not found 'profile'. The picture will be naked or not depending on girl's current status, and exclude hardcore acts.

show screen show_event(pic, x=config.screen_width, y=int(config.screen_height*0.8), bg=None)This part displays the image as an event that takes up 100% of the screen width and 80% of the screen height (leaving enough room at the bottom for text). There is no background (bg).

with dissolveThis adds a dissolve transition to make the display smoother.

Once the event is done, you'll want to hide it with the following code:
hide screen show_event
with dissolve

This will be fine for a start. For more in-depth understanding, check the 'get_pic' picture in BKgirlclass.rpy (but be warned that it is quite complex).

QuoteIf it's not too hard, i will eventually use that as a base to include battle events, where if a girl has a perk warrior or something, she will be able to join those events and fight. Kind of like a mini rpg game with different characters. Her constitution and defense points will be considered and so on. I wanted to get your opinion first, because you know the game better than anyone, i want to know what i'm getting myself into and whether you think it's something too difficult for a beginner?
I definitely don't recommend biting more than you can chew at the moment, but yeah in the long long run it's definitely possible. The coding is not the hard part, the system design is. One word of caution: as I remember, the SimBro-like Pytfall devolved into a rpg battle sim at some point and this more or less killed the project. It's easy to overcomplexify things when designing new systems. I like to quote the KISS mantra, even though I often fail at it.
Title: Re: [Resources] Writing events for BK
Post by: Goldo on May 27, 2022, 03:39 PM
Does anyone have a copy of the cool map that someone made to illustrate the lore?
Title: Re: [Resources] Writing events for BK
Post by: neronero on May 27, 2022, 04:00 PM
With regions/roads/cities (https://i.imgur.com/kvLmtaZ.jpg)
Without labels (https://i.imgur.com/F0Bj5Bh.jpg)

PSD file (https://mega.nz/file/x0YQhAqD#1KHHmKbWQmNfiCv7uOKjyUnaXB939LPY5LkwBLcLWiQ)
Title: Re: [Resources] Writing events for BK
Post by: Goldo on May 31, 2022, 02:46 PM
Awesome! Was it yours? I'd like to credit the artist! ;)
Title: Re: [Resources] Writing events for BK
Post by: neronero on May 31, 2022, 03:26 PM
(https://i.imgur.com/7hk7lRl.gif)

Credit me, senpai!
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Jun 03, 2022, 09:49 AM
Take the credit you filthy animal!!!

(https://pa1.narvii.com/5788/8f860c40288a3097f7a38126c893131e479e29e0_hq.gif)
Title: Re: [Resources] Writing events for BK
Post by: reddok on Aug 13, 2022, 05:42 PM
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?
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Aug 22, 2022, 03:40 PM
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
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Aug 23, 2022, 10:06 AM
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):

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!
Title: Re: [Resources] Writing events for BK
Post by: Hareb on Sep 25, 2022, 01:43 PM
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.
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Sep 25, 2022, 01:48 PM
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)
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Sep 25, 2022, 02:40 PM
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.
Title: Re: [Resources] Writing events for BK
Post by: Hareb on Sep 25, 2022, 05:20 PM
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
Title: Re: [Resources] Writing events for BK
Post by: neronero on Sep 25, 2022, 05:50 PM
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?
Title: Re: [Resources] Writing events for BK
Post by: Hareb on Sep 26, 2022, 05:41 AM
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...
Title: Re: [Resources] Writing events for BK
Post by: Hareb on Sep 30, 2022, 05:56 AM
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.
Title: Re: [Resources] Writing events for BK
Post by: neronero on Sep 30, 2022, 06:11 AM
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():
Title: Re: [Resources] Writing events for BK
Post by: neronero on Oct 03, 2022, 10:48 AM
Friends and Foes.zip

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
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Oct 04, 2022, 08:31 AM
Quote from: neronero on Oct 03, 2022, 10:48 AMFriends and Foes.zip
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.

Thanks, looks cool!

I wonder if the frequency is not a bit too high (72% of showing dialogue on any given day if pulling a girl with both friends and rivals, which should happen fairly often), but it'll take some practice playing to see how it pans out.

Another remark, you can replace this chunk of code:
          other_girl_list = []
               
          for candidate in MC.girls:
              if candidate != girl:
                  if not candidate.away:
                      other_girl_list.append(candidate)

With this single line:
other_girl_list = [g for g in MC.girls if g != girl and not g.away]which I think is one of the sleek cool things about Python.

Title: Re: [Resources] Writing events for BK
Post by: Hareb on Oct 12, 2022, 07:53 PM
Here's an updated version of the bookworm event, if someone wants to test. I've added four different reactions based on her preferences > 200 > 80 > 20 > completely refuse. Also, the dialogue is now a bit different, if she working or having a day off.

It now also shows pictures and does something to stats for various outcomes. Both of these could use some tweaking, since I am not so sure, what is an appropriate gain from training from game balance POV.

Also, the image tags could be more specific. I am not that familiar with the extended image tag system, since I've never compiled girl packs (figured there are enough people without me).

Bisexual training currently produces an error message. Also, I am not sure how to remove naked training option, if she is already nude.

Nonetheless, this is heaps better than previous file and most options work, if someone wants to give this a try  8)
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Oct 18, 2022, 03:22 PM
Thanks, I will try and take a look this week when I'm able.
Title: Re: [Resources] Writing events for BK
Post by: Hareb on Oct 18, 2022, 07:58 PM
It would be great, if you do. I could probably try and fix the bisexual checks (it's not girl.get_sex_attitude('bisexual') - is it?), but it will require some balancing by you in case, as I don't know my way around all the stats.

Also, I am currently really busy at work and have something every evening this week apart from Sunday. Things are very different than they were, when I got into BK during the lockdowns...

At least, the writing should be there
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Oct 21, 2022, 02:54 PM
Hi, so here is some feedback on what I had time to try:

- Nothing seems broken in the code so far, so congrats!

- The sequence of events is strange when she refuses. For instance, I got this order of dialogue:
Spoiler
you "Let's see what you have learned! You know how to suck a mango, right?"
girl.char "I love sucking mango fruit, Sir. They're delicious!"
"She gets on her knees and begins to service your cock."
"She refuses."
girl.char "No way! I'm not actually doing that! I was mildly interested. That's why I picked the book."
girl.char "but I am not putting that thing in my mouth!."
"She rushes off."
[close]
Which doesn't make sense. You should probably put the conditional on refusing earlier in the interaction.
It seems to be the same for other sex acts.

- In general, I feel the tone of the girl's answers is very friendly, but that might not suit a girl that hates or fears the player. Some alternate lines here and there could help. In the end, you'll want to make use of the dialogue system (but that can wait).

- It's good to see you thought to include a conditional for taking a girl's virginity, congrats on that. It's easy to forget.

- I don't think it makes sense that every girl would be into spanking. You should probably add a check for a certain Fetish score and/or the Spanking fixation.

- Regarding typos, I spotted various sentences starting without caps, and some odd punctuation here and there.

- Minor immersion thing, but girls will mention their reading 'hobby', even though it is not one of their in-game hobbies as discovered through free girl interactions.

- I recommend thinking next about the skills and variables you want each outcome to affect. I see you left comments but it would be better with precise values and I found it lacked impacts on mood/love/hate (for instance, making her clean up the brothel on her free day is unlikely to make her very happy).

Information for others: For anyone who's curious to try this, you need a brothel with at least one girl who is a nerd, loyal or class president (personality-wise), and a minimum libido and obedience of 60. Then, you can run 'call test_hareb' in the console (shift+o), or use the test event cheat with 'test_hareb' (don't include the quotes).
Title: Re: [Resources] Writing events for BK
Post by: Hareb on Oct 23, 2022, 04:52 PM
Thanks so much for the feedback ... 8)

It's much better than I thought, if there's nothing broken. Is there not an error message with bisexual training?

Quote from: Goldo on Oct 21, 2022, 02:54 PM- The sequence of events is strange when she refuses. For instance, I got this order of dialogue:
Spoiler
you "Let's see what you have learned! You know how to suck a mango, right?"
girl.char "I love sucking mango fruit, Sir. They're delicious!"
"She gets on her knees and begins to service your cock."
"She refuses."
girl.char "No way! I'm not actually doing that! I was mildly interested. That's why I picked the book."
girl.char "but I am not putting that thing in my mouth!."
"She rushes off."
[close]
Which doesn't make sense. You should probably put the conditional on refusing earlier in the interaction.
It seems to be the same for other sex acts.

Yes, that's clearly mistake in placement of the if/elif structures. I'll get it fixed.

Quote- In general, I feel the tone of the girl's answers is very friendly, but that might not suit a girl that hates or fears the player. Some alternate lines here and there could help. In the end, you'll want to make use of the dialogue system (but that can wait).

Ah, so I should add a bit more dialogue for those...

I'll also add checks for spanking fetish and write some dialogue for girls who are not into that (it's a very well designed book cover though :P ).

Quote- Regarding typos, I spotted various sentences starting without caps, and some odd punctuation here and there.

I hope I can do some proofreading at some point. Most of the dialogue has been written late in the evening, when I am not at my most careful... so typos and weird punctuation may happen.

Quote- Minor immersion thing, but girls will mention their reading 'hobby', even though it is not one of their in-game hobbies as discovered through free girl interactions.

And I'll change the wording for that too..

Quote- I recommend thinking next about the skills and variables you want each outcome to affect. I see you left comments but it would be better with precise values and I found it lacked impacts on mood/love/hate (for instance, making her clean up the brothel on her free day is unlikely to make her very happy).

Alright... I'll try to be more precise about which values exactly change. Many of the comments are from very beginning, when I wrote the event as independent Ren'Py thing and had even less idea of how BK, Ren'Py and Python work. I've been watching some tutorials for both Ren'Py and Python as well.

Title: Re: [Resources] Writing events for BK
Post by: Goldo on Oct 27, 2022, 03:34 PM
Cool! Once you have a more precise idea on the impacts of each outcome, I can give you pointers on how to implement it in-game (i.e. turn the comment into a line of code that works).

The final step will be to integrate it in the daily event system.

(sorry I have not tested the bi event, so there might still be a bug there)
Title: Re: [Resources] Writing events for BK
Post by: Hareb on Nov 16, 2022, 07:02 PM
Quote from: Goldo on Oct 21, 2022, 02:54 PM- In general, I feel the tone of the girl's answers is very friendly, but that might not suit a girl that hates or fears the player. Some alternate lines here and there could help. In the end, you'll want to make use of the dialogue system (but that can wait).

- I don't think it makes sense that every girl would be into spanking. You should probably add a check for a certain Fetish score and/or the Spanking fixation.


The last few weeks have been crazy at work, but finally it's easier and I've got some time to work on this...

How do I check hate and fear values?

How do I check, if the girl has a negative fixation about spanking?
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Nov 18, 2022, 11:30 PM
Quote from: Hareb on Nov 16, 2022, 07:02 PM
Quote from: Goldo on Oct 21, 2022, 02:54 PM- In general, I feel the tone of the girl's answers is very friendly, but that might not suit a girl that hates or fears the player. Some alternate lines here and there could help. In the end, you'll want to make use of the dialogue system (but that can wait).

- I don't think it makes sense that every girl would be into spanking. You should probably add a check for a certain Fetish score and/or the Spanking fixation.


The last few weeks have been crazy at work, but finally it's easier and I've got some time to work on this...

How do I check hate and fear values?
girl.get_love() # Returns a value from +125 to -125 (capped +/-25 per rank)
girl.get_fear() # Returns a value from +125 to -125 (capped +/-25 per rank)

QuoteHow do I check, if the girl has a negative fixation about spanking?
girl.has_fixation("neg", "spanking") # Returns True or False
Easy, ain't it?
Title: Re: [Resources] Writing events for BK
Post by: Hareb on Nov 22, 2022, 07:08 PM
Thanks!

Easy, if you know your way around all the various files with stats, which I can't say I do...

Still, there was a warning in the tutorials at the start of the thread that it's easier to start with linear events featuring set characters than brothel day events, which I of course ignored  8)
Title: Re: [Resources] Writing events for BK
Post by: reddok on Dec 22, 2022, 06:53 PM
Hi everyone.
I'm back after a very busy year with not much to show and a question.

I'm looking for a way to add custom personalities that are not tied to an specific girl's _BK.ini
Sadly I'm not any more experienced than before, so I'm having trouble figuring out how, or even if it is possible to do so.

The reason why is I'm trying to make a series of events that will end with the addition of a girl to the brothel. Said girl would get a different personality depending on the decisions the player made along the way, and I want the dialogues to reflect them.
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Dec 23, 2022, 12:56 PM
Quote from: reddok on Dec 22, 2022, 06:53 PMHi everyone.
I'm back after a very busy year with not much to show and a question.

I'm looking for a way to add custom personalities that are not tied to an specific girl's _BK.ini
Sadly I'm not any more experienced than before, so I'm having trouble figuring out how, or even if it is possible to do so.

The reason why is I'm trying to make a series of events that will end with the addition of a girl to the brothel. Said girl would get a different personality depending on the decisions the player made along the way, and I want the dialogues to reflect them.

There are several ways to do this, all are fairly advanced. Here is what I would recommend:

1) Create your new Personality as an instance of the Personality() class in a custom .rpy file
2) Append your personality to the gpersonalities dictionary (after init).
3) Force personality change in-game using the generate_personality() method of the Girl() class. This will likely work, but you may get some potentially weird misalignment of backgrounds, traits and sexual preferences, depending on how far the new personality is from the original one.
4) If you can't live with that, you may need to force the re-generation of background/preferences, and possibly overwrite traits. The drawback is the player may notice the changes and get confused.

If the above does not make sense, you are probably not ready.
Title: Re: [Resources] Writing events for BK
Post by: Raptor010 on Jan 05, 2023, 12:20 AM
I have some useful links for anyone looking to get into making events from an old user by the name of Poke. These have all been rehosted into a new Drive:

This first document has some small explanations and links to documents/packs with events in them. (Some links are broken):
https://docs.google.com/document/d/1Ywc4I5_0jFw7lrqASYtJX8szAS9TCFyx_xP4FbhNLMM/edit?usp=sharing (https://docs.google.com/document/d/1Ywc4I5_0jFw7lrqASYtJX8szAS9TCFyx_xP4FbhNLMM/edit?usp=sharing)

This document explains Transitions, writing events, sizing, and has coding examples for multiple possibilities:
https://docs.google.com/document/d/1yITTRpLA1yKAp2ejL49bGdwieP5rV7KsGw3hUZgsYFc/edit?usp=sharing (https://docs.google.com/document/d/1yITTRpLA1yKAp2ejL49bGdwieP5rV7KsGw3hUZgsYFc/edit?usp=sharing)

This document is an example of how they laid out their events and planned them in advance (Nessa). This may provide some insight and assist with anyone looking to plan their own:
https://docs.google.com/document/d/1n0543MgP6TCOC3hAvsHsiCs03wokBWjX1yj26ZUSo_I/edit?usp=sharing (https://docs.google.com/document/d/1n0543MgP6TCOC3hAvsHsiCs03wokBWjX1yj26ZUSo_I/edit?usp=sharing)
Title: Re: [Resources] Writing events for BK
Post by: neronero on Jan 20, 2023, 09:45 PM
I'm trying to make girls gossip about one another while they're not around (escaped, exhausted, hurt)

Example:
Quotecall dialogue(girl1, "gossip intro")
Girl 1: "Did you hear the news about [Girl 3]?"

call dialogue(girl2, "gossip topic")
Girl 2: "I know, right? She totally has stallion-AIDS now."

The problem is/was: How can I put [Girl 3]'s name in [Girl 1]'s mouth, while still using the dialogue system.

The best I've come up with after some tinkering is this:
# Add dialogue lines on the topic with placeholder substrings (or whatever their official name is)
add_dialogue("gossip intro", ("very modest"), ("Does anyone know where %s is?"))

# Find dialogue on the topic
dialogue_object = pick_dialogue("gossip intro", "very modest")

# Modify the line within the dialogue object before it's spoken
dialogue_object.line = dialogue_object.line % (girl3.name)

# Say the modified line
dialogue_object.say(girl1.char)

# Keep the rest of the gossiping interaction simple, not using girl3's name but just "she"/"her"
call dialogue(girl2, "gossip topic")
One thing that's annoying about this is that I can't give pick_dialogue() multiple keys (to also search for personality + attributes) - but I guess I could run it 3 times with a different key each time, and pick randomly from the 3 results.

Other than that, it sorta works. But I'm just stumbling along, so maybe there's a more obvious solution I'm missing?
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Jan 27, 2023, 11:49 AM
Before diving into anything too complicated, this seems to work well enough:

add_dialogue("gossip intro", ("generic"), ("Does anyone know where [girl2.name] is?"))

$ girl1 = MC.girls[0]
$ girl2 = MC.girls[1]

call dialogue(girl1, "gossip intro")

It also works with multiple dialogue:

add_dialogue("gossip intro", ("generic"), ("g: Does anyone know where [girl2.name] is?", "mc: You mean [girl2.fullname]? I haven't seen her."), multiple=True)

$ girl1 = MC.girls[0]
$ girl2 = MC.girls[1]

call dialogue(girl1, "gossip intro")
Title: Re: [Resources] Writing events for BK
Post by: ron1 on Mar 15, 2023, 05:57 PM
hi everyone,

i tried to make something (not a mod, more like a 1 time event). but i have a few issues, i wanted to make something for later in the game (for around chapter 4 or 5 or so). i repeat do not direct install this, it does not work, i wanted to let this trigger around entering chapter 4 + 20 days, but i dont know how to write it... do i need to write some troubleshooting to? i wanted to keep it simple but without these things, i cant test it. dont be to harsh  :)  and i love some feedback (i know i am going to throw some more soundstuff in, but first things first), i hope i didnt do to much mistakes. love the work put in this game so far. i am hoping that ther is still progress for 3.0 to come out

https://www.mediafire.com/folder/crfos2km0sjbn/GUP
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Mar 15, 2023, 06:15 PM
How you could do it:
- Add a 'silent' event that triggers only when Chapter 4 is reached (using the 'chapter' argument of the StoryEvent class)
- Make that event a single-line event that adds a second event with a calendar alarm set for 20 days later
- The second event is the one you want to proc

If you're not clear on how to do that, let me know and I can try and give you more detailed pointers.
Title: Re: [Resources] Writing events for BK
Post by: ron1 on Mar 15, 2023, 06:28 PM
i already looked at excisting files like the sewer girl event, but that gets triggered on location, then i tried looking at when kunoichi appeared and i didnt understand that writing either, i have seen that there is an alarm set, but i didnt understand the eventclose stuff (the eventclosing so it does not repeat itself), i am very basic in it. i wanted to do someting like this for some time, and i thought what the hell, if this is kinda working i wanna give it a shot for a repeating event, some shallow events that drain a few resources and that ´´break the game´´, in the end it gets kinda repetitive. (you got max girls, not much mre to explore.....)

thank you for replying
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Mar 15, 2023, 06:56 PM
Quote from: ron1 on Mar 15, 2023, 06:28 PMi already looked at excisting files like the sewer girl event, but that gets triggered on location, then i tried looking at when kunoichi appeared and i didnt understand that writing either, i have seen that there is an alarm set, but i didnt understand the eventclose stuff (the eventclosing so it does not repeat itself), i am very basic in it. i wanted to do someting like this for some time, and i thought what the hell, if this is kinda working i wanna give it a shot for a repeating event, some shallow events that drain a few resources and that ´´break the game´´, in the end it gets kinda repetitive. (you got max girls, not much mre to explore.....)

thank you for replying

Ok so here is a more detailed walkthrough:

1/ Add a 'silent' event that declares in Chapter 4

Somewhere at the start of your mod, you want to add an event that triggers in Chapter 4. This event will be a StoryEvent() object. Here is what it should look like:

$ daily_events.append(StoryEvent(label = "my_silent_first_event", chapter=4))

Explanation:
- daily_events is the list of events that are tested daily (unlike city_events for instance, which are tested when visiting the city)
- label is the label of your event that will be called (make it unique)
- chapter is the minimum chapter you need to reach for the event to happen

2/ Create the first (silent) event

This event is very simple, it just sets a timer so that the next event (the real one) will proc in 20 days.

label my_silent_first_event():
    $ calendar.set_alarm(calendar.time+20, StoryEvent(label = "my_second_real_event", type = "night"))
    return

Explanation:
- calendar.set_alarm(date, event) is a method that adds the given event to daily_events but sets its minimum date to the first argument value (in days). If for some reason it doesn't proc on the given date, it will proc ASAP after that.
- calendar.time is the current date in days
- type can be morning, day, night, city or any. In this example, the event will proc at night (after the player clicks the 'End day' button).


3/ Add your final real event

The only thing left to do is to create your actual event. It's up to you depending on what you want to happen.

label my_second_real_event():
    # Put any code you like here...
    return



A final note: Maybe you not only want to call events, but you want to give them arguments too (for instance, the 'girl' argument. In that case, you can do it like this:

$ daily_events.append(StoryEvent(label = "my_silent_first_event", call_args=[girl], chapter=4))

[...]

label my_silent_first_event(girl):
    $ calendar.set_alarm(calendar.time+20, StoryEvent(label = "my_second_real_event", call_args=[girl], type = "night"))
    return

[...]

[code]label my_second_real_event(girl):
    girl.char "Hi, my name is [girl.name]."
    # Put any code you like here...
    return

[/code]

Note that you must provide a list as call_args even if there is only one argument.

I hope it helps you.
Title: Re: [Resources] Writing events for BK
Post by: ron1 on Mar 15, 2023, 07:37 PM
 yeah i adjusted the file and now it keeps crashing :D, i am still an idiot

Full Traceback ------------------------------------------------------------

Full traceback:
  File "renpy/bootstrap.py", line 331, in bootstrap
    renpy.main.main()
  File "renpy/main.py", line 492, in main
    renpy.game.script.load_script() # sets renpy.game.script.
  File "renpy/script.py", line 283, in load_script
    self.load_appropriate_file(".rpyc", ".rpy", dir, fn, initcode)
  File "renpy/script.py", line 781, in load_appropriate_file
    data, stmts = self.load_file(dir, fn + source)
  File "renpy/script.py", line 594, in load_file
    stmts = renpy.parser.parse(fullfn)
  File "renpy/parser.py", line 2953, in parse
    lines = list_logical_lines(fn, filedata, linenumber)
  File "renpy/parser.py", line 238, in list_logical_lines
    data = f.read().decode("utf-8", "python_strict")
  File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python2.7/encodings/utf_8.py", line 16, in decode
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb4 in position 367: invalid start byte

Windows-10-10.0.22621
Ren'Py 7.4.11.2266
 
Wed Mar 15 20:35:53 2023

https://www.mediafire.com/folder/j21nrf6ezizl9/GUP
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Mar 15, 2023, 09:50 PM
Ok, I don't know what to tell you because this is Ren'py crashing not BK. Either you modded a native renpy file (not recommended), or you included wrong characters in your code that fuck up Ren'py.

My advice is commenting out some parts of your code until you find the likely culprit.
Title: Re: [Resources] Writing events for BK
Post by: ron1 on Mar 16, 2023, 05:30 PM
i threw everything out and started over, just trying the basics now, but how do you define a picture path? if i use this: Picture(path="NPC/GUP/sex21)

i got perhaps you left a " at the end of the first line.
if i add it, i got an error saying expected statement.
Picture (path="NPC/GUP/sex21")    (arrow backwards)
this is all i wrote for the moment, just to test the beginning

label time_for_GUP_event(): # Happens after Chapter 4 begins after 20days.


    $ calendar.set_alarm(calendar.time+1, StoryEvent(label = "time_for_aGUP_event", type = "morning"))

    return

label time_for_aGUP_event(): # Morning event


    "As you get on with your morning routine, the brothel receives some unexpected visitors."

Picture(path="NPC/GUP/sex21")

    $ MC.interactions = 0

"You have lost all remaining actions for the day."
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Mar 17, 2023, 12:00 PM
Quote from: ron1 on Mar 16, 2023, 05:30 PMi threw everything out and started over, just trying the basics now, but how do you define a picture path? if i use this: Picture(path="NPC/GUP/sex21)

You left out the " at the end in Picture(path="NPC/GUP/sex21") so it won't work. Every time you open a string with " you must also close it.

Quotei got perhaps you left a " at the end of the first line.
if i add it, i got an error saying expected statement.
Picture (path="NPC/GUP/sex21")    (arrow backwards)
this is all i wrote for the moment, just to test the beginning

The 'expected statement' error usually happens when you try to use python code in Ren'py script, aka you forgot either the '$' sign or the python: header.

Quotelabel time_for_GUP_event(): # Happens after Chapter 4 begins after 20days.


    $ calendar.set_alarm(calendar.time+1, StoryEvent(label = "time_for_aGUP_event", type = "morning"))

    return

label time_for_aGUP_event(): # Morning event


    "As you get on with your morning routine, the brothel receives some unexpected visitors."

Picture(path="NPC/GUP/sex21")

    $ MC.interactions = 0

"You have lost all remaining actions for the day."


Calling an object of the Picture class like that in the middle of the code will do nothing useful for you. If you just want to display a given picture, use renpy to define  (https://www.renpy.org/doc/html/displaying_images.html#image-statement)and then show  (https://www.renpy.org/doc/html/displaying_images.html#show-statement)the picture.
Title: Re: [Resources] Writing events for BK
Post by: darkzerotor on Mar 20, 2023, 01:58 PM
hi goldo is it possible to make the free girl only show up in a specific location rather than randomly all over the place
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Mar 20, 2023, 05:24 PM
You mean using _BK.ini? Not now unless you include custom events, but I could add this to the next version if needed.
Title: Re: [Resources] Writing events for BK
Post by: darkzerotor on Mar 20, 2023, 05:47 PM
that would be amazing  ;D
Title: Re: [Resources] Writing events for BK
Post by: Hareb on Mar 20, 2023, 07:51 PM
I was working on the 'bookworm' event I started in the autumn after quite some delay ... I can't seem to get it to launch in the console anymore (with the command 'call test_hareb')

The 'label test_hareb:' line is where it should be.

I definitely have one Loyal and one Class President in my stall, so it should work and I've tried to temporarily remove the personality requirement, so it should work with any girl.

There is no error message. The event just won't launch.
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Mar 24, 2023, 09:02 AM
Quote from: Hareb on Mar 20, 2023, 07:51 PMI was working on the 'bookworm' event I started in the autumn after quite some delay ... I can't seem to get it to launch in the console anymore (with the command 'call test_hareb')

The 'label test_hareb:' line is where it should be.

I definitely have one Loyal and one Class President in my stall, so it should work and I've tried to temporarily remove the personality requirement, so it should work with any girl.

There is no error message. The event just won't launch.

Can you put a simple line of dialogue as the beginning of your event such as:
sill 'Event launched'
so you know for certain if it is running or not? Maybe an 'if' statement is screwing with your event.

Using call in the console is vanilla renpy and very straightforward, so it should work. Sometimes the console deactivates renpy commands and restricts to python for no apparent reason (but it does give an error message). If that happens, going into the options menu then back usually reactivates them (no clue why). You would also get an error if the label didn't exist.

So the most likely scenario is that your event is indeed called, but returns immediately for some reason.

Title: Re: [Resources] Writing events for BK
Post by: Goldo on Mar 24, 2023, 05:05 PM
Quote from: darkzerotor on Mar 20, 2023, 01:58 PMhi goldo is it possible to make the free girl only show up in a specific location rather than randomly all over the place

One thing I didn't think about: Girls are 'shuffled' between locations every week. What should we do for girls that are set to a specific location by their _BK.ini setting? It would be weird if they were nailed in place.

I lean towards the following solution: Girls with that setting generate in place and do not shuffle until MC first interacts with them. After that they change locations normally.

I'm willing to hear other suggestions.
Title: Re: [Resources] Writing events for BK
Post by: darkzerotor on Mar 25, 2023, 05:19 PM
QuoteWhat should we do for girls that are set to a specific location by their _BK.ini setting? It would be weird if they were nailed in place.
I mean for normal girl it would be weird, but if it's for specific girl like a mermaid that you just want to stay at beach location or something it would be quite normal right?
Title: Re: [Resources] Writing events for BK
Post by: neronero on Mar 25, 2023, 11:29 PM
It doesn't seem that weird to me. Shopkeepers are also nailed in place and we're used to that.
If every girl stayed in place then that'd become a bit weird.
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Mar 28, 2023, 11:52 AM
Quote from: darkzerotor on Mar 25, 2023, 05:19 PM
QuoteWhat should we do for girls that are set to a specific location by their _BK.ini setting? It would be weird if they were nailed in place.
I mean for normal girl it would be weird, but if it's for specific girl like a mermaid that you just want to stay at beach location or something it would be quite normal right?

I guess, although it would slightly imbalance the game by removing the element of randomness for a particular girl, but it can be added as a _BK.ini option as well.

On the subject of _BK.ini, as I am doing some clean-up on that part of the code, are there other things you guys would like to be able to customize with it?
Title: Re: [Resources] Writing events for BK
Post by: AlolanNinetales on Jul 13, 2023, 09:31 PM
I don't know if this is the right thread for this question, but I was having trouble getting part of an event to work. I basically copied boa hancock's _events code from Gold's character and just replaced some of the text for another character. It's the part of the _events where you can go and visit her room and you find the snake in her room. Except I can never seem to get to that part of the event, whenever I visit her room the same dialogue option comes up. All the code is the exact same except for some text that I changed for my own character. The code looks like this

label tifa_lockhart_interact(girl):

    # The player is limited to one visit per day

    if girl.flags["tifa_has_visited"]:
        "You have already visited [girl.fullname]'s room today."
        return

    $ MC.interactions -= 1
    $ girl.flags["tifa_has_visited"] = True

    "You decide to pay a visit to [girl.fullname]'s bedroom."

    play sound s_knocks

    show expression brothel.bedroom_type.pic_path
    with dissolve

    ## Visits go through three stages. Each stage after the first one has a 33% chance of happening

    # First stage

    if not girl.flags["tifa_visit_stage"]:
        $ girl.flags["tifa_visit_stage"] = 1

        play sound s_door

        "[girl.fullname] is getting dressed, sitting on her bed stretching her arms."

        show screen show_event(girl.profile, x=1024, y=768, bg=None)

        you "Hey, [girl.name]."

        girl.char "[MC.name]? What are you doing here?"

        you "Hmm, I was just checking on you, wondering if everything's all right with your room..."

    if brothel.get_mood_modifier(girl.rank) < 0:
            girl.char "This place is a dump. My room was much nicer back at Seventh Heaven."

            menu:
                girl.char "This place is a dump. My room was much nicer back at Seventh Heaven."
                "Apologize":
                    you "I'm sorry, I am going to improve the facilities as soon as I can..."

                    girl.char "I sure hope so. I am beginning to miss how things were before I came here."

                    $ girl.change_fear(-1)

                "Scold her":
                    you "I don't care what you think, it's still better than that shithole of a bar I saved you from. Get ready for work, and stop complaining."

                    girl.char "What... What did you say..."
 
                    $ girl.change_love(-1)

    # Second stage

    elif girl.flags["tifa_visit_stage"] == 1 and dice(6) >= 1:
        $ girl.flags["tifa_visit_stage"] = 2

        "As you approach [girl.name]'s door, you are met with the reverberating thuds as the punching bag endures a relentless barrage."

        you "I am coming in."

        play sound s_door

        show screen show_event(girl.profile, x=1024, y=768, bg=None)

        girl.char "Huh?"

        play sound s_surprise

        girl.char "You could knock you know..."

        "[girl.name] was startled to see you. She grabs a water bottle and returns to sit on her bed."   
 
        you "You sure know how to pack a punch, where did you learn to fight like that?"

        girl.char "I had a good teacher... but that's honestly besides the point. I am not as strong as I was before, just recently my gloves broke and now I feel a lot weaker."

        girl.char "It's too bad cause sometimes customers get rough and rowdy, if only I were as strong as before then it wouldn't be a problem."

        "You examine her gloves and see they are all busted up."

        you "Damn! What did you have to beat up to wear these gloves out this badly?"

        girl.char "You wouldn't believe me if I told you..."

        you "I tell you what; if you keep being a good girl, I'll see what I can do about those gloves. Take it as a token of my appreciation for your honest work."

        "As you turn around to leave, you hear her continue to fiddle with her gloves."

        you "I can tell those gloves meant a lot to her. If I can fix them I'll be irresistible."


I can never get past the first stage of the event as it always just repeats itself. Was just wondering if anyone knows How I can change the code so I can get past the 1st stage and be able to actually complete the event.

Again, I'm sorry if this is the wrong thread to be asking this but just wanted some help, new to this whole events and coding thing. Thank you for your help!
Title: Re: [Resources] Writing events for BK
Post by: neronero on Jul 16, 2023, 07:00 PM
Quote from: AlolanNinetales on Jul 13, 2023, 09:31 PMif brothel.get_mood_modifier(girl.rank) < 0:
Looks like it's an indentation error with this line. Add four more spaces before it (eight in total)

The elif statement of the second stage is now linked to that unrelated if statement, while it should be linked to the first stage's if statement.
Title: Re: [Resources] Writing events for BK
Post by: AlolanNinetales on Jul 17, 2023, 08:55 AM
Quote from: neronero on Jul 16, 2023, 07:00 PM
Quote from: AlolanNinetales on Jul 13, 2023, 09:31 PMif brothel.get_mood_modifier(girl.rank) < 0:
Looks like it's an indentation error with this line. Add four more spaces before it (eight in total)

The elif statement of the second stage is now linked to that unrelated if statement, while it should be linked to the first stage's if statement.
Thank you this fixed it!
Title: Re: [Resources] Writing events for BK
Post by: GMWinters on Sep 22, 2023, 08:18 PM
Whelp! Given Alolan was kind enough to open the flood gates, I too have an event question that's more related to 'code' than 'writing' per se...

Can anyone explain how the Dim/Bright lights effect
Effect("boost", "customer events", 0.5, scope="brothel")would be translated to a single girl? And does the effect need to be attached to something such as a trait or can it just be attached to a girl directly? (I'm goofing around with modifying the Augment Mod code)

Any just to confirm I haven't wildly misread something... "customer events" are when a customer asks a job girl to fuck, right?
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Sep 24, 2023, 08:05 PM
Quote from: GMWinters on Sep 22, 2023, 08:18 PMWhelp! Given Alolan was kind enough to open the flood gates, I too have an event question that's more related to 'code' than 'writing' per se...

Can anyone explain how the Dim/Bright lights effect
Effect("boost", "customer events", 0.5, scope="brothel")would be translated to a single girl? And does the effect need to be attached to something such as a trait or can it just be attached to a girl directly? (I'm goofing around with modifying the Augment Mod code)

Any just to confirm I haven't wildly misread something... "customer events" are when a customer asks a job girl to fuck, right?

Minor spoiler about the game's mechanics:
Spoiler
The chance for a girl to have a special customer encounter is a flat 10%. With this effect, it becomes 15% which is 50% higher.
[close]
Title: Re: [Resources] Writing events for BK
Post by: GMWinters on Sep 25, 2023, 12:16 PM
Quote from: Goldo on Sep 24, 2023, 08:05 PMMinor spoiler about the game's mechanics:
So just to confirm:
Spoiler
Is that a 10% chance per customer for said customer to initiate an event?
or a 10% chance per night for something to happen?

Edit: Testing seems to indicate it's a per night chance.

Are modifications to that base chance additive? or multiplicative?
i.e. do two +100% chance effects result in a 30% chance or a 40% chance?
(And possibly more important, do two -50% chance effects result in 0% or 2.5%?)
[close]

And do I just drop the 'scope' parameter to make it only apply to the one girl?
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Sep 26, 2023, 07:49 AM
Quote from: GMWinters on Sep 25, 2023, 12:16 PM
Quote from: Goldo on Sep 24, 2023, 08:05 PMMinor spoiler about the game's mechanics:
So just to confirm:
Spoiler
Is that a 10% chance per customer for said customer to initiate an event?
or a 10% chance per night for something to happen?

Edit: Testing seems to indicate it's a per night chance.

Are modifications to that base chance additive? or multiplicative?
i.e. do two +100% chance effects result in a 30% chance or a 40% chance?
(And possibly more important, do two -50% chance effects result in 0% or 2.5%?)
[close]

And do I just drop the 'scope' parameter to make it only apply to the one girl?

It's a roll after each interaction, so in that case once per job girl performing every night.

Boost values are always additive, so a boost of 50% and a boost of 100% combine to +150%, that is a final result of 250% of the original value.

And yes, if you don't specify the scope, it will only apply to this girl.
Title: Re: [Resources] Writing events for BK
Post by: GMWinters on Oct 12, 2023, 01:29 PM
Is it possible to make trait effects vary depending on personality? Or would either the BK code or Renpy engine get angry if conditionals were included in a Trait?

If it matters, I was originally thinking of situations where a trait indicates action XYZ hurts and so applies some penalty to it, but it occurs to be that a Masochist girl might see that as a benefit not a downside and could instead get a bonus.

That then led me to wondering about something like a "living stereotype" trait or whatever where the girl isn't just a pervert/princess/bimbo, she's the pervert/princess/bimbo or whatnot with the specific effect varying by personality or some other variable. But I assume the code would have to be designed to handle that kind of input and probably isn't?

Title: Re: [Resources] Writing events for BK
Post by: Vaan on Nov 02, 2023, 08:59 PM
Hi guys, does anyone know if there are any good Ai out there that will help write events for BK? I honestly couldn't do much by myself and i kind of gave up. Played around and did a few simple ones like making the screen fade or adding a sound, but nothing to do with what i originally wanted haha. I tried ChatGPT, but it feels restricted, it might be able to help someone with more advanced renpy knowledge, but didn't do much for me. It can point you in the right direction, but not actually help with writing. An Ai that can possibly scan the code you give it and try to create something for you based on that code, while you edit the code after as you see fit. I feel like i will give it a second try, since i have so many ideas! But wondered if there is a simpler (and faster) way to do it.
Title: Re: [Resources] Writing events for BK
Post by: Vaan on Nov 02, 2023, 11:53 PM
Perhaps i came back wiser! Happy to share that my first ever (small and basic) event is finished. My ideas might not always align with the story Goldo is going for, but hopefully a lot of them will. Hopefully will bring something more complex in a week. One of my ideas will be to have an event where if a girl reaches love or fear =100 and MC is good, not neutral or evil, he will be able to release her from slavery and she will join the brothel as a normal worker. Obviously, it won't be easy for me to implement such a permanent and complex event into the story, but hopefully while i do these small ones, in time i will be able to do more complex ones that will change the story to an extend. I don't plan on touching the main story, just the stories that involve the brothel girls. Please find my first ever event below, ha!

I do have one question, will my event randomly play with the other ones or will i have to add it into the game somehow?

label vaan_start:


    $ renpy.show_screen("show_img", brothel.pic, _layer = "master")
    with fade

"That night i couldn't sleep, so i got up and walked around our brothel for a bit."


$ able_girls = [g for g in MC.girls if not (g.away or g.hurt or g.exhausted)]

if able_girls:
    $ girl = rand_choice(able_girls)
    show screen show_event(girl.get_pic("profile"), x=config.screen_width, y=int(config.screen_height*0.7))

    girl.char "Hello [MC.name], do you mind if i call you that sometimes?"
    with fade



    if girl.love < 25:

        girl.char "Not that it matters to me what i call you!"
    elif girl.love > 25:

        girl.char "It will make me happy if i can call you something other than master!"
    menu:
        extend""


        "Yes":
            if girl.love < 25:
                girl.char "Thank you!"
            elif girl.love > 25:
                girl.char "I knew it wouldn't be a problem for you! You're always so kind to me!"

        "No":
            if girl.love < 25:

                girl.char "I hate you!"
            elif girl.love > 25:

                girl.char "Awww, i guess i'll keep calling you Master then"
            if girl.is_("dom"):
                girl.char "Have it your way, for now!"

Title: Re: [Resources] Writing events for BK
Post by: Vaan on Nov 05, 2023, 10:18 PM
Created another one. Based it on the consitution event it's a mix from that and one of the city challenges, can't believe it actually worked. Not fully finished, but playable (works for me at least), plan to add various choices and outcomes, but will have to wait until next week. Have to figure out a way to properly get a girl's defense points into the challenges too. Once that's done, i want to find a way to make a girl's defence determine various outcomes in challenges as a "bonus". The idea being that the MC has taken one of the girls with him to the city and she will offer "bonus" support in challenge rows, depending on what her defense points are. Anyway this is what i came up with, it works for me, but you guys will probably want something more efficient

label girl_fight():
$ able_girls = [g for g in MC.girls if not (g.away or g.hurt or g.exhausted)]

if able_girls:
    $ girl = rand_choice(able_girls)
    $ ev_type = rand_choice(["constitution"])
    $ stat = girl.get_stat(ev_type)

    if stat >= 25:



        if ev_type == "constitution" and girl.energy >= 25:

            $ renpy.show_screen("show_img", brothel.pic, _layer = "master")
            with fade

            "You hear noise outside, only to find one of the girls trying to learn to fight. It's [girl.fullname]"
            show screen show_event(girl.get_pic("Profile", naked_filter=True, soft=True), x=config.screen_width, y=int(config.screen_height*0.7), bg=None)
            with dissolve
            show screen show_event(girl.get_pic("constitution", "fight", naked_filter=True, soft=True), x=config.screen_width, y=int(config.screen_height*0.7), bg=None)


            you "That's very good. You think you would be able to take me on?"





    if girl.is_("dom"):

         girl.char "You don't stand a chance against me. Leave before i beat you"

    else:

     girl.char "I am not sure, but i will give it my all!"





show screen show_event(girl.get_pic("constitution", "fight", naked_filter=True, soft=True), x=config.screen_width, y=int(config.screen_height*0.7), bg=None)
with dissolve

$ girl_def = 4 + girl.get_defense()
$ tt = show_tt("top_right")
$ chal = renpy.call_screen("challenge_menu", challenges=[("Fight her", "fight", girl_def), ("Restrict her movement", "control", girl_def)], cancel=("Give up", False))
hide screen tool
if chal == "fight":

     $ renpy.block_rollback()


call challenge(chal, district.rank+2) from _call_challenge_70 # result is stored in the _return variable
$ r = _return
if r < 0:
     you "Looks like i win, better luck next time! You have to train a lot harder to beat someone like me!"



elif r <= 2:

     girl.char "Looks like you were no match for me!"

return
Title: Re: [Resources] Writing events for BK
Post by: neronero on Nov 07, 2023, 07:24 PM
Quote from: Vaan on Nov 02, 2023, 08:59 PMHi guys, does anyone know if there are any good Ai out there that will help write events for BK? I honestly couldn't do much by myself and i kind of gave up. Played around and did a few simple ones like making the screen fade or adding a sound, but nothing to do with what i originally wanted haha. I tried ChatGPT, but it feels restricted, it might be able to help someone with more advanced renpy knowledge, but didn't do much for me. It can point you in the right direction, but not actually help with writing. An Ai that can possibly scan the code you give it and try to create something for you based on that code, while you edit the code after as you see fit. I feel like i will give it a second try, since i have so many ideas! But wondered if there is a simpler (and faster) way to do it.
Most AI's can help you with Python programming, but they don't seem very familiar with Ren'Py and they're oblivious about Brothel King's own custom labels and functions.

I do like to use language models to write lots of unique responses for all girl personalities, using BK's dialogue system. Having more variety there will add some replay value to the events. Take the following exchange as an example:

add_dialogue("girl spars with MC", ("generic"), "I am not sure, but i will give it my all!")
add_dialogue("girl spars with MC", ("very dom"), "Hah! You don't stand a chance against me. Leave before i beat you.")
add_dialogue("girl spars with MC", ("rebel"), "Finally! I've been waiting for an excuse to kick your ass.")
add_dialogue("girl spars with MC", ("meek"), "*whimper* P-Please don't hurt me, Master.")
(...etc, you could make a long list with all personalities)

you "That's very good. You think you would be able to take me on?"

call dialogue(girl, "girl spars with MC")

The game automatically picks a fitting response for the girl with the label "girl spars with MC". You can add as many responses as you like. If there are multiple valid options (eg: A "rebel" girl is also "very dom"), then it'll randomly pick a response from the suitable dialogue lines. And AI can be super helpful for adding lots of variety there... As long as you have a working jailbreak (https://henthighschool.net/brothel-king/community-dialogue-project/msg3071/#msg3071) to negate the AI's content policies.


I think ((but I could be wrong)) it's theoretically possible to train/finetune our own language model (https://medium.com/@geronimo7/finetuning-llama2-mistral-945f9c200611) based on Brothel King's codebase, to specifically help with Ren'Py code & events. But it requires some programming expertise and hasn't been attempted yet.
Title: Re: [Resources] Writing events for BK
Post by: Vaan on Nov 08, 2023, 01:28 PM
Thank you, will give it a try. I saw the dialogue system file, but honestly didn't know what it was used for. But now i think i get how to use it after writing a few events, so will give it a try!
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Nov 14, 2023, 11:47 AM
I have had surprising success using https://novelai.net/ to help me write a couple of H event for Chapter 3 (I'm curious if you guys will be able to spot which ones when it is released, without hurting my feelings ;) ). Just feed it the beginning of your event written using Ren'py script patterns and it will adjust pretty well.

Quote from: GMWinters on Oct 12, 2023, 01:29 PMIs it possible to make trait effects vary depending on personality? Or would either the BK code or Renpy engine get angry if conditionals were included in a Trait?

If it matters, I was originally thinking of situations where a trait indicates action XYZ hurts and so applies some penalty to it, but it occurs to be that a Masochist girl might see that as a benefit not a downside and could instead get a bonus.

That then led me to wondering about something like a "living stereotype" trait or whatever where the girl isn't just a pervert/princess/bimbo, she's the pervert/princess/bimbo or whatnot with the specific effect varying by personality or some other variable. But I assume the code would have to be designed to handle that kind of input and probably isn't?

The best way to design something like that would be to create an alternate trait that has the same name, but different effects, and add a personality check to BKgirlclass.rpy in 'add_trait()' to replace the vanilla trait with the special one for specific personalities. I'm not 100% clear if the checks that are done by trait name (such as 'has_trait()' ) would all work but my gut feeling is they would.
Title: Re: [Resources] Writing events for BK
Post by: Vaan on Nov 20, 2023, 08:02 PM
Hi guys,

Managed to create a mod and already have a few events in it, about 5 so far, nothing complex. Will post it here once i get to 10 or something. Anyway, i was wondering, and this might be a stupid question, is there a way to draw a specific group of girls from the brothel? I came up with an idea to do events in the four different rooms, but i'm struggling to do it. I'm trying to draw out the dancers only as it's an event in that group only, for the first one, but can't seem to figure out how? This is what i've tried
$ able_girls = [g for g in MC.girls if not (g.away or g.hurt or g.exhausted)]
$ girl = rand_choice(able_girls,  job = "dancer")


$ able_girls = [g for g in MC.girls if not (g.away or g.hurt or g.exhausted)]
$ girl = rand_choice(able_girls, if girl.job in ("dancer"))

$ able_girls = [g for g in MC.girls if not (g.away or g.hurt or g.exhausted)]
$ girl = girl_job("dancer"), (able_girls))

Played around with all combinations and whatever i could find in the game's scripts, but couldn't find anything that resembles what i'm trying to do and i have no idea how to write it on my own. Any help would be appreciated, so far i've only ever used this on all my events, but it's getting a bit boring to choose a random girl from them all and wanted to do something a bit more specific:

$ able_girls = [g for g in MC.girls if not (g.away or g.hurt or g.exhausted)]
$ girl = rand_choice(able_girls)
Title: Re: [Resources] Writing events for BK
Post by: neronero on Nov 24, 2023, 08:02 PM
Quote from: Vaan on Nov 20, 2023, 08:02 PMManaged to create a mod and already have a few events in it, about 5 so far, nothing complex. Will post it here once i get to 10 or something. Anyway, i was wondering, and this might be a stupid question, is there a way to draw a specific group of girls from the brothel? I came up with an idea to do events in the four different rooms, but i'm struggling to do it.
Nice, someone's cooking! ;D 

The purpose of rand_choice is: give it a list of things and it'll give back one random item from the list. In most of your attempts you're trying add your extra filtering criteria within the rand_choice() function. It should be done before that point, when you're defining the list that you're going to give to rand_choice()

Here's how you could do the filtering in 2 steps, to make it easy to understand
# Make a list of girls that are present in the brothel and not injured or burned out
$ able_girls = [g for g in MC.girls if not (g.away or g.hurt or g.exhausted)]

# Take the list above and reduce it to a smaller list, leaving only girls with the "dancer" job
$ dancer_girls = [g for g in able_girls if g.job == "dancer"]

# Give dancer_girls to rand_choice, which will pick a random thing from any list you put inside its brackets
$ girl = rand_choice(dancer_girls)

But it doesn't have to be an extra step, you could also add the extra criteria to the able_girls line to instantly create the right list:
$ able_girls = [g for g in MC.girls if not (g.away or g.hurt or g.exhausted) and g.job == "dancer"]
$ girl = rand_choice(able_girls)
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Nov 30, 2023, 02:08 PM
Quote from: neronero on Nov 24, 2023, 08:02 PM
Quote from: Vaan on Nov 20, 2023, 08:02 PMManaged to create a mod and already have a few events in it, about 5 so far, nothing complex. Will post it here once i get to 10 or something. Anyway, i was wondering, and this might be a stupid question, is there a way to draw a specific group of girls from the brothel? I came up with an idea to do events in the four different rooms, but i'm struggling to do it.
Nice, someone's cooking! ;D 

The purpose of rand_choice is: give it a list of things and it'll give back one random item from the list. In most of your attempts you're trying add your extra filtering criteria within the rand_choice() function. It should be done before that point, when you're defining the list that you're going to give to rand_choice()

Here's how you could do the filtering in 2 steps, to make it easy to understand
# Make a list of girls that are present in the brothel and not injured or burned out
$ able_girls = [g for g in MC.girls if not (g.away or g.hurt or g.exhausted)]

# Take the list above and reduce it to a smaller list, leaving only girls with the "dancer" job
$ dancer_girls = [g for g in able_girls if g.job == "dancer"]

# Give dancer_girls to rand_choice, which will pick a random thing from any list you put inside its brackets
$ girl = rand_choice(dancer_girls)

But it doesn't have to be an extra step, you could also add the extra criteria to the able_girls line to instantly create the right list:
$ able_girls = [g for g in MC.girls if not (g.away or g.hurt or g.exhausted) and g.job == "dancer"]
$ girl = rand_choice(able_girls)

Just don't forget to add a check for what happens if no girl fits the criteria (rand_choice will return 'False'), or you're in for a crash.
Title: Re: [Resources] Writing events for BK
Post by: Vaan on Dec 02, 2023, 10:16 PM
Thank you, i did. Learned how to do it from a different event you helped me with. I have managed to do it and have a very basic version of the mod that i am sending the link to. There are still a lot of events i will do and will probably be able to upload monthly, but as i said before, the quality of these events is pretty basic, because i don't have a lot of knowledge of coding and renpy. I only started this mod, because i enjoy playing the game a lot and wanted to expand on that. To make my experience even better.

I feel like it did it at least for me. Thanks to you guys i added 9 - 10 events to the game and i will probably add more every month. Depending on whether the mod picks up, i might upload it here too, but for now, i think i will just use it for me, because the quality is not on the same level as yours. The events expand on a lot of the tags which i don't think are fully used and add a lot of features.

Some of them will not work with the lore of BK, such as "femdom" (i might remove that one), added a "pool day", which is kind of a pool party with all girls in the brothel. Expanded on the Cosplay tags, so now they are all included in one event, i will probably add to that more at some point. As i mentioned, i am still polishing the events i created and creating new ones at the same time, removing and adding things i don't like.


Felt like i had to upload at least a basic version of it, since you guys have been so nice and answered all the questions i had! Feel like i am at a place where i know everything i needed to know to create my events. Only thing i don't like (and i really wanted to do) is that i was not able to create a button for my events. My original idea was to add the button where the menus are, kind of like the Augment Mod. Button would have basically said "go on a walk or "take some time off", at which point you would get a list of my events and you could choose what you wanted to do. My knowledge is quite limited and could not achieve it.


Currently you would have to go into the mods menu, click on "walk around", then you will get a list of all events and you can choose what you want to do. One of the options in the list also allows you to choose randomly. Other than appearing automatically, you can choose what you want to do, it takes away 2 interaction points each time you do an event. As i said, if the mod picks up, i will upload a new version monthly or every 2 - 3 weeks with new events and upgrades to the old ones, but for now, i am planning on using it for myself, i am quite happy with what i achieved even if it is quite basic. Please find a link below, let me know if you're having issues with it. Once again, thanks for all your help! Oh, if anyone wants to do anything with the code or edit anything on the mod, they have full permission! Code is a bit of a mess, since i'm a beginner, but if you find anything useful, you are welcome to use it!

https://mega.nz/file/TLpHVL6I#tYfIspdED0rovvw2B2CLeg07XuzjcgD9ff4xvMXx9uA
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Dec 07, 2023, 03:54 PM
Thanks, I recommend making a separate thread for it to give the mod visibility and collect people's feedback.
Title: Re: [Resources] Writing events for BK
Post by: Aetheran on Dec 17, 2023, 12:22 AM
So I'm starting to create my own events for a mod I want to do, and am a bit confused on how exactly to structure the code. I have very *very* minimal coding experience from years ago, but I do understand pseudo-code. I know what if/elseif statements are, what variables are, etc etc, so with that level of knowledge in mind, I was wondering if I could get some help?

I tried looking through the mymod example mod, as well as Goldo's first few posts in this topic to try and figure it out, but I'm still unsure how to actually start the events, how to set trigger conditions, what variables I need to set, etc etc.

For reference, I'm using Visual Studio Code with the Ren'py Language Extension to do the coding.

I'll post my pseudo-code below to give an idea of what I'm trying to do for the very first event. Any help would be greatly appreciated.

Pseudo-code:
Spoiler
Silver Wolf Intro 01;
Random Event: Can trigger when MC is walking around Warehouse or Dock districts.
Event Requirements: 2nd Brothel unlocked. Warehouse/Dock districts unlocked (Chapter 2?)

SCENE TRANSITION IN
[TOWN SCENE]

[SFX: Low crowd mumble]
[SFX: Guards yelling/whistling]

???: *yelling* "Stop! Stop I said!"

You're walking around town when you hear a commotion coming from the direction of some shops.

[SHOW Silver Wolf PIC]

Looking over, you notice a silver-haired girl in odd clothing being chased by some city guards.

Guard: *yelling* "You're only making it worse for yourself when we catch you!"

[SFX: Running?]

The girl continues running. She's extremely nimble, athletically dodging through the crowd as she runs from the guards.

With almost laughable ease, she keeps ahead of the guards. You guess that she could easily lose the them if she wanted.

Maybe she has a reason to keep them chasing her?

[HORIZONTAL MOVE Silver Wolf PIC OFF SCREEN (indicating her running away)]

Soon enough they disappear around a corner. You hear the guards continuing to tell her to stop. Good luck with that, guys.

TRANSITION OUT

FLAG [Intro 01 - Silver Wolf] COMPLETE

ENABLE [[Intro 02 - Silver Wolf 02]]
[close]

EDIT: Ok so I looked through some of the BK chapter events to get an idea of what I need to use for what, and this is now what I have in actual code:

EDIT 2 (Dec 19): So I took a look at the headhunter mod to figure out how it calls the headhunter NPC picture, so I figured that part of it out. It displays the girls full body picture and portrait picture fine during the event.
New questions:

1. How do I add new sounds? I know the game already has laugh sounds, but I have sound clips of the character's actual laugh I'd like to insert. Again using the Headhunter mod as a reference, I see it has defines for sounds, for example: $ s_giggle = "giggle.mp3". So is there a way I can add my swlaugh.ogg in here somehow? The headhunter mod doesn't actually have a giggle.mp3 so I assume it was using BK 0.2's giggle.mp3, does that mean that define automatically looks in the /sound/ folder?
2. So I'm using the call function in the console to test the event. After the event runs, the screen stays black. How would I make it go back to its original location? I looked around in BKchapter2.rpy to see how Goldo does it but the events I looked at all also end with "screen black with fade", so I'm not sure how its done...

Actual code (edited Dec 19):
Spoiler
############ BROTHEL KING: STAR RAIL VARIABLES (edited from Headhunter mod) ############
## TO BE DONE:  - "color=c_firered" = text color? If so, change to blueish-purple
##              - Find out how the games knows where to pull sounds from.

init -2:

    define silverwolf = Character("Silver Wolf", color=c_firered, image = "silverwolf", window_left_padding=int(config.screen_height*0.205))

    $ game_image_dict["Characters"]["silverwolf"] = [
                                            declare('silverwolf', 'Mods/Brothel Star Rail/Pictures/Silver Wolf/silverwolf__smile_profile (bw outline).webp', 'f', x=0.5, y=0.5),
#                                            declare('headhunter strip1', 'NPC/Headhunter/Headhunter2.webp', 'f', x=0.5, y=0.5),
#                                            declare('headhunter strip2', 'NPC/Headhunter/Headhunter3.webp', 'f', x=0.5, y=0.5),
#                                            declare('headhunter angry', 'NPC/Headhunter/Headhunter4.webp', 'f', x=0.5, y=0.5),
                                            declare('side silverwolf', 'Mods/Brothel Star Rail/Pictures/Silver Wolf/silverwolf_portrait.webp', 'p', x=200, y=200, gallery=False),
#                                            declare('side headhunter strip1', 'NPC/Headhunter/Headhunter_portrait2.webp', 'p', x=152, y=152, gallery=False),
#                                            declare('side headhunter strip2', 'NPC/Headhunter/Headhunter_portrait3.webp', 'p', x=152, y=152, gallery=False),
#                                            declare('side headhunter angry', 'NPC/Headhunter/Headhunter_portrait4.webp', 'p', x=152, y=152, gallery=False),
                                            ]

#    $ game_image_dict["Backgrounds"]["slavemarket"] += [declare("bg slave market21", "backgrounds/slave market21.webp", "p")]

    $ s_erm = "erm.mp3"
    $ s_hmmm = "uhm.mp3"
    $ s_hmm = "uhm.mp3"
    $ s_ahh_frustrated = "ahh_frustrated.ogg"
    $ s_giggle = "giggle.mp3"

init -1 python:

    ## TO BE DONE:  -Define new characters. Should that be in this file?
    ##              -

    bstarrail_template = Mod(

                ## Basic mod information (Important: Version is used to check for new versions of the mod. Failure to update the version number may lead to broken mods and saved games)
                name = "Brothel King: Star Rail",
                folder = "Brothel Star Rail",
                creator = "Aetheran",
                version = 0.01,
                pic = "bstarrail-logo.webp",
                description = """Brothel King: Star Rail is a mod that incorperates a few girls from the Honkai: Star Rail universe into the Brothel King world using (relatively) lore-friendly events.\n\n{b}May contain story spoilers for Honkai: Star Rail up to patch 1.6.{/b}""",

                ## Mod option menu (access through the Help (click on '?') menu)
                ## help_prompts = [("About Brothel: Star Rail", "bstarrail_about_event")],

                ## Init label: This will run when the mod is activated, allowing you to set some variables and events if necessary
                init_label = "bstarrail_init",
                update_label = "bstarrail_update",

                ## Event dictionary (all mod events must be declared here)
                events = {
                            "Intro Silver Wolf" : StoryEvent("bstarrail_introsw01", location = "market"),
                            "Intro Silver Wolf 02" : StoryEvent("bstarrail_introsw02", location = "market"),
                            "Intro March 7th" : StoryEvent("bstarrail_introm701", location = "thieves guild"),
                            "Intro Fu Xuan" : StoryEvent("bstarrail_introfu01", condition = "mymod_stolen_gold", min_gold = 200),
                        },
                home_rightmenu_add_buttons = ["test_mod_but"]*10
                )

## This label runs when the mod is activated
label bstarrail_init():

    ## Important! It is necessary to copy the mod template to a variable upon initializing it if you would like mod variables to save together with the player's saved game (ie. most cases)
    $ bstarrail = bstarrail_template

    "You have just installed [bstarrail.name]."

    "The writing in this mod assumes the Player Character is good or neutral. The dialogue won't fit those roleplaying an evil character, sorry!"

    return

## label bstarrail_about_event():

## "This mod incorperates a few girls from the Honkai: Star Rail universe into the game using (relatively) lore-friendly events."

label bstarrail_introsw01():

    ## Silver Wolf Intro Event 01

    scene black
    show bg street at top
    with fade

    hide screen visit_location
    hide screen overlay

    # SFX: Low crowd mumbles
   
    "You're walking around town on another peaceful day"

    "Suddenly, you hear a commotion further ahead"

    # SFX: Guards yelling/whistling

    guard "Stop! Stop I said!"

    show silverwolf at left with dissolve

    "Looking over in the direction of the noise, you notice a silver-haired girl in odd clothing being chased by some city guards."

    guard "You're only making it worse for yourself when we catch you! Stop immediately!"

    silverwolf "You know what? I don't think I will!"

    # SFX Running foot noises

    play sound s_laugh

    "The girl continues running. She's extremely nimble, athletically dodging through the crowd as she runs from the guards."

    "With almost laughable ease, she keeps ahead of the guards. You guess that she could easily lose them if she wanted."

    "Maybe she has a reason to keep them chasing her?"

    # MOVE HORIZONTALLY Silver Wolf PIC OFF SCREEN (indicating her running away)

    "Soon enough they disappear around a corner. You hear the guards continuing to shout at her to stop. Good luck with that, guys."

    scene black with fade

    # $ calendar.set_alarm(calendar.time+7+dice(3), StoryEvent(label = "bstarrail_introsw02", type = "morning"))

    return

# label bstarrail_introsw02():

    ## Silver Wolf Intro Event 02

#    return
[close]
Title: Re: [Resources] Writing events for BK
Post by: vadi92 on Dec 19, 2023, 09:13 PM
Quote from: Aetheran on Dec 17, 2023, 12:22 AM1. How do I add new sounds? I know the game already has laugh sounds, but I have sound clips of the character's actual laugh I'd like to insert. Again using the Headhunter mod as a reference, I see it has defines for sounds, for example: $ s_giggle = "giggle.mp3". So is there a way I can add my swlaugh.ogg in here somehow? The headhunter mod doesn't actually have a giggle.mp3 so I assume it was using BK 0.2's giggle.mp3, does that mean that define automatically looks in the /sound/ folder?

You find it in the BKSettings.rpy around line 434. (But its better if you create a separate rpy file for it.
Title: Re: [Resources] Writing events for BK
Post by: Aetheran on Dec 19, 2023, 11:51 PM
Quote from: vadi92 on Dec 19, 2023, 09:13 PMYou find it in the BKSettings.rpy around line 434. (But its better if you create a separate rpy file for it.


Awesome thanks. Looking at those lines in BKSettings.rpy and then googling the renpy.music.register_channel line, I was able to work it out and get it working. Someone on the f95 forums was saying to add my own sounds I needed Goldo to put in hooks for the sound code or something? Will my above line of code mess anything up with the game? Or was that user just not knowing how sound works? I'm still new to this but from what knowledge I do have, I *think* this solution works fine?

I just added this at the top of my .rpy file:

init -3 python:

    renpy.music.register_channel("bkstarrail", mixer = "sfx", file_prefix = "Mods/Brothel Star Rail/Sounds/", loop = False)

Then in my  init -2: section below that, I added this:

$ s_bksr_sw_isthatit = "silver_is_that_it.ogg"

And then to play it, in the event (again, within my own .rpy file):

play bkstarrail s_bksr_sw_isthatit

Worked perfectly
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Dec 21, 2023, 03:50 PM
Quote from: Aetheran on Dec 19, 2023, 11:51 PM
Quote from: vadi92 on Dec 19, 2023, 09:13 PMYou find it in the BKSettings.rpy around line 434. (But its better if you create a separate rpy file for it.


Awesome thanks. Looking at those lines in BKSettings.rpy and then googling the renpy.music.register_channel line, I was able to work it out and get it working. Someone on the f95 forums was saying to add my own sounds I needed Goldo to put in hooks for the sound code or something? Will my above line of code mess anything up with the game? Or was that user just not knowing how sound works? I'm still new to this but from what knowledge I do have, I *think* this solution works fine?

I just added this at the top of my .rpy file:

init -3 python:

    renpy.music.register_channel("bkstarrail", mixer = "sfx", file_prefix = "Mods/Brothel Star Rail/Sounds/", loop = False)

Then in my  init -2: section below that, I added this:

$ s_bksr_sw_isthatit = "silver_is_that_it.ogg"

And then to play it, in the event (again, within my own .rpy file):

play bkstarrail s_bksr_sw_isthatit

Worked perfectly

You don't need any hooks at all to add your own sounds and music. See this (https://www.renpy.org/doc/html/audio.html) for reference.

You can just refer to it using the relative path and quotes, like in this example:
play sound "Mods/AetheranMod/silver_is_that_it.ogg"
Of course this is the same as:
$ s_bksr_sw_isthatit = "Mods/AetheranMod/silver_is_that_it.ogg"

[...]

play sound s_bksr_sw_isthatit


That allows you to keep your sound and music in a separate folder if you want to.

I don't see the point of adding a separate sound channel for your sounds, unless you're planning on doing some weird stuff like separate volume settings or special effects. The base game has four channels (sound, sound2, sound3, and music), which should be enough for most use cases.
Title: Re: [Resources] Writing events for BK
Post by: Aetheran on Dec 21, 2023, 11:48 PM
Quote from: Goldo on Dec 21, 2023, 03:50 PMYou don't need any hooks at all to add your own sounds and music. See this (https://www.renpy.org/doc/html/audio.html) for reference.

You can just refer to it using the relative path and quotes, like in this example:
play sound "Mods/AetheranMod/silver_is_that_it.ogg"


Holy crap that is a lot easier lol. Ya I don't care too much about keeping music/sound in different folders so this way will suit me fine.
LONG EDIT: It actually gives me an error when I try with just this line.
I added: play sound "Mods/AetheranMod/silver_is_that_it.ogg"
Error:OSError: Couldn't find file "sounds/Mods/BK Star Rail/Sounds/silver_is_that_it.ogg"
So its still defaulting to look into the BK/game/sounds/ folder, not the BK/game/Mods/ folder. The reference link you posted is where I learned how to do the sound channel stuff, actually. I looked through it again and couldn't find how to go UP directories, so I tried the other example on there and did:

Into init -2:
define audio.silverwolf_sound = "Mods/BK Star Rail/Sounds/silver_is_that_it.ogg"
Into the event label:
play music silverwolf_sound
Now I get the same error, but its looking for the file in "music/Mods/BK Star Rail/Sounds/silver_is_that_it.ogg"

So... so far the renpy.music.register_channel is the only way that has actually made it look in the correct folder.

ANYWHO... this was a long edit. Now back to the original reason for this reply... which is more issues (of course)

...

One problem I have yet to figure, though, is how exactly I call my first event. I spent about an hour this morning looking through other events to try to figure it out but had to goto work before I made any progress.

I took a look in mymod and saw the following within init -1 python:

               events = {
                          "surprise me" : StoryEvent("mymod_surprise"),
                          "meet me" : StoryEvent("mymod_meeting", location = "thieves guild", min_gold = 100),
                          "justice prevails" : StoryEvent("mymod_justice", condition = "mymod_stolen_gold"),
                          },

And then within label my_mod_init, there was this:

$ mymod.add_event("justice prevails", type="morning", call_args = [end_picture])
So am I correct in that the first part defines the event, and the 2nd part enables it within the game to be triggered, in this case during the morning (if min_gold = 200)?

I took those examples and tried to make it work, but the event never fires. I added into "init -1 python:" this:

                events = {
                            "Intro Silver Wolf" : StoryEvent("bkstarrail_introsw01", location = "market"),
                        },

Then into label bkstarrail_init I put this:

    $ bkstarrail.add_event("Intro Silver Wolf", type="city", location = "market")
However, bkstarrail_introsw01 never fired when visiting the market. I thought this was because I used "Intro Silver Wolf" instead of "bkstarrail_introsw01", but neither worked. So I copied your kosmo example from the start of this thread:

    $ bkstarrail.add_event("Intro Silver Wolf", date = calendar.time+1, type = "morning")
After passing a few days, it didn't work either, so again I changed "Intro Silver Wolf" to "bkstarrail_introsw01".

Still nothing (again after waiting a few days).

I know the event works cause I can use the console to call it, so I dunno. Obviously I'm doing something wrong but I have no idea what. I also tried adding to bkstarrail_init this:

#    python:
#        calendar.set_alarm(calendar.time+1, StoryEvent(label="bkstarrail_introsw01", type="morning"))

Because I saw that type of code in other events, and figured out calendar.time stores the current day since game start, so that *should* trigger it 1 day later? But it still didn't work.

I figured I may be over-thinking things so I decided to copy your mymod examples EXACTLY. The issue with this is the only event mymod adds within label my_mod_init is the "justice prevails" one. which has a custom condition in the declare (mymod_stolen_gold) AND "call_args = [end_picture]" in the $ line... I'm assuming the call_args end picture thing means it displays a picture? But that means I can't really copy this code exactly, so *again* I tried to edit it to suit my needs but it still didn't work. This time I added this to init -1 python:
                events = {
                            "Intro Silver Wolf" : StoryEvent("bkstarrail_introsw01"),
                        },
And then to label bkstarrail_init:
    $ bkstarrail.add_event("bkstarrail_introsw01", type = "morning")Which *should* call that event in the morning? But it doesn't. Again neither does "Intro Silver Wolf"

I also tried other variations. type="city", location="market" or "thieves guild". Other random stuff. I can't seem to get this to trigger no matter what I do.
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Dec 22, 2023, 10:05 AM
My bad sorry!

I forgot the sound channel changed the root directory. In that case, try this:
play audio "Mods/AetheranMod/silver_is_that_it.ogg"
Untested but I think the 'audio' channel will use the root game folder for the relative path. You can also use it to play music, and the beauty of it is that it will play along fine with other sounds at the same time without the need to switch channels. It will probably only work with v0.3 though, but give it a try.

QuoteOne problem I have yet to figure, though, is how exactly I call my first event. I spent about an hour this morning looking through other events to try to figure it out but had to goto work before I made any progress.

It's been a long while since I've worked on mod events, let me dive into the code and see if I can help you.

Edit: After some testing, mod events seem to work as intended but mod activation during a game doesn't. My advice is to make sure your mod is properly activated by turning it on from the start menu, and then restarting the game for good measure. You should see your Mod is activated from the notification or Mod menu. Then, start a new game and see if things now work.
Title: Re: [Resources] Writing events for BK
Post by: Aetheran on Dec 22, 2023, 02:13 PM
Quote from: Goldo on Dec 22, 2023, 10:05 AMMy bad sorry!

I forgot the sound channel changed the root directory. In that case, try this:
play audio "Mods/AetheranMod/silver_is_that_it.ogg"
Untested but I think the 'audio' channel will use the root game folder for the relative path. You can also use it to play music, and the beauty of it is that it will play along fine with other sounds at the same time without the need to switch channels. It will probably only work with v0.3 though, but give it a try.

Yep, that works perfectly, thanks!

QuoteEdit: After some testing, mod events seem to work as intended but mod activation during a game doesn't. My advice is to make sure your mod is properly activated by turning it on from the start menu, and then restarting the game for good measure. You should see your Mod is activated from the notification or Mod menu. Then, start a new game and see if things now work.

Ok, following your advice I tried that out, and was able to get the first event to fire from mod init event by using

$ calendar.set_alarm(calendar.time+1, StoryEvent(label = "bkstarrail_introsw01", type = "morning"))
After changing the code, steps I followed:

- Started BK
- Disabled mod
- Closed BK
- Started BK
- Enabled mod
- Closed BK
- Started BK
- Started new game (Normal Mode - No intro)

I'm not too sure I need to close the game after every mod deactivation/activation, but you DID mention restarting the game after making sure the mod is activated, soooo... I took that to the extreme just to be safe.

After all that, the event properly fires in the morning after waiting a day.

HOWEVER, I then did the same steps as above again (deactivate, close/open BK, activate, close/open BK), but this time instead of starting a new game, I loaded a test save in chapter 2, and the event never fires in the morning, even after waiting multiple days.

So I decided to change the event type. In "init -1 python" I changed the line in the Event dictionary from
"Intro Silver Wolf" : StoryEvent("bkstarrail_introsw01", type="morning"),to "Intro Silver Wolf" : StoryEvent("bkstarrail_introsw01", location = "farm"),
And in the mod init, I changed the add_event from
$ bkstarrail.add_event("Intro Silver Wolf", type = "morning")to $ bkstarrail.add_event("Intro Silver Wolf", type = "city")
The above code now matches Goldo's "mymod_meeting" parameters, but just with my event names instead of his.

Again I did the whole close/open deactivate/activate mod shenanigans, and started a new game (no intro). Went to the farm, and the event triggered fine.

Did the close/open deactivate/activate again, but this time loaded my save game, and the event didn't fire.

So.... will my mod just never work with anyone who wants to use it in an existing save? That seems... odd.

Pre-post EDIT: I did some checking on the only two other mods I know of that adds events, Headhunters and Friends and Foes. Friends and Foes mod actually schedules an event in their mod init label, but it's exactly like my first one (the calender.set_alarm one). So why does theirs work and mine doesn't?

I'll keep on playing around with it and see if I can work it out. Maybe hit up a renpy discord or something.
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Dec 22, 2023, 02:24 PM
Quote from: Aetheran on Dec 22, 2023, 02:13 PM
Quote from: Goldo on Dec 22, 2023, 10:05 AMMy bad sorry!

I forgot the sound channel changed the root directory. In that case, try this:
play audio "Mods/AetheranMod/silver_is_that_it.ogg"
Untested but I think the 'audio' channel will use the root game folder for the relative path. You can also use it to play music, and the beauty of it is that it will play along fine with other sounds at the same time without the need to switch channels. It will probably only work with v0.3 though, but give it a try.

Yep, that works perfectly, thanks!

QuoteEdit: After some testing, mod events seem to work as intended but mod activation during a game doesn't. My advice is to make sure your mod is properly activated by turning it on from the start menu, and then restarting the game for good measure. You should see your Mod is activated from the notification or Mod menu. Then, start a new game and see if things now work.

Ok, following your advice I tried that out, and was able to get the first event to fire from mod init event by using

$ calendar.set_alarm(calendar.time+1, StoryEvent(label = "bkstarrail_introsw01", type = "morning"))
After changing the code, steps I followed:

- Started BK
- Disabled mod
- Closed BK
- Started BK
- Enabled mod
- Closed BK
- Started BK
- Started new game (Normal Mode - No intro)

I'm not too sure I need to close the game after every mod deactivation/activation, but you DID mention restarting the game after making sure the mod is activated, soooo... I took that to the extreme just to be safe.

After all that, the event properly fires in the morning after waiting a day.

HOWEVER, I then did the same steps as above again (deactivate, close/open BK, activate, close/open BK), but this time instead of starting a new game, I loaded a test save in chapter 2, and the event never fires in the morning, even after waiting multiple days.

So I decided to change the event type. In "init -1 python" I changed the line in the Event dictionary from
"Intro Silver Wolf" : StoryEvent("bkstarrail_introsw01", type="morning"),to "Intro Silver Wolf" : StoryEvent("bkstarrail_introsw01", location = "farm"),
And in the mod init, I changed the add_event from
$ bkstarrail.add_event("Intro Silver Wolf", type = "morning")to $ bkstarrail.add_event("Intro Silver Wolf", type = "city")
The above code now matches Goldo's "mymod_meeting" parameters, but just with my event names instead of his.

Again I did the whole close/open deactivate/activate mod shenanigans, and started a new game (no intro). Went to the farm, and the event triggered fine.

Did the close/open deactivate/activate again, but this time loaded my save game, and the event didn't fire.

So.... will my mod just never work with anyone who wants to use it in an existing save? That seems... odd.

Pre-post EDIT: I did some checking on the only two other mods I know of that adds events, Headhunters and Friends and Foes. Friends and Foes mod actually schedules an event in their mod init label, but it's exactly like my first one (the calender.set_alarm one). So why does theirs work and mine doesn't?

I'll keep on playing around with it and see if I can work it out. Maybe hit up a renpy discord or something.

I'm not sure I'd need to take a look at your code. But what did you do exactly?

If you activated the mod, started a new game, and saved, before the event happened, there's really no reason why it wouldn't work when loading that save.

If you're trying to load a save from before installing the mod, then it's totally normal that it doesn't load the event.

Finally, it sounds like you may be trying to trigger the event a second time. Are you trying to trigger the event several times in one playthrough? As a reminder, StoryEvent objects come with the once property set to True, so they only fire up once. If you want an event to be repeatable, you need to change it likeso:
"Intro Silver Wolf" : StoryEvent("bkstarrail_introsw01", type="morning", once=False),
And then you'll need to think about if/when to remove the event manually.
Title: Re: [Resources] Writing events for BK
Post by: Aetheran on Dec 22, 2023, 04:26 PM
Quote from: Goldo on Dec 22, 2023, 02:24 PMI'm not sure I'd need to take a look at your code. But what did you do exactly?

If you activated the mod, started a new game, and saved, before the event happened, there's really no reason why it wouldn't work when loading that save.

If you're trying to load a save from before installing the mod, then it's totally normal that it doesn't load the event.

Finally, it sounds like you may be trying to trigger the event a second time. Are you trying to trigger the event several times in one playthrough? As a reminder, StoryEvent objects come with the once property set to True, so they only fire up once. If you want an event to be repeatable, you need to change it likeso:
"Intro Silver Wolf" : StoryEvent("bkstarrail_introsw01", type="morning", once=False),
And then you'll need to think about if/when to remove the event manually.

The only two places I have the event mentioned are in the "init -1 python:" section, this portion:

                ## Event dictionary (all mod events must be declared here)
                events = {
                            "Intro Silver Wolf" : StoryEvent("bkstarrail_introsw01", location = "farm"),
                        },

And then in "label bkstarrail_init():", here:

label bkstarrail_init():

    ## Important! It is necessary to copy the mod template to a variable upon initializing it if you would like mod variables to save together with the player's saved game (ie. most cases)
    $ bkstarrail = bkstarrail_template

    "You have just installed [bkstarrail.name]."

    "The writing in this mod assumes the Player Character is good or neutral. The dialogue won't fit those roleplaying an evil character, sorry!"

    $ bkstarrail.add_event("Intro Silver Wolf", type = "city")

    return

Which is examples directly from your mymod. In my testing, I tried a bunch of different ways to call this event, as listed above, but I never tried to call it more then once anywhere, and only in the "label bkstarrail_init():"

My post may have been confusing since I did list a bunch of different ways I tried, but I've only had one call line in the "label bkstarrail_init():" at one time.

QuoteIf you're trying to load a save from before installing the mod, then it's totally normal that it doesn't load the event.

I think this is the important part of your message here. What I've been trying to do is have the event trigger from a game that was started before the mod was added. From what you've been saying, I'm assuming that only games that were created WITH the mod activated from the start will work.

I've been under the assumption that I can start a game, then at a later date add a mod (kind of like how you can add girl packs to existing games). But apparently that isn't the case? Mods only work with brand new games?
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Dec 22, 2023, 04:37 PM
Quote from: Aetheran on Dec 22, 2023, 04:26 PM
Quote from: Goldo on Dec 22, 2023, 02:24 PMI'm not sure I'd need to take a look at your code. But what did you do exactly?

If you activated the mod, started a new game, and saved, before the event happened, there's really no reason why it wouldn't work when loading that save.

If you're trying to load a save from before installing the mod, then it's totally normal that it doesn't load the event.

Finally, it sounds like you may be trying to trigger the event a second time. Are you trying to trigger the event several times in one playthrough? As a reminder, StoryEvent objects come with the once property set to True, so they only fire up once. If you want an event to be repeatable, you need to change it likeso:
"Intro Silver Wolf" : StoryEvent("bkstarrail_introsw01", type="morning", once=False),
And then you'll need to think about if/when to remove the event manually.

The only two places I have the event mentioned are in the "init -1 python:" section, this portion:

                ## Event dictionary (all mod events must be declared here)
                events = {
                            "Intro Silver Wolf" : StoryEvent("bkstarrail_introsw01", location = "farm"),
                        },

And then in "label bkstarrail_init():", here:

label bkstarrail_init():

    ## Important! It is necessary to copy the mod template to a variable upon initializing it if you would like mod variables to save together with the player's saved game (ie. most cases)
    $ bkstarrail = bkstarrail_template

    "You have just installed [bkstarrail.name]."

    "The writing in this mod assumes the Player Character is good or neutral. The dialogue won't fit those roleplaying an evil character, sorry!"

    $ bkstarrail.add_event("Intro Silver Wolf", type = "city")

    return

Which is examples directly from your mymod. In my testing, I tried a bunch of different ways to call this event, as listed above, but I never tried to call it more then once anywhere, and only in the "label bkstarrail_init():"

My post may have been confusing since I did list a bunch of different ways I tried, but I've only had one call line in the "label bkstarrail_init():" at one time.

QuoteIf you're trying to load a save from before installing the mod, then it's totally normal that it doesn't load the event.

I think this is the important part of your message here. What I've been trying to do is have the event trigger from a game that was started before the mod was added. From what you've been saying, I'm assuming that only games that were created WITH the mod activated from the start will work.

I've been under the assumption that I can start a game, then at a later date add a mod (kind of like how you can add girl packs to existing games). But apparently that isn't the case? Mods only work with brand new games?

Adding a mod during a game is broken right now, but I fixed it in the future test version.
What you can do to activate manually is call this in the console (Shift+o):
game.activate_mod(bkstarrail)
Should work, although I recommend doing that right after activating the Mod in the normal way to be on the safe side.
Title: Re: [Resources] Writing events for BK
Post by: Aetheran on Dec 23, 2023, 05:55 PM
Quote from: Goldo on Dec 22, 2023, 04:37 PMAdding a mod during a game is broken right now

Ok quick question on this then, just so I know how to go about testing my mod in a "live game" environment.

If I have the mod loaded/activated and start a new game with it, then save that game lets say in chapter 2, if I make changes to the mod, do I have to re-activate it? And will I be ok to load that save game? (this is assuming any changes I made to the mod are in events that haven't been triggered yet in that save game, and no changes were made to any init labels/sections).
Title: Re: [Resources] Writing events for BK
Post by: vadi92 on Dec 24, 2023, 06:17 AM
Quote from: Aetheran on Dec 23, 2023, 05:55 PM
Quote from: Goldo on Dec 22, 2023, 04:37 PMAdding a mod during a game is broken right now

Ok quick question on this then, just so I know how to go about testing my mod in a "live game" environment.

If I have the mod loaded/activated and start a new game with it, then save that game lets say in chapter 2, if I make changes to the mod, do I have to re-activate it? And will I be ok to load that save game? (this is assuming any changes I made to the mod are in events that haven't been triggered yet in that save game, and no changes were made to any init labels/sections).

You dont need to reactivate it if it's already active. But it's better if you start a new game when you change something.
Title: Re: [Resources] Writing events for BK
Post by: Vaan on Dec 27, 2023, 06:08 PM
Hi guys,

Took down the mod for a bit as i'm clearing out some of the crap that doesn't work or is no longer needed. Managed to clear out about 6000 lines and made it neat. Will probably upload a new version in a few weeks if i'm not too busy. I've been playing around with the tags and came up with an idea to have events for characters from the same shows to make it more fun (for me at least) and make it a bit more realistic. I'll probably use the "friend" or "party" tags, so i got that figured out. I've found some trouble when writing the event though, i wanted to ask if it's possible to call out a specific girl from the girlpacks in some way? I wanted to test with a Naruto event first, but haven't gone far. I tried this:

$ able_girls = [g for g in MC.girls if not (g.away or g.hurt or g.exhausted)]
$ girl1 = "Sakura Haruno"(able_girls)
$ girl2 = "Ino Yamanaka"(able_girls)

Which returns an "object not callable". I was wondering if there is a simple way to call a specific girl.
Title: Re: [Resources] Writing events for BK
Post by: Yasaki74 on Dec 30, 2023, 03:21 AM
Hey @Goldo!
do you know any tips for changing girl clothes, I know there's bunny girl, maid, cosplay and all but there are girls that has more clothing images than others so I was testing something out like rename all image to .bmp so that ren'py won't noticed the changes but it doesn't seem to work out for me right now. got any thoughts on this?

init python:
    import os

    Casual = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Casual"
    Maid = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Maid"
    Cosplay = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Cosplay"
    Original = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Original"
    Erotic = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Erotic"
    Underwears = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Underwears"
    Half_naked = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Half_naked"

    S_all = ["C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Casual",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Maid",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Cosplay",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Original",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Half_naked",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Underwears",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Erotic"]

    new_ext = ".jpg"
    old_ext = ".raw"

    def rename_files(source, new_ext):
        for filename in os.listdir(source):
            base_file, ext = os.path.splitext(filename)
            if ext:
                os.rename(os.path.join(source, filename), os.path.join(source, base_file + new_ext))
   
    def revert_files(source, old_ext):
        for filename in os.listdir(source):
            base_file, ext = os.path.splitext(filename)
            if ext:
                os.rename(os.path.join(source, filename), os.path.join(source, base_file + old_ext))
label Noelle_clothes:
    "This is a experimental feature I added in, It's not stable but you're welcome to try it out"
    menu:
        "Revert":
            python:
                for source in S_all:
                    rename_files(source, new_ext)
            jump Noelle_button
        "Continue":
            ""
    python:
        for source in S_all:
            revert_files(source, old_ext)
    menu:
        "Casual": #if girl.get_love() >= 25:
            "Can you change something more casual?"
            $ rename_files(Casual, new_ext)
            girl.char "Ok!"
        "Maid": #if girl.get_stat("Obedience") >= 75:
            "Can you change to a maid outfit?"
            $ rename_files(Maid, new_ext)
            girl.char "Ok!"
        "Cosplay": #if girl.get_love() >= 50:
            "Cosplay for something for me"
            $ rename_files(Cosplay, new_ext)
            girl.char "Ok!"
        "Original":
            "Go back to your original outfit"
            $ rename_files(Original, new_ext)
            girl.char "Ok!"
        "Erotic": #if girl.get_stat("libido") >= 175:
            "Changes your outfit to something attractive"
            $ rename_files(Erotic, new_ext)
            girl.char "Ok!"
        "Underwears": #if girl.get_stat("libido") >= 75 and girl.get_love() >= 75:
            "Changes to your underwears"
            $ rename_files(Underwears, new_ext)
            girl.char "Ok!"
        "Half_naked": #if girl.get_stat("Obedience") >= 175 and girl.get_love() >= 50:
            "Open up some skin"
            $ rename_files(Half_naked, new_ext)
            girl.char "Ok!"
        "Suprised_me": #if girl.get_stat("Libido") >= 250 and girl.get_love() >= 75 and girl.get_stat("Obedience") >= 250:
            $ renpy.random.randint(1, 7)
            if Noelle_random == 1:
                $ rename_files(Casual, new_ext)
            elif Noelle_random == 2:
                $ rename_files(Maid, new_ext)
            elif Noelle_random == 3:
                $ rename_files(Cosplay, new_ext)
            elif Noelle_random == 4:
                $ rename_files(Original, new_ext)
            elif Noelle_random == 5:
                $ rename_files(Erotic, new_ext)
            elif Noelle_random == 6:
                $ rename_files(Underwears, new_ext)
            elif Noelle_random == 7:
                $ rename_files(Half_naked, new_ext)
        "Back":
            jump Noelle_button

            girl.char "Ok!"
    return
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Jan 04, 2024, 04:12 PM
Quote from: Vaan on Dec 27, 2023, 06:08 PMHi guys,

Took down the mod for a bit as i'm clearing out some of the crap that doesn't work or is no longer needed. Managed to clear out about 6000 lines and made it neat. Will probably upload a new version in a few weeks if i'm not too busy. I've been playing around with the tags and came up with an idea to have events for characters from the same shows to make it more fun (for me at least) and make it a bit more realistic. I'll probably use the "friend" or "party" tags, so i got that figured out. I've found some trouble when writing the event though, i wanted to ask if it's possible to call out a specific girl from the girlpacks in some way? I wanted to test with a Naruto event first, but haven't gone far. I tried this:

$ able_girls = [g for g in MC.girls if not (g.away or g.hurt or g.exhausted)]
$ girl1 = "Sakura Haruno"(able_girls)
$ girl2 = "Ino Yamanaka"(able_girls)

Which returns an "object not callable". I was wondering if there is a simple way to call a specific girl.

What you are doing cannot work as you are using strings as a function, which gives you a Python error.

To get a specific girl by name, here's what to do:
$ able_girls = [g for g in MC.girls if not (g.away or g.hurt or g.exhausted)]

# Retrieves a list of all able girls with that name
$ girls_called_sakura_haruno = [g for g in able_girls if g.fullname == "Sakura Haruno"]

# Picks the first girl from that list
if girls_called_sakura_haruno:
    $ girl1 = girls_called_sakura_haruno[0]
Very importantly, you need to handle the event were no girl called X is able, or you'll get a crash.

Quote from: Yasaki74 on Dec 30, 2023, 03:21 AMHey @Goldo!
do you know any tips for changing girl clothes, I know there's bunny girl, maid, cosplay and all but there are girls that has more clothing images than others so I was testing something out like rename all image to .bmp so that ren'py won't noticed the changes but it doesn't seem to work out for me right now. got any thoughts on this?

init python:
    import os

    Casual = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Casual"
    Maid = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Maid"
    Cosplay = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Cosplay"
    Original = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Original"
    Erotic = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Erotic"
    Underwears = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Underwears"
    Half_naked = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Half_naked"

    S_all = ["C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Casual",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Maid",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Cosplay",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Original",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Half_naked",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Underwears",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Erotic"]

    new_ext = ".jpg"
    old_ext = ".raw"

    def rename_files(source, new_ext):
        for filename in os.listdir(source):
            base_file, ext = os.path.splitext(filename)
            if ext:
                os.rename(os.path.join(source, filename), os.path.join(source, base_file + new_ext))
   
    def revert_files(source, old_ext):
        for filename in os.listdir(source):
            base_file, ext = os.path.splitext(filename)
            if ext:
                os.rename(os.path.join(source, filename), os.path.join(source, base_file + old_ext))
label Noelle_clothes:
    "This is a experimental feature I added in, It's not stable but you're welcome to try it out"
    menu:
        "Revert":
            python:
                for source in S_all:
                    rename_files(source, new_ext)
            jump Noelle_button
        "Continue":
            ""
    python:
        for source in S_all:
            revert_files(source, old_ext)
    menu:
        "Casual": #if girl.get_love() >= 25:
            "Can you change something more casual?"
            $ rename_files(Casual, new_ext)
            girl.char "Ok!"
        "Maid": #if girl.get_stat("Obedience") >= 75:
            "Can you change to a maid outfit?"
            $ rename_files(Maid, new_ext)
            girl.char "Ok!"
        "Cosplay": #if girl.get_love() >= 50:
            "Cosplay for something for me"
            $ rename_files(Cosplay, new_ext)
            girl.char "Ok!"
        "Original":
            "Go back to your original outfit"
            $ rename_files(Original, new_ext)
            girl.char "Ok!"
        "Erotic": #if girl.get_stat("libido") >= 175:
            "Changes your outfit to something attractive"
            $ rename_files(Erotic, new_ext)
            girl.char "Ok!"
        "Underwears": #if girl.get_stat("libido") >= 75 and girl.get_love() >= 75:
            "Changes to your underwears"
            $ rename_files(Underwears, new_ext)
            girl.char "Ok!"
        "Half_naked": #if girl.get_stat("Obedience") >= 175 and girl.get_love() >= 50:
            "Open up some skin"
            $ rename_files(Half_naked, new_ext)
            girl.char "Ok!"
        "Suprised_me": #if girl.get_stat("Libido") >= 250 and girl.get_love() >= 75 and girl.get_stat("Obedience") >= 250:
            $ renpy.random.randint(1, 7)
            if Noelle_random == 1:
                $ rename_files(Casual, new_ext)
            elif Noelle_random == 2:
                $ rename_files(Maid, new_ext)
            elif Noelle_random == 3:
                $ rename_files(Cosplay, new_ext)
            elif Noelle_random == 4:
                $ rename_files(Original, new_ext)
            elif Noelle_random == 5:
                $ rename_files(Erotic, new_ext)
            elif Noelle_random == 6:
                $ rename_files(Underwears, new_ext)
            elif Noelle_random == 7:
                $ rename_files(Half_naked, new_ext)
        "Back":
            jump Noelle_button

            girl.char "Ok!"
    return

Sorry I don't recognize any of this code, are you building something on top of an existing girl pack that does this? In that case it's best to contact the girlpack maker. I am not aware of any way to change pictures based on clothing in vanilla BK.
Title: Re: [Resources] Writing events for BK
Post by: Yasaki74 on Jan 06, 2024, 10:41 AM
Quote from: Goldo on Jan 04, 2024, 04:12 PM
Quote from: Yasaki74 on Dec 30, 2023, 03:21 AMHey @Goldo!
do you know any tips for changing girl clothes, I know there's bunny girl, maid, cosplay and all but there are girls that has more clothing images than others so I was testing something out like rename all image to .bmp so that ren'py won't noticed the changes but it doesn't seem to work out for me right now. got any thoughts on this?

init python:
    import os

    Casual = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Casual"
    Maid = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Maid"
    Cosplay = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Cosplay"
    Original = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Original"
    Erotic = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Erotic"
    Underwears = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Underwears"
    Half_naked = "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Half_naked"

    S_all = ["C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Casual",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Maid",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Cosplay",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Original",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Half_naked",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Underwears",
            "C:/Main/e/Heavy/Brothel_King-pc/game/girls/Noelle/resources/clothing/Erotic"]

    new_ext = ".jpg"
    old_ext = ".raw"

    def rename_files(source, new_ext):
        for filename in os.listdir(source):
            base_file, ext = os.path.splitext(filename)
            if ext:
                os.rename(os.path.join(source, filename), os.path.join(source, base_file + new_ext))
   
    def revert_files(source, old_ext):
        for filename in os.listdir(source):
            base_file, ext = os.path.splitext(filename)
            if ext:
                os.rename(os.path.join(source, filename), os.path.join(source, base_file + old_ext))
label Noelle_clothes:
    "This is a experimental feature I added in, It's not stable but you're welcome to try it out"
    menu:
        "Revert":
            python:
                for source in S_all:
                    rename_files(source, new_ext)
            jump Noelle_button
        "Continue":
            ""
    python:
        for source in S_all:
            revert_files(source, old_ext)
    menu:
        "Casual": #if girl.get_love() >= 25:
            "Can you change something more casual?"
            $ rename_files(Casual, new_ext)
            girl.char "Ok!"
        "Maid": #if girl.get_stat("Obedience") >= 75:
            "Can you change to a maid outfit?"
            $ rename_files(Maid, new_ext)
            girl.char "Ok!"
        "Cosplay": #if girl.get_love() >= 50:
            "Cosplay for something for me"
            $ rename_files(Cosplay, new_ext)
            girl.char "Ok!"
        "Original":
            "Go back to your original outfit"
            $ rename_files(Original, new_ext)
            girl.char "Ok!"
        "Erotic": #if girl.get_stat("libido") >= 175:
            "Changes your outfit to something attractive"
            $ rename_files(Erotic, new_ext)
            girl.char "Ok!"
        "Underwears": #if girl.get_stat("libido") >= 75 and girl.get_love() >= 75:
            "Changes to your underwears"
            $ rename_files(Underwears, new_ext)
            girl.char "Ok!"
        "Half_naked": #if girl.get_stat("Obedience") >= 175 and girl.get_love() >= 50:
            "Open up some skin"
            $ rename_files(Half_naked, new_ext)
            girl.char "Ok!"
        "Suprised_me": #if girl.get_stat("Libido") >= 250 and girl.get_love() >= 75 and girl.get_stat("Obedience") >= 250:
            $ renpy.random.randint(1, 7)
            if Noelle_random == 1:
                $ rename_files(Casual, new_ext)
            elif Noelle_random == 2:
                $ rename_files(Maid, new_ext)
            elif Noelle_random == 3:
                $ rename_files(Cosplay, new_ext)
            elif Noelle_random == 4:
                $ rename_files(Original, new_ext)
            elif Noelle_random == 5:
                $ rename_files(Erotic, new_ext)
            elif Noelle_random == 6:
                $ rename_files(Underwears, new_ext)
            elif Noelle_random == 7:
                $ rename_files(Half_naked, new_ext)
        "Back":
            jump Noelle_button

            girl.char "Ok!"
    return

Sorry I don't recognize any of this code, are you building something on top of an existing girl pack that does this? In that case it's best to contact the girlpack maker. I am not aware of any way to change pictures based on clothing in vanilla BK.

well I made the pack myself and the code was design for girls having more than 5 default outfits which in picture namer it is cosplay, maid, bunny, swim, kimono
I found that some girls have other clothings and specific clothes that's from events in the original game. So I was wondering if there's a way that I could make renpy read only pictures that the code I write change them. meaning you can go ask the girl which clothes they should be wearing and the code will change the extension name of every pictures in that folder
but now I think about it, I could've make a mod about it, but I don't have enough understanding of the code and it's been a headache trying to get started on creating the marriage mod which idk where to start or which part should be added to make sense on gameplay
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Jan 11, 2024, 12:16 PM
Quote from: Yasaki74 on Jan 06, 2024, 10:41 AMwell I made the pack myself and the code was design for girls having more than 5 default outfits which in picture namer it is cosplay, maid, bunny, swim, kimono
I found that some girls have other clothings and specific clothes that's from events in the original game. So I was wondering if there's a way that I could make renpy read only pictures that the code I write change them. meaning you can go ask the girl which clothes they should be wearing and the code will change the extension name of every pictures in that folder
but now I think about it, I could've make a mod about it, but I don't have enough understanding of the code and it's been a headache trying to get started on creating the marriage mod which idk where to start or which part should be added to make sense on gameplay

Renaming files at runtime is in general a very bad idea that will cause bugs or crashes, and simply will not work. The game doesn't recognize 'outfits', only a bunch of tags that can then be used in code or associated with jobs (for instance, geisha also uses the 'kimono' tag, and masseuse uses the 'swimsuit' tag as fallback).

What you want to do is create your new tags in the tag dictionary (which you can find in BKsettings.rpy), for instance 'catsuit' or whatever new clothing you want to add (AKA, the easy part).
Then, you would need to change the code extensively pretty much everywhere to add the conditionals for such clothing tags. This is the long, difficult and bug-prone part, not to mention you would then need to convince every girlpack maker to revisit their packs to add these new tags or there wouldn't be any in-game effect.

It could be done, but the starting point would be a very good understanding of tagging and of the code base. If all you want to do is use different girl pictures during custom events, there are easier ways to do that (such as including your underlying pictures in separate folders and calling images with a relative path).
Title: Re: [Resources] Writing events for BK
Post by: Yasaki74 on Jan 13, 2024, 12:26 PM
@Goldo
Do you have any example codes for city_label?
because I still haven't fully understand how the city_label works, I've looked through your code today. At first this code is within another code but I can't find the conditions for the city_label to be activated
Title: Re: [Resources] Writing events for BK
Post by: Vaan on Jan 14, 2024, 11:03 PM
Thank you for the help. I managed to do a few buttons and it grew into something bigger. I had an idea about an event that will include the MC buying a house and upgrading the facilities in there, came up with a idea for it to have different facilites which might not work with the BK lore much, it will have a gym, sauna, swimming pools and so on, a bit more modern stuff.

Script works fine and everything worked out great, i created the screen, the buttons and they jump properly onto the right labels. My problem is that i don't know how to disable the previous options after i made them. So in this specific scenario, player upgrades the pool, but i have no idea how to make sure that the option stays disabled after the upgrade:


screen guild:
 image "Mods/Vaan/guild.png" xalign 0.0 yalign 0.0


 grid 2 2:
     xalign 0.5
     yalign 0.5
     spacing 20
     frame:
         xpadding 40
         ypadding 20
         xalign 0.5
         yalign 0.5
         textbutton "Check out the pool" action [ToggleScreen("guild"), Jump("g_pool")]

     frame:
         xpadding 40
         ypadding 20
         xalign 0.5
         yalign 0.5
         text "This is in the middle" yalign 0.5 xalign 0.5

     frame:
         xpadding 40
         ypadding 20
         xalign 0.5
         yalign 0.5
         text "This is in the middle" yalign 0.5 xalign 0.5

     frame:
         xpadding 40
         ypadding 20
         xalign 0.5
         yalign 0.5
         text "This is in the middle" yalign 0.5 xalign 0.5







label g_pool:

 "The pool will need some work, no one has used it for quite some time, would you like to upgrade it?"

 "It will cost 50000 to fix it."


 menu:

     "Yes":

     if MC.gold < 50000:
          "You don't have enough gold."

          return

       

       else:

         "Congratulations, you upgraded the pool!"

         show screen guild_pool

         $ MC.gold -= 50000

         
    "No":

         "Not right now"


         return

Will really appreciate any help. Just want to figure out a way to grey out\hide the options\buttons after player has done the upgrade. Even if the buttons cannot be hidden, it will help if there is a message that comes out when the player presses to button to say "You've already upgraded this" I tried reddit, tried youtube and i can't seem to find anything similar to what i want to do. Thank you in advance, quite proud with what i've achieved so far, me from 2 months ago would have never made it this far haha. I will add all of my events into the different rooms within the house, so that it kind of looks like the player is walking around, which will make it more realistic. It will look so much better this way when i release it again, would also appreciate if anyone could help with another idea. I

I was wondering if there is a way for me to move girls into the house to make it more realistic? I haven't gotten that far yet, but i have a few ideas.
Once i'm done with the rooms, i'll try and connect it to the Brothel Bedrooms, a menu will come up that will say, you don't have space in the bedroom, would you like to move the girl to the house? Once there i will figure out a way to make girls randomly appear in the different rooms, but that's a bit further down the line.
Title: Re: [Resources] Writing events for BK
Post by: Vaan on Jan 15, 2024, 12:14 AM
https://mega.nz/file/jGwnVYiR#g3VdyaodEW3gQaZA4UqGq69V9gOyOUARtAzPrEjqU2E

https://mega.nz/file/GbB1jCyQ#HtuCKc0q5UbzvKlqaKV4-OrjpGAYo1XJ2zjLwQ1uC1Y

This is kind of what it looks like for now, but will add much more. I'll start connecting my events to the different facilities at some point next week if i have time

Managed to replicate the girls screen, only problem is that it copies the girls from there over here too, have to find a way to transfer them instead. Will see if i can create a job role or something that transfers them over. But so far everything is coming up great!

https://mega.nz/file/qWh01bJS#YOP6wB14VI48tv9eKszo-S4UBQYTy2nHRYZr8dyIiM4
Title: Re: [Resources] Writing events for BK
Post by: Goldo on Jan 16, 2024, 10:48 PM
Quote from: Yasaki74 on Jan 13, 2024, 12:26 PM@Goldo
Do you have any example codes for city_label?
because I still haven't fully understand how the city_label works, I've looked through your code today. At first this code is within another code but I can't find the conditions for the city_label to be activated

I'm going to assume you are talking about 'city_label' in _BK.ini and not, say, in a mod. The easiest is to check Boa Hancock's example _events.rpy which is included in the base girl pack.

The city label is boa_hancock_city and it looks like this:

label boa_hancock_city(girl):

    if not girl.MC_interact: # This plays if the MC and the girl haven't met

        # Hides the player notebook for the first interaction
        $ choice_menu_girl_interact = False

        $ loc = selected_location.name.lower() # This recovers the location name in lowercase

        "Strolling past a large avenue near the [loc], you see a strikingly beautiful woman making her way through the crowd. There's something imperial about her."

        [...]

        $ girl.meet_MC() # Tracks that MC and girl met for the first time
        $ MC.interactions -= 1 # Causes the MC to spend one AP

    else: # Defaults to normal city dialog by using 'call free_girl_talk(girl)' if girl and MC have already met (Note: Do NOT use the 'from ...' clause)
        call free_girl_talk(girl)

    return

Notice that this label is provided the 'girl' argument by default so that you can use it to target the specific instance of the girl template the MC is currently interacting with.

Of course, nothing prevents you from changing this example to, say, remove the greeting part and instead develop the part where they have already met, or test for selected_location to make something happen only at the beach, of any other things you may want to do such as starting an event chain. In particular, selected_location tracks the current Location object which you can find variables for in BKstart.rpy around line 371 (or you can simply test for selected_location.name).

Quote from: Vaan on Jan 14, 2024, 11:03 PMThank you for the help. I managed to do a few buttons and it grew into something bigger. I had an idea about an event that will include the MC buying a house and upgrading the facilities in there, came up with a idea for it to have different facilites which might not work with the BK lore much, it will have a gym, sauna, swimming pools and so on, a bit more modern stuff.

Script works fine and everything worked out great, i created the screen, the buttons and they jump properly onto the right labels. My problem is that i don't know how to disable the previous options after i made them. So in this specific scenario, player upgrades the pool, but i have no idea how to make sure that the option stays disabled after the upgrade:

[...]

Will really appreciate any help. Just want to figure out a way to grey out\hide the options\buttons after player has done the upgrade.

I assume what you want to do is to grey out or disable a particular game button. Here is what it would look like using your code.

Greyed out
label vaan_mod_init(): # This must be declared as your Mod's init_label or included into it if it exists. Alternatively, you can initiate the variable below whenever your first event happens, provided it doesn't repeat itself (which would reset the variable to False).
    $ vann_pool_built = False

screen guild:
 image "Mods/Vaan/guild.png" xalign 0.0 yalign 0.0


 grid 2 2:
     xalign 0.5
     yalign 0.5
     spacing 20
     frame:
         xpadding 40
         ypadding 20
         xalign 0.5
         yalign 0.5
         textbutton "Check out the pool":
             if not vaan_pool_built: # If vann_pool_built is True, no action will be provided and the default greyed out style will be used
                 action [ToggleScreen("guild"), Jump("g_pool")]

[...]

     else:

         "Congratulations, you upgraded the pool!"

         show screen guild_pool

         $ MC.gold -= 50000 # Better to use MC.change_gold(-50000) to have the notifications work automatically and some built-in sanity checks.
         $ vann_pool_built = True

Disabled --> Same changes, but write your textbutton like this instead:
     frame:
         xpadding 40
         ypadding 20
         xalign 0.5
         yalign 0.5
         if not vaan_pool_built: # If vann_pool_built is True, the button will not appear
             textbutton "Check out the pool" action [ToggleScreen("guild"), Jump("g_pool")]

Appearing with tooltip --> Same changes, one additional option to consider:
     frame:
         xpadding 40
         ypadding 20
         xalign 0.5
         yalign 0.5
         if not vaan_pool_built:
             textbutton "Check out the pool":
                if not vaan_pool_built:
                     action [ToggleScreen("guild"), Jump("g_pool")]
                else:
                     action NullAction() # This is needed to make the button sensitive and use tooltips
                     tooltip "You have already built this facility."
This last option is more player-friendly as it provides them with an explanation as to why the button is disabled. Of course, you could also include the check of vaan_pool_built in your g_pool label and change nothing to your screen code.
Title: Re: [Resources] Writing events for BK
Post by: Vaan on Feb 04, 2024, 07:16 PM
Hi guys,

I've had to delay my mod for a bit since i've been busy and also it feels like every time i'm almost finished with an idea, i either expand it or come up with something different and re-do the previous event...Anyway, i've managed to sort the house thanks to Goldo and added all the buttons, added diiferent rooms where players will be able to get my old events and some new ones depending on where they choose to go. I came back, because i had another idea which potentially might cause me to re-write and expand(yet again) my events. I will also have to release a different version for here, with normal tags, because i've created a lot of personal tags and a lot of them will not be used on packs outside of the ones i edited.


I was creating a few new outfit tags and i came up with the idea to kind of create like a "wardrobe" for girls. My question is this, if i have an event where i basically ask the game to do a random choice between 5 - 10 outfits, is there a way to make the upcoming tags in the event use the tag selected randomly.


A bit confusing, but will try to give an example.

Let's say Goldo's beach event, the event is looking to get tags swim as it is in the normal game. I add my code before that and make the game choose one of the outfits within the game, like dress, china, maid, casual. Is there a way to force the event to play with the outfit selected from the random choice after that instead? So that when MC enters the beach, the game has chosen let's say casual and text appearing will say "She has her casual outfit and looks great, then a pic with the casual outfit appears, then the rest if the event plays as normal, but instead of swim, it only looks for casual tags. Then the same for dress, china, and so on, basically you get the same event, but the girl appears in different clothing and it brings up the pics connected to that clothing.

I was hoping for a way where it magically removes "swim" and adds whichever tag the game chosen haha. Let's say, it chooses randomly "casual", then uses the code it already has, but instead of "swim" it changes it to casual. Otherwise, i would probably have to add a whole bunch of code for each outfit, which might take me a while.

The only way i figured out so far is to copy an entire event and re-write it for each outfit, but obviously i would have to copy each event at least ten times, once for each outfit and make the random choice jump towards the correct event with the outfit it selected



Title: Re: [Resources] Writing events for BK
Post by: neronero on Feb 05, 2024, 01:17 PM
Quote from: Vaan on Feb 04, 2024, 07:16 PMI was creating a few new outfit tags and i came up with the idea to kind of create like a "wardrobe" for girls. My question is this, if i have an event where i basically ask the game to do a random choice between 5 - 10 outfits, is there a way to make the upcoming tags in the event use the tag selected randomly.
You can save the outfit as a variable/string in your mod, and during an event use that variable/string when searching for a picture.

For example, something like this:

// check if the girl is actually naked, then having an outfit wouldn't make much sense
if girl.naked:
    $ pic = girl.get_pic("naked", soft=True)
else:
    // pick a random outfit and save it to a girl as her current attire
    $ girl.outfit = rand_choice("bunny", "swim", "santa")

    // look for a strip picture with that outfit
    $ pic = girl.get_pic(girl.outfit, and_tags=["strip"], soft=True)

if not pic:
    // no picture with that outfit could be found, so she doesn't have an outfit
    $ girl.outfit = None

    // look for a generic strip picture instead
    $ pic = girl.get_pic("strip", soft=True)

// show picture
show screen show_event(pic, x=config.screen_width, y=int(config.screen_height*0.8), bg=None)
with dissolve

if girl.naked:
    "She bends over, spreads her ass cheeks and lets out a loud fart."
elif girl.outfit == "bunny":
    "She takes off her bunnysuit."
elif girl.outfit == "swim":
    "She takes off her swimwear."
elif girl.outfit == "santa":
    "She unwraps her sexy santa outfit like it's christmas."
else:
    "She undresses in a generic way without drawing attention to what exactly she was wearing."
(not tested, might be something wrong with this code)

But there are limitations:
- It'll only work for your own event(s), not for base game events.
- It'll only work with outfits that have tags in the tag dictionary, unless you want to add new tags (but that's a whole different can of worms)
- It'll only work as a generic category, not a specific piece of clothing. You know she's wearing a swimsuit, but you don't know if it's a bikini or a one-piece, and she could be wearing a bikini in the first pic and a one-piece in the next one, or a red bikini that turns yellow 30 seconds later, etc.
Title: Re: [Resources] Writing events for BK
Post by: Vaan on Feb 05, 2024, 09:02 PM
Thanks for the fast reply! I'll give this a try, i've added the new tags(minus the colours, because it would take forever to go through every single colour, although it would be quite awesome...) in the tag dictionary already for my own game, but will remove those for the public version and use the normal ones instead. I've spent so many days re-doing my packs haha. I won't touch the base game events as Goldo might want to change some of them in time and i don't want to interfere with his changes.

Thanks for the help, i'll see where i go with this, i might have to re-write quite a few of my events, which shouldn't take too long hopefully! If only my stupid head would stop coming up with new ideas when i'm already finished with events...
Title: Re: [Resources] Writing events for BK
Post by: Vaan on Feb 18, 2024, 04:21 PM
Hi guys,

First version of the mod is ready. I've added dating events, events are accessable from the options menu., Walk around for now, i'll add a button at some point. Siege events will happen more often now, after MC has 4 or more girls, if he fails there will be new kidnapping events that occur until he saves the girls.

I've done the MC house and have added events almost everywhere. Got inspired by a few other games to add "Spy" events where MC will have to use speed challenges to not get caught. If he does, event is over.

I played around with the renpy dice system to add simple "missions" like in RPG games where girls can be sent out to complete missions in exchange for gold and different kinds of experience, should they complete it. If not, they will get kidnapped which will also trigger the new kidnapping events, and it's up to MC to save them and so on. That one is still in progress, have not released it for the public version yet, there are a few details i would like to iron out before release.

House can be bought from the button in the mod menu and some of the areas will also need to be bought to access more events (eventually all areas will need to be bought\repaired to access them.)

https://mega.nz/file/rbJjQIbQ#epv61BTYCeroY5nXRGnARlZAHPayO_uW3wQYCdf9UIk

I've done a few playthroughs, haven't encountered many problems. My private version has a few extra things that i'm working on, that i will add here once i've fixed all the issues

I had another question, hopefully an easy one. Is it possible to get MC.girls using their traits?

Tried these, but so far it's still getting random girls.

$ able_girls = [g for g in MC.girls if girl.has_trait("Brave")]

$ girl = get_girls(1, free=False, p_traits=["Brave"])[0]

$ girl = get_girls(1, able_girls, p_traits=["Brave"])[0]

Also is there an easy way to remove the cap on love and fear, so that you can reach max or lowest without being affected by rank? I imagine it's within the game somewhere, but i can't find it. That one is just for me, won't try to add it to the public mod. If it's too compicated, i won't bother and leave it as it is.

Hope you enjoy the mod, i'll add a separate page for it if needed, i will probably be supporting it too, but support on the mod will be slow as i'm busy most days.

Title: Re: [Resources] Writing events for BK
Post by: AlolanNinetales on Feb 19, 2024, 05:03 AM
Quote from: Vaan on Feb 18, 2024, 04:21 PMHi guys,

First version of the mod is ready. I've added dating events, events are accessable from the options menu., Walk around for now, i'll add a button at some point. Siege events will happen more often now, after MC has 4 or more girls, if he fails there will be new kidnapping events that occur until he saves the girls.

I've done the MC house and have added events almost everywhere. Got inspired by a few other games to add "Spy" events where MC will have to use speed challenges to not get caught. If he does, event is over.

I played around with the renpy dice system to add simple "missions" like in RPG games where girls can be sent out to complete missions in exchange for gold and different kinds of experience, should they complete it. If not, they will get kidnapped which will also trigger the new kidnapping events, and it's up to MC to save them and so on. That one is still in progress, have not released it for the public version yet, there are a few details i would like to iron out before release.

House can be bought from the button in the mod menu and some of the areas will also need to be bought to access more events (eventually all areas will need to be bought\repaired to access them.)

https://mega.nz/file/rbJjQIbQ#epv61BTYCeroY5nXRGnARlZAHPayO_uW3wQYCdf9UIk

I've done a few playthroughs, haven't encountered many problems. My private version has a few extra things that i'm working on, that i will add here once i've fixed all the issues

I had another question, hopefully an easy one. Is it possible to get MC.girls using their traits?

Tried these, but so far it's still getting random girls.

$ able_girls = [g for g in MC.girls if girl.has_trait("Brave")]

$ girl = get_girls(1, free=False, p_traits=["Brave"])[0]

$ girl = get_girls(1, able_girls, p_traits=["Brave"])[0]

Also is there an easy way to remove the cap on love and fear, so that you can reach max or lowest without being affected by rank? I imagine it's within the game somewhere, but i can't find it. That one is just for me, won't try to add it to the public mod. If it's too compicated, i won't bother and leave it as it is.

Hope you enjoy the mod, i'll add a separate page for it if needed, i will probably be supporting it too, but support on the mod will be slow as i'm busy most days.


Thank you good sir, will definitely check this out and am excited to play this
Title: Re: [Resources] Writing events for BK
Post by: Vaan on Feb 19, 2024, 01:10 PM
Hope you like it, let me know if there are any issues! The main idea of the house would be to have a list of free girls who live there (might be able to do a landlord\rent system or something in the future), but i haven't figured out how to do that yet, as i'm not good with python, i believe i will need it to be able to free and move girls to the house, but that would be a lot further down the line when i get better. It's why some of the content might not be related to the usual brothel interactions. But when i was writing the code, i had free girls in mind hah, felt like their content has opportunity to be expanded.

Forgot to remove some of my personal tags (kidnapped, spy), added new areas(tavern, showers, gym, pool, dressing room, living room, office and a few more) and also added furniture interactions (like on char, on table, on desk, on bed and so on). I've replaced those ones with the normal ones, (wet, public, beach, dirty, rest). I could potentially release downloads with the girlpacks i have that work with the extended tags at some point (have about 95 of them). This version should be cleaner:


https://mega.nz/file/7OZlRKjB#0PPSdrZwQ0AEWVecTOlkioeuM-vSvH5wMq69cnZUkWE