Could I use persistet data for...?

Use this forum to help develop your game-making skills, and get feedback on writing, art, music, or anything else you've created that isn't attached to a game in progress.
Locked
Message
Author
Toki-the-Baker
Newbie
Posts: 15
Joined: Sun Feb 22, 2009 10:19 pm
Projects: Akatsuki Romance- WIP
Location: United States
Contact:

Could I use persistet data for...?

#1 Post by Toki-the-Baker »

So I'm back with another question and I appologize ahead of time if this question is misplaced/all ready answered/Poorly explained/dumb but I searched on here for something specific to my problem but couldn't find it. Okay, here's the situation:

Say I have a list of options in my menu, but I want one or more of the options to be unusable after the player has chosen it. For example a menu pops up and asks you if you want to fight bad guy A, B or C. You chose to fight bad guy A. Once you've done that and return to the menu, is it possible to block out the option to fight them again?

Here's a simple layout since I haven't gotten it scripted yet:

(Menu)
Fight Bad Guy A
Fight Bad Guy B
Fight Bad Guy C
Talk To Person 1


You pick Bad Guy A and the story progresses then you come back to the same menu but this time it should look like this:


(Menu)
Talk To Person 1

The option to fight the bad guys no longer being available and the game remembering you chose to fight Bad Guy A.



Is this possible to do using persistent data? I have no clue how to go about doing something like this, but I'm determined to make it work somehow. I saw someone on here said that I could find out about persistent data in the cookbook section, but I'm so blind I can't find it, I'm hopeless I suppose. If anyone could help point me in the right direction for how to make this work that would be amazing of you. Thanks.

User avatar
blankd
Veteran
Posts: 258
Joined: Wed Aug 26, 2009 4:04 pm
Completed: Vicarwissen
Projects: Heavenseed (current), I'm Not a Monster! (working on it slowly...)
Organization: Team Lazilisk
Tumblr: blankd
itch: blankd
Location: *taka taka taka*
Contact:

Re: Could I use persistet data for...?

#2 Post by blankd »

Persist data is for new game+, what you want is a variation of the "if" statement and other flags. I'm not a pro so there are probably better methods out there.

Code: Select all

label start:
       $ Fight_Thug = False
       
       
label Pick_Battle:
           menu:
               "Fight Bad Guy A" if Fight_Thug == False:
                   $ Fight_Thug = True
                   $ Which_Thug = A
               "Fight Bad Guy B" if Fight_Thug == False:
                   $ Fight_Thug = True
                   $ Which_Thug = B
               "Fight Bad Guy C" if Fight_Thug == False:
                   $ Fight_Thug = True
                   $ Which_Thug = C
               "Talk":
                   "CHATCHAT"
Hope that helps. c_c

Cironian
Regular
Posts: 33
Joined: Sun Aug 26, 2007 5:34 pm
Projects: Dragon Story
Contact:

Re: Could I use persistet data for...?

#3 Post by Cironian »

Do you mean you get back to the same menu during the same playthrough? Then you shouldn't use the persistency mechanism, but just normal variables. Persistent data is for things that should remain even after you completely restarted the game. From your description, it doesn't sound like this is what you want.

As for how to disable menu entries, here's the relevant example from http://www.renpy.org/wiki/renpy/doc/ref ... _Statement :

Code: Select all

menu what_to_do:

    "What should we do today?"

    "Go to the movies.":
        "We went to the movies."

    "Go shopping.":
        "We went shopping, and the girls bought swimsuits."
        $ have_swimsuits = True

    "Go to the beach." if have_swimsuits:
        "We went to the beach together. I got to see the girls in their
         new swimsuits."
In this, the "Go to the beach." option would only be active if you set the have_swimsuits variable to True beforehand (as shown in the "Go shopping" option).

Toki-the-Baker
Newbie
Posts: 15
Joined: Sun Feb 22, 2009 10:19 pm
Projects: Akatsuki Romance- WIP
Location: United States
Contact:

Re: Could I use persistet data for...?

#4 Post by Toki-the-Baker »

Thank you both very much. I understand now what the persistent data is for and I doubt I'll need to use it. Both of your posts had great examples of what I need to do, thanks for showing me how to go about it and the link explaining menu statements further. Back to work for me!

Locked

Who is online

Users browsing this forum: No registered users