Visible attraction points in dating game?

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
Crowley

Visible attraction points in dating game?

#1 Post by Crowley »

Hello! I've looked and looked, but I can't seem to find the answer for my question. I'm currently working on a dating sim (not using the DSE engine, just so you know, because I can't figure out how it would work the way I want it to), and so far I know how to increase and decrease certain points depending on your choices throughout the game. For example, the attraction points for a specific character might go up when you're nice towards them, or decrease if you do things they don't like.

Now, my question is, how do I make these points visible? My mind wanders to the beating hearts in some of the Harvest Moon games - the ones that also change colour and get bigger depending on how much attraction points you have. I'm not sure I would be able to pull that off since I'm not really an amazing coder, so otherwise I was thinking of showing a point bar. Much like health bars, except they increase or decrease depending on your attraction points for a certain character... Yeah, you get it. I'm just tired right now.

I can easily draw the images for these things, but the question is, how would I make this work properly? How can I put, for example, the bar, in a good position and how do I make it change depending on the points?

JinzouTamashii
Eileen-Class Veteran
Posts: 1686
Joined: Mon Sep 21, 2009 8:03 pm
Projects: E-mail me if you wanna rock the planet
Location: USA
Contact:

Re: Visible attraction points in dating game?

#2 Post by JinzouTamashii »

Uh, I saw it in the Cookbook at one point...

Was it covered in the DSE recipes, guys?
Don't worry, we can get through it together. I didn't forget about you! I just got overwhelmed.
https://cherylitou.wordpress.com

JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: Visible attraction points in dating game?

#3 Post by JQuartz »

Crowley wrote:Much like health bars, except they increase or decrease depending on your attraction points for a certain character...
You can use ui.bar overlay like so:

Code: Select all

init python:
    
    max_love=100
    current_love=50
    show_stats=False
    
    def stats_overlay():
        if show_stats:
            ui.frame()
            ui.vbox()
            ui.text("Love meter")
            ui.bar(max_love,current_love, xmaximum=150)
            ui.close()
                        
    config.overlay_functions.append(stats_overlay)
    
label start:
    $ show_stats=True
    "Game start"
    $ current_love+=10
    "Increase love point"
    $ current_love-=10
    "Decrease love point"
You can read about uis here:http://www.renpy.org/wiki/renpy/doc/ref ... _Functions
You can read about overlay here:http://www.renpy.org/wiki/renpy/doc/reference/Overlays
You can read about properties here:http://www.renpy.org/wiki/renpy/doc/ref ... Properties
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

JinzouTamashii
Eileen-Class Veteran
Posts: 1686
Joined: Mon Sep 21, 2009 8:03 pm
Projects: E-mail me if you wanna rock the planet
Location: USA
Contact:

Re: Visible attraction points in dating game?

#4 Post by JinzouTamashii »

Bookmark'd for future reference.
Don't worry, we can get through it together. I didn't forget about you! I just got overwhelmed.
https://cherylitou.wordpress.com

Crowley

Re: Visible attraction points in dating game?

#5 Post by Crowley »

Thank you kindly, I'll post again if there are any problems.

Zalkyria
Regular
Posts: 36
Joined: Mon Jan 28, 2013 7:39 pm
Contact:

Re: Visible attraction points in dating game?

#6 Post by Zalkyria »

I went ahead and put that in my date sim, and i got these errors

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game\script.rpy", line 2: python block expects a non-empty block.
init python:
^

File "game\script.rpy", line 4: expected statement.
max_love=100
^

File "game\script.rpy", line 5: expected statement.
current_love=50
^

File "game\script.rpy", line 6: expected statement.
show_stats=False
^

File "game\script.rpy", line 8: expected statement.
def stats_overlay():
^

File "game\script.rpy", line 16: expected statement.
config.overlay_functions.append(stats_overlay)
^

Ren'Py Version: Ren'Py 6.14.1.366

Zalkyria
Regular
Posts: 36
Joined: Mon Jan 28, 2013 7:39 pm
Contact:

Re: Visible attraction points in dating game?

#7 Post by Zalkyria »

