News:

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

Former www.henthighschool.com

[Resources] Seaside Pharmacy mod

Started by Jman, Jul 12, 2024, 11:32 AM

Previous topic - Next topic

JmanTopic starter

Continuing the theme of stripping things out of Bonanza, here is a new shop that takes medicine items away from the Giftgirl and puts them into a pharmacy at the Seaside location. Hence the name Seaside Pharmacy.

Download:
0.1: Mediafire

This is for BK 0.3. If there's demand for an 0.2 version, I suppose I can see what I can do.

Features:
  • A new shop.
  • Tonics, medpacks, monster juice, love potions and wine moved from the Giftgirl to there.
  • This probably means more of each category available to purchase.
  • Papa Freak is butted to the Taverns. I hope Goldo isn't planning on putting another special location there. :P
  • Bugs, most likely. :'(
And with strange aeons even death may die...

22ndgentlemen

Will give this a try and let you know of any findings.  I don't normally use consumables, but there is a first time for everything.

JmanTopic starter

Hmm, can I ask for some hooks in the game for this mod? Because copying over long labels like this for just a few small changes (mainly activating and deactivating Taverns instead of Seaside for Papa Freak) is really inelegant and not at all update-friendly.

Unless Goldo has some alternative ideas for a medicine dealer he'd like to explore in the future?
And with strange aeons even death may die...

Goldo

Quote from: Jman on Jul 23, 2024, 09:26 PMHmm, can I ask for some hooks in the game for this mod? Because copying over long labels like this for just a few small changes (mainly activating and deactivating Taverns instead of Seaside for Papa Freak) is really inelegant and not at all update-friendly.

Unless Goldo has some alternative ideas for a medicine dealer he'd like to explore in the future?

Sure, what do you need and where?
Maker of BK. Looking for the latest patch for BK v0.3? The link doesn't change, so bookmark it!

JmanTopic starter

Switching out the Seafront activation with the Taverns, mainly. I hope this is all:

label chapter2:
    ...
    $ story_add_event("meet_riche")

    # <Seaside Pharmacy Mod>
    if game.has_active_mod("Seaside Pharmacy"):
        $ story_add_event("meet_doctor")
    #</Seaside Pharmacy Mod>
label c2_meet_papa_freak():
    ...
    "Papa Freak wants to meet a girl who has {b}at least 50 in Beauty, Body, Refinement and Charm{/b}, and is open to whoring."

    if selected_district.name == "The Docks":
        $ _loc = seafront
        # <Seaside Pharmacy Mod>
        if game.has_active_mod("Seaside Pharmacy"):
            $ _loc = taverns
        #</Seaside Pharmacy Mod>
    else:
        $ _loc = gallows   

label visit_papa():
                ...
                "You are a little shaken to learn that the total bill amounts to a whopping {b}[cost] denars{/b}."

                $ seafront.action = False
                $ gallows.action = False
                $ plaza.action = False
                # <Seaside Pharmacy Mod>
                if game.has_active_mod("Seaside Pharmacy"):
                    $ taverns.action = False
                    python:
                        try:
                            if doctor_name == "Doctor":
                                seafront.action = True
                            else:
                                pass
                        except:
                            pass
                #</Seaside Pharmacy Mod>

label c3_interrogate_contacts():
        ...
        call c3_papa_cells() from _call_c3_papa_cells_1

        if district.name == "The Docks":
            $ seafront.action = True
            #<Seaside Pharmacy Mod>
            if game.has_active_mod("Seaside Pharmacy"):
                $ taverns.action = True
                python:
                    try:
                        if doctor_name == "Doctor":
                            seafront.action = True
                        else:
                            seafront.action = False
                    except:
                        seafront.action = False
            #</Seaside Pharmacy Mod>
        elif district.name == "The Warehouse":
            $ gallows.action = True

