Kisa135

Villager
Member
Joined
May 26, 2019
Messages
13
Reaction score
0
First Language
English
Primarily Uses
RMMV
Help me.PNG Please.PNG Hello, I'm new to rmmv and trying to make a small game for a friend (And for practice) using no plugins or outside scripts.
What gave me an issue was when I tried to make a locked door with two possible keys.
Both keys are supposed to work. But, the key the player uses will change the story down the line.
Every time I try to use the code the way my tiny brain tells me it should work, the game crashes and doesn't do the thing.
Is there a tutorial out there that can help me or a similar thread I can be directed towards?
 
Last edited:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,586
Reaction score
12,126
First Language
English
Primarily Uses
RMVXA
I think it would help if you posted a screen shot of the event where you are trying to do this so that we can see what's happening. Don't crop it, as we need the information down the left side as well as the commands themselves. If there is more than one page, then we will need a screen shot of each one. Please use Alt+PrtSc to take the shot, so that only the active window is included, not your whole desk top.
 

Kisa135

Villager
Member
Joined
May 26, 2019
Messages
13
Reaction score
0
First Language
English
Primarily Uses
RMMV
I think it would help if you posted a screen shot of the event where you are trying to do this so that we can see what's happening. Don't crop it, as we need the information down the left side as well as the commands themselves. If there is more than one page, then we will need a screen shot of each one. Please use Alt+PrtSc to take the shot, so that only the active window is included, not your whole desk top.
Yes! Sorry. Here you go (I'll update the main post, too.)Help me.PNG Please.PNG
 

mathmaster74

just...John
Veteran
Joined
Jun 12, 2016
Messages
285
Reaction score
195
First Language
English
Primarily Uses
RMMV
@Kisa135 Here's a screenshot of a very simple door locked by key mechanism I used in a project:

2019-05-25.png

You could add a nested if statement in the else case of this one checking for Party has Key 2, create an else branch to that, and move the failure text to the second else branch from where it is. In each case of success, you can then simply create a switch which will tell you either Key1Used when ON or Key2Used when ON. Make sense? :smile:

EDIT: Thanks for including the screenshot update. What's the line of code Script: If Not: MisterSnugglesNo being used for? Is it a comment line? I thought you didn't want to use scripts. You should get rid of it either way. It may clear things up as an undefined script could do exactly what you're experiencing...crash the game.
 
Last edited:

Kisa135

Villager
Member
Joined
May 26, 2019
Messages
13
Reaction score
0
First Language
English
Primarily Uses
RMMV
@Kisa135 Here's a screenshot of a very simple door locked by key mechanism I used in a project:


You could add a nested if statement in the else case of this one checking for Party has Key 2, create an else branch to that, and move the failure text to the second else branch from where it is. In each case of success, you can then simply create a switch which will tell you either Key1Used when ON or Key2Used when ON. Make sense? :smile:

It does make sense, in fact it looks very similar to what I did in fact do but that didn't work so I tried a few other variations and I-
Well, I'm honestly kind of sad now. I'd love to get it working soon.
 

Kisa135

Villager
Member
Joined
May 26, 2019
Messages
13
Reaction score
0
First Language
English
Primarily Uses
RMMV

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
35,860
Reaction score
9,501
First Language
German
Primarily Uses
RMMV
@Kisa135 I think you completely misunderstood how the select item command works - because you can't use it like you did in your events.

First, when giving the select item command the player gets a window displaying all items of that type he has in inventory.
So there is absolutely no need to check if the player has an item - it will simply not appear in the list if he doesn't have it in his inventory as long as it fits the selection criteria.

Second, the variable specified in the command will get the ID of the item the player selects. You can't know in advance which item the player selects - that could be anything he has in the inventory.

So to check what the player has done you ALWAYS need a conditional branch checking that specific variable agains the possible IDs of the items that would work. You can't use that command without checking its result.

So you should always use the same variable in it - name it as "selection" or something like that.

Then your code would read
Select Item (variable #10 selection, key item)
Conditional branch if variable #10 = 5 (or ID of the Mister Snuggles item)
> switch mistersnuggles = ON
Conditional branch if variable #10 = 6 (or ID of the Mister Chicken Item)
> switch misterchicken = ON

and so on - you only need one select item command even if there are dozens of items that could be used, but you need one conditional branch with that variable for any item ID that should give a reaction (even if it is just a show text "this is sharp not fluffy" if the player selects a knive instead of the plush.


EDIT: And you get the crash because the script line "if not" is not a script, you can't use that there
 

Kisa135

Villager
Member
Joined
May 26, 2019
Messages
13
Reaction score
0
First Language
English
Primarily Uses
RMMV
@Kisa135 I think you completely misunderstood how the select item command works - because you can't use it like you did in your events...
@Andar Thank you very much for that explanation.
Unfortunately, even using it, my game doesn't do anything after putting the item in place.
I really don't understand.
The game runs perfectly fine, I get to the menus, I select the items alright, the image appears at the event location properly (Which tells me that the switches are working) But then as soon as the switch is down, I lose control of the player entirely.
The water in the scene still animates, I still have my follower, no part of the map glitches out... I just cannot move.
 

Kupotepo

Fantasy realist/Advocatus Diaboli
Veteran
Joined
Jul 5, 2017
Messages
1,957
Reaction score
2,109
First Language
Thai
Primarily Uses
RMMV
@Kisa135, sorry I do not understand. Please restate your sentence. Would you like to use the key to lock the door or open the door? So I can test to see myself.
 

Kisa135

Villager
Member
Joined
May 26, 2019
Messages
13
Reaction score
0
First Language
English
Primarily Uses
RMMV
@Kisa135, sorry I do not understand. Please restate your sentence. Would you like to use the key to lock the door or open the door? So I can test to see myself.
@Kupotepo Unlock.
Also, for some reason, adding an extra line of dialogue after the code makes it progress past the freeze...
Squinting really hard at my editor now because I DID try that before....

EDIT:
NEVERMIND, it only fixed itself for MisterChicken and not MisterSnuggles.
It still freezes up on that one even if I add extra dialogue.
 
Last edited:

Kupotepo

Fantasy realist/Advocatus Diaboli
Veteran
Joined
Jul 5, 2017
Messages
1,957
Reaction score
2,109
First Language
Thai
Primarily Uses
RMMV
You can do like @mathmaster74 way or you would like another way. Tested it worked. Capture28.PNG Capture29.PNG
 

Kisa135

Villager
Member
Joined
May 26, 2019
Messages
13
Reaction score
0
First Language
English
Primarily Uses
RMMV

Kupotepo

Fantasy realist/Advocatus Diaboli
Veteran
Joined
Jul 5, 2017
Messages
1,957
Reaction score
2,109
First Language
Thai
Primarily Uses
RMMV
@Kisa135, you make like a puzzle key which will open to another door far away. You have to give choices as Andar said sorry if you want to use items. Now the door will appear neither the key will open the door.
Capture30.PNG
Capture31.PNG Capture32.PNG
 

Kisa135

Villager
Member
Joined
May 26, 2019
Messages
13
Reaction score
0
First Language
English
Primarily Uses
RMMV
Capture.PNG This is my current code.
it works for MisterChicken. I just need it to also work for MisterSnuggles.
 

Kupotepo

Fantasy realist/Advocatus Diaboli
Veteran
Joined
Jul 5, 2017
Messages
1,957
Reaction score
2,109
First Language
Thai
Primarily Uses
RMMV
@Kisa135, I am sorry I completely forget about "Select Item Button."
I do not think it is something wronged with the first page. How about the second page and third page?
 

Kisa135

Villager
Member
Joined
May 26, 2019
Messages
13
Reaction score
0
First Language
English
Primarily Uses
RMMV
@Kupotepo Second and third pages are literally just:
"If this switch is active, say this"
I put the check for if the switch is active under the conditions bar on the left and unless that's also a coding mistake somehow...
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
35,860
Reaction score
9,501
First Language
German
Primarily Uses
RMMV
@Kisa135
First rule:
ALWAYS, and that really means ALWAYS name a switch or variable as soon as it is used.
It has nothing to do with this error, but you will only cause yourself the greatest headaches if you forgot to name and then re-use some variables in your project.
In the case above you didn't name the variable #1 that you use to store the selection.

t works for MisterChicken. I just need it to also work for MisterSnuggles.
we need a better description than "doesn't work" to even start helping. WHAT does not work?
- Is the item not in the selection window of the command?
- can the item be selected but nothing happens?
- can the item be selected, the show text appears but the result in the game doesn't happen?

depending on what does and what does not happen there are different possible causes, and NONE of those causes are in the screenshot of the event. If you specify what happens and what not we can ask for other screenshots that will help find the cause.
 

Latest Threads

Latest Posts

Latest Profile Posts

COMBAT:

Finally showing combat in my game. The lighting system I'm currently using doesn't transfer over into combat, but I am hoping to find a new one soon... or an update for the one I'm using. The plan is to make combat less bright, though. You'll want to click the video link below and visit YT for audio.
Huge thanks to D757 Gaming for his stream, impressions and review of my game, please check him out!
Thank you to everyone who participated in the 3rd quarter annual Drifty jam! I'm always so impressed with the games people make! This time our winner dominated both categories!
jamWinners2.png
That feeling when you have an out-of-bounds error and an ai enemy exploits it to kill you

Forum statistics

Threads
122,040
Messages
1,146,071
Members
160,308
Latest member
DoctorDeathtrap
Top