How to handle loads of dialogue choices without tons of switches?

Aerianr

Villager
Member
Joined
Jul 13, 2019
Messages
14
Reaction score
3
First Language
English
Primarily Uses
RMMV
I'm working on a game with lots of dialogue and a relationship system similar to what you'd find in a TellTale game. There are lots of characters you can form relationships with, and I want part of the exp for leveling up your relationships to come from dialogue choices.

Example:

When talking to an NPC, they'll run some typical dialogue and then interaction options will show up. Talk/Give Item/Cancel.
When you choose talk, several different questions show up.

Talk>
...> I like your face. (gain exp)
...> You have the fashion sense of a naked mole rat. (lose exp)
...> sup bb? (result depends on existing relationship level)

Once the player chooses "I like your face", I want them to still be able to access the other two options without being able to access "I like your face" again.

I can only think of using switches or variables to prevent and endless loop where they could repeatedly gain or lose exp, but it seems to me like it would take a huuuuuge, confusing amount of switches considering the number of NPCs, length of the game, and progressing relationship levels changing the initial dialogue options. Even self switches would make things convoluted and would vastly limit things.

Hopefully all of this makes sense. I tried both Yanfly's Message Core EXT 1 and Himeworks Disable choices, but neither of those do what I need them to. I thought I'd ask here in case I'm missing something obvious and simple.
 

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,075
Reaction score
446
First Language
Portuguese - Br
Primarily Uses
RMMV
Hi there!
Well, you said that those two plugins don't help you. But I'm pretty sure that they do what you want.
But using the LABEL option in the event can help you too:


If I remember correctly, the yanfly command, when you disable, for example, the choice 1, this will disable all choices 1 during the entire game. I think you have to enable it again when you need.
Also, there is another plugin for conditional choices if you want too.
I give you basically. But the Label can really help you out.

You just have to make sure to don't get stuck in the loop, like in my example.
 

Aerianr

Villager
Member
Joined
Jul 13, 2019
Messages
14
Reaction score
3
First Language
English
Primarily Uses
RMMV
@Eliaquim

Thank you so much! That did it. The plugins weren't working without the labels. It works perfectly now.

Edit: Okay I actually spoke too soon. The choice is now disabled thanks to the labels, but if you exit the conversation with the NPC and talk to them again, the option is enabled again, so players can still repeat the same convo over and over and easily get infinite EXP through conversations.

Is there a way I can make the disabling permanent?
 
Last edited:

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,075
Reaction score
446
First Language
Portuguese - Br
Primarily Uses
RMMV
@Eliaquim

Thank you so much! That did it. The plugins weren't working without the labels. It works perfectly now.

Edit: Okay I actually spoke too soon. The choice is now disabled thanks to the labels, but if you exit the conversation with the NPC and talk to them again, the option is enabled again, so players can still repeat the same convo over and over and easily get infinite EXP through conversations.

Is there a way I can make the disabling permanent?
Well, why don't you put a self switch to change the page after the conversation? Then you go to another page of the event.
I don't remember the hime one, but for the yanfly one, as long as I remember, the choices are only shown again if you enabled them again or use a script call like "$gameChoices.clear()".
You cal also put a conditional check at the beginning of the event that checks what questions have already selected by the player. You can do this either with variables(Then you have to add a variable or switch in the choices) or checking if a choice is disabled. I think the yanfly one has a script call to check for disabled choices.
 

Aerianr

Villager
Member
Joined
Jul 13, 2019
Messages
14
Reaction score
3
First Language
English
Primarily Uses
RMMV
Well, why don't you put a self switch to change the page after the conversation? Then you go to another page of the event.
It would take more self switches than I can use to do it that way. Here's a more precise example:

Choices:
>Talk
>Give gift
>Cancel

When Talk:
>A. What's your name?
>B. How are you?

A can branch a little bit where the player can say something in response, like "I like your name" or "I hate your name" which would either give or deduct EXP towards their relationship.

So in this scenario I would need a self switch for when A is done but B isn't, when B is done but A isn't, and when both are done - right? And this is for only 2 options. I'm going to have more than that typically.

I don't remember the hime one, but for the yanfly one, as long as I remember, the choices are only shown again if you enabled them again or use a script call like "$gameChoices.clear()".
You're right. So all Choice 1s are hidden or disabled until you change it otherwise. This won't work, because of the nested choice options. Doing it this way means that of these:

Choices:
>Talk
>Give gift
>Cancel

When Talk:
>A. What's your name?
>B. How are you?

Once you disable choice 1 the talk option will no longer show up, meaning that the other talk options won't be accessible anymore either. This would get especially messy if they stopped talking to that NPC and went to talk to another one.

I looked all through Yanfly's plugin and didn't see anything to check for disabled choices, but I could be missing it or something.

