Assigning party members to choices.

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
vreish
Newbie
Posts: 4
Joined: Thu Sep 04, 2014 11:45 pm
Contact:

Assigning party members to choices.

#1 Post by vreish »

I've just started looking into Ren'Py, and want to figure out if it would work for my purposes. Here's what I'm going for.

Example: My character is in front of a locked door. My protagonist is weak, but one of their sidekicks is strong. I click "break down the door" and my weak character fails. Taking a different tack, I press a keyboard button, and the game screen changes to indicate that the next action selected will now be taken by the party member keyed to that button. Now I select break down the door, my sidekick easily smashes it, and I enter. The game automatically resets so that the next choice I make defaults to my protagonist.

Example 2: Later on, my party encounters a narrow bridge over a pit, and must cross right away. This is a special kind of choice, and no matter how I go about selecting it the game treats it as if all party members had individually tried and either succeeded or failed. I click, and most of my party crosses. The big sidekick isn't very agile, so he falls into the pit and has to meet up with us later. Alternatively, he might break the bridge, causing everyone to automatically fail and fall in, depending on how the challenge is set up.

Example 3: Finally, I try to tell me sidekick to do something only the protagonist should be able to ("pull that glowing sword of destiny out of the stone, sidekick"). Rather than them even trying, with a chance for success or failure I get a quick response from them ("No can do boss") and the game once again reverts to treating my protagonist as the action taker.

-----

How complicated would it be to get Ren'Py to recognize something like this? Could a know-nothing with just basic HTML/CSS knowledge (mentioning this is only to give a point of comparison for my general code learning ability), or would I have to go find a programmer? To be clear, I'd like this game to allow this kind of thing by default on all choices for all sidekicks. Their success or failure of a character attempting any given action would determined by a simple stat test.

I'm afraid just having the game recognize "X character" is in the party therefore all doors get broken down automatically would not work for my purposes. Thanks for your time.
Last edited by vreish on Wed Mar 14, 2018 9:35 pm, edited 6 times in total.

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Assigning party members to choices.

#2 Post by rayminator »

you can't use HTML/CSS with rempy best thing to do is to learn python and how to use renpy

renpy doc's
https://www.renpy.org/doc/html/index.html

renpy tutorial
https://www.youtube.com/watch?v=CjJ2R22 ... afLcRH0rAX

python doc's
https://www.python.org/doc/

python tutorial
https://www.youtube.com/watch?v=HBxCHon ... k4JHw91mC_

I can't help you on this i'm just learn how to use python/renpy hope this does help you in one way or another hope another member of this forum to get you on the right track

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Assigning party members to choices.

#3 Post by philat »

It's not particularly hard to do if you keep it simple, although probably a lot of work. Something like the following (you can use a screen with buttons or key statements to change the variable selected_character).

Code: Select all

default selected_character = "protag"

label start:
    menu:
        "What should I do?"
    
        "Kick down the door":
            if selected_character = "protag":
                "I can't."
            elif selected_character = "warrior":
                warrior "Sure thing, boss."
                jump (insert label here for entering by breaking the door)
            else:
                rogue "No can do, boss."
    
        "Pick the lock":
            if selected_character = "protag":
                "I can't."
            elif selected_character = "warrior":
                warrior "No can do, boss."
            else:
                rogue "Sure thing, boss."
                jump (insert label here for entering by picking the lock)

vreish
Newbie
Posts: 4
Joined: Thu Sep 04, 2014 11:45 pm
Contact:

Re: Assigning party members to choices.

#4 Post by vreish »

@philat: Hi, thanks for your response. In regards to the above, while I'm still getting the hang of this, I think I would prefer it if instead of writing an outcome for every potential party member I could instead essentially put a bar on the choice saying "any selected character with Agility higher than ten or the Rogue trait succeeds here, any selected character without that fails". With the success or failure message being basically generic, or just inserting "selected_character"'s name into a generic success/failure text.

Is that possible?

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Assigning party members to choices.

#5 Post by philat »

Yes, but then it becomes quite a bit more complicated. What you'd want to do is have character classes/stats and use those to govern the mechanics. (Similar things discussed here: viewtopic.php?p=415130#p415130 ) It's not an insurmountable challenge, by any means -- I myself am not a programmer, have/had zero programming background, and learned python for free on the internet as a hobby, and I can think of a basic structure for that kind of system -- but it is a much more significant investment in learning basic python, which you may or may not be willing to do.

vreish
Newbie
Posts: 4
Joined: Thu Sep 04, 2014 11:45 pm
Contact:

Re: Assigning party members to choices.

#6 Post by vreish »

Ok, thanks. I'll check the link. If you want to post a hint to the gist of that "basic structure" as a lead that would be great, but if it's prohibitive to explain I'm also fine stumbling through on my own.

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Assigning party members to choices.

#7 Post by philat »

Well. It depends on how you want to set it up. I can think of something, but I don't know if that would be what you actually want -- not only is the devil in the details for even just the examples you mentioned, there could be other mechanics in the game that would make any given set up more or less suitable. In any case, I'm not going to attempt to explain classes, but this is a barebones example.

Do keep in mind that getting the mechanics working and presenting them in an appealing way are two separate things and I haven't bothered with the screens part in this example.

Code: Select all

init python:
    class PartyMember():
        def __init__(self, name, agility, strength):
            self.name = name
            self.agility = agility
            self.strength = strength

default rogue = PartyMember("Rogue", 20, 5)
default warrior = PartyMember("Warrior", 5, 20)
default protag = PartyMember("Protag", 10, 10)

default selected_character = protag

label start:

    menu:
        selected_character.name "What should I do?"
    
        "Kick down the door":
            if selected_character.strength > 10:
                selected_character.name "Will do."
            else:
                selected_character.name "I can't."
    
        "Pick the lock":
            if selected_character.agility > 10:
                selected_character.name "Will do."
            else:
                selected_character.name "I can't."

        "Pick up the glowing sword.":
            if selected_character.name != "Protag":
                selected_character.name "I can't."
            else:
                selected_character.name "Behold your once and future king!"

    jump change_char
   

label change_char:
    menu:
        "Select who will act."

        "Protag":
            $ selected_character = protag
    
        "Warrior":
            $ selected_character = warrior

        "Rogue":
            $ selected_character = rogue

    jump start

vreish
Newbie
Posts: 4
Joined: Thu Sep 04, 2014 11:45 pm
Contact:

Re: Assigning party members to choices.

#8 Post by vreish »

Awesome, I'll start fiddling around. Thanks!

Post Reply

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Google [Bot], Semrush [Bot]