Secrets & Bonus'

Darth Bane

Member
May 2, 2018
146
1,102
Hey folks!

I'm nearing the completion of my first release and I have a few questions about some stuff that's driving me mad.

I want to do something similar to Milfy City and Dual Family; hidden secrets in scenes.

1. Where do I code the clickable secrets and how? Is it in the script or screens or somewhere entirely different.
For example, hover over a specific place and click.

2. I want to have a specific number of secrets that would open up a bonus, extra scene. Not just a sexy image, but part of the story, with dialogue.
For example, if you found all "3" secrets; in the bonus menu, you'd be privy to an extra scene.
How would I go about setting that up?
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,498
7,099
You didn't say what engine you were using, but I'm assuming Ren'py. You also didn't say whether your game was in VN style or "sandbox" style.

If you want to have something clickable, you're almost certainly going to have to use a screen. That screen could be "called", in which case the user won't leave the screen until they click on something, since you'll need to execute a Return or a Jump to continue. On the other hand, you could "show" a screen on top of regular dialog without interrupting the dialog flow. (And then "hide" it when the dialog moves past where you want the clickable item to exist.)

Bottom line, you need to use a screen to get (most likely) a Renp'y imagebutton on the screen. Clicking on the imagebutton can set a variable (and then probably hide the screen so it can't be clicked on again).

Then when you get to the point of potentially offering the bonus scene or not, you check to see if enough different "they clicked on it" variables have been set.
 
  • Like
Reactions: Darth Bane

Darth Bane

Member
May 2, 2018
146
1,102
Thanks for the quick response!

It's VN style with Ren'py.
So, I would use a png overlay over the original image and set it up as a textbutton?
Also, how would I add the variable: If clicked so and so is:True?

I've got the script and multiple story branches down, this seems to elude me for some reason :(
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,498
7,099
You would create the variable just like you'd create any variable. Something like:
Code:
default Item_1_Clicked = False
Then create a screen something like this:
Code:
screen Item_1_Screen:
    textbutton:
        pos(????,????)
        idle "item_1_idle"
        hover "item_1_hover"
        action [SetVariable("Item_1_Clicked", True), Hide("Item_1_Screen")]
where item_1_idle and item_1_hover are images for the item you want clicked.

The question marks are where you'd put in the x,y location that you want the textbutton to appear on the screen - that obviously depends on your screen layout.

Then, at the appropriate point,
Code:
show screen Item_1_Screen
will set this up as an overlay for whatever else is on the screen. When you get to the point where the textbutton should be hidden if they use didn't already click on it,
Code:
hide screen Item_1_Screen
If the user clicked on the item, the variable Item_1_Clicked will be True instead of False.

(That's all banged out off the top of my head - might be a syntax error in it, but it should get you close enough.)
 

Darth Bane

Member
May 2, 2018
146
1,102
You would create the variable just like you'd create any variable. Something like:
Code:
default Item_1_Clicked = False
Then create a screen something like this:
Code:
screen Item_1_Screen:
    textbutton:
        pos(????,????)
        idle "item_1_idle"
        hover "item_1_hover"
        action [SetVariable("Item_1_Clicked", True), Hide("Item_1_Screen")]
where item_1_idle and item_1_hover are images for the item you want clicked.

The question marks are where you'd put in the x,y location that you want the textbutton to appear on the screen - that obviously depends on your screen layout.

Then, at the appropriate point,
Code:
show screen Item_1_Screen
will set this up as an overlay for whatever else is on the screen. When you get to the point where the textbutton should be hidden if they use didn't already click on it,
Code:
hide screen Item_1_Screen
If the user clicked on the item, the variable Item_1_Clicked will be True instead of False.

(That's all banged out off the top of my head - might be a syntax error in it, but it should get you close enough.)


After a long night, I finally got it working! On to the next order of business...
I've built my bonus menu, now I need to add the variable here to open up the image or scene inside.

Here's what I've got:

bonus_items = []

bonus_items.append(BonusItem("Extra Scene", ["PRNE01", "PRNE02"], "bonus_1"))

Where and how would I add: if "Item_1_Clicked", True
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,498
7,099
Where and how would I add: if "Item_1_Clicked", True
That depends an awful lot on how your code is designed to work - there are a ton of different ways you can do this, depending on how you want to manage your data.

Possibility #1: You build the bonus_items array dynamically at runtime (each time just before you need it) to only include the bonus items that the user has actually enabled.

Code:
if Item_1_Clicked:
    bonus_items.append(BonusItem("Extra Scene", ["PRNE01", "PRNE02"], "bonus_1"))
Possibility #2: Instead of using a "Item_1_Clicked" variable, you modify your BonusItem class so that it has an "enabled" field, and then have your action be
Code:
action [SetField("bonus_items[3]", "enabled", True), Hide("Item_1_Screen")]
Possibility #3: You have two parallel arrays - one with bonus_items and one as, maybe, bonus_flags that is an array of booleans (to replace the Item_n_Clicked).

This really all depends on how the rest of the logic in your game works - I can't tell you what the "right" or "wrong" approach is.
 
  • Like
Reactions: Darth Bane