I'm trying to figure out if there's a script call I can make that will let me disable specific choices not based on the choice index but rather by the title of it. I'm not sure where to begin looking for that though.
 

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,075
Reaction score
446
First Language
Portuguese - Br
Primarily Uses
RMMV
Hi!
Well, I don't have the updated extension of the core of the yanfly message. I only have the old one before he put it to pay.
And the YEP_X_ExtMesPack1 has a parameter to you to configure a switch to enable or disable each choice index(choice 1, choice 2, choice 3, etc...)
So, if you assign a switch there, you can check if this switch is on or off(aka choice on or off).


Also, what you want to do it's not difficult but requires a lot of eventing. If you make step by step, going slow, you will get it.
The thing is, for each choice the player select you have to set on/off the switches(or choices) for it to not interfere with the next choice branches.

Ex:
First Choice Branch
> What's your name? (Choice 1)
- The player selects this, so let's disable it.
> How old are you? (Choice 2)

// Middle way!

Second Choice Branch
> You are a boy or a girl? (Choice 1)
- If I don't enable choice 1 again, this would be disabled too.
- So I have to put a check above these choices branches(Middle way) to see if I have to enable or disable this.
> Do you know anything about cars? (Choice 2)

I think that would be tricky. But with conditional branches and maybe some variables to store each choice selected, you can do it.
You can use the yanfly plugin selfVariables, and add a self variable for each choice branch.
So, when the player select a choice, you increase(or decrease) the self variable.
And before you set any choice branches, you put a conditional branch to check the self variables for each choice. Based on that, you will disable or enable your choices.
 

glaphen

Veteran
Veteran
Joined
Jan 13, 2019
Messages
298
Reaction score
108
First Language
English
Primarily Uses
RMMV
I mean there has to be someway to track what you've done, if you don't want to keep track of many variables or switches you can keep it all in one array. At beginning of game use this script and change the variable you want to use to whatever.
Code:
$gameVariables.setValue(1, []);
Then whenever you do a choice you can do
Code:
$gameVariables.value(1).push('I like your face');
if that is the choice selected, insert whatever text you want inside the quotes.
Then have a conditional branch that uses a script before each choice and 1 per choice then
Code:
$gameVariables.value(1).contains('I like your face');
if it's true then disable that choice inside the conditional.
 

Aerianr

Villager
Member
Joined
Jul 13, 2019
Messages
14
Reaction score
3
First Language
English
Primarily Uses
RMMV
I mean there has to be someway to track what you've done, if you don't want to keep track of many variables or switches you can keep it all in one array. At beginning of game use this script and change the variable you want to use to whatever.
Code:
$gameVariables.setValue(1, []);
Then whenever you do a choice you can do
Code:
$gameVariables.value(1).push('I like your face');
if that is the choice selected, insert whatever text you want inside the quotes.
Then have a conditional branch that uses a script before each choice and 1 per choice then
Code:
$gameVariables.value(1).contains('I like your face');
if it's true then disable that choice inside the conditional.
Thank you for answering!

So to be clear, this would still be using up slots from the variables you normally define in the editor, right? So if I made an array of 10-20, it would take up slots 10 through 20, and there would be issues if I tried to manually assign them to something else?

Also, could you please elaborate a bit more? It's gone a little over my head.
 

glaphen

Veteran
Veteran
Joined
Jan 13, 2019
Messages
298
Reaction score
108
First Language
English
Primarily Uses
RMMV
Thank you for answering!

So to be clear, this would still be using up slots from the variables you normally define in the editor, right? So if I made an array of 10-20, it would take up slots 10 through 20, and there would be issues if I tried to manually assign them to something else?

Also, could you please elaborate a bit more? It's gone a little over my head.
No they take up only 1 variable, if you add a bunch of things with push ingame you can see the list by typing into the F12 console $gameVariables.value(1) or whatever the variable you use is. They would be stored like ["I like your face", "whatever", "thing", "hi"] with indexes for each, so if you use $gameVariables.value(1)[0]; it would print "I like your face", if you needed to access it for whatever reason, you shouldn't ever use the variable for anything else though, only in manual script calls.

Oh and you said you wanted me to elaborate here's an image.
Choices.png
Plugin command is nonsense, make sure you don't use the same array phase twice,
If you needed to for some reason delete a phrase to have it reappear you can use this script call.
Code:
var index = $gameVariables.value(1).indexOf('I like your face');
if (index > -1) {
  $gameVariables.value(1).splice(index, 1);
};
 
Last edited:

Aerianr

Villager
Member
Joined
Jul 13, 2019
Messages
14
Reaction score
3
First Language
English
Primarily Uses
RMMV
No they take up only 1 variable, if you add a bunch of things with push ingame you can see the list by typing into the F12 console $gameVariables.value(1) or whatever the variable you use is. They would be stored like ["I like your face", "whatever", "thing", "hi"] with indexes for each, so if you use $gameVariables.value(1)[0]; it would print "I like your face", if you needed to access it for whatever reason, you shouldn't ever use the variable for anything else though, only in manual script calls.
Thank you! I completely understand about the array (and thank you for the link), but I'm still confused about this part:

