Questions about 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
pokkoru
Newbie
Posts: 3
Joined: Sun Apr 20, 2008 1:48 pm
Contact:

Questions about Dating Game

#1 Post by pokkoru »

Hi! I'm just new to this forum and Ren'py, and I must say, I was glad I found this program! It's certainly newbie-friendly and so much fun to use. =D I've managed to work on at least half of the beginning part. However, I have a question that I think hasn't been asked yet (or if it is, please forgive me), and I really need it for my WIP game.

I'm not sure if I make any sense, but let me try. It's like this: my game is just a simple dating game, in which Character A is asked out by Character B. There's no other characters involved in the "date", except these two characters. On the date, there's an imagemap with 8 places that you could choose from. The goal of this game is to have Character A choose the "perfect" places for her to eventually "fall in love" in Character B (perfect ending). Choosing random places would either end the player up to bad and normal ending, depending on the points they've accumulated along the way (point based system).

And now, here are my questions:
1. There are eight places that you could choose from, but I want to limit the player to only go to any five of them before the day is up. After randomly choosing five places, you'll automatically go back to the main entrance of the "dating place" and Character B would tell you that it's time to go, and then you'll get the ending that matches your points. I've seen it done before in the Japanese Ren'ai game called "Heroine Dream" before, so I was wondering if it's possible to do that in Ren'py as well.

2. Since it's just a short and simple game, I want to make it a -bit- challenging by making the player go to five place (and choose the "perfect" answers) consecutively in order to get the "perfect" ending, instead of just going to the same five places in random orders. Can I do that?

3. Is it possible to prevent the player to go back to the same place again after they've already went through it once? Let's say the player wants to go back inside the shopping center to try out different responses/buy different stuff after their first try, but Character B would stop her and say something like "We've already went there. Let's go somewhere else.", and you'd go back to the imagemap. (I've seen this done in a RMK2000 fan game years before, so I wonder how you could do that in Ren'py)

4. Is it possible to lock the rollback feature? I just want the player to stick with their original choice and not go back to, uhm, cheat. f^^;;; (I think that it would somehow ruin the point based system IMO because they could go back and change their answers, thus allowing them to somewhat change their "points" along the game.)

5. Lastly, with regards to the point based system: Do you put the if-elif-else statement at the last part of the game (meaning, that part before you see your ending) or do you put it somewhere else?

Sorry if my questions ended up this long. ^^;; I just want to make sure of those before I could make changes of my game plan, depending on which one is possible and not possible. (I'll be sure to go back if I have anymore questions to ask after this. ^^;;)

Your help would be greatly appreciated! Thank you so much in advance! =D

- Kornet

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

Re: Questions about Dating Game

#2 Post by monele »

The problem with the ImageMap is that I'm not sure you can put conditions on its interactive parts :/... If it's a regular menu or if you use UI elements manually, though, it's easy to add the test conditions you need (wether you've been there before and wether you can still go to another place).

Basically, I'd suggest keeping track of things with a True/False variable for each place (amusement_park_been_there = False) and a counter for the number of spots you can visit (canVisit = 5... and then "canVisit = canVisit -1" when visiting each place).

Since there is a "loop" here, you'll also need a label that you will go back to after each datespot, displaying the map. Then, each map element will lead to a separate label. Finally, have a test on the map label to see if you've visited all possible places (if canVisit == 0) and jump to the ending label.

pokkoru
Newbie
Posts: 3
Joined: Sun Apr 20, 2008 1:48 pm
Contact:

Re: Questions about Dating Game

#3 Post by pokkoru »

monele wrote:The problem with the ImageMap is that I'm not sure you can put conditions on its interactive parts :/... If it's a regular menu or if you use UI elements manually, though, it's easy to add the test conditions you need (wether you've been there before and wether you can still go to another place).
Oh, I see. I saw an RMK2000 game that implements that before so I was curious if I could do that with Ren'py, too. ^^;;
monele wrote:Basically, I'd suggest keeping track of things with a True/False variable for each place (amusement_park_been_there = False) and a counter for the number of spots you can visit (canVisit = 5...
monele wrote:Finally, have a test on the map label to see if you've visited all possible places (if canVisit == 0) and jump to the ending label.
Uhm, I'm so sorry if this sound very stupid, but where do you put those codes? Right before the label statement (of the imagemap)? ^^;; *still new at this*

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Questions about Dating Game

#4 Post by PyTom »

An imagemap takes a list of hotspots. While most examples give that list directly, there's nothing preventing you from constructing it using Python code, and supplying that to the user.

Code: Select all

python:
    hotspots = [ ]
    if not seen_date_1:
        hotspots.append((100, 100, 200, 200, "date_1"))
    if not seen_date_2:
        hotspots.append((100, 200, 200, 300, "date_2"))

    # etc.

    rv = renpy.imagemap(hotspots)

