Creating a store on the main menu -Help needed-

A place to discuss things that aren't specific to any one creator or game.
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Post Reply
Message
Author
Nayru
Regular
Posts: 35
Joined: Thu Sep 03, 2009 6:47 pm
Projects: Short OC's BL game
Location: The less expected place
Contact:

Creating a store on the main menu -Help needed-

#1 Post by Nayru »

I would like to know if it is possible to create it. Being more specific, what I wanted to do is creating a new section in the main menu (a section like the gallery for example). Just that in this case it would be kind of a shop.

Through the game you're able to collect objects that you can exchange for extra content(like pictures, or mini games) in the shop, which can be accessed anytime in the main menu, so that it doesn't break the plot and can be seen anytime giving the game a replayable value.

My questions are:
·Is it possible to do that and still have the gallery in the main menu?
·If the previous answer is yes, How?
·Would you be able to talk to the owner of the shop and change the background or offers depending on your choices?

If anyone has an idea of how to do that or if there's any post where this information can be found (I tried yet I failed) or if this post is wrong placed, then please tell me.

Also saying that I'm a total noob to coding but I can draw and write. Thanks for reading ^-^

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Creating a store on the main menu -Help needed-

#2 Post by Alex »

You can make your shop similar way as a gallery (add another button to main menu, make label that have the code for your shop)
Never tried to do something like that myself..., but I think you`ll have to use persistent variables for this, since you plan to make access to the shop from main menu.

Nayru
Regular
Posts: 35
Joined: Thu Sep 03, 2009 6:47 pm
Projects: Short OC's BL game
Location: The less expected place
Contact:

Re: Creating a store on the main menu -Help needed-

#3 Post by Nayru »

That is what I tried to do, but I can't find the right code.

KimiYoriBaka
Miko-Class Veteran
Posts: 636
Joined: Thu May 14, 2009 8:15 pm
Projects: Castle of Arhannia
Contact:

Re: Creating a store on the main menu -Help needed-

#4 Post by KimiYoriBaka »

hmm...interesting idea. It's doesn't seem like it would be too hard, and I think this is how you'd do it:

okay, so if you're using the cookbook entry "new cg gallery", you would use Gallery.condition() with different persistent variables inside the parentheses (which I assume is what normally would be done). in case you don't know, persistent variables are ones beginning with "persistent." and are considered null if you don't define them (unlike normal which give an error if you don't define them). you need to do this for everything in your gallery that is unlockable. also, the line with Gallery.condition goes right after the matching Gallery.image() line.

an example for a persistent would be, say if an image is unlocked by viewing ending 1, you could use "persistent.end1". it doesn't really matter what the name is, but it's best that it be easy to recognize.

if you're not using the cookbook then whichever part you use to show the images in your gallery should contain if statements with persistent variables as the conditions.

either way, you need a different variable for each thing that can be bought in your shop, that is then used as the condition for viewing or using that item. also, in one of your init blocks, you'll need to define a persisten to represent the amount of money the player has and set it to start at zero. this could be done like this:

Code: Select all

init:
    $ persistent.money = 0
then, you use whichever method is convenient for adding the shop button to the main menu. if you use the method shown in the gallery cookbook, it would be

Code: Select all

$ config.main_menu.insert(2, ('Shop', "shop", "True"))
I don't know what the first value is for because I couldn't find this function in the renpy reference (it's probably python) but this adds the button and makes it always clickable.

next, you make a label called "shop" that defines the menu of things to buy and then makes a whole bunch of buttons for the items to buy, each with the condition the the matching variable is false. You then make each button first check if the player has enough money (as in check if persistent.money > the price) and if it is, set the matching persistent to true.

if you haven't already, you'll need to learn how to make the menu for the shop, which can be done various ways. if you're not good with code, I would suggest just stick with the basic menu blocks mentioned in the tutorial, but if you want it look better an imagemap could work too. I would the ui functions but thats if you can understand the confusing documentation...

the last thing to do is go through the code for each of the places where the player would gain money and just increase persistent.money by whatever amount you're giving them.

Post Reply

Who is online

Users browsing this forum: No registered users