Questions about a point system.

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
Zoideah
Newbie
Posts: 21
Joined: Sun Apr 01, 2007 10:59 am
Contact:

Questions about a point system.

#1 Post by Zoideah »

So far, I haven't been able to find a point system that quite fits what I'm looking for. I need a point system, invisible to the player, that adds points to each "character" every time the player answers something the right way... or the wrong way. I'm not talking about yes or no questions, either. For example, I have Sara and Laura, both NPC characters. Both characters are in a scene, and a multiple-answer question pops up. One answer will appeal to Sara, adding an invisible point to her score. The other, to Laura. The very last answer adds a point to both. Scores will affect which CGs and endings a player sees.

How can I work this out? Is it possible to port scores over to different scripts in case I come up with a sequel? If a thread with such coding already exists, please point me in it's direction. =w=;

Thanks!

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

Re: Questions about a point system.

#2 Post by monele »

For multiple games persistence :
http://renpy.org/wiki/renpy/doc/referen ... sistent%29

For your point system, hm... since I'm not sure how much you know about Ren'Py... all I'll say for now is that basically, you want a "menu" with multiple choices, each one adding the correct points to some variable.

Code: Select all

$ saralove = 0
$ lauralove = 0

menu:
    "Say something Sara will like.":
        $ saralove = saralove + 1
        "Blabla..."
    "Say something Laura will like.":
        $ lauralove = lauralove+1
        "Blabla..."
    "Say something everyone will like.":
        $ saralove = saralove+1
        $ lauralove = lauralove+1
        "Blabla..."

"The story goes on..."

Zoideah
Newbie
Posts: 21
Joined: Sun Apr 01, 2007 10:59 am
Contact:

Re: Questions about a point system.

#3 Post by Zoideah »

Ah, yes, I've got the menu thing down pat. Where I'm having trouble, however, is when the game needs to recall how many points a particular character has in order to go to a particular scene. What I've been doing is difficult to manage, and I'd like to know if there's another way. I must say, I haven't used Ren'py in months, so this is probably a bit wrong... XD

Something similar to this:

Code: Select all

menu:
    "Blah.":
        jump next
        
    "Blah?":
        $ sara = sara +1
        jump next
    "Blah!":
        $ laura = laura +1
        jump next

label next:
    "Moving on..."
    
if sara > 0:
    jump sara1

if laura > 0:
    jump laura1
    
label laura1:
    "lawl"
    jump mainstory

label sara1:
    "lol"
    jump mainstory

label mainstory:
    "omg"
As you can see, it's a load of text. Is there any was this Ren'py newb can shorten it a bit? ...a lot? D:

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

Re: Questions about a point system.

#4 Post by monele »

I'm really not sure you can make it shorter than that ô_o...
What particular part of your example do you consider "difficult to manage"?

Zoideah
Newbie
Posts: 21
Joined: Sun Apr 01, 2007 10:59 am
Contact:

Re: Questions about a point system.

#5 Post by Zoideah »

All of the labels. Because I have so many characters planned, there will likely be 20~30 paragraphs in between each main story event. Isn't there something like the return command that will take players back to the main story after a character event? I don't quite know how the return command works.

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

Re: Questions about a point system.

#6 Post by monele »

In that case you can do this :

Code: Select all

if saralove > 1:
    "Here's sara's part."
elif lauralove > 1:
    "Here's Laura's part."
"The story goes on here."
Use of if/else/elif will depend on your own story conditions :).

Free Time Machine
Regular
Posts: 42
Joined: Fri Jun 15, 2007 9:45 am
Location: Philly, USA
Contact:

Re: Questions about a point system.

#7 Post by Free Time Machine »

Remember that you don't need to start a new label after a menu or an if statement, as long as you indent correctly.

If your character scene is long enough that you'd like to make it into its own section, you can use a call statement.

Let me show you what I mean:

Code: Select all

label start:
    "Blah, blah, blah."

    menu:
        "Impress Sara.":
            $ saralove += 1
        "Impress Laura.":
            $ lauralove += 1

    if saralove > 0:
        call sarascene
    elif lauralove > 0:
        call laurascene

    "and the plot goes on..."

label sarascene:
    "Sara" "O NOES"
    return

label laurascene:
    "Laura" "THEY BE STEALIN MAH BUKKET"
    return
The advantage of using a call statement is that no matter when you call it into the game, the "return" statement will return you to exactly where you left off. It's very useful. In your case it might be more appropriate than jumping there and jumping back.
"HOLD ON TIGHT" ~ Outfits and expressions, where art thou? And why does Elsa's face look so awful??? *bangs head in*

Everytime you delete a traceback, someone else gets it. -PyTom

Zoideah
Newbie
Posts: 21
Joined: Sun Apr 01, 2007 10:59 am
Contact:

Re: Questions about a point system.

#8 Post by Zoideah »

So that's how call and return work! Thank you so much, that's exactly what I was looking for.

Post Reply

Who is online

Users browsing this forum: Kocker