Objectives screen?

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
HammeredEnt
Regular
Posts: 33
Joined: Sat May 04, 2019 8:09 am
Contact:

Objectives screen?

#1 Post by HammeredEnt »

Hi all!

I’m trying to put together a ‘current objectives’ screen for my game but am having problems with getting it to work how I want.

The story progression for each character is controlled by a simple numerical value – the character Anna starts off at value 0 and as each step in the story progresses that goes up by one to trigger new events, etc. I figure it should be relatively easy to have something along the lines of

“if anna == 1
Get Anna repaired.”
Or
“if clea == 3
Find an object of magical value to bring to the Sanctum.”
Or
“if pg == 4
Consult Friday at the Foundry.”

I’m trying to display them all on screen at the same time for multiple characters (not as dialogue which the coding above kinda does, of course) and I don’t see anything in the cookbook that lends itself to this sort of thing. Can anyone help point me in the right direction for something in this vein? There are multiple characters that will have open objectives at any time, so it’s not just one listing at a time. I do want to try and future-proof it so that there can be multiple ‘pages’ of this information, rather than jammed onto one ‘page’ but I’m hazy on that code too, sorry!

I’m also squeezing in a little quicklinks menu at the bottom of that screen as well (it’s a cellphone interface) which is it’s own actual screen, just in case that affects how I need to approach this.

Thanks everyone!

User avatar
XxrenxX
Veteran
Posts: 267
Joined: Tue Oct 02, 2012 2:40 am
Projects: Chasing
Deviantart: bara-ettie
Location: Canada
Contact:

Re: Objectives screen?

#2 Post by XxrenxX »

Code: Select all

if anna == 1:
    "Get Anna repaired."
if clea == 3:
    "Find an object of magical value to bring to the Sanctum."
if pg == 4:
    "Consult Friday at the Foundry."
Indentation and not having the if's in "" might help. So if it's set up as a menu it could be like this

Code: Select all

menu:
    if anna == 1:
        "Get Anna repaired.":
            jump label1
    if clea == 3:
        "Find an object of magical value to bring to the Sanctum.":
            jump label2
    if pg == 4:
        "Consult Friday at the Foundry.":
            jump label3
    else:
        jump label4 #incase no one has any of above

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Objectives screen?

#3 Post by xavimat »

XxrenxX wrote: Fri May 17, 2019 12:13 amSo if it's set up as a menu it could be like this

Code: Select all

menu:
    if anna == 1:
        "Get Anna repaired.":
            jump label1
    if clea == 3:
        "Find an object of magical value to bring to the Sanctum.":
            jump label2
    if pg == 4:
        "Consult Friday at the Foundry.":
            jump label3
    else:
        jump label4 #incase no one has any of above
@XxrenxX, have you tried your code? It's not working for me. Menus does not work that way. See: https://renpy.org/doc/html/menus.html
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Objectives screen?

#4 Post by xavimat »

HammeredEnt wrote: Sun May 12, 2019 10:57 pm Hi all!

I’m trying to put together a ‘current objectives’ screen for my game but am having problems with getting it to work how I want.

The story progression for each character is controlled by a simple numerical value – the character Anna starts off at value 0 and as each step in the story progresses that goes up by one to trigger new events, etc. I figure it should be relatively easy to have something along the lines of

“if anna == 1
Get Anna repaired.”
Or
“if clea == 3
Find an object of magical value to bring to the Sanctum.”
Or
“if pg == 4
Consult Friday at the Foundry.”

I’m trying to display them all on screen at the same time for multiple characters (not as dialogue which the coding above kinda does, of course) and I don’t see anything in the cookbook that lends itself to this sort of thing. Can anyone help point me in the right direction for something in this vein? There are multiple characters that will have open objectives at any time, so it’s not just one listing at a time. I do want to try and future-proof it so that there can be multiple ‘pages’ of this information, rather than jammed onto one ‘page’ but I’m hazy on that code too, sorry!

I’m also squeezing in a little quicklinks menu at the bottom of that screen as well (it’s a cellphone interface) which is it’s own actual screen, just in case that affects how I need to approach this.

Thanks everyone!
This is the simplest way I can think:

Code: Select all

default objectives = {
    "Chara1": ["Chara1-Obj0", "Chara1-Obj1", "Chara1-Obj2"],
    "Chara2": ["Chara2-Obj0", "Chara2-Obj1", "Chara2-Obj2"],
    "Chara3": ["Chara3-Obj0", "Chara3-Obj1", "Chara3-Obj2"],
    "Chara4": ["Chara4-Obj0", "Chara4-Obj1", "Chara4-Obj2"]
    }

default points = {"Chara1": 0, "Chara2": 0, "Chara3": 0, "Chara4": 0}

screen objs():
    vbox:
        for k, v in points.items():
            text "[k]: " + objectives[k][v]

label start:
    show screen objs
    "Let's start."
    $ points["Chara1"] += 1
    "Hi!"
    $ points["Chara2"] += 1
    "Hello!"
    $ points["Chara3"] += 1
    "Sup!"
    $ points["Chara1"] += 1
    "Hi!"
    $ points["Chara4"] += 1
    "Howdy!"
    return
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: Google [Bot], Nozori_Games