nevermind i solved that.

User avatar
Ayutac
Regular
Posts: 150
Joined: Thu Oct 18, 2012 2:23 pm
Projects: Pokémon Dating Sim
Organization: A Breeze Of Science
Deviantart: Ubro
Location: Mayence, Germany
Contact:

Re: Visible attraction points in dating game?

#8 Post by Ayutac »

Crowley wrote:Hello! I've looked and looked, but I can't seem to find the answer for my question. I'm currently working on a dating sim (not using the DSE engine
The what? No, seriously, what Dating Sim Engine? Link it please. And oh, I hope it is not so good as mine or my work would be in vain...
Up next: An original, open source, text-based Dating Sim. Stay tuned ;)

Zalkyria
Regular
Posts: 36
Joined: Mon Jan 28, 2013 7:39 pm
Contact:

Re: Visible attraction points in dating game?

#9 Post by Zalkyria »

Actually what do you do if you have 5 different girls. I'm making a date sim based on Danny Phantom, and I am using 5 bachlorettes. Please help.
Currently working on Dance With Me? - Danny Phantom Date Sim.
Link to our blog - http://dpdatesim.tumblr.com/
Currently looking for writers, and help with coding on the game. Please contact me or JaxxyLupei, on here or message on the blog.

gekiganwing
Lemma-Class Veteran
Posts: 2473
Joined: Wed Sep 29, 2004 1:38 pm
Contact:

Re: Visible attraction points in dating game?

#10 Post by gekiganwing »

Ayutac wrote:The what? No, seriously, what Dating Sim Engine? Link it please. And oh, I hope it is not so good as mine or my work would be in vain...
Here you go. And here is the documentation on how the DSE works. Look it over to see if you understand it, and if you find the code useful. Keep in mind that it was created in 2007 and last updated in 2008.

User avatar
Ayutac
Regular
Posts: 150
Joined: Thu Oct 18, 2012 2:23 pm
Projects: Pokémon Dating Sim
Organization: A Breeze Of Science
Deviantart: Ubro
Location: Mayence, Germany
Contact:

Re: Visible attraction points in dating game?

#11 Post by Ayutac »

Ohhhhh, that thing. Now I'm relieved since the concept (choose your actions for the day, then do them) is different from mine (DAYWDAYWDAYW do anything you want (as long as you have HP))
Up next: An original, open source, text-based Dating Sim. Stay tuned ;)

Zalkyria
Regular
Posts: 36
Joined: Mon Jan 28, 2013 7:39 pm
Contact:

Re: Visible attraction points in dating game?

#12 Post by Zalkyria »

JQuartz wrote:
Crowley wrote:Much like health bars, except they increase or decrease depending on your attraction points for a certain character...
You can use ui.bar overlay like so:

Code: Select all

init python:
    
    max_love=100
    current_love=50
    show_stats=False
    
    def stats_overlay():
        if show_stats:
            ui.frame()
            ui.vbox()
            ui.text("Love meter")
            ui.bar(max_love,current_love, xmaximum=150)
            ui.close()
                        
    config.overlay_functions.append(stats_overlay)
    
label start:
    $ show_stats=True
    "Game start"
    $ current_love+=10
    "Increase love point"
    $ current_love-=10
    "Decrease love point"
You can read about uis here:http://www.renpy.org/wiki/renpy/doc/ref ... _Functions
You can read about overlay here:http://www.renpy.org/wiki/renpy/doc/reference/Overlays
You can read about properties here:http://www.renpy.org/wiki/renpy/doc/ref ... Properties
What about if you have more than one bachlorette?
Currently working on Dance With Me? - Danny Phantom Date Sim.
Link to our blog - http://dpdatesim.tumblr.com/
Currently looking for writers, and help with coding on the game. Please contact me or JaxxyLupei, on here or message on the blog.

User avatar
15nick
Regular
Posts: 33
Joined: Thu Oct 17, 2013 2:46 am
Contact:

Re: Visible attraction points in dating game?

#13 Post by 15nick »

