[Solved]Problem with new mechanics

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
User avatar
zabuzaeldemonio
Regular
Posts: 80
Joined: Sun Jan 08, 2017 7:24 pm
Contact:

[Solved]Problem with new mechanics

#1 Post by zabuzaeldemonio » Thu Jul 12, 2018 11:00 am

Greetings, first should explain the situation,

I'm creating the concept of mobile in the visual novel, and I'm stuck in the contact interface. Since as the story progresses, more contacts are added (some before and others after, depending on the decisions of the player).

The problem is that I do not have an effective way to control that, I tried with if but many times the same contact was repeated, or empty gaps remained.

Therefore, is there any way to add the contacts in the order that the player got them?

I show you a piece of the interface:

Code: Select all

screen contactos:
    use navi
    add "gui/movil/contactos.jpg"
    
    imagebutton auto "gui/movil/hideo_%s.png" xpos 750 ypos 330 focus_mask True
    imagebutton auto "gui/movil/sayuri_%s.png" xpos 750 ypos 420 focus_mask True
    
    
Last edited by zabuzaeldemonio on Thu Jul 12, 2018 3:43 pm, edited 1 time in total.

User avatar
Chekhov
Regular
Posts: 25
Joined: Tue Jun 26, 2018 9:19 am
Projects: Pluton
Contact:

Re: Problem with new mechanics

#2 Post by Chekhov » Thu Jul 12, 2018 11:54 am

Are you sure you want to give each contact a location? I guess you could do it that way, kinda like a map where you discover new locations.

You also have the option of putting them into a menu with conditions: https://www.renpy.org/doc/html/menus.html (see the "if drank tea" at the bottom).

Otherwise you could do it like the tutorial shows with unlocking locations, if I'm not mistaken.

edit: I see I have not read quite as clearly; you want to put them in the order you discover them. I guess I would do it with python where I have a list of:

Code: Select all

$ discovered_people = []
Then when I have that empty list I would add the newly discovered person at the end:

Code: Select all

$ discovered_people.append("Jason")
to keep track of the people as the player meets them (make sure to add a way to check if the name is already in the list before adding it, like:)

Code: Select all

init python:
	if "jason" in discovered_people:
		"You already have jason in your contact list"
	else:
		"You add jason to your contact list"
		discovered_people.append("Jason")
And finally I would write something to display it one by one.
Last edited by Chekhov on Thu Jul 12, 2018 12:02 pm, edited 2 times in total.

rames44
Regular
Posts: 54
Joined: Sun May 29, 2016 4:38 pm
Contact:

Re: Problem with new mechanics

#3 Post by rames44 » Thu Jul 12, 2018 12:00 pm

If your game maintained a list of the contacts that had been encountered, in the order they were encountered, your screen could iterate thru that list, adding image buttons for each character in the list. If the image buttons were inside a vbox, they would be listed vertically in the order encountered.

Is that what you’re trying to accomplish?

User avatar
zabuzaeldemonio
Regular
Posts: 80
Joined: Sun Jan 08, 2017 7:24 pm
Contact:

Re: Problem with new mechanics

#4 Post by zabuzaeldemonio » Thu Jul 12, 2018 2:13 pm

I think your proposal is quite similar to the method I was doing.

Code: Select all

 $ phone1 = True
And then analyze the options

Code: Select all

    if phone1:
        imagebutton auto "gui/movil/hideo_%s.png" xpos 750 ypos 330 focus_mask True
    if phone2:
        imagebutton auto "gui/movil/sayuri_%s.png" xpos 750 ypos 420 focus_mask True
If I'm wrong, tell me why I can not see the difference.

User avatar
zabuzaeldemonio
Regular
Posts: 80
Joined: Sun Jan 08, 2017 7:24 pm
Contact:

Re: Problem with new mechanics

#5 Post by zabuzaeldemonio » Thu Jul 12, 2018 3:43 pm

Okey i find a way to solve this, thanks to all

Post Reply

Who is online

Users browsing this forum: Braydxne