News:

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

Former www.henthighschool.com

[Resources] Writing events for BK

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

Previous topic - Next topic

GoldoTopic starter

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.
Maker of BK. Looking for the latest patch for BK 0.2? The link doesn't change, so bookmark it!

Aetheran

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).

vadi92

#92
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.

Vaan

#93
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.

Yasaki74

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

GoldoTopic starter

#95
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.
Maker of BK. Looking for the latest patch for BK 0.2? The link doesn't change, so bookmark it!

Yasaki74

#96
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

GoldoTopic starter

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).
Maker of BK. Looking for the latest patch for BK 0.2? The link doesn't change, so bookmark it!

Yasaki74

@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

Vaan

#99
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.

Vaan

#100
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

GoldoTopic starter

#101
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.
Maker of BK. Looking for the latest patch for BK 0.2? The link doesn't change, so bookmark it!

Vaan

#102
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




neronero

#103
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.
My Girl Packs: [ link ] - Trait King mod: [ link ]

Vaan

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...