u/KoanliColors

▲ 1 r/RenPy

How to make Inventory items Usable for player?

I have a working inventory, and I'm currently trying to figure out how to make it so the player can use the items in their inventory and code it in a way that different items have different effects(attached to variables. Like using food would be $ health += 10, or something to that effect).

*** am able to manually check for an item and remove it myself, but my goal is for the player to be able to use the items in their inventory as needed.***
There are already things I'm able to do, such as checking for inventory items, removing inventory items; I'm just not sure how to associate that into those items effecting variables in the game. What I'm trying to do is make another button that would remove and item and trigger or effect another variable. I feel like this is possible but I just wasn't sure how to make it work, I think I have most of what I need to do it; I just don't know how to put it together.

I'll share what I have for my code, any help, advice or insight is so greatly appreciated!

This is how I check for the item myself and remove it manually in the script:

    $ InvItem(*item_sodac).pickup(2)


    if inventory.has_item(sodac) == False:
        "Nice, I have soda"
        $ health += 10 
    else:
        "Damn, I'm so thirsty..."


    if "item_sodac" in inv:
        $ inv.remove("item_sodac") 
    else:
        pass

This is my how my toss button is written in the script (I want to add a *use* button beside it and connect it to different variables depending on what item is used by the player.

            vbox:
                align (.9,.1)
                style_group "sort"
                if selling:
                    textbutton _("SELL") action ShowTransient("buying", whichitem=thisitem, howmuch=thisitem.value, selling=True)
                else:
                    textbutton _("TOSS") action ShowTransient("buying", whichitem=thisitem, howmuch=0)


            # shop-free alternative toss button:
                #textbutton _("TOSS") action [Function(thisitem.toss, 1), SetVariable("selected_item", None)]

I can post more/ all of the code but I didn't want the post to look too overwhelming T_T Any insight is much appreciated!

reddit.com
u/KoanliColors — 1 day ago
▲ 1 r/RenPy

Inventory Item Help

I'm back again for help (I'm so sorry), I've been trying to add more retrievable items to my inventory but I'm getting an error code when I open my bag after they've been added. When I add certain items, the inventory works and opens just fine but it's started crashing what I add different ones I've recently coded into the game. I check over and over but the newer items are coded the exact same as the other ones, so I'm not sure what's wrong.

### Before the start line
define item_maxsegg = (_("Max's Magic Blue Egg"), "item maxsegg", 0,
    _("A plain egg, colored with blue marker"), "item_maxegg")

