Help integrating a minigame

A place to discuss things that aren't specific to any one creator or game.
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Post Reply
Message
Author
bdaywans
Newbie
Posts: 15
Joined: Sat Jul 13, 2019 2:54 pm
Contact:

Help integrating a minigame

#1 Post by bdaywans »

New to Renpy and still learning so this may be basic and I just don't know what to look up to figure out what I'm looking for but I've made a match 3 game somewhat integral to my game. The idea being you can play the game without it but this is how you get money, increase stats, and effects your relationships with competitors.

Anyways, I want to add the game as something the user can play once a day and I think I've gotten that part to work (In the NewDay counter I have a T/F tag that resets but if there is a better way I'm open to suggestions) but I want the game to have a number of interactions. For example, the game starts with you able to compete against 3 different characters. Depending on the hour of the day determines who you compete against. On top of that, I want it so that between rounds there are mini cut scenes and dialogue.

Since I don't know how to code it below is what I think I'd need to do. I'm wondering if this is the correct way to go about it...
  • Make the game script that I can use with 'call' and 'return'
  • Set up my match dialogue and variables: intro conversations stats that may change based on wins/losses, conversations, what sprites changes, etc
  • Give this match specific attributes such as npc1_match1
  • Set a variable in the game to call back to whichever variable called the game in the first place: for example at the end of round 1 if the player wins it will call mc_win1_[npc1]_match[1] and then return.
  • At the end of the game I have it jump to the corresponding 'npc1_match1' end and then it goes right back into the story
My crude attempt and how that may look as code would be:

Code: Select all

label lobby:
...
...
npc1 "Let's DUEL!" #No, not really
$ challenger = npc1
$ match = match1
call game
meanwhile...

Code: Select all

label game:
  $ battle = [challenger]_[match]
  call [challenger]_[match]_intro
label gamestart
  #first round ends, mc wins, jumps to win label
label mc_win:
  if win == 1
    call [challenger]_[match]_round1_win
    jump gamestart
  if win == 2
    call [challenger]_[match]_round2_win
    jump gamestart
  if win == 3
    call [challenger]_[match]_round3_win
    jump gamestart
  if gameSet <= 4:
    if win == 3:
        jump [challenger]_[match]_won
    elif win <= 2:
        jump gamestart
  elif gameSet == 5:
    if win == 3:
        jump [challenger]_[match]_won
    elif loss <= 2:
        jump [challenger]_[match]_lost  
    
Pretty much the game has a max of 5 founds or first to 3... this is just a snipped of the code (which I built using the Memoria script I found online) and so far it works by itself.

Then back in the script...

Code: Select all

label npc1_match1_intro:
  #text and stats go here
  return
label npc1_match1_round1_win:
  #text and stats go here
  return
label npc1_match1_round1_loss:
  #text and stats go here
  return
label npc1_match1_round2_win:
  #text and stats go here
  return
label npc1_match1_round2_loss:
  #text and stats go here
  return
label npc1_match1_round3_win:
  #text and stats go here
  return
label npc1_match1_round3_loss:
  #text and stats go here
  return
label npc1_match1_round_won:
  #text and stats go here
  return
label npc1_match1_round_lost:
  #text and stats go here
  jump lobby
Is this about right? Any recommendations to make this better

Post Reply

Who is online

Users browsing this forum: No registered users