Character interaction screen
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
- Abuelitaland
- Regular
- Posts: 135
- Joined: Fri Jun 07, 2013 9:12 pm
- Projects: Ways To The Grave(18+/Gore), Pantyline(18+)
- Tumblr: sketchyland
- Location: U.S.
- Contact:
Character interaction screen
Siiiighhh I've hit a wall here, making this thing. It turned out to be uh more complicated than i first thought and I don't know what I'm doing anymore haha... Actually I could use some help from someone good at programming if any of y'all would be kind enough.
You see, two columns of four "slots". as for the items, I only want them to show up in a slot on this screen if you have that item in your inventory. when you click it, i want it to show an image and there'll be a couple of lines of dialogue in the usual textbox and then go back to this screen. I want for the to be an option in the very last slot no matter what, though.
yeesh let me know if that was too vague or if i left out some necessary information
Re: Character interaction screen
I'd do it using screen language: http://www.renpy.org/doc/html/screens.html to make a screen for the inventory, and have a list to store whether you have the items or not.
First, set up the screen, and stick some boxes in there for the items to go in, and the list of inventory items. Assuming you want it like in your picture where the same items always take the same inventory slot, something like this:
Now you need to populate the inventory, sometime after the start label, so that it gets saved properly...
To add or remove things use
To show and hide the screen use
The actions as I've written will cause you to Jump to a label for each item, which will then need to send you back to the game. Alternatively you could so something like make them set a variable, then have that cause text to show up:
Then at the bottom of the screen:
etc.
Well, you can basically do what you want. Check out the screen language and screen actions pages on the documentation!
First, set up the screen, and stick some boxes in there for the items to go in, and the list of inventory items. Assuming you want it like in your picture where the same items always take the same inventory slot, something like this:
Code: Select all
init:
$ box = Solid("#ff0000", area=(0,0,160,120))
screen inv:
vbox xalign 0.0:
frame:
xpadding 10
ypadding 10
xalign 0.5
yalign 0.5
if "knife" in inventory:
imagebutton auto "knife_%s.png" action Jump('Knife')
else:
add box
frame:
xpadding 10
ypadding 10
xalign 0.5
yalign 0.5
if "cigar" in inventory:
imagebutton auto "cigar_%s.png" action Jump('Cigar')
else:
add box
frame:
xpadding 10
ypadding 10
xalign 0.5
yalign 0.5
if "hat" in inventory:
imagebutton auto "hat_%s.png" action Jump('Hat')
else:
add box
frame:
xpadding 10
ypadding 10
xalign 0.5
yalign 0.5
if "walkman" in inventory:
imagebutton auto "walkman_%s.png" action Jump('Walkman')
else:
add box
vbox xalign 1.0:
frame:
xpadding 10
ypadding 10
xalign 0.5
yalign 0.5
if "mouse" in inventory:
imagebutton auto "mouse_%s.png" action Jump('Mouse')
else:
add box
frame:
xpadding 10
ypadding 10
xalign 0.5
yalign 0.5
if "dirigible" in inventory:
imagebutton auto "dirigible_%s.png" action Jump('Dirigible')
else:
add box
frame:
xpadding 10
ypadding 10
xalign 0.5
yalign 0.5
if "syringe" in inventory:
imagebutton auto "syringe_%s.png" action Jump('Syringe')
else:
add box
frame:
xpadding 10
ypadding 10
xalign 0.5
yalign 0.5
if "dove" in inventory:
imagebutton auto "dove_%s.png" action Jump('Dove')
else:
add boxCode: Select all
$ inventory = ["knife", "syringe", "dove"]Code: Select all
$ inventory.append("hat")
$ inventory.remove("knife")Code: Select all
show screen inv
hide screen invCode: Select all
imagebutton auto "syringe_%s.png" hovered SetVariable("infotext", "syringe") unhovered SetVariable("infotext", "nothing")Code: Select all
if infotext == "syringe":
text "It's a syringe"
if infotext == "knife":
text "It's a knife"Well, you can basically do what you want. Check out the screen language and screen actions pages on the documentation!
Who is online
Users browsing this forum: Bing [Bot]