Give keys/item to only certain characters? [SOLVED!!]

Hi, I'm a little new so I could just be missing something, but I'm trying to give only certain characters their own key/item. I have a character who is smart, a character who is strong, and one that is kind, so
I'm trying to make it so that you can only "solve" a puzzle if you switch players to the smart guy in "formation".
So if you try to move a boulder out of the way it would say something like, "Only strong guy can move this." unless you're already playing as the strong guy. I tried looking this up on the forums but I couldn't find anything this specific.
Thanks!
Try Conditional Branches which check if Actor X is in the party. If yes, move boulder. Else your text.
I've tried doing that, but since the characters are always in the party it just lets them through.
I'm trying to make the player switch to the correct character before they are able to move through.
How are you handling the switching?
I'm not sure how a switch would be needed.
Please elaborate on what you have in mind!
I believe he means, how do you handle the switching between characters?
By "In formation" do you mean among the active battle members? If that is the case you can use this:
Code:
$game_party.battle_members.include?($game_actors[actor_id])
Of course, you have to replace "actor_id" with the actual ID of your actor.
Spoiler: Why the event command does not work
The default Event Command handles it this way:
Code:
result = ($game_party.members.include?(actor))
However, the "members" method for Game_Party returns "battle_members" only when the party is in a battle, returning the whole party otherwise (all_members).
Code:
def members
  in_battle ? battle_members : all_members
end
Using the previous code in the script box of a conditional branch you can effectively check if the actor you want is part of the current formation.
Control VariableX = Set to ID of Party Member 1
Conditional Branch if VariableX equal to 3 do push rock, else texbox: "the wrong Actor is Party Leader"
slimmmeiske2: Ohh, when you manually go into the menu and switch characters in formation.
Heirukichi: No, not in battle, in game.
Bex: I'll try that right now!
Heirukichi: No, not in battle, in game.
That is exactly why I used "battle_members". I added an explanation to my previous post, it should answer your question.
I'll try that right now.
Thank you so much, Bex!!! All I had to do was set the equals to 1 and it worked!!😍😍
(When I set it to 3 it made the 3rd character have the ability to but no-one else.)
Thanks everyone for helping me!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/give-keys-item-to-only-certain-characters-solved.109739/