jump expression rv
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
akemicchi
Veteran
Posts: 465
Joined: Mon Dec 31, 2007 11:22 pm
Projects: Magicians of Delphine, Panaderia: Ensaimada, SweetTooth!, XOXO Droplets
Deviantart: littlebabyshoes
Contact:

Re: Questions about Dating Game

#5 Post by akemicchi »

Hi! Welcome to the Forums! :D Kyahaha, I'm so slow-- everyone has posted and stuff. xD; Well, I'll just post what I've written! Some of the stuff I'm mentioning has already been said, so, yeah-- you can ignore that if you'd like:

For your first question, you can use variables. Like:

Code: Select all

init:
    # The date spots' variables.
    $ spot_one = False
    $ spot_two = False
    # Etc etc....
    $ spot_eight = False

    # The number of selected spots.
    $ datenumber = 0

label choose_date_spot:

    if datenumber == 5:
        # If the number of selected date spots is 5, jump straight to the date.
        jump date

        # -- Otherwise, 'else' will run.
    else:
        # Display the imagemap to make a selection.
        $ result = renpy.imagemap("MAP.png", "selectedMAP.png", [
                           (100, 100, 300, 400, "spot_one"),
                           (500, 100, 700, 400, "spot_two"),
                           # etc, etc.
                          ])
        # The imagemap. Another variable which determines the spot gets toggled when selected.
        if result == spot_one:
            $ spot_one = True
        elif result == spot_two:
            $ spot_two = True
        # More elifs.
        else:
            $ spot_eight = True

        $ datenumber += 1
        # Adds to the number of date spots chosen. :D As long as the variable datenumber is not equal to 5, this will loop back to the beginning.
        jump choose_date_spot

label date:

    # The date starts.
    if spot_one == True:
        jump date_at_spot_one
    elif spot_two == True:
        jump date_at_spot_two
    # ...
    else:
        jump date_at_spot_three
You could do that. xD It's lengthy, and it might get confusing, though. It doesn't determine the order that you take it, either... :< Hrm, if you really want it to have a specific order, another way is to use a little python.

Code: Select all

init:
    # An empty list.
    $ spot_list = []

label choose_date_spot:

    if len(spot_list) == 5:
        # If the length of the list 'spot_list' is equal to five,
        jump date
        # -- Otherwise...

    else:

        $ result = renpy.imagemap("MAP.png", "selectedMAP.png", [
                           (100, 100, 300, 400, "spot_one"),
                           (500, 100, 700, 400, "spot_two"),
                           # etc, etc.
                          ])

        if result == spot_one:
            # Append-- or add-- to the list 'spot_list': 'spot_one'.
            # This is in quotations because it's not a variable.
            $ spot_list.append('spot_one')
        elif result == spot_two:
            $ spot_list.append('spot_two')
        # More elifs.
        else:
            $ spot_list.append('spot_eight')

        # Loop.
        jump choose_date_spot

label date:

    # The date starts.

    for x in spot_list:
        # This is a loop. x will substitute an item from the list, starting from the first appended item. When all items in the list have been used, the loop will break and will continue on to the next line.:
        if x == 'spot_one':
            # If you're going to use jump, then decide to jump back to date, you'll want to take out the item that has already been used in the list. To do that, use 'remove':
            $ spot_list.remove('spot_one')
            jump date_at_spot_one

            # It'd be probably better if you used call date_at_spot_one instead, though... :< If you did that, as soon as all the items in the list is used, the for loop will break.
        # etc, etc.
If you use the second one with python, the dates occur consecutively, so that answers your second question, too.

To prevent the player from rolling back, you can use:
$ renpy.block_rollback()
... right after the decision. If you're not going to use rollback in the game at all, you can use:
$ config.rollback_enabled = False


For question 5:
You use the if-else statements whenever you want the game to check through conditions and determine which one path will play. ^^;; If it's in an if-else statement, you're telling the computer to play either the 'if' or the 'elif' or the 'else', depending on whether the conditions of the 'if' and 'elif are met'. (Otherwise, run 'else'.)

See, items inside the 'if' block will be played instead of the items in, say, the 'else' block or the 'elif' block. You should use it whenever you want the script to branch.

Did that make any sense? ;_;;; I'm terrible at explaining.

So, you can put it wherever you want, but if it's the ending, you'd probably want it right before you see it. xD; Like:

Code: Select all

label endings:
    B "I love you, A!"
    A "B..."

    if points >= 100:
        A "I love you, too!"
    elif points >= 50:
        A "Sorry, I only see you as a friend."
    else:
        A "Uhh... I have to go now."
    "The end."

pokkoru
Newbie
Posts: 3
Joined: Sun Apr 20, 2008 1:48 pm
Contact:

Re: Questions about Dating Game

#6 Post by pokkoru »

U-Uwahh, that was so very detailed, akemicchi. Thank you so much! ;___;

I guess I need to learn more about the second option (the one with the python) because it still confuses me a bit on how to edit it. XD;;

Post Reply

Who is online

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