Inventory Screen

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
Tesspolar
Newbie
Posts: 21
Joined: Fri Mar 20, 2020 11:37 am
Contact:

Re: Inventory Screen

#91 Post by Tesspolar » Tue Mar 31, 2020 10:27 am

hi, how can i stop inventory screen to close itself up when you click on an item? I wanted to close it only with Close Inventory textbutton/
Thanks

M-77
Regular
Posts: 56
Joined: Tue Sep 04, 2018 7:58 am
Contact:

Re: Inventory Screen

#92 Post by M-77 » Wed Apr 01, 2020 3:51 pm

Hello Tesspolar, see my comments/code on page 5 (and 6). You will see that I add a "Imagebutton" for that function, and blocked the older code with # above my imagebutton code.
#Imagebutton for hide inventory:
imagebutton idle "HUDINV_idle001.png" hover "HUDINV_hover001.png" xpos 0.933 ypos 0.417 action [Hide("inventory_screen")]

And I also did some changes to made this inventory code fit to my basic requirements in my project.
Just read the last two pages and compare to your code. You need to put some short lines in the screen.rpy for the imagebutton. You need to do a png/jpg pic for the button too. It is relative easy to do, as I am also beginner in Renpy. Just try around what happens. Made notes on paper. Do one change at a time to see what is doing what.
Last edited by M-77 on Sun Aug 23, 2020 5:40 pm, edited 1 time in total.

Tesspolar
Newbie
Posts: 21
Joined: Fri Mar 20, 2020 11:37 am
Contact:

Re: Inventory Screen

#93 Post by Tesspolar » Thu Apr 02, 2020 2:20 pm

M-77 wrote:
Wed Apr 01, 2020 3:51 pm
Hello Tesspolar, see my comments/code on page 5 (and 6). You will see that I add a "Imagebutton" for that function, and blocked the older code with # above my imagebutton code.
#Imagebutton for hide inventory:
imagebutton idle "HUDINV_idle001.png" hover "HUDINV_hover001.png" xpos 0.933 ypos 0.417 action [Hide("inventory_screen")]

And I also did some changes to made this inventory code fit to my basic requirements in my project.
Just read the last two pages and compare to your code. You need to put some short lines in the screen.rpy for the imagebutton. You need to do a png/jpg pic for the botton too. It is relative easy to do, as I am also beginner in Renpy. Just try around what happens. Made notes on paper. Do one change at a time to see what is doing what.
Thank you. Yeah it was textbutton and i switched it to imagebutton and it works nice right now

Ace94
Regular
Posts: 113
Joined: Sat Apr 08, 2017 4:22 pm
Contact:

Re: Inventory Screen

#94 Post by Ace94 » Tue Jun 16, 2020 12:56 am

Hi! How can you buy or add more than one item (in bulk)? Does anyone know?

Code: Select all

    $inventory.buy(gun)
    "Me" "Nice"
    $inventory.add(laser)
Also, how to make a max inventory space and make a message notifying the player that his bag is full? And selling items to a vendor would be possible with this code? Thanks in advance.

M-77
Regular
Posts: 56
Joined: Tue Sep 04, 2018 7:58 am
Contact:

Re: Inventory Screen

#95 Post by M-77 » Sun Aug 23, 2020 5:27 pm

Hello "Ace94", I use my version of this only to show the player what items he has. And description of the items.
You can use variables in addition to the "add" "drop" items commands to remove items from the inventory.

This before "label start":
#Inventotry Item markers
Item_Spezielles_Oel = False


This in game;
Just a line after the "label start", in the list for the inventory:
default specialoil = Item("Special Oil", image="gui/inv_Special_Oil.png")

And when you obtain such item in game, like at a shop/menu code should tell this:
$ Item_Spezielles_Oel = True
$ inventory.add(specialoil)


When you use it up in game your code should tell this both:
$ Item_Spezielles_Oel = False
$ inventory.drop(specialoil)


So I use double hardcoding to simulate action in my inventory. Hope this gives you an idea.

Post Reply

Who is online

Users browsing this forum: No registered users