Is there a way to create an "if-and" conditional branch?

Brief synopsis... my character shows an animation when searching an object for an item, and so the image changes to that animation for the duration. Occasionally, my character will also be shown carrying an object, e.g. firewood.

I am looking for a way to only show the "search" animation image when interacting with an object if the character is NOT already holding a large object, because the actor image would change, the large object carried would disappear, and well, that would look just stupid.

So I am curious to know a way to insert and "if/and" statement using the engine. If the actor activates the event, AND the character is holding the large item, the search animation will NOT show. In other words, the search animation will only execute before or after the large object actor image is gone.

I apologize if that doesn't make any sense, haha. And I'm sure there's a simple solution... I just haven't figured it out quite yet because I'm a derp. 🙂 Thanks so much in advance for anyone who can help me with this little dilemma.
You can nest and combine multiple conditions and use the ELSE branch if you need a "NOT".

Code:
IF character has item
   ...
ELSE
   > show animation
END

If you need a "if A AND B" condition, you would nest a condition in a condition.

Code:
IF ...
    IF ...
        > continue here
    END
END

If you need a "if A and NOT B" condition, you would continue in the ELSE Branch of the 2nd condition.

Code:
IF ...
    IF ...
        ...
    ELSE
        > continue here
    END
END

In your case, it would look like this:
There is an additional trick I use when the methods that @Aerosys describes are not enough. For example if you use their method and you want to do something in the else branch of an AND, you would need to insert the same code into both else branches. Or maybe you need a logical OR. In these cases I use the following:

AND:
Code:
Switch 'temp boolean' = ON

IF condition A
ELSE
  Switch 'temp boolean' = OFF

IF condition B
ELSE
  Switch 'temp boolean' = OFF

IF 'temp boolean' is ON
  //do something if A && B
ELSE
  //do something otherwise

OR:
Code:
Switch 'temp boolean' = OFF

IF condition A
  Switch 'temp boolean' = ON

IF condition B
  Switch 'temp boolean' = ON


IF 'temp boolean' is ON
  //do something if A || B
ELSE
  //do something otherwise
Thank you both so much for this. However, still not sure I'm fully understanding. I tried this a couple ways, and before the switches in the branch are "off" everything works fine. But then, once it progresses to the switches being on, nothing happens. I can't interact with the object any longer. I tried turning the switches off after they occur, but that causes an error and certain objects in the area related to the switches reappear that aren't supposed to be there.

Also, @eomereolsson is the boolean switches you listed examples of control switches, or is this an actual boolean that you put in as script? I wasn't sure, tried it both ways.

Here's a screenshot if it helps.
Yes, I just use a regular control switch and just named the particular switch 'temp boolean'. Because I initialize it every time as the first step I can reuse the same switch for every check of this kind across different events.

While your event in general seems a bit wonky to me, I don't see why you couldn't interact with the object or why stuff would suddenly appear. At least in the screenshot you are not actually setting any switches.
What seems off to me:
- Why is the check if both WoodFound and HuntingTrapFound are OFF only performed if the player is facing up, but the check if they both are ON is only performed if the player looks in any other direction?
- What happens if WoodFound is ON, but HuntingTrapFound is OFF (or vice versa)? It seems to me that handling for these cases is missing.
if you need to check for an item or switches, you can also
use a scriptcall for them

if: script: itemA && itemB
do stuff
else
you dont have it yet
end

on MV you can shorten them with ConditionalBrach+ plugin, not
sure if it can be ported or usefull with RETRO plugin?

so you dont have to make nested conditional branches 🙂
@eomereolsson I was putting in the switches that were used to change the character images, e.g. firewood was being carried (on) so was hoping that if in the conditional branch is was shown either off or on, it would do the thing I wanted as far as the interactions. I haven't had a chance yet to mess with it again, but I'll give it a shot in a little while. The direction-facing thing was a boo boo that I corrected after posting the screenshot, but still had no luck.

And @ShadowDragon I will also see if I have success with your plugins... thank you so much, by the way. I also see there's a menu customization plugin I'm definitely going to try out. I was working on a menu using pictures and don't really like it too much so will work on one using the plugin and see what comes of it.

Update: I can't seem to find anything available as far as the plugin you mentioned for MZ. 🙁
Sorry for the double post, just wanted to confirm that using @eomereolsson 's strategy (after more closely following the instructions, was able to construct the correct conditional branch. Thank you all.
my menu plugin is mostly for single actor, and work in MV, not MZ,
I doubt even with RETRO it could work, while MZ handles images
differently alot.

there is a PhoneMenu for MV and MZ, which also works, by estriole
found [here] while it works far different than mine.

but you can make your menu unique with it. mine is simplified and
use a button template for enable, disable and hover for both. (except locked).
but also have fixed text that you set.

if you want a status menu, mine wont do, the link I gave might, but not sure.
I didn't try it out, but it can give you some looks to it which you can try out.

good luck on your project 🙂

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-create-an-if-and-conditional-branch.142944/