### before the start line
define itemlist = [
    item_maxsegss,

### After the start line
        maxsegg = Item("Max's Magic Blue Egg", 0, "")

When I add the item to my inventory, I use this code:

    $ InvItem(*item_maxsegg).pickup(1)

But this is the error code I get when I check to see if the item is in my back buy clicking the bag on my screen that opens up my inventory

File "game/items/item-screens.rpy", line 38, in execute

screen inventory(collection, selling=False):

File "game/items/item-screens.rpy", line 38, in execute

screen inventory(collection, selling=False):

File "game/items/item-screens.rpy", line 63, in execute

use invgrid(collection, page, first, last)

File "game/items/item-screens.rpy", line 180, in execute

screen invgrid(collection, page, first, last, selling=False):

File "game/items/item-screens.rpy", line 180, in execute

screen invgrid(collection, page, first, last, selling=False):

File "game/items/item-screens.rpy", line 182, in execute

frame:

File "game/items/item-screens.rpy", line 191, in execute

grid invgrid_x invgrid_y:

File "game/items/item-screens.rpy", line 194, in execute

for item in collection[first:last]:

File "game/items/item-screens.rpy", line 198, in execute

button xysize itemslot_xysize:

File "game/items/item-screens.rpy", line 198, in keywords

button xysize itemslot_xysize:

File "renpy/python.py", line 1305, in py_eval

return py_eval_bytecode(code, globals, locals)

My thing is, I'm using the exact format and spacing for the item water, which is the only one that seems to be working. I'm not sure why I'm getting an error code for one, but not the other. Does anyone have an idea of what I'm doing wrong or how I can fix it so the game does crash when I open my inventory with new items?

reddit.com
u/KoanliColors — 6 days ago
▲ 2 r/RenPy

In game camera for screenshots

How do I get a camera for screenshots to work, I know in the script it needs to be:

$ renpy.screenshot(“camera.png”)

And that the name of the camera image has to be in the images folder, but do I need to add anything else in the script for this to work?

reddit.com
u/KoanliColors — 7 days ago
▲ 1 r/RenPy

Need help fixing loading screen overlap

https://preview.redd.it/svam0xpwxb1h1.png?width=2560&format=png&auto=webp&s=c38429dc987920078dae35831afb9737f3fe5805

Ion even know how to fix this, but my save file images are huge and overlap the save space. Does anyone know how to make my save file images smaller or how to force them into staying within the save slots? The dates and page numbers also overlap for some reason T_T Any help or insight is greatly appreciated?

reddit.com
u/KoanliColors — 7 days ago
▲ 1 r/RenPy

Opening Inventory Help

So, I have a working inventory but I wanted to have a bag on screen that brings the player to the inventory when they click it. The inventory itself shows if I call the inventory screen and I have another screen that shows the bag on screen. Can someone tell me how I might link the two? I tried changing the "action" in the bag screen to connect it with the inventory but it doesn't work. Does anyone know what action I need to use to connect the two? This is what I have for the inventory and bag call/show screens:

    show screen inventoryUI
# After the START button (This is the how I call the bag that shows)

####In the screens section/ This is the bag that shows in game

screen inventoryUI:


    imagebutton:
        xalign 1.092
        yalign 1.18
        idle "UI/bag_idle.png"
        action Notify("Empty")


###How I call my actually inventory
    call screen inventory(inv) 

Any help or insight is much appreciated! Thank you so much

reddit.com
u/KoanliColors — 7 days ago
▲ 1 r/RenPy

Switching audio help

I’m trying to switch my audio by pausing one and playing the other. I’m getting an error that says
“TypeError: ‘>=‘ not supported between instances of ‘float’ and ‘str’ “ Does anyone know what this means? I have my code like this

pause “audio/houseofglass.mp3”
play music “audio/mainost.ogg”

Am I missing a peace of code that goes inbetween or something like that? The music plays fine until it gets to the part of the script where I have to switch music

reddit.com
u/KoanliColors — 9 days ago
▲ 56 r/RenPy

My game is 440mb, how do I shrink it for itchio?

Aight, so I want to put my game on itchio, but it’s 440.6 MB🥴 A lot of my images are 1-3mb and I’ve got a few hundred, which is why it’s so big aside from music. What’s the easiest way to shrink all my files without doing it one by one?

If anyone knows what the max game file a game can be for it to be playable on browser for itchio, I’d love that info too! Any help or insight is much appreciated!

u/KoanliColors — 9 days ago
▲ 6 r/RenPy

Script not responding to the code

I finished my coding my visual novel and I’m currently playing through it to fix bugs and image overlap. But there’s this weird bug going on and I can’t for the life of me figure out what’s wrong.

For example, I notice a mouth is missing, then I’ll go into the script and add it but it’s already there. I’ll see this:

Show bb_mo

But when I go back to that line of script it’s not showing, I can skip to a different part of the script and the image will show, so I’m not sure what’s happening. There aren’t any images covering it and I’ve tried deleting the line and writing again but the image still will not show even though I can call the imagine and it shows on different parts of the story.

I’m having the same issue (that I think is a big) when using the TRUE statements. For example I’ll write

$ lunch_wseth == True

If lunch_wseth == True:
“Something happens”
else:
“Nothing happens”

Even thought I labeled the statement to be true, it will jump to the “else” statement instead. It’s driving me nuts, I set it so that that statement will be true but the script/code is ignoring it; has anyone else had any issues with the script ignoring statements or images? Any help would be so much appreciated 😭I finally finished the game but it feels like now I’ve hit a brick wall.

u/KoanliColors — 11 days ago