Conditional Actor in first position

I'm using MZ i coudnt find a specific MZ help. but they're basically the same

Ok so Im making a system that requires certain actors to perform certain action to be able to solve puzzles. There are two thing i'd like to have.

how do i make a conditional that checks that actor 001 is in first position or not?

how can i make it so that when i hit the action button and there are no events nearby, it switches the order of the party members 4 to 3, 3 to 2, 2 to 1, 1 to 4th position.
how do i make a conditional that checks that actor 001 is in first position or not?
I Googled "RPG Maker MV leader" and got: $gameParty.leader().actorId() == 1
how can i make it so that when i hit the action button and there are no events nearby, it switches the order of the party members 4 to 3, 3 to 2, 2 to 1, 1 to 4th position.
This has two pieces. First, you'll need a plugin to call a common event when you press a button.

Second, the code to do the swapping: I looked up "RPG Maker MV script change order":
$gameParty.swapOrder(index1,index2)
You'll just need to be thoughtful with the numbers you use, because it won't be simultaneous like the way you described it above.

As you say, both of these calls are technically from MV, but are likely to be the same in MZ. I have not double checked.
I'm going to sound super noob but I probably am. How do I use that as a conditional in an event?

Edit. Nevermind. I found it!

Thank your so much. I'll let you know if I manage to do it right
Control Variables lets you put the id of a party member in any position into a variable. So to check the leader it'd be Control Variables > Game Data > Party Member 1
oh wow, thx. My god my game is getting so good. Thank you so much. now i just have to find a way to switch characters easier and visually as it will be an important part of the game mechanics
How do I use that as a conditional in an event?
I know you said you found it, but just for anyone else who might come across this thread later - tab 4 of Conditional Branch has a field where you enter a script as the condition.

Original thread: https://forums.rpgmakerweb.com/threads/conditional-actor-in-first-position.139390/