In Game Mall

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
User avatar
TheOneAndOnly-K
Regular
Posts: 78
Joined: Mon Apr 07, 2014 10:33 am
Contact:

In Game Mall

#1 Post by TheOneAndOnly-K »

I can't find or understand a simple coding for an 'in game mall'.

The player goes to the 'mall' on a weekend evening, and can visit multiple stores before going home.
They can also buy things within the store, using a money system, which I don't understand that either.

Help will be thanked!

User avatar
noeinan
Eileen-Class Veteran
Posts: 1153
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA
Contact:

Re: In Game Mall

#2 Post by noeinan »

Image

Image
Image

User avatar
TheOneAndOnly-K
Regular
Posts: 78
Joined: Mon Apr 07, 2014 10:33 am
Contact:

Re: In Game Mall

#3 Post by TheOneAndOnly-K »

Thank you~

The thing is, these are all inventory, not a mall...

User avatar
noeinan
Eileen-Class Veteran
Posts: 1153
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA
Contact:

Re: In Game Mall

#4 Post by noeinan »

Generally, when I've seen people do a mall, they use an inventory and a store. If you want people to have time slots, to see multiple stores, that would be a calendar.

This could play out in game in a variety of ways. Here's an example:

-Player knows they have 4 hours to be at the mall. They decide to go to a clothing shop first. They get there, and browse around (all text and images provided by the game creator.)

-They are asked if they would like to buy anything. If you say yes, a store inventory pops up, where you can purchase items out of the store and the go into the players inventory.

-After purchase, they may choose to leave the store, which "eats up" a time slot. After this, maybe they go to get some food. They choose what they want to eat, and then get a different lunch scene depending on what they purchased.

-So on and so forth until they run out of time slots and have to go home.

What features besides these did you want for a mall?
Image

Image
Image

User avatar
TheOneAndOnly-K
Regular
Posts: 78
Joined: Mon Apr 07, 2014 10:33 am
Contact:

Re: In Game Mall

#5 Post by TheOneAndOnly-K »

Ooooooh I understand I need the inventory to make the shop in the first place...

Right I get it... It's confusing to use one, but I get it~

Thank you~

User avatar
noeinan
Eileen-Class Veteran
Posts: 1153
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA
Contact:

Re: In Game Mall

#6 Post by noeinan »

No problem. :)
Image

Image
Image

User avatar
TheOneAndOnly-K
Regular
Posts: 78
Joined: Mon Apr 07, 2014 10:33 am
Contact:

Re: In Game Mall

#7 Post by TheOneAndOnly-K »

I'm a little confused with inventory...

I just want a 'do you want to buy this?' buy it and go. I don't need an inventory of player, just what he/she buys within store.

User avatar
noeinan
Eileen-Class Veteran
Posts: 1153
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA
Contact:

Re: In Game Mall

#8 Post by noeinan »

If you don't have an inventory, how do you want to keep track of items purchased?

If you want, you could forgo it altogether, and just use event flags. Each "do you want to buy" bit is a multiple question, and then in the story you can have flags saying "if you bought this, then this happens."

Code: Select all

"What do you want to buy?"

menu: 
     "The red dress.":
          $ red_dress = True
     "The yellow dress.":
          $ yellow_dress = True

"You buy the dress and leave."
Then later...

Code: Select all

if red_dress:
     "You put on the red dress."
else if yellow_dress:
     "You put on the yellow dress."

"Time to go to dinner."
Image

Image
Image

User avatar
TheOneAndOnly-K
Regular
Posts: 78
Joined: Mon Apr 07, 2014 10:33 am
Contact:

Re: In Game Mall

#9 Post by TheOneAndOnly-K »

That looks so simple!

I just need the image thing for the mall itself now...

Kingv
Veteran
Posts: 324
Joined: Sun Jan 29, 2012 11:54 pm
Projects: Pet Tails, Transformation Sequence, Cheer On!
Tumblr: EphemeralBalance
Deviantart: kingv
Location: USA
Contact:

Re: In Game Mall

#10 Post by Kingv »

TheOneAndOnly-K wrote:I can't find or understand a simple coding for an 'in game mall'.

The player goes to the 'mall' on a weekend evening, and can visit multiple stores before going home.
They can also buy things within the store, using a money system, which I don't understand that either.

Help will be thanked!
Daikiraikimi pretty much answered your question. Here's the way I did it for my game just in case you wanted to see multiple ways to do the same thing. It would require using imagemaps but one you get one of the stores coded, it[s pretty easy to do it for the other ones you may need. Copied and pasted the code so it might be missing some labels such as for home and map. Also attached screenshots of what it's supposed to look like so you can have a better idea of the layout. Oh and it includes the money code you were asking about as well as how to code it to be visible in game as well as how to deduct the cost of items.

This bit of code goes into your main script file:

Code: Select all

####
#MONEY CODE
init python:
    showmoney = True
    money = 100
    def display_money():
        if showmoney:   
            ui.frame(xpos=870, ypos=80 )#This is optional. It adds a frame around the text.
            ui.text("$ %d" %money)
            #ui.text(("$" + str(money)))
$ showmoney = True #Hides the Money box thing
init:
    $ money = 100
    $ handy = 0
    $ stamina = 4

#TECH ITEMS
    $ tech1 = True #Fix it Fred game
    $ tech2 = True #My Boyfriend's A Mermaid!! game
    $ tech1Event = False  
    $ tech2Event = False 

define A = Character('Abby', color="#c8ffc8")
define W = Character('Willow', color="#c8ffc8")
define T = Character('Travis', color="#c8ffc8")
define R = Character('Remy', color="#c8ffc8")