Code:
$gameVariables.value(1).push('I like your face');
if that is the choice selected, insert whatever text you want inside the quotes.
Then have a conditional branch that uses a script before each choice and 1 per choice then
Code:
$gameVariables.value(1).contains('I like your face');
if it's true then disable that choice inside the conditional.
I understand about pushing, but not the rest. Could you please explain this part more?
 

glaphen

Veteran
Veteran
Joined
Jan 13, 2019
Messages
298
Reaction score
108
First Language
English
Primarily Uses
RMMV
Thank you! I completely understand about the array (and thank you for the link), but I'm still confused about this part:



I understand about pushing, but not the rest. Could you please explain this part more?
I edited the post above with an example picture, and linked to 1st page of arrays instead of 2nd.
 

Aerianr

Villager
Member
Joined
Jul 13, 2019
Messages
14
Reaction score
3
First Language
English
Primarily Uses
RMMV
I edited the post above with an example picture, and linked to 1st page of arrays instead of 2nd.
Thank you for all of your help. I checked out your edit and have been trying to get it to work in my game and .push isn't doing anything.

I'm using a parallel event to establish

Code:
$gameVariables.setValue(11, []);
Then I have an NPC set up with choices.

Code:
◆If:Script:$gameVariables.value(11).contains('This is yes');
  ◆Plugin Command:disable_choice 1
  ◆
:End
◆If:Script:$gameVariables.value(11).contains('This is no');
  ◆Plugin Command:disable_choice 2
  ◆
:End
◆Label:start
◆Show Choices:Yes, No, cancel (Window, Right, #1, #2)
:When Yes
  ◆Script:$gameVariables.value(11).push('This is yes');
  ◆Text:None, Window, Bottom
  :    :you said yes
  ◆Plugin Command:Autosave
  ◆Wait:60 frames
  ◆Jump to Label:start
  ◆
:When No
  ◆Script:$gameVariables.value(11).push('This is no');
  ◆Plugin Command:Autosave
  ◆Text:None, Window, Bottom
  :    :you said no
  ◆Wait:60 frames
  ◆Jump to Label:start
  ◆
:When cancel
  ◆Exit Event Processing
  ◆
:End

When that wasn't disabling anything, I added a new NPC to check more simply:

Code:
◆If:Script:$gameVariables.value(11).contains('This is yes');
  ◆Text:None, Window, Bottom
  :    :'This is yes' has been added to the array.
  ◆
:Else
  ◆If:Script:$gameVariables.value(11).contains('This is no');
    ◆Text:None, Window, Bottom
    :    :'This is no' has been added to the array.
    ◆
  :Else
    ◆Text:None, Window, Bottom
    :    :Nothing was added.
    ◆
  :End
  ◆
:End

In game I speak with the choices NPC, then speak with this new NPC and 'Nothing was added' is all I get, and of course no options are getting disabled.

If I check in console, same result. The array is empty.

Sorry to keep bugging you.
 

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,075
Reaction score
446
First Language
Portuguese - Br
Primarily Uses
RMMV
$gameVariables.setValue(11, []);
If you are putting this into a parallel event, the game is constantly setting the variable value to an empty array. So the push will "not work" as long as this command is being executed.
 

Aerianr

Villager
Member
Joined
Jul 13, 2019
Messages
14
Reaction score
3
First Language
English
Primarily Uses
RMMV
If you are putting this into a parallel event, the game is constantly setting the variable value to an empty array. So the push will "not work" as long as this command is being executed.
That was incredibly stupid of me and I'm gonna blame sleep deprivation. Thank you so much! It's working great right now but I'm going to do some more testing to be sure.

Thank you @glaphen also!
 

diwang

Villager
Member
Joined
Dec 6, 2019
Messages
10
Reaction score
1
First Language
Indonesia
Primarily Uses
Other
Aside from the actual solution , having a clean and well managed system or code is actually the solution to this problem and problem similar to this .
Soon enough , if your game is getting more npc and dialogues , a lot more than what it is now , solution to this problem won't help you a lot if you didn't properly tidy up your work and writing a note to indicate which does what .
There will be less confusal and "convoluted" problems if you do what i just suggested .
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Gave my avatar an update, stay safe, people!
I'm currently available for hire for scripting (and perhaps other things).
Also, don't worry, the Advanced Minimap plugin is a work in progress.
Hallelujah! Work is getting stricter on humans in the store.
Day 3 of mapping... at least the whole game its just one location :3 (Still taking forever...)


Almost 5 am.. and I decide to put up a Youtube video instead of sleeping. It's strangely addicting! :kaoswt:

Forum statistics

Threads
95,621
Messages
930,492
Members
125,929
Latest member
RitBro
Top