7/2/2023 0 Comments Renpy hide quick menu"The Faerie Queen snapped her delicate fingers together, the sound echoing unusually loudly around the room." "I want Zoran to come with me." if zoran_trust_points >= 5: "I want Xia to come with me." if xia_trust_points >= 5: "I want Ashwin to come with me." if ashwin_trust_points >= 5: "Faerie Queen" "Is there anyone you wish to have accompany you?" The use case list above included “Hide choice options from players if they haven’t gained enough trust or affection points with a particular character”. The only difference is that it comes after the text of the choice option. Again, the conditional statement can have as many operands and operators as you need to complete the check, just like for regular conditional statements. Like in the original tutorial with this conditional statement, I’ve used parentheses to split this long expression up onto multiple lines for improved readability. "Shepard" "All ships, this is Commander Shepard." "Convince the quarian fleet to cease fire." if ( "Shepard" "No, I can't risk the quarian fleet." "Shepard" "Tali, call off the fleet if you can." "Allow Legion to finish uploading the code.": Let’s turn that into an actual menu now: menu: "Convince the quarian fleet to cease fire." The check looked like this: if (reputation >= 4 and quarian_trust >= 5 If you recall from the tutorial on combining comparisons, there was a conditional statement from Mass Effect 3 to see if Shepard had fulfilled the conditions to get the best outcome for one of the missions. Though the previous example’s expression is quite short (it just checks a string value), the check can be as complex as you want it to be. You can follow Made Marion’s development here and wishlist the game on Steam! Example 2 "Choice" if ate_apple: and "Choice 2" if not ate_apple: rather than using an if/else structure. If you would like a choice to be available only if some previous conditions in the choice menu are not True, you will have to add those checks into your conditional statement e.g. Note that there is no such thing as elif or else for menu choices. If the player did not kiss Layton – that is, tuck_status = "nodance" or tuck_status = "escaped" in this case – they will not see this choice at all, and will only see the options “Robin”, “John”, and “Will”. This choice will only appear in the choice menu if tuck_status = "snogged" evaluates to True. This is how you add conditional logic to a choice menu option. This looks like a pretty standard choice menu – the only thing of note is on line 12: "Ask About Layton" if tuck_status = "snogged". "Ask About Layton" if tuck_status = "snogged": "Who will I choose as my partner in the rebellion?" Let’s see what that looks like below: A screenshot of a choice menu from Made Marion by Velvet Cupcake Games default tuck_status = "nodance" The variable tuck_status tracks the player’s interactions with Layton – "nodance" if the player doesn’t meet him in Chapter 1 (the default), "escaped" if the player met Layton but didn’t run off into the woods with him, and "snogged" if they kissed Layton.įor this choice menu, the player can only ask if Layton can be their partner if they kissed him earlier in the game. A fourth character, Layton Tuck, cannot be romanced in the main game, but the player has the opportunity earlier in the Sherwood common route to meet Layton and possibly kiss him. There are three main love interests on the Sherwood common route: Robin, John, and Will. Special thanks to Becky for letting me feature their code!Īt the end of the Sherwood common route in the game, the player gets a choice of who to choose as their partner in the rebellion, which begins a romance route with their chosen character. Example 1įor this example, I’m using an excerpt from the upcoming Made Marion game by Velvet Cupcake Games. The first thing you need to know about adding conditionals onto menu options is that it comes after the choice text but before the final colon. How to add a conditional statement to a choice For example, when asking a character for information, they should only be able to ask each question once.Prevent a player from choosing a choice more than once.a stealthy character doesn’t have the option to brute-force entry by breaking down the door) Only allow players to make choices that align with their character’s stats (e.g.Hide choice options from players if they haven’t gained enough trust or affection points with a particular character.Allow a player to choose to reference a past event, but only if that past event actually occurred.Sometimes you may want to do things like: Next Steps What can you use conditional statements in menus for?Ĭonditional statements are all about controlling the flow of gameplay so that the game can react to the player’s choices.
0 Comments
Leave a Reply. |