I could be looking in the wrong places or using the wrong search terms - in which case, some guidance would be deeply appreciated.
Context
The concept is this:
You play as a friendly neighborhood pal. In your free time, unscripted and offscreen, you are going around doing Good Deeds and increasing your Renown as a result.
This is represented with a LiveComposite map, and a number of random, regenerating, clickable hotspots.
When you click a hotspot, you get a message with some flavor text and points. The hotspot will then deactivate for a certain amount of IRL time, so players can't farm infinite points by spam clicking.
The purpose of this minigame is to reward the player with bonus points in exchange for checking into the minigame's screen occasionally. The bonus points are not required to win in the main game, but they can be used to unlock special options later on.
This minigame is similar to the Spaceship minigame in Mystic Messenger, and I am sure several cookie clicker games utilize this mechanic.
Part One of my Dilemma is This:
The problem I have is with the "random" command. In my first attempt, I used the code below:
Code: Select all
define RMC = renpy.random.choice(['You helped an old woman carry groceries! \n \n Earned 5 Reputation.\n \n', 'You saved a cat from a tree! \n \n Earned 10 Reputation.\n \n', 'You tied your shoes. Aww. \n \n Earned 1 Reputation.\n \n'])
I'd like the code to randomly choose a message EACH time I CLICK, not each time the player quits the game.
One of my Attempts at a Solution is This:
I thought, maybe I'll just create different sets of messages, so each hotspot is guaranteed to be different from one another. This ends up looking like....
Code: Select all
screen MapClicker():
tag menu
modal True
imagemap:
ground "Ground.jpg"
hover "Hover.jpg"
hotspot (262, 117, 77, 73) action Show("ReputationGet_Set1")
##This links the hotspot button to the first list of messages.
hotspot (469, 363, 71, 74) action Show("ReputationGet_Set2")
##This links the hotspot button to the second list of messages.
hotspot (882, 575, 398, 225) action Hide("MapClicker")
##This exits the minigame, resuming the main game.
frame:
pass
define CivillianRMC_Set1 = renpy.random.randint(1,6)
define CivillianRMC_Set2 = renpy.random.randint(7,12)
screen ReputationGet_Set1():
modal False
zorder 200
frame:
xalign 0.5 yalign 0.5
xsize 500 ysize 350
xpadding 50 ypadding 50
vbox:
xalign 0.5 yalign 0.5
if CivillianRMC_Set1 ==1:
text "You called your family. They hope you’re doing well. \n \n Earned 10 Reputation.\n \n"
elif CivillianRMC_Set1 ==2:
text "You folded your clothes. Great job! \n \n Earned 2 Reputation.\n \n"
elif CivillianRMC_Set1 ==3:
text "You tied your shoes. Aww. \n \n Earned 1 Reputation.\n \n"
elif CivillianRMC_Set1 ==4:
text "You helped an old woman carry groceries! \n \n Earned 5 Reputation.\n \n"
elif CivillianRMC_Set1 ==5:
text "You saved a cat from a tree! \n \n Earned 10 Reputation.\n \n"
elif CivillianRMC_Set1 ==6:
text "You took a lint-roller to your clothes today. Thanks, cat. \n \n Earned 1 Reputation.\n \n"
else:
text "Bad luck! You didn't do anything useful..."
pass
hbox:
xalign 0.5 yalign 0.5
textbutton "OK" action [Hide("ReputationGet_Set1"), Show("MapClicker")]
screen ReputationGet_Set2(): ##Possibly make/have four of these screens....
modal False
zorder 200
frame:
xalign 0.5 yalign 0.5
xsize 500 ysize 350
xpadding 50 ypadding 50
vbox:
xalign 0.5 yalign 0.5
if CivillianRMC_Set2 ==7:
text "You picked a new background picture on your phone. \n \n Earned 1 Reputation.\n \n"
elif CivillianRMC_Set2 ==8:
text "You decided to stop biting your nails. Here's hoping you can commit! \n \n Earned 2 Reputation.\n \n"
elif CivillianRMC_Set2 ==9:
text "You did the dishes! \n \n Earned 3 Reputation.\n \n"
elif CivillianRMC_Set2 ==10:
text "You watched an inspiring video. \n \n Earned 3 Reputation.\n \n"
elif CivillianRMC_Set2 ==11:
text "You made a motivational instagrum post. You got a lot of likes! \n \n Earned 10 Reputation.\n \n"
elif CivillianRMC_Set2 ==12:
text "Selfie time! \n \n Earned 8 Reputation.\n \n"
else:
text "Bad luck! You didn't do anything useful..."
pass
hbox:
xalign 0.5 yalign 0.5
textbutton "OK" action [Hide("ReputationGet_Set2"), Show("MapClicker")]
And it works! Since each hotspot pulls from a different set of messages, there are no more duplicates. So the only problem remaining, is the way ren'py will only make a random choice each time I exit the game, rather than each time I click... However, if the hotspot times out/hides (say, for two hours before reappearing) maybe the cooldown will allow the game to choose a new message?
I have no idea how to move forward in coding cooldowns. The hotspots will need to be hidden (or disabled), and then reappear after a certain amount of time. Hopefully with a new, randomly chosen message.
Perhaps some of you have created something similar in the past? I'm looking through the timed menu documentation (yes yes, it's out of date), but I'm blanking on how I can use it in this situation...
This was fairly tricky to explain, but I did my best. Please don't hesitate to ask for more clarity if I've skimmed over something. Thoughts? Alternatives? Links? Examples? Or maybe you have a better, tidier way of doing things? I'll love you forever.