How to make a puzzle involving multiple item selection?

hernanvalles88

Villager
Member
Joined
Jan 20, 2020
Messages
11
Reaction score
3
First Language
Spanish
Primarily Uses
RMMV
Hi everyone, I have an idea for a puzzle but I don't know if it's possible to do it with RPG Maker MV. The idea is that the player can collect 7 different books and then place 3 of them in a bookcase. If the player picks the 3 correct books (no specific order), the bookcase will reveal a secret passageway. If not, the books will return to the inventory.

Is this possible with MV? any plugins that might help? Or maybe I should move on and think of other ideas? I know how to do it with one item, but I can't find any tutorials on how to do it with more.

Thanks in advance. BTW, I'm not a native english speaker, sorry if I didn't explain myself well!
 
Joined
Oct 15, 2015
Messages
94
Reaction score
130
First Language
English
Primarily Uses
RMMV
I'm assuming the player can only obtain one of each book, let me know if that's not the case.
I indented this so it hopefully make more sense.


Use the item select command
Check with conditional branches whether the item chosen was one of the three correct books
If true then remove the item. If false then end here OR do two more item selects, checks, and item removals then return items and end.
do another item select​
do another check​
if true then remove the item. If false then return the item that has been removed OR do another item select, check, and removal and then return the items that have been removed.​
do another item select​
do another check​
if true then remove the item and reveal the doorway. If false then return the items that have been removed.​
 

hernanvalles88

Villager
Member
Joined
Jan 20, 2020
Messages
11
Reaction score
3
First Language
Spanish
Primarily Uses
RMMV
Yes, the player can only obtein each book once. Anyway, I'm probably doing something wrong, because it's not working. But thank you for taking the time to reply :)
 
Joined
Oct 15, 2015
Messages
94
Reaction score
130
First Language
English
Primarily Uses
RMMV
If you show me a screenshot I might be able to help you diagnose the problem.
 

hernanvalles88

Villager
Member
Joined
Jan 20, 2020
Messages
11
Reaction score
3
First Language
Spanish
Primarily Uses
RMMV
My RM is in spanish, so I'll transcribe it in english. Books A, B and C are meant to be the correct ones.

-Item select: Variable 1, key item
-If: party has book A
-book A -1
-Else:
-Item select: Variable 1, key item
-If: party has book B
-book B -1
-Else:
-Item select: Variable 1, key item
-If: party has book C
-book C -1
-Else:
-Book A +1
-Book B +1
-Book C +1
-End
-End

-Item select: Variable 1, key item
-If: party has book B
-book B -1
-Else:
-Item select: Variable 1, key item
-If: party has book C
-book C -1
-Self-Switch A ON (reveals passageway)
-Else:
-Book A +1
-Book B +1
-Book C +1
-End
-End

I hope somewhat clear. Truth is I still don't have a full grasp on how conditional branches and variables work (I've been looking to some tutorials on Youtube, but most are pretty basic). Thanks a lot!
 
Joined
Oct 15, 2015
Messages
94
Reaction score
130
First Language
English
Primarily Uses
RMMV
I was just about to publish an edit to my earlier post when you posted this. While I was thinking about this problem I found a much cleaner way of doing this with the help of script calls. The way it'll work is it will ask the player to choose an item and then remove the item they chose. It'll do this three times and then check to see if the items that the player put on the shelf were the correct ones. If yes then you open the passage else it will return the items that were placed on the shelf.
a screenshot showing what's going on:
bookshelf.png
By the way you will need 3 different variables for this. In the screenshot the variables I used were name "first" "second" "third". The names aren't important, just wanted to make sure you could recognize them in the picture. You will need to know the IDs of the variables and items you will be using though.

The scripts calls I used (make sure each line is in a different script call):
Change X, Y, and Z into the IDs of the variables you are using.

$gameParty.loseItem($dataItems[$gameVariables.value(X)], 1);
$gameParty.loseItem($dataItems[$gameVariables.value(Y)], 1);
$gameParty.loseItem($dataItems[$gameVariables.value(Z)], 1);

$gameParty.gainItem($dataItems[$gameVariables.value(X)], 1);
$gameParty.gainItem($dataItems[$gameVariables.value(Y)], 1);
$gameParty.gainItem($dataItems[$gameVariables.value(Z)], 1);


And this is the script used in the conditional branch:
Change X, Y, and Z into the IDs of the variables you are using
Change A, B, and C into the item IDs of the correct books

($gameVariables.value(X) === A && $gameVariables.value(Y) === B && $gameVariables.value(Z) === C)||($gameVariables.value(X) === A && $gameVariables.value(Y) === C && $gameVariables.value(Z) === B )||($gameVariables.value(X) === B && $gameVariables.value(Y) === C && $gameVariables.value(Z) === A)||($gameVariables.value(X) === B && $gameVariables.value(Y) === A && $gameVariables.value(Z) === C)||($gameVariables.value(X) === C && $gameVariables.value(Y) === B && $gameVariables.value(Z) === A)||($gameVariables.value(X) === C && $gameVariables.value(Y) === A && $gameVariables.value(Z) === B );

The code looks a bit intimidating, but it should work given the correct numbers. Let me know if you have any problems with it.


EDIT:
@hernanvalles88 I took a look at the info you gave of the event. I think there was a misunderstanding about the conditional branches. Understandable, they are tricky little devils sometimes but when used to their fullest they are incredibly powerful. Same with variables and switches.

Basically what happened in your event:
the player selects an item
then you checked to see if the player HAS the item rather than if the item he chose was book A

hopefully I can explain this clearly...
The item select will put the item ID into the variable you chose, so to use a conditional branch to check if the item the player chose was a particular item you would do the following:
*assuming book a has the ID of 3 and you used variable 1
if variable 1 = 3
"the player chose the right item!"
else
"the player chose the wrong item..."

checking if the player HAS an item is seeing whether it's in their inventory or not.
 
Last edited:

hernanvalles88

Villager
Member
Joined
Jan 20, 2020
Messages
11
Reaction score
3
First Language
Spanish
Primarily Uses
RMMV
It worked! Thanks a lot for your clear explanation, you made it seem so easy! :)

I also think I understand what you're saying about the conditional branches. Basically, whenever the player is requiered to choose multiple items, I need to create one variable per item and check if they chose the right item with conditional branches, instead of creating just one variable and make the items ID's add to the value of said variable and check if they have it on the inventory. Am I getting this right?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Hi, there.
I'm Creta Park, as Software engineer and Indie game developer.

Profile : creft.me/cretapark
GitHub : github.com/creta5164
Blog : creta5164.tumblr.com


My stuff

Who shares/sells their scripts/plugins on itch.io? Can I pick your brain?
If you ever need fantasy names and you're bored, make a fictional alphabet. Switch around the letters and see what you get :p
I JUST GOT PROMOTED TO 9TH GRADE BOIS!

Forum statistics

Threads
98,170
Messages
949,964
Members
129,459
Latest member
thanhlan
Top