I had a previous game that used what you mentioned (the Harvest Moon heart thing) and the code's kind of disgusting to look at, but it might help as a springboard. I did a Button in the corner (Mine was an imagebutton but I'll just use Textbutton for simplicity)

Code: Select all

screen love_button:
    textbutton _("Relationships"):
        xalign 1.0
        yalign 0.0
        action Show("Love_meters")
and a screen for it to show:

Code: Select all

screen Love_meters:
    if Y_points < 101:
        $ y_aff = "[y]: [Y_points]/[aff_max]                      {image=blueheart}"
    elif Y_points in range(101,200):
        $ y_aff = "[y]: [Y_points]/[aff_max]                      {image=greenheart}"
    elif Y_points in range(201,300):
        $ y_aff = "[y]: [Y_points]/[aff_max]                      {image=yellowheart}"
    elif Y_points in range(301,400):
        $ y_aff = "[y]: [Y_points]/[aff_max]                      {image=orangeheart}"
    elif Y_points in range(401,499):
        $ y_aff = "[y]: [Y_points]/[aff_max]                      {image=pinkheart}"
    else:
        $ y_aff = "[y]: [aff_max]/[aff_max]                      {image=redheart}"
    #Rinse and repeat for additional love interests
    vbox:
        xalign .5
        yalign .25
        text y_aff:
            size 50
        null height 10
        #Rinse and repeat for additional love interests
screenshot0010.png
These can be in their own separate file or screens.rpy. I like to put it in a separate one personally.

Like I said, kind of juryrigged (especially that big if...else block in the screen. Yuck.) but it works and displays one of six colors of throbbing (unpleasant word) hearts based on your affection with that character (I defined the heart images as Displayables at the beginning of the game to make them throb). The first variable I have there is the name [y], then their affection they have for you [Y_points] that can be added to or subtracted at any point in the game and finally the max affection they could get [aff_max]. All defined somewhere in the script.
If you want bars, it's much easier.

Code: Select all

screen Love_meters:     
    vbox:
        xalign .5
        yalign .25
        text "[y]: [Y_points]/[aff_max]":
            size 50
        bar:
            value Y_points
            range aff_max
            xmaximum 300
        null height 10
        #Rinse and repeat for additional love interests
screenshot0011.png
And to have this button show up simply have this

Code: Select all

show screen love_button
In the script at the very first instance of when you want the player to be able to check their relationship meters. Need to hide it?

Code: Select all

hide screen love_button
and an example in script:

Code: Select all

label start:
$ Y_point = 0
$ aff_max = 500
$ y = "Erik"
show screen love_meters
Y "Love me, why won't you love me abloobloobloo."
$ Y_point += 5
Hope that helps somehow. I'm sure it's not the best or classiest way to do it, but it works and if you just want a helping hand understanding how you could do this it gets the job done.

Maiden-of-Wolves
Newbie
Posts: 14
Joined: Sat Apr 12, 2014 3:56 pm
Projects: Shifting Realities
Contact:

Re: Visible attraction points in dating game?

#14 Post by Maiden-of-Wolves »

15nick wrote:
I was so happy to have stumbled upon the code that you presented here, but when I incorporated it into my game there was an error.

The error that the traceback.txt gives me is: "TypeError: 'ScreenLangScreen" object is not iterable"
I've tried looking up what this means -- it seems like something isn't being recalled by the engine, but I'm not sure how to fix that. Do you have any insights?

xMichi
Regular
Posts: 35
Joined: Fri May 30, 2014 4:17 am
Contact:

Re: Visible attraction points in dating game?

#15 Post by xMichi »

Maiden-of-Wolves wrote:
15nick wrote:
I was so happy to have stumbled upon the code that you presented here, but when I incorporated it into my game there was an error.

The error that the traceback.txt gives me is: "TypeError: 'ScreenLangScreen" object is not iterable"
I've tried looking up what this means -- it seems like something isn't being recalled by the engine, but I'm not sure how to fix that. Do you have any insights?

Can you post the code you were getting? Cuz mine worked perfectly. Although I used the bar one, not the hearts one ;o

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Sugar_and_rice