Page 1 of 1

Question about choices

Posted: Sat Apr 03, 2010 7:33 pm
by IxIoN
Well I only want to ask... how can I make the choices sum up? Let me explain myself.

-Ending 1
-Ending 2

Example 1:
1. Run(Ending 1 +1)/Walk (Ending 2 +1) Chose Run. Ending 1 +1=> Ending 1= 1. Ending 2= 0
2. Eat(Ending 1 +2)/Don't eat (Ending 2 +1) Chose Eat. Ending 1 +1=> Ending 1= 3. Ending= 0
You get ending 1.

Example 2:
1. Run(Ending 1 +1)/Walk (Ending 2 +1) Chose Walk. Ending 2 +1=> Ending 1= 0. Ending 2= 1
2. Eat(Ending 1 +2)/Don't eat (Ending 2 +1) Chose Don't eat. Ending 2 +1=> Ending 1= 0. Ending= 2
You get ending 2.

Can someone explain how to do this? Thanks in advance.

Re: Question about choices

Posted: Sun Apr 04, 2010 10:27 am
by JQuartz
You mean something like this?:

Code: Select all

init:
    $ Ending1=0
    $ Ending2=0
label choice1:
    menu:
        "Run":
            $ Ending1+=1
        "Walk":
            $ Ending2+=1

label choice2:
    menu:
        "Eat":
            $ Ending1+=2
        "Don't Eat":
            $ Ending2+=1

label ending:
    if Ending1==3:
        jump ending1
    elif Ending2==2:
        jump ending2
    

Re: Question about choices

Posted: Sun Apr 04, 2010 10:46 am
by Alex
Well, exactly as you showed in your example...
1. Make variables to store the results (end1, end2 or smth)
2. Change the values during game process (like <$ end1 += 1>)
3. At the end compare the values to find what ending to show

Code: Select all

init:
    $ end1 = 0
    $ end2 = 0

label start:
    menu:
        "Run(Ending 1 +1)":
            $ end1 += 1
        "Walk (Ending 2 +1)":
            $ end2 += 1

    menu:
        "Eat(Ending 1 +2)":
            $ end1 += 2
        "Don't eat (Ending 2 +1)":
            $ end2 += 1
    if end1 > end2:
        jump "ending_1" # label names shouldn`t have spaces
    else:
        pass

# here you goes if ending 2 
    "Ending 2"
    jump "credits"

label ending_1:
    "Ending 1"
    jump "credits"

label credits:
    "Some credits"
You can read more here
http://www.renpy.org/wiki/renpy/doc/tut ... With_Menus
http://www.renpy.org/wiki/renpy/doc/tut ... er_Choices
http://www.renpy.org/wiki/renpy/doc/tut ... _the_Story

Late again...((

Re: Question about choices

Posted: Sun Apr 11, 2010 11:44 am
by IxIoN
Finally I made my first choice and it works perfect. Thanks you two.