label start: 
"Let's go to the mall!"
if stamina <= 0:	
	"I'm so tired. I better go home now..."
	jump home
else:
	jump shops

label shops:
menu:
    "TechnoBUG":
        $ stamina -= 1
        "Whenever I'm in need of the latest gadgets this is my first place to visit."  
        scene techShop with dissolve
        call techShop
        jump shops
    "The Cutting Edge":
        $ stamina -= 1
        "This shop has alot of different clothes."
        scene clothesShop with dissolve
        call clothesShop 
        jump shops              
    "Leave the shopping center.":
	"That's enough shopping for one day. Time to head home."
        call home
return

label clothesShop:
"This shop is closed. I'll have to come back later."
return

label techShop:
show screen calendar 
show travis at right
show screen techShop
T"You need some help or what?"

label noBuyTech:
A"I'll come back some other time..." 
hide screen techShop
hide travis at right 
call buyTech
call map

label buyTech:#Checks for items then triggers certain events
if tech1 == False and tech1Event == False: 
    N"I leave TechnoBug with my new game purchase in hand. As I walk along the aisles I run into Willow." 
    W"Hi Abby! I wasn't expecting to see you here today. Doing some shopping, huh?"
    A"Yeah, there were a few things I had to pick up while I'm in town. "
    N"I open up my bag and Willow peers curiously inside."
    W"Oh you bought a game! That's cool. Remember how us and Dorian would spend hours playing Fabio Bros when we were kids? We were so mad when he beat us."
    A"Yeah, well I recall he cheating a lot of the times we played... "
    W"That's true. Guess somethings never change. Hey! My coworker Chiaki organizes a gaming meetup at a friends place every Saturday afternoon. He was just saying how they needed more people. Maybe you should swing by and check it out when you have a free Saturday."
    menu:
        "Sure, sounds like fun..":#Agree to join
           N"Willow quickly scribbles down the address where the meet up will happen and hands it to me."
           W"I'll let Chiaki know you're coming! See ya!" 
        "Sorry but I can't.":#Decline
           A"With everything that's going on I don't think I can commit time to just playing games. "
           W"I totally understand so no worries. Just thought I'd ask you about it. Catch you later Abby!"          
    $ tech1Event = True     
return

if tech2 == False and tech2Event == False: 
A"Ah! I'm really sorry about that Remy! I didn't notice you there."
R"It's quite alright."
"I stand there sheepishly as Remy bends down to pick up my dropped items."
R"I didn't know you were a fan of \"My Boyfriend's A Mermaid\"..."
A"Um...well, it look interesting so i thought why not give it a try, you know?"
"Remy just eyes me suspiciously as I stand there. Why'd he of all people have to be the one I bumped into??"
R"Indeed...Take care Miss Bartlett."
$ tech2Event = True
return

label buyTech1:
T"Do you really need an explanation about that? Fix It Fred! is a game about fixing stuff. Guess it would be good to buy if you wanted your Handiness to increase. It's a remake of a classic so I wouldn't expect it to teach you much..."
hide screen techShop
menu:
    T"So...do you want to buy it or not?"
    "Yes please!":
        if money >= 30:
            $ money -= 30
            $ tech1 = False
            $ handy += 1
            show travis blush at right 
            T"Thanks, Hope you enjoy the game."
            jump techShop
        else:
            T"Eh?"
            jump techShop
    "No thanks.":
        show travis sleep at right 
        T"You sure? Whatever, I'm still getting paid so It doesn't really matter one way or another."
        jump techShop
hide screen techShop        
call map

label buyTech2:
T"I think this game is some kind of romance/RPG hybrid. But the title makes no sense. Wouldn't he technically be a merman, not a mermaid?"
hide screen techShop
menu:
    T"So...do you want to buy it or not?"
    "Yes please!":
        if money >= 60:
            $ money -= 60
            $ tech2 = False
            show travis blush at right 
            T"Thanks, Hope you enjoy the game."
            jump techShop
        else:
            T"Eh?"
            jump techShop
    "No thanks.":
        show travis sleep at right 
        T"You sure? Whatever, I'm still getting paid so It doesn't really matter one way or another."
        jump techShop
hide screen techShop        
call map   



And put this in your Screens section:

Code: Select all

#####
screen techShop:
    imagemap:
        ground "GUI/shop/storeDisplay.png"#Display image behind items
    imagemap:
        insensitive "GUI/shop/techSold.png"#Items that you've already bought 
        ground "GUI/shop/tech.png"#Items that are for ale
        hover "GUI/shop/techHover.png"#Appearance when hovered over with mouse
        alpha True   
        hotspot (0, 121, 203, 191) action If (tech1, Jump ("buyTech1"))          
        hotspot (205, 123, 203, 191) action If (tech2, Jump ("buyTech2"))               
        hotspot (920, 137, 105, 51) action Return()    
    vbox:   
        text "$" xpos 858 ypos 83 color "#fff" size 35
    vbox:           
        text ("%s" %(money)) xpos 880 ypos 83 color "#fff" size 35   
Basically the games starts off with the MC going to the mall. You can choose to go to either TechnoBUG (techShop) or The Cutting Edge(clothesShop). Each time you visit a shop 1 stamina point is taken away from the 4 points your begin the game with. Once all points are gone, you are forced to go home and to bed. You should be able to see how much money you have in the top right corner. As you're leaving the shop an event will happen depending if you purchased anything. For the purpose of this example you can only purchase the first two items in the tech shop.
Attachments
Attempting to purchase an item.
Attempting to purchase an item.
What TechnoBUG looks like the first time you enter it
What TechnoBUG looks like the first time you enter it

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]