- Joined
- Jan 9, 2022
- Messages
- 561
- Reaction score
- 493
- First Language
- English
- Primarily Uses
- RMMZ
So, this is really stumping me. I have searched every variation of questions I can think of and tried different scripts I found in the RPG Maker MZ Script Call Reference list. But nothing works. I probably found the answer, but just don't know how to use it correctly.
What I am trying to do is use the \P[ ] for Choice Options. Then I am using a script to check those choices against the Party Member Name or Actor ID using a Conditional Branch.
The problem I ran into was if you create the event with 5 \P[ ] choices, but then the party is only 3, 2 of the choices are blank. Which is fine, but if you select one of those choices, you get an error.
So, I made the event go through all of the options based on how many party members there are. From 1 to 5. That works, but it is really long.
I was thinking there should be a way to check to see if the specific \P[ ] choice is actually empty. Like the event is set to show \P 1-5, but there are only 3 party members. If the player selected the 4th or 5th choice that is blank, the event will check to see if that slot in the party is empty and will then do something without giving an error.
If was trying to find a way to basically say if the 4th Party slot is empty, then do this. I tried using stuff I found about JS and null values, but nothing worked.
Here is a screenshot of part of the event that shows the adjudication of the choice selection.

What I am trying to do is if there is no \P[4] or \P[5], instead of getting an error if the player selects those, it displays a message.
This is all just testing the functionality and NOT what I am trying to do in a game. Showing text is the easiest way to test if it is doing what I want.
A real application for this would be selecting which party member is doing something. Like speaking, using a skill, using an item, etc. But I want to build it so it works no matter how many party members you have.
Right now, what I am doing is determining the party size, then going through all the options. If the party size is 1, don't show any choices. If the party size is 2, show two choices of \P[1] and \P[2], etc. And each \P[ ] option then goes through and checks to determine which actorID is associated.
And this allows the player to change the formation of the party and the choices still work.
I am hoping there is an easier way to do this.
But I am still very new to RPG Maker and Java Script. I struggle to figure out the script calls and how to properly implement them.
I hope I have explained what I am trying to do in a way that makes sense.
Any help is greatly appreciated.
Thanks!
What I am trying to do is use the \P[ ] for Choice Options. Then I am using a script to check those choices against the Party Member Name or Actor ID using a Conditional Branch.
The problem I ran into was if you create the event with 5 \P[ ] choices, but then the party is only 3, 2 of the choices are blank. Which is fine, but if you select one of those choices, you get an error.
So, I made the event go through all of the options based on how many party members there are. From 1 to 5. That works, but it is really long.
I was thinking there should be a way to check to see if the specific \P[ ] choice is actually empty. Like the event is set to show \P 1-5, but there are only 3 party members. If the player selected the 4th or 5th choice that is blank, the event will check to see if that slot in the party is empty and will then do something without giving an error.
If was trying to find a way to basically say if the 4th Party slot is empty, then do this. I tried using stuff I found about JS and null values, but nothing worked.
Here is a screenshot of part of the event that shows the adjudication of the choice selection.

What I am trying to do is if there is no \P[4] or \P[5], instead of getting an error if the player selects those, it displays a message.
This is all just testing the functionality and NOT what I am trying to do in a game. Showing text is the easiest way to test if it is doing what I want.
A real application for this would be selecting which party member is doing something. Like speaking, using a skill, using an item, etc. But I want to build it so it works no matter how many party members you have.
Right now, what I am doing is determining the party size, then going through all the options. If the party size is 1, don't show any choices. If the party size is 2, show two choices of \P[1] and \P[2], etc. And each \P[ ] option then goes through and checks to determine which actorID is associated.
And this allows the player to change the formation of the party and the choices still work.
I am hoping there is an easier way to do this.
But I am still very new to RPG Maker and Java Script. I struggle to figure out the script calls and how to properly implement them.
I hope I have explained what I am trying to do in a way that makes sense.
Any help is greatly appreciated.
Thanks!