How do you swap PCs in an event?

mikey1393drago

Dragon Fanatic
Veteran
Joined
Aug 31, 2016
Messages
69
Reaction score
6
First Language
English
Primarily Uses
RMVXA
Hey. This is something new I am trying to figure out, but I am unsure how to do it right. I don't have any screenshots this time for the problem, but I am hoping a minute description will help.

I have for instance an event that contains two PCs. The event works correctly with the main PC being played by the player, but how would 'said' event play out correctly if the player is controlling the other PC instead? This 'said' event must have the main PC in front of the minor PC, but I can't seem to figure it out. I've tried the 'change party member'; 'change player followers'; and 'gather followers' buttons, but none of them worked.

Any ideas?

Or is it simply a case of using the right button in the right way.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
What do you mean by "an event that contains two PCs"? Event's don't contain PCs. How does the player control two different PCs? Do you simply mean there are two party members and you want one to be the leader and not the other? In that case, you could use a Control Variables command to get the id of the party leader, Conditional Branch to test if it's the wrong character, and a script call as follows:

Code:
$gameParty.swapOrder(0,1);
 

mikey1393drago

Dragon Fanatic
Veteran
Joined
Aug 31, 2016
Messages
69
Reaction score
6
First Language
English
Primarily Uses
RMVXA
Yeh. What I meant was one character i.e Luca, has to be the leading character in the event. i.e Laya was originally being controlled by player.
And will the script call work if I don't have the script, or is it as a default?

Edit: Just checked on the script editor, and that script is present. Never had to think about using scripts for something like this.

Could you show me an example please Shaz. I've tried to implement your advice, but I've done it all wrong.
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Oh - you're using Ace. Sorry - the code I gave you was for MV.

Code:
$game_party.swap_order(0, 1)
You're only using a script call because there isn't an event command to do it directly, so you're imitating what would happen if the player adjusted the formation from the editor.

Actually, there IS a way to do it with events. You just use Change Party Members to remove the character you don't want to be the leader, and then another Change Party Members to add them back again. That simply takes them out then puts them back at the end of the party. If you only have 2 party members and you know they're both going to be there, you can do it this way. It gets more complicated if you don't know who's going to be in the party at the time.
 

mikey1393drago

Dragon Fanatic
Veteran
Joined
Aug 31, 2016
Messages
69
Reaction score
6
First Language
English
Primarily Uses
RMVXA
I was wondering why the script call was not working. Lol. No worries. Everyone makes mistakes.

But you saying use the 'change party members' button, that works but then the event does not play with the other character's sprite in the event. In the event the main character looks to the minor character, that's what I'm trying to get right.

Edit: Yay. The script works how I want the scene to play if the player has control of the other character now. Cheers Shaz. B)
I've just got to figure it out if the main character is the one the player is playing. There is something I must do to cancel out the script call so it does not swap while the main character is in play.
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I told you that in my first reply ;)

Use Control Variables to get the leader's actor id. Then do a Conditional Branch to see if that variable is NOT equal to the id of the main character, and do your swapping around inside that. So the swap will only happen if the main character is not the leader. If the main character is already the leader, nothing will happen.
 

mikey1393drago

Dragon Fanatic
Veteran
Joined
Aug 31, 2016
Messages
69
Reaction score
6
First Language
English
Primarily Uses
RMVXA
I know. Soz.:frown: It's me wanting player convenience in my game, which is always very hard to fulfil. Thanks for the help. It's just when I tried to use the variables the other way it worked but only showed the leading character. If I sleep on it, maybe my brain will figure out the problem as to why the other character for some reason does not show when the swap never happens.

I'm so complex I confuse myself so much.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Show us a screenshot of your event. You say you did something, but unless I can actually see it, I'm left to assume how you did it, and that's usually a bad move.
 

mikey1393drago

Dragon Fanatic
Veteran
Joined
Aug 31, 2016
Messages
69
Reaction score
6
First Language
English
Primarily Uses
RMVXA
I have highlighted the part in question. This is exactly how I first tried, before I tried changing things ending in the same result.
The first conditional branch is correct as you helped with that, but as I'm trying to nest another conditional branch with the opposite option in mind, it never shows the character behind the main character. It cancels out the other character entirely from the equation.

upload_2017-4-16_2-26-3.png

Edit: I say cancels out, but in fact it just swaps. Soz.
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
That doesn't follow the instructions I gave. You are checking if someone is in the party. I said to check if someone is the party leader. Not the same. You're also putting the member id into a variable (for both of them) but you're not using it in a test anywhere. So it's going to swap them every time, not just if your main character is not the leader.

Once more from the top ...

Use Control Variables to get the actor id of the party leader (member 1)
Use Conditional Branch to see if that variable is NOT your main character.
Inside the true branch, do the swap.

Code:
Control Variables: Leader = Member 1's Actor ID
Conditions Branch: Variable [Leader] <> 1 (assuming actor 1 is your main character)
  Script: $game_party.swap_order(0, 1)
End
That's it. If you know you are going to have the second character in your party at this stage, you can just turn followers on. There's no need to do a conditional branch if you know they're going to be there. If there's a possibility that they won't be there, then the rest of the dialogue doesn't make much sense, and you don't have that in a condition.

Also, if you need to provide a screenshot of your event, please use Alt+PrintScreen, as that captures JUST the active window (the event window) without the background. That gives us a larger image which is easier to read.


And after seeing your event, I realise you don't have followers on by default. In that case, you can just use two events for your main character and secondary character, and at the time you want them to talk to each other, you just use Set Move Route from your main event that's controlling everything, to set the graphics on the other two events, and make your player transparent. Then you don't need to worry about swapping characters around at all, and once the event is done, the player will still have control of whoever they were controlling prior to the event.
 
Last edited:

mikey1393drago

Dragon Fanatic
Veteran
Joined
Aug 31, 2016
Messages
69
Reaction score
6
First Language
English
Primarily Uses
RMVXA
Okay. Thanks Shaz. I apologise for my annoyance.

Edit: Alas. The problem is now fixed correctly. Thanks a bunch Shaz.
I cannot put a screenshot into this post when I edit it, so I will write the code for the fix below.
@>Control Variables: [0001:Leader] = Member #1's Actor ID
@>Conditional Branch: Variable [0001 Leader] != 1
@>Script: $game_party.swap_order(0, 1)
@>
: Branch End
@>Change Player Followers: ON

The rest flows as normal.
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,863
Messages
1,017,053
Members
137,571
Latest member
grr
Top