label c3_papa_cells():
                ...
                papa "See you around soon, my boy!"

                $ seafront.action = False
                $ gallows.action = False
                # <Seaside Pharmacy Mod>
                if game.has_active_mod("Seaside Pharmacy"):
                    $ taverns.action = False
                    python:
                        try:
                            if doctor_name == "Doctor":
                                seafront.action = True
                            else:
                                pass
                        except:
                            pass
                #</Seaside Pharmacy Mod>
And with strange aeons even death may die...

Goldo

So here's my implementation, designed to make things a little more flexible. Let me know if you see something wrong with it:

In BKclasses.rpy
class Mod(object):
        def __init__(self,...):
            [...]
            # May store a single label (string) to be called at the start of a specific chapter (None by default)
            self.chapter_labels = {1: None, 2: None, 3: None, 4: None, 5: None, 6: None, 7: None}

Then in BKevents.rpy:
label chapter(chapter = None, silent=False, forced=False):
    [...]

    if lbl:
        $ renpy.call(lbl)

    python:
        mod_labels = []
        for mod in self.active_mods.values():
            if mod.chapter_labels[game.chapter]:
                if renpy.has_label(mod.chapter_labels[game.chapter]):
                    mod_labels.append(mod.chapter_labels[game.chapter])
                else:
                    raise AssertionError("%s mod error (chapter labels): %s is not a recognized label (check for spelling mistakes)." % (mod.name, mod.chapter_labels[game.chapter]))

    while mod_labels: # Because ren'py calls don't play nice with python 'for' loops
        $ lbl = mod_labels.pop(0)
        call expression lbl
        $ norollback()

    return

In BKinit_variables.rpy:
init -4 python:
    [...]
    papa_location = {"The Docks" : "Seafront", "The Warehouse" : "Gallows"}

Then in BKchapter2.rpy:
label c2_meet_papa_freak():
    [...]
    $ _loc = location_dict[papa_location[selected_district.name]]

    # Similar changes to all other relevant Papa events

Then all you'll need to do when initiating your mod is:
- Declare 'your_mod.chapter_labels[2] = "meet_doctor"' somewhere
- Change Papa's location to 'papa_location["The Docks] = "Taverns"' (be careful to use the district and location names as strings, capitalized and all, and not the objects)
Maker of BK. Looking for the latest patch for BK v0.3? The link doesn't change, so bookmark it!

JmanTopic starter

#6
Well, it mostly looks fine, but I don't want to call the "meet_doctor" label (which leads to problems since it's a location-dependent label). I just want to add it to the location-specific label list, so it triggers when visiting that location.


I'm also not sure this is not overkill, but I suppose generic beats specific.


Edit: There's a 'self' in the chapter code that should be 'game'.
And with strange aeons even death may die...

Goldo

#7
In that case, you can add it as a city event like so:
$ add_event("meet_doctor", chance = 1.0, type="city", location = "taverns", once = False, AP_cost = 1)

But I think instead you might want to include the following as part of a Chapter2 intro event:
$ taverns.menu = ("Visit the doctor", "meet_doctor")
$ taverns.action = True

This would keep the doctor action separate and avoid events conflicting if there is a story event set to happen at the taverns or something.

Will edit the 'self' typo.
Maker of BK. Looking for the latest patch for BK v0.3? The link doesn't change, so bookmark it!

JmanTopic starter

#8
I guess I can add a chapter requirement to this 'add_event', forgot about that. Perhaps that's the way to go, indeed.


I don't want to put her into the Taverns, I want to shift Papa Freak there (if he's set up to take over the Seafront).

I guess I can change the Seafront from 'meet_doctor' to 'visit_doctor' within the 'meet_doctor' label, and skip the chapter stuff. But I'd actually kinda like to retain that, so that this mod can serve as a generic template for shopkeeper mods.

If there's a story event happening, it'll happen only once, or - if not - it's the same deal as with Papa Freak and I might not be able to access the Pharmacy at all.



And with strange aeons even death may die...

mmm520555

Quote from: Jman on Jul 29, 2024, 02:37 PMI guess I can add a chapter requirement to this 'add_event', forgot about that. Perhaps that's the way to go, indeed.


