Conditional branch that recognizes current character graphic

Hello! I hope someone can help with this.

I have a puzzle where the character swaps places with a butterfly by walking into it, and the same with a sheep, and vice versa (ie, swapping between 3 graphics, all with different abilities - character, butterfly and sheep).

I've got everything almost working, but am having trouble working out a way for the conditional branches to figure out what to change into based on what you are when you walk into it.

At the moment I'm using simple 'i am butterfly', 'i am sheep' switches, but as there are several swaps that can happen (avatar > sheep, avatar > butterfly, butterfly > sheep, butterfly > avatar etc) I can't quite get it all to work properly.

Is there some kind of conditional branch script call that recognizes what graphics the character currently is (ie, animal: sheep, animal: butterfly, or main avatar)? I think that'd be the simplest solution, unless anyone can think of something else.

Thanks!
There are, but I'd recommend using a variable instead of a switch. That way you can assign each form a numerical value; 0 would be avatar, 1 for sheep, 2 for butterfly etc. Then you can check what the value is to know what form the player is in.
Thanks Trihan!

I should have mentioned in my original post that the target remains on screen in whatever form the avatar was when you walk into it after the swap has happened, so the problem I have is that I need to track 2 values; current avatar form and current target form.

I've attached a screenshot of what I currently have, but it only tracks what the avatar form is, and not the target. The result is that it almost works (perfectly so, if the player does everything right in the puzzle) but if the player tries an 'incorrect' swap, the event changes to the wrong graphic.

I still can't quite figure out a solution, either with switches or variables, though I feel like there should be something relatively simple that I'm just missing.

Hope that all makes sense!
Can you assign different form variables for your character, the sheep event and the butterfly event. Then make a fourth variable (temp) that you can use to save a value when switching.

Then when you interact with the events, for example event 1:

control variables -> temp variable = your form variable
control variables -> your form variable = event 1 form variable
control variables -> event 1 form variable = temp variable

Then put conditional branches to change the pictures depending on what the form variables are.

I guess that works...maybe...my brain is tilted this evening 😀
Thanks so much - it worked! Posting my solution as a screenshot because I'm pretty proud of it.

I ended up using a variable for current avatar form, a conditional branch for each variation, and self switches to change the target graphic (all switches off for whatever it starts as, 'A' for sheep, 'B' for butterfly), then just changed them around depending on what it needs to start out as.

Works like a charm.

Now, after all that work, I just need to figure out some more puzzles that use the mechanic..

Original thread: https://forums.rpgmakerweb.com/threads/conditional-branch-that-recognizes-current-character-graphic.144855/