New User , in need of help with Events

Greetings all!


I am trying to do something like this, not sure how to do it, since it needs more Conditions.


When you have Party Member 1 and 2 in your Party, one event is activating when going to Location X.


When you have Party Member 2,3 and 4 in your Party, another event is activating when going to Location X.


When you have no Partymembers at all in your Party, yet another event is activating when going to Location X.


Do i use Switches, Variables or Conditional Branch: When Y is in your Party?


Some events require you to have three specific characters in your party, so im not sure how to do this.


Thanks for your help!
Welcome to the forum! I noticed that you have "RMVX" written as your primary maker in your profile, but you're posting in the VX Ace Support section. I can only give you a definite answer for VX Ace since I don't own VX, but it's quite likely that it works the same in both makers anyway.


Conditional Branches are the way to go here. To check for multiple actors in the party, I can think of two possible ways to solve it, either with nested Conditional Branches (probably easier to understand if you're new to RPG Maker) or with a line of Ruby code in the Script option of a single Conditional Branch (might look a bit intimidating at first). To check if the party is empty, I would definitely use a Script in the Conditional Branch.


Nested Conditional Branches:


If e.g. you want to check whether Eric, Natalie and Terence are in the party and have an NPC show a message only if that is the case, the event would look like this:

Spoiler
NestedConditionals.png

The structure of the commands - Conditional Branch inside another Conditional Branch - would be the same if you put it as an Autorun or Parallel Process (with some kind of command to keep it from repeating over and over) on the map to make it run automatically when the player enters the map.


The message would also show if there are more than these three actors in the party. If you only want it to activate if just the three and nobody else are in the party, you can either make use of the Else branch ("Set handling when conditions do not apply") or - probably easier in that case - use the Script option of the Conditional Branch instead.


Single Conditional Branch with Script


In the Script field at the bottom of tab 4 of the Conditional Branch, you can enter a line of Ruby code. If that code evaluates to "true", the contents of the Conditional Branch are executed, the same way as if you would enter a "normal" condition.


Some lines you can use (same for VX and VX Ace, as far as I know) are:

Code:
$game_party.members.length == 0

"Are there exactly 0 party members?"

Code:
$game_party.members.include?($game_actors[1])

"Is actor #1 in the party?" This is the same as using the "Actor X in the party" option, but in the code you can combine multiple conditions like this:


$game_party.members.include?($game_actors[1]) && $game_party.members.include?($game_actors[2]) && $game_party.members.include?($game_actors[3])


"Is actor #1 in the party AND is actor #2 also in the party AND is actor #3 also in the party?"


Or to check if a certain actor is alone in the party:

Code:
$game_party.members.length == 1 && $game_party.members.include?($game_actors[4])

"Is there exactly one actor in the party AND is actor #4 in the party (which means only actor #4 is in the party)?"


If you have any questions, feel free to ask!
How would you go to location X when you have no party members at all?
Many thanks Lady Baskerville, didn't know you could put a Conditional Branch inside another Branch like that! Will try that out asap.


Also writing down the Ruby-Scripts!


Thanks heaps, you have been a great help!

Original thread: https://forums.rpgmakerweb.com/threads/new-user-in-need-of-help-with-events.73482/