I don't want to put her into the Taverns, I want to shift Papa Freak there (if he's set up to take over the Seafront).

I guess I can change the Seafront from 'meet_doctor' to 'visit_doctor' within the 'meet_doctor' label, and skip the chapter stuff. But I'd actually kinda like to retain that, so that this mod can serve as a generic template for shopkeeper mods.

If there's a story event happening, it'll happen only once, or - if not - it's the same deal as with Papa Freak and I might not be able to access the Pharmacy at all.




Hello, I have enabled the use in the MOD management and help menus, but I did not find the newly added NPCs in the 18 small maps in the first three areas, and I could not find the entrance to the pharmacy.
Dear MOD maker, can you answer my questions?
Because I am not an English user, my description may confuse you, after all, it is translated through Google.

JmanTopic starter

You should 'look around' in the Seafront area. You might hit the 'tavern man' first if you haven't seen him yet, so may need two tries. After that, the shop is unlocked, gets its own icon and everything. If not, try re-enabling the mod from the '?' menu.

If it still doesn't work, come back and tell me more about what you did and how you're still unable to keep up with your girls' potion habits.
And with strange aeons even death may die...

mmm520555

Quote from: Jman on Aug 09, 2024, 02:34 PMYou should 'look around' in the Seafront area. You might hit the 'tavern man' first if you haven't seen him yet, so may need two tries. After that, the shop is unlocked, gets its own icon and everything. If not, try re-enabling the mod from the '?' menu.

If it still doesn't work, come back and tell me more about what you did and how you're still unable to keep up with your girls' potion habits.
OK, maybe I haven't looked around enough in the coastal area. I'm going to give it a try a few more times.
 Thank you for your patience in answering~~~

mmm520555

#12
When I was "looking around" at this beachfront location, the following error message appeared.

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/BKmain.rpy", line 235, in script
    $ result = ui.interact()
  File "game/BKmain.rpy", line 235, in <module>
    $ result = ui.interact()
  File "game/BKscreens.rpy", line 3805, in execute
    screen visit_location():
  File "game/BKscreens.rpy", line 3805, in execute
    screen visit_location():
  File "game/BKscreens.rpy", line 3829, in execute
    frame:
  File "game/BKscreens.rpy", line 3835, in execute
    has vbox
  File "game/BKscreens.rpy", line 3899, in execute
    hbox:
  File "game/BKscreens.rpy", line 3916, in execute
    if selected_location.action:
  File "game/BKscreens.rpy", line 3917, in execute
    button xsize xres(240) ysize yres(50):
  File "game/BKscreens.rpy", line 3924, in execute
    hbox yalign 0.5 xfill True:
  File "game/BKscreens.rpy", line 3925, in execute
    if selected_location.can_do_action():
  File "game/BKscreens.rpy", line 3926, in execute
    add location_tb[selected_location.menu[1]] insensitive_alpha 0.33 idle_alpha 0.66 hover_alpha 1.0
  File "game/BKscreens.rpy", line 3926, in <module>
    add location_tb[selected_location.menu[1]] insensitive_alpha 0.33 idle_alpha 0.66 hover_alpha 1.0
KeyError: 'visit_doctor'

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

Full traceback:
  File "game/BKmain.rpy", line 235, in script
    $ result = ui.interact()
  File "D:\Brothel_King\renpy\ast.py", line 1138, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "D:\Brothel_King\renpy\python.py", line 1122, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "game/BKmain.rpy", line 235, in <module>
    $ result = ui.interact()
  File "D:\Brothel_King\renpy\ui.py", line 299, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "D:\Brothel_King\renpy\display\core.py", line 3579, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, pause_modal=pause_modal, **kwargs) # type: ignore
  File "D:\Brothel_King\renpy\display\core.py", line 4052, in interact_core
    root_widget.visit_all(lambda d : d.per_interact())
  File "D:\Brothel_King\renpy\display\core.py", line 681, in visit_all
    d.visit_all(callback, seen)
  File "D:\Brothel_King\renpy\display\core.py", line 681, in visit_all
    d.visit_all(callback, seen)
  File "D:\Brothel_King\renpy\display\core.py", line 681, in visit_all
    d.visit_all(callback, seen)
  File "D:\Brothel_King\renpy\display\screen.py", line 476, in visit_all
    callback(self)
  File "D:\Brothel_King\renpy\display\core.py", line 4052, in <lambda>
    root_widget.visit_all(lambda d : d.per_interact())
  File "D:\Brothel_King\renpy\display\screen.py", line 487, in per_interact
    self.update()
  File "D:\Brothel_King\renpy\display\screen.py", line 680, in update
    self.screen.function(**self.scope)
  File "game/BKscreens.rpy", line 3805, in execute
    screen visit_location():
  File "game/BKscreens.rpy", line 3805, in execute
    screen visit_location():
  File "game/BKscreens.rpy", line 3829, in execute
    frame:
  File "game/BKscreens.rpy", line 3835, in execute
    has vbox
  File "game/BKscreens.rpy", line 3899, in execute
    hbox:
  File "game/BKscreens.rpy", line 3916, in execute
    if selected_location.action:
  File "game/BKscreens.rpy", line 3917, in execute
    button xsize xres(240) ysize yres(50):
  File "game/BKscreens.rpy", line 3924, in execute
    hbox yalign 0.5 xfill True:
  File "game/BKscreens.rpy", line 3925, in execute
    if selected_location.can_do_action():
  File "game/BKscreens.rpy", line 3926, in execute
    add location_tb[selected_location.menu[1]] insensitive_alpha 0.33 idle_alpha 0.66 hover_alpha 1.0
  File "game/BKscreens.rpy", line 3926, in <module>
    add location_tb[selected_location.menu[1]] insensitive_alpha 0.33 idle_alpha 0.66 hover_alpha 1.0
KeyError: 'visit_doctor'

Windows-10-10.0.19041 AMD64
Ren'Py 8.1.1.23060707
Brothel King 0.3t v230923
Sat Aug 10 09:43:36 2024

mmm520555

I guess it's not a problem with the mod, because after I reinstalled the game, the map became inaccessible again.

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/BKmain.rpy", line 258, in script call
    python:
  File "game/BKevents.rpy", line 735, in script call
    $ ev.play()
  File "game/BKmain.rpy", line 258, in script call
    python:
  File "game/BKevents.rpy", line 735, in script call
    $ ev.play()
ScriptError: could not find label 'meet_doctor'.

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

Full traceback:
  File "D:\00000000000000\Brothel_King\renpy\bootstrap.py", line 275, in bootstrap
    renpy.main.main()
  File "D:\00000000000000\Brothel_King\renpy\main.py", line 670, in main
    run(restart)
  File "D:\00000000000000\Brothel_King\renpy\main.py", line 144, in run
    renpy.execution.run_context(True)
  File "D:\00000000000000\Brothel_King\renpy\execution.py", line 953, in run_context
    context.run()
  File "game/BKmain.rpy", line 258, in script call
    python:
  File "game/BKevents.rpy", line 735, in script call
    $ ev.play()
  File "game/BKmain.rpy", line 258, in script call
    python:
  File "game/BKevents.rpy", line 735, in script call
    $ ev.play()
  File "D:\00000000000000\Brothel_King\renpy\script.py", line 1013, in lookup
    raise ScriptError("could not find label '%s'." % str(original))
ScriptError: could not find label 'meet_doctor'.

Windows-10-10.0.19041 AMD64
Ren'Py 8.1.1.23060707
Brothel King 0.3t v230923
Sat Aug 10 09:57:47 2024

mmm520555

When I start a new game, using additional settings (or using sandbox mode) and directly starting the game from "Chapter 2", I can't meet the drugstore clerk in the seaside map no matter what.
Whether using the current installation file or installing a new game, the old game saves are not usable when "looking around" in the seaside map. I think my game saves